英文:
TinyMCE use after being reinserted into document
问题
I'm having a difficult time making TinyMCE work after it has been removed from the document and then re-inserted. I've created this TinyMCE Fiddle to demonstrate the issue: https://fiddle.tiny.cloud/F8iaab/3 .
To see the issue:
- Click the "Init / re-init TinyMCE" button. This will initialise TinyMCE below the buttons.
- Now click "Remove content" to remove the container from the document
- Click the "Append content" button to put it back in
- Finally, click the first button again - its impossible to enter text into the editor.
The final step is based on other discussions I've found on this topic (references below).
Any ideas how I can make a TinyMCE instance usable after being reinserted into a document?
Refs:
- http://archive.tinymce.com/forum/viewtopic.php?id=35083
- http://archive.tinymce.com/forum/viewtopic.php?id=36438
- https://stackoverflow.com/questions/26737588/cant-type-in-tinymce-4-instance-after-mceaddeditor
英文:
I'm having a difficult time making TinyMCE work after it has been removed from the document and then re-inserted. I've created this TinyMCE Fiddle to demonstrate the issue: https://fiddle.tiny.cloud/F8iaab/3 .
To see the issue:
- Click the "Init / re-init TinyMCE" button. This will initialise TinyMCE below the buttons.
- Now click "Remove content" to remove the container from the document
- Click the "Append content" button to put it back in
- Finally, click the first button again - its impossible to enter text into the editor.
The final step is based on other discussions I've found on this topic (references below).
Any ideas how I can make a TinyMCE instance usable after being reinserted into a document?
Refs:
答案1
得分: 1
Seems to work if you remove the tinymce instance when removing content.
function removeContent() {
container.parentNode.removeChild(container);
var editor = tinymce.get('content');
if (editor) {
editor.remove();
}
}
Fiddle.
英文:
Seems to work if you remove the tinymce instance when removing content.
function removeContent() {
container.parentNode.removeChild(container);
var editor = tinymce.get('content');
if (editor) {
editor.remove();
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论