OverviewFilesCommitsIssuesDocsReleasesPeers

holepunchto-deps / @holepunchto / keet-editor / src / extensions / bullet-list.js

18 lines · javascript ref:
import { BulletList as BulletListTiptap } from '@tiptap/extension-bullet-list'
import { exitAfterBlock, exitBeforeBlock } from './helpers/index.js'

export const BulletList = BulletListTiptap.extend({
  addKeyboardShortcuts () {
    const thisExitAfterBlock = exitAfterBlock.bind(this)
    const thisExitBeforeBlock = exitBeforeBlock.bind(this)

    return {
      'Mod-Shift-8': () => this.editor.commands.toggleBulletList(),
      ArrowUp: () => thisExitBeforeBlock(),
      ArrowLeft: () => thisExitBeforeBlock(),
      ArrowDown: () => thisExitAfterBlock(),
      ArrowRight: () => thisExitAfterBlock()
    }
  }
})