Sha256: fc0e19b8cadaef38c459c1b4885553a2777f6f18d8b7930fea27420c58371caa

Contents?: true

Size: 849 Bytes

Versions: 25

Compression:

Stored size: 849 Bytes

Contents

import { Node } from 'tiptap'
import { chainCommands, exitCode } from 'tiptap-commands'

export default class LineBreak extends Node {
  get name() {
    return 'line_break'
  }

  get schema() {
    return {
      inline: true,
      group: 'inline',
      selectable: false,
      parseDOM: [{ tag: 'br' }],
      toDOM: () => ['br'],
    }
  }

  commands({ type }) {
    return () =>
      chainCommands(exitCode, (state, dispatch) => {
        dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView())
        return true
      })
  }

  keys({ type }) {
    const command = chainCommands(exitCode, (state, dispatch) => {
      dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView())
      return true
    })
    return {
      Enter: command,
      'Mod-Enter': command,
      'Shift-Enter': command,
    }
  }
}

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
maglevcms-1.8.0 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.7.3 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.7.2 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.7.1 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.7.0 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.6.1 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.6.0 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.5.1 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.4.0 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.3.0 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.2.2 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.2.1 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.2.0 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.1.7 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.1.6 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.1.5 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.1.4 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.1.3 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.1.2 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js
maglevcms-1.1.1 app/frontend/editor/components/kit/rich-text-input/extensions/LineBreak.js