【问题标题】:CKEditor. How to turn off autogrow (set constant height)CK编辑器。如何关闭自动增长(设置恒定高度)
【发布时间】:2012-07-17 09:09:29
【问题描述】:

我使用自动增长插件,在某些情况下需要关闭它。并设置恒定的高度......但我该怎么做呢?没有找到任何关于如何动态启用/禁用插件的文档。

【问题讨论】:

    标签: javascript configuration ckeditor


    【解决方案1】:

    感谢 codewaggle 和

    oleqjQuery UI Resizable in CKEditor

    这是我如何实施他们的建议:

    <form .....  onload="CKStart()">
    .....
    <div id="resizable" style="overflow: hidden; max-height:240px;">
        <ckeditor:editor name="content" id="myCKEditor" height="200px" width="100%" >
        </ckeditor:editor>
      </div>
    
    
    ...
    
    </form>
    
    <script>
    
    function CKStart(){
      var editor = CKEDITOR.replace( 'myCKEditor', {
        autoGrow_onStartup: false,
            resize_enabled: false,
        height: '200px'
    
        });
    }
    </script>
    

    它似乎在工作 - 没有可用的调整大小

    【讨论】:

      【解决方案2】:

      您可以为每个实例设置配置。

      以下示例包括用于关闭自动增长和通过设置高度和禁用调整大小来设置恒定高度的配置设置。

      如果您想为特定实例修改一堆配置设置,您可以调用自定义配置文件:

      CKEDITOR.replace( 'textareaID',
      {
        customConfig : 'customConfigSettingsA.js';
      });
      

      否则,只需在创建实例时将设置包含在文件中即可。

      CKEDITOR.replace( 'textareaID',
      {
        config.autoGrow_onStartup = false,
        config.resize_enabled = false,
        config.height = '111px';
      });
      

      您还可以加载共享的自定义配置文件并同时设置特定设置:

      CKEDITOR.replace( 'textareaID',
      {
        customConfig : 'customConfigSettingsA.js',
        config.autoGrow_onStartup = false,
        config.resize_enabled = false,
        config.height = '111px';
      });
      

      有关控制宽度、高度、可调整性和最小/最大尺寸设置的其他配置设置,请参阅这篇文章:

      How to set and lock the CKEditor window size?

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-01-03
        • 2015-05-11
        • 2016-04-29
        • 2018-03-15
        • 2022-05-16
        • 2014-01-28
        相关资源
        最近更新 更多