-
-
Notifications
You must be signed in to change notification settings - Fork 694
Closed
Description
Due to some special reasons, I need to disable the nest feature.
I customized the toolbar to remove the nest unNest button. However, I still can't get rid of the Tab and Shift Tab shortcuts.
I found that the shortcut code is written in the blockContainer, and I intended to disable it through the extend method, with the code as follows:
import {BlockContainer} from "@blocknote/core/src/pm-nodes";
const newBlockContainer = BlockContainer.extend({
addKeyboardShortcuts() {
const obj = this.parent?.() || {};
delete obj.Tab
delete obj['Shift-Tab']
return obj
}
})
export default function App() {
const editor = useCreateBlockNote({
_tiptapOptions: {
extensions: [
newBlockContainer.configure({
editor, // the editor has not been initialized
domAttributes: {},
})
]
},
disableExtensions: ['blockContainer'],
});
return <BlockNoteView editor={editor} />;
}However, the issue lies in the fact that the configure method requires the editor object, which, at this point, has not been fully initialized, leading to an error. In this scenario, perhaps the tiptapOptions could be a function instead?
_tiptapOptions: (editor) => Partial<EditorOptions>Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels