【发布时间】:2015-12-04 21:24:03
【问题描述】:
我希望用户能够使用转义键中止内联模式下 tinyMCE 编辑器中的任何更改。这是 HTML:
<div id="tinymce">
<p>Foo Foo Foo</p>
</div>
还有脚本:
tinymce.init({
selector: '#tinymce',
inline: true,
setup: function (editor) {
editor.on('keydown', ((e) => {
var tinyMceEditor = tinyMCE.get(e.target.id);
if (e.keyCode === 27) { // escape
// This will hide the editor but it won't come back when trying to re-edit
tinyMceEditor.hide();
}
}));
}
});
也是个jsfiddle:http://jsfiddle.net/kfnyqufm/
点击转义会像我想要的那样关闭编辑器,但有两个问题:(1) 单击文本时编辑器不返回 (2) 任何已编辑的文本都不会恢复为原始值
【问题讨论】:
标签: javascript tinymce tinymce-4