I am using the Editor.js library.
I want to have a title section on my edit page that only accepts a Header block. This is the code that I have used to implement that:
const titleEditor = new EditorJS({
placeholder: "Enter a title...",
holderId: "title-editor",
tools: {
header: {
class: Header,
shortcut: "CMD+SHIFT+H",
config: {
placeholder: "Enter a Header..."
}
}
}
});
Now, this basically works like I want. However, it allows me to add multiple titles in that editor. That is, if I type a header and hit return, I can then get the plus icon which allows me to add another header --- and another, etc.
But I don't want that. I want one single header for the page. I.e., I want to lock that block to only one instance of the Header block.
Any idea how I can do this?