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

[BUG] CKEditor isn't removed from the DOM #37

Open
kuhelbeher opened this issue May 19, 2020 · 5 comments
Open

[BUG] CKEditor isn't removed from the DOM #37

kuhelbeher opened this issue May 19, 2020 · 5 comments

Comments

@kuhelbeher
Copy link

CKEditor isn't removed from the DOM after component deselected. It could cause weird bugs like double CKEditor:

image

image

@Houst0n345
Copy link

Have the same bug. After init Ckeditor toolbar and draggin component to another place we have 2 toolbars.
Resolve with help of this command:
editor.on('sorter:drag:end', ({ srcEl }) => { if (srcEl) { $(document).find(#cke_${srcEl.id}).remove(); } });

@jackyhuynh0407
Copy link

I found the solution:
In index.js line 41:

      let rteToolbar = editor.RichTextEditor.getToolbarEl();
      [].forEach.call(rteToolbar.children, (child) => {
      	child.style.display = 'none';
      });

change to:

      let rteToolbar = editor.RichTextEditor.getToolbarEl();
      [].forEach.call(rteToolbar.children, (child) => {
      	child.remove();
      });

and run npm run build

yanfanvip added a commit to yanfanvip/grapesjs-plugin-ckeditor that referenced this issue Nov 6, 2021
@ronaldohoch
Copy link

ronaldohoch commented Mar 23, 2022

@jackyhuynh0407 will you open a PR with it?

Well, test it.

This code doesn't allow me to edit a text anymore. 🤔
Should be other solution

@jackyhuynh0407
Copy link

Yes I have other solution. But i forgot to update it. I'm not open PR yet

      let rteToolbar = editor.RichTextEditor.getToolbarEl();
      [].forEach.call(rteToolbar.children, (child) => {
        if(child.id == `cke_${el.id}`) child.remove()
      	else child.style.display = 'none';
      });

@ronaldohoch
Copy link

@jackyhuynh0407 nice, thank you!
@artf update the plugin to us 🙈

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

4 participants