import { Extension } from '@tiptap/core'
export const TextContent = Extension.create({
name: 'textContent',
addKeyboardShortcuts () {
return {
'Shift-Enter': () => {
const { editor } = this
const { state } = editor
const { $head, $anchor, from, to } = state.selection
if (from !== to || !$head.sameParent($anchor) || $head.depth > 1) {
return
}
return this.editor.commands.first(({ commands }) => [
() => commands.newlineInCode(),
() => commands.createParagraphNear(),
() => commands.liftEmptyBlock(),
() => commands.splitBlock()
])
}
}
}
})