开发者

Why does TinyMCE require typing something before being able to use the delete key properly?

开发者 https://www.devze.com 2023-01-07 22:21 出处:网络
I have just implemented TinyMCE and it is working fine, except that the user must type something, even a space character, before being 开发者_开发问答able to delete content.

I have just implemented TinyMCE and it is working fine, except that the user must type something, even a space character, before being 开发者_开发问答able to delete content.

Please tell me if you need more information.


It's a browser bug. There is a hacky workaround I've seen and used in the past; I can't verify it at the moment. If you call the following once the TinyMCE editing iframe has loaded, it may work:

// doc is a reference to the iframe's document
try {
    doc.execCommand("Undo", false, false);
} catch (ex) {}


Indeed it is a browser bug (almost FF). My workaround for this resets the design mode:

editor_instance = tinymce.EditorManager.getInstanceById(editor_id); //editor id needed here (ed.id)
editor_instance.getDoc().designMode = 'Off';
editor_instance.getDoc().designMode = 'On';
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号