问题描述
我在Web项目中使用CkEditor 4。我设法完全集成了编辑器以及https://ckeditor.com/cke4/addon/lineheight
中的外部行高插件,以调整文本的行高。默认的行高效果很好。但是,我面临一个挑战。当我根据使用em
提供的文档修改行高时,行高不会改变。只是保持不变。我试图编辑我的config.js
文件,但没有任何反应。研究还没有被证明是富有成果的。有人可以帮我吗。我需要选择线高为0em,1em,2em等。
我的config.js
CKEDITOR.editorConfig = function( config ) {
config.extraPlugins = 'lineheight';
config.uiColor = '#ced4da';
config.line_height="1em;1.1em;1.2em;1.3em;1.4em;1.5em";
};
我的html文件片段如下:
<div class="row mt-3">
<div class="col-12">
<textarea name="editor" id="editor" rows="10" cols="80">This is my textarea to be replaced with CKEditor 4.</textarea>
</div>
</div>
$(document).ready(function(event){
CKEDITOR.replace('editor');
});
有人可以帮助我配置自定义行高选项吗?
根据官方文档,这是信息
Customizing the lineheight values in the dropdown
-------------------------------------------------------
In order to have custom values of line-height instead of the default,you can add following line in the config.js file:
config.line_height="1em;1.1em;1.2em;1.3em;1.4em;1.5em";
Here,"em" is the unit of line-height which you can change to "px","%" or any other allowed unit for line-height.
You can also change the numbers based on your requirements. You can have more range or low range,it all depends on your requirements.
解决方法
也认为这是一个问题,但你猜怎么着,不是。
只需将行高值(如果您使用 px 测量)更改为更大的值,您就可以看到实际的变化。
例如:
line_height: '1px;10px;20px;30px;40px;50px',