changing ckeditor dimension for different instances (not all instances)

泄露秘密 提交于 2019-12-24 10:53:01

问题


i'm trying to change dimensions for multiple ckeditor in the same page using this code just after the textarea

<script type="text/javascript">
CKEDITOR.config.width ='250px';
CKEDITOR.config.height='600px';
</script>

it changes all instances in the page and i know how to adjust default values in the config.js but i'm trying to change dimensions for some instances not all of them


回答1:


If you ever need to change the height of specific instance of CKEditor and all you can change is config.js, then you can use this.name inside configuration file to detect the right instance of the editor:

CKEDITOR.editorConfig = function( config ) {
    // Default height for all instances
    config.height = '400';

    // Height for specific instance, the ID of textarea is "editor1"
    if (this.name == 'editor1') {
        config.height = '200';
    }
};


来源:https://stackoverflow.com/questions/9408707/changing-ckeditor-dimension-for-different-instances-not-all-instances

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!