Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do all Blocks get initialized twice? When you initiate the editor with readOnly true, i've got a problem with custom block tool #2878

Open
bettysteger opened this issue Nov 25, 2024 · 1 comment

Comments

@bettysteger
Copy link
Contributor

bettysteger commented Nov 25, 2024

I created a custom Block via https://editorjs.io/tools-api/.

I am creating the Editorjs with readOnly true, and when i output the data from my Tool constructor, it will get initialized twice with different readOnly values.

constructor({ data, config, api, readOnly, block }) {
  console.log('readOnly', readOnly);
}
// readOnly false
// readOnly true

Expected behavior: Just initialize every block once?

That means i need to change my custom block tool, so it handles the "switch" from edit to readOnly... But i don't really need a toggle. i just want to show the content in read-only mode.

Codepen: https://codepen.io/bettyst/pen/azooqYQ

Device, Browser, OS:

Editor.js version: 2.29 and latest

@bettysteger
Copy link
Contributor Author

bettysteger commented Nov 25, 2024

Additionally i think a few plugins are not loaded correctly:

  • editor-js/table is showing no left border when initializing the Editor in readOnly mode.
  • editor-js/image is suddenly showing an empty caption input in readOnly mode.

@neSpecc neSpecc removed the bug label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants