CKeditor 中的行间距
Line spacing in CKeditor
抱歉,我对此绝对是菜鸟。我在我的网站上使用以下 HTML:
实现了一个 CKeditor
<!doctype html>
<html>
<head>
<!--Define the character set for the HTML element -->
<meta charset="utf-8">
<!--Call the external script to use the CDN CKEditor in your page-->
<script src="//cdn.ckeditor.com/4.6.2/standard/ckeditor.js"></script>
<script type="text/javascript">
//Define an init function that sends the rich text editor contents to the page code
function init() {
//onMessage runs when the HTML element receives a message from the page code
window.onmessage = (event) => {
if (event.data == "x") {
CKEDITOR.instances.CK1.setData( '<p></p>' );
console.log(event.data,"ok");
} else {
//postMessage sends the contents of the CKEDITOR back to the page code
window.parent.postMessage(CKEDITOR.instances.CK1.getData(),"*");
console.log(event.data,"okd");
}
}
}
</script>
</head>
<body onload="init();">
<!--Define the HTML element as a textarea-->
<textarea name="editor1" id="CK1"></textarea>
<script>
//Use the CKEditor replace() function to turn our textarea into a CKEditor rich text editor
CKEDITOR.replace("editor1");
</script>
</body>
</html>
效果很好,但我遇到了行间距问题,段落之间似乎有一条线,但稍后显示时,它会彼此重叠。有没有办法减少间距,让用户意识到他们需要再次按回车键?
附上图片,第一个测试是在文本后按 1 次回车(看起来中间有一条线但实际上没有),第二个是 2 次回车。
我的问题还在于我使用的是 Wix,因此我无法托管配置或任何要更改的文件。所以这一切都需要来自 html link.....
谢谢!
enter image description here
是否需要强制用户按两次 Enter 键才能进入新段落?如果是这样,试试这个:
CKEDITOR.addCss('.cke_editable p { margin: 0 !important; }');
CKEDITOR.replace('editor1');
这些代码行将删除多余的 space
:host ::ng-deep .ck-editor__editable_inline p {
margin: 0;
}
抱歉,我对此绝对是菜鸟。我在我的网站上使用以下 HTML:
实现了一个 CKeditor<!doctype html>
<html>
<head>
<!--Define the character set for the HTML element -->
<meta charset="utf-8">
<!--Call the external script to use the CDN CKEditor in your page-->
<script src="//cdn.ckeditor.com/4.6.2/standard/ckeditor.js"></script>
<script type="text/javascript">
//Define an init function that sends the rich text editor contents to the page code
function init() {
//onMessage runs when the HTML element receives a message from the page code
window.onmessage = (event) => {
if (event.data == "x") {
CKEDITOR.instances.CK1.setData( '<p></p>' );
console.log(event.data,"ok");
} else {
//postMessage sends the contents of the CKEDITOR back to the page code
window.parent.postMessage(CKEDITOR.instances.CK1.getData(),"*");
console.log(event.data,"okd");
}
}
}
</script>
</head>
<body onload="init();">
<!--Define the HTML element as a textarea-->
<textarea name="editor1" id="CK1"></textarea>
<script>
//Use the CKEditor replace() function to turn our textarea into a CKEditor rich text editor
CKEDITOR.replace("editor1");
</script>
</body>
</html>
效果很好,但我遇到了行间距问题,段落之间似乎有一条线,但稍后显示时,它会彼此重叠。有没有办法减少间距,让用户意识到他们需要再次按回车键?
附上图片,第一个测试是在文本后按 1 次回车(看起来中间有一条线但实际上没有),第二个是 2 次回车。
我的问题还在于我使用的是 Wix,因此我无法托管配置或任何要更改的文件。所以这一切都需要来自 html link.....
谢谢!
enter image description here
是否需要强制用户按两次 Enter 键才能进入新段落?如果是这样,试试这个:
CKEDITOR.addCss('.cke_editable p { margin: 0 !important; }');
CKEDITOR.replace('editor1');
这些代码行将删除多余的 space
:host ::ng-deep .ck-editor__editable_inline p {
margin: 0;
}