TinyMCE:为特定的div禁用“可调整大小"功能吗? [英] TinyMCE: Disable 'resizable' function for specific div?

查看:664
本文介绍了TinyMCE:为特定的div禁用“可调整大小"功能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Wordpress中有一个插件,该插件使用jQuery Resizable来调整TinyMCE中对话框的大小.特别是有一个<div>(如下所示),我不想调整其大小.我该怎么做?

I have a plugin in Wordpress that uses jQuery Resizable to resize dialogs in TinyMCE. There's one <div> in particular (shown below) that I don't want to be resizable. How do I accomplish this?

这是输出的<div>我不想调整大小:

This is the outputted <div> I don't want resizable:

<div class="ui-dialog ui-widget ui-widget-content ui-corner-all wp-dialog ui-draggable ui-resizable" tabindex="-1" role="dialog" aria-labelledby="ui-id-1">

这是可调整大小的句柄的输出:

This is the resizable handle's output:

<div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se ui-icon-grip-diagonal-se"></div>

我尝试了这两个jQuery函数,但都没有起作用:

I tried these two jQuery functions and neither worked:

$('.ui-dialog').resizable('destroy');
$('.ui-resizable-handle').resizable('destroy');

推荐答案

添加一个onMouseDown处理函数,以通过CLASS检查您的DIV.如果单击了正确的DIV,则需要处理编辑器的BODY元素.

add an onMouseDown handler to check for your DIV via CLASS. if the correct DIV is being clicked, you will need to address the BODY element of the editor.

这使我永远找不到!享受

This took me for ever to find! enjoy

ed.onMouseDown.add(function(ed, e){ 
    var body = ed.getBody();
    if(jQuery(e.target).hasClass('someclass')){
        jQuery(body).attr({'contenteditable': false})
    }else{
        jQuery(body).attr({'contenteditable': true})
    }
})

这篇关于TinyMCE:为特定的div禁用“可调整大小"功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆