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

Tools-API destroy is not invoked when editor.destroy() is triggered #1047

Closed
natterstefan opened this issue Feb 27, 2020 · 0 comments · Fixed by #1264
Closed

Tools-API destroy is not invoked when editor.destroy() is triggered #1047

natterstefan opened this issue Feb 27, 2020 · 0 comments · Fixed by #1264

Comments

@natterstefan
Copy link
Contributor

The Problem

According to the docs, when I do the following:

/**
* Create an instance
*/
const editor = new EditorJS();

/**
* Destroy editor.
*/
editor.destroy();

all destroy methods of the tools should be invoked.

destroy
Method will be fired when Editor's instance is destroying with destroy API method. Clear your Tool's stuff here: remove event listeners, clear nodes cache and null variables and properties.
Docs: https://editorjs.io/tools-api#destroy

But, this does not happen.

Not sure if this is what was reported here already: #855.

Reproduce

  1. Add the following to example/tools/header/src/index.js
  static get toolbox() {
    // ...
  }

  destroy() {
    console.log('I was destroyed');
  }
  1. Now run yarn build:dev and execute editor.destroy() in the console

  2. Nothing happend, even though the console should now say I was destroyed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants