通过windows.resize事件调整CKEditor4的大小 [英] resize CKEditor4 by windows.resize events

查看:794
本文介绍了通过windows.resize事件调整CKEditor4的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不需要用户调整大小的功能,但由 windows.resize事件触发的自动调整大小。



将我的必要性翻译成一个时髦的/有意的代码(它不工作!),对我的应用程序:

  $(window).resize (function(){
editor = CKEDITOR.instances.editor1;
editor.height = window.innerHeight - 106;
editor.width = window.innerWidth - 253;
} );

如何用CKEditor4实现这种调整大小?编辑器在textarea。






PS:行为的名称可能是改变编辑器的大小 ,但我的必要性不是关于配置的百分比宽度,请参阅所需的减法。

解决方案

a href =http://docs.ckeditor.com/#!/api/CKEDITOR.editor-method-resize =nofollow> editor.resize() method;)

  $(window).resize(function(){
editor = CKEDITOR.instances.editor1;
editor.resize window.innerWidth - 253,window.innerHeight - 106);
});


I not need the "user ability to resize", but an automatic resize triggered by windows.resize events.

Translating my necessity into an hipothetical/intentional code (it not works!), for my applicartion:

    $( window ).resize(function() {
        editor = CKEDITOR.instances.editor1;
        editor.height = window.innerHeight - 106;
        editor.width  = window.innerWidth  - 253;
    });

How to implement this kind of resize with CKEditor4? I am using standard editor at textarea.


PS: the name of the behaviour is perhaps "Change the Size of the Editor on the Fly", but my necessity is not about config by percentual width, see the required subtractions.

解决方案

Well... just use the editor.resize() method ;)

$( window ).resize(function() {
    editor = CKEDITOR.instances.editor1;
    editor.resize( window.innerWidth  - 253, window.innerHeight - 106 );
});

这篇关于通过windows.resize事件调整CKEditor4的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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