Files
mixtape/zero.Web.UI/app/components/forms/rte.extensions.js
T
2020-12-17 01:19:29 +01:00

36 lines
606 B
JavaScript

import { Node } from 'tiptap';
import { chainCommands, exitCode } from 'prosemirror-commands';
export class HardBreak extends Node
{
get name()
{
return 'br'
}
get schema()
{
return {
inline: true,
group: 'inline',
selectable: false,
parseDOM: [
{ tag: 'br' },
],
toDOM: () => ['br'],
}
}
keys({ type })
{
const command = chainCommands(exitCode, (state, dispatch) =>
{
dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView())
return true
})
return {
'Enter': command
}
}
}