admin管理员组文章数量:1323342
tinyMCE is adding those move and resize handles
to some of my elements (not just the images).
i would love to get rid of them all together but i have had no success.
these did not work for me
tinyMCE.init({
object_resizing : false
});
seems like it should be real easy.
OK, so it looks like it is adding the resize js to any element that is absolutely positioned. if that helps anyone with an answer.
i just tried to remove it but i need to position it to do what i need.
tinyMCE is adding those move and resize handles
to some of my elements (not just the images).
i would love to get rid of them all together but i have had no success.
these did not work for me
tinyMCE.init({
object_resizing : false
});
seems like it should be real easy.
OK, so it looks like it is adding the resize js to any element that is absolutely positioned. if that helps anyone with an answer.
i just tried to remove it but i need to position it to do what i need.
Share Improve this question edited Nov 12, 2012 at 23:05 100pwd asked Nov 12, 2012 at 22:43 100pwd100pwd 1402 silver badges8 bronze badges2 Answers
Reset to default 4Removing jQuery, and making cheez la weez's answer work for TinyMCE version 4. Use this in a plugin, in your init code, or just in your page after you instantiate the editor
// var editor = your tinyMCE editor instance (e.g. tinymce.activeEditor)
editor.on('mousedown', function(e) {
var element = e.target,
body = editor.dom.doc.body;
if (editor.dom.hasClass( element, 'your-class')) {
editor.dom.setAttrib(body,'contenteditable',false);
} else {
editor.dom.setAttrib(body,'contenteditable',true);
}
});
The only unfortunate bit is that your user will have to click back into the editor to resume editing (arrow keys won't work)
in the body tag of your editor is an attribute contenteditable="true"
. that is what is adding those pesky resizing elements.
if you set that attribute to false
you will not be able to edit anything.
what you need to do is set up an onMouseDown
listener. if the user is clicking on the elements in question... set it to contenteditable="false"
. if any other element, set it to contenteditable="true"
.
try this...
(function() {
tinymce.create('tinymce.plugins.yourplugin', {
init : function(ed, url) {
ed.onMouseDown.add(function(ed, e) {
var body = ed.getBody();
if(jQuery(e.target).hasClass('target-in-question')) {
jQuery(body).attr({'contenteditable': false})
// and whatever else you want to do when clicking on that element
}else {
jQuery(body).attr({'contenteditable': true})
}
});
},
createControl : function(n, cm) {
return null;
},
});
tinymce.PluginManager.add('yourplugin', tinymce.plugins.yourpluginl);
})();
本文标签: javascripttinyMCE removedisable resizing togglesStack Overflow
版权声明:本文标题:javascript - tinyMCE removedisable resizing toggles - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742135183a2422337.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论