我即将使用CKEditor
用于post
功能。但是我不需要post
功能的工具栏。我需要提供应该是HTML
版本的preview
的CC_4,preview
功能应由onkeyup
/any button
完成。preview
部分将在CKEditor
下方。
图像 http://grab.by/h5sk
邮件目的是向user
提供格式化的帖子。如果我使用的是textarea
,则它将返回string
,并且无法显示为在TextArea中输入的user
。
您应该使用editor#change
和editor#contentDom
事件。您不应像
CKEDITOR.replace('editor1', {toolbar: []})
因为它会禁止编辑器中的任何类型的内容,因为工具栏与高级内容过滤器相对应,除非您通过设置config.allowedContent = true
将其禁用,但不建议使用它。
请参阅JSFIDDLE。
html
<textarea id="editor">
<p>Hello world! <a href="http://google.com">This is some link</a>.</p>
<p>And there is some <s>deleted</s> text.</p>
</textarea>
<div id="preview"></div>
JS
var preview = CKEDITOR.document.getById( 'preview' );
function syncPreview() {
preview.setHtml( editor.getData() );
}
var editor = CKEDITOR.replace( 'editor', {
on: {
// Synchronize the preview on user action that changes the content.
change: syncPreview,
// Synchronize the preview when the new data is set.
contentDom: syncPreview
}
} );
CSS
/* Hide the toolbar with CSS */
.cke_top { display: none !important }
for ckeditor:测试
ckeditor.replace('editor1',{工具栏:[]});
另一个解决方案:
这就是stackoverflow使用