codex-team / codex-team/editor.js

Limiting Instance to One Block Style

Open
#863 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

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({
// autofocus: true,
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.

How can I modify my code so that I can limit the number of block instances to one?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.