diff --git a/resources/js/components/fieldtypes/bard/Set.js b/resources/js/components/fieldtypes/bard/Set.js index bd5225b064..907d5e58cd 100644 --- a/resources/js/components/fieldtypes/bard/Set.js +++ b/resources/js/components/fieldtypes/bard/Set.js @@ -1,5 +1,5 @@ import { Node } from '@tiptap/core'; -import { Plugin, PluginKey } from '@tiptap/pm/state'; +import { Plugin, PluginKey, NodeSelection } from '@tiptap/pm/state'; import { Slice, Fragment } from '@tiptap/pm/model'; import { Decoration, DecorationSet } from '@tiptap/pm/view'; import { VueNodeViewRenderer } from '@tiptap/vue-3'; @@ -86,6 +86,21 @@ export const Set = Node.create({ return found; }; return [ + new Plugin({ + key: new PluginKey('setBlockCharacterInput'), + props: { + handleKeyDown(view, event) { + const { selection } = view.state; + if (!(selection instanceof NodeSelection) || selection.node.type !== type) return false; + + const key = event.key; + if (['Backspace', 'Delete', 'Enter', 'Escape', 'Tab'].includes(key)) return false; + if (key.length === 1) return true; + + return false; + }, + }, + }), new Plugin({ key: new PluginKey('setSelectionDecorator'), props: {