【发布时间】:2014-02-11 12:36:11
【问题描述】:
http://gw.ablueman.co.uk/tabbednotepad.php
我有 3 个 ckeditor 文本区域,所有三个都相同,但与主要的或类有很大不同。
如果我放 3 个替换,它工作正常。但是,如果我尝试使用 CKEDITOR.replace( 'editor1', 'editor2', 'editor3' {
它可以替换它们,但会忽略 { 之后的任何内容,就像类一样。
我只是在格式化 CKEDITOR.replace('editor1', 'editor2', {});错误地,我需要三个都使用相同的替换。
代码如下:
<form name="title" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>">
<textarea class="ckeditor" id="editor3" name="editor3" rows="200"><?php echo $editor3;?></textarea>
<input id="tabtitle1" name="tabtitle1" size="30" placeholder="Tab Title.." />
<input type="submit" value="Submit" >
</form>
<script type="text/javascript">
CKEDITOR.replace( 'editor1', {
height: '600px',
enterMode: CKEDITOR.ENTER_BR,
toolbar:
[ { name: 'document', groups: [ 'document', 'doctools' ], items: [ 'Save', 'NewPage', 'Preview', 'Print', '-', 'Templates' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ], items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ], items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl' ] }, '/',
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ], items: [ 'Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] },
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] }, { name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ], items: [ 'Find', 'Replace', '-', 'SelectAll', '-', 'Scayt' ] },
{ name: 'insert', items: [ 'Image', 'Table', 'HorizontalRule', 'SpecialChar', 'PageBreak', 'Iframe', 'Syntaxhighlight' ] }, '/',
{ name: 'styles', items: [ 'Format', 'Font', 'FontSize' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'others', groups: [ 'mode' ], items: [ 'Source', 'searchCode', 'autoFormat', 'CommentSelectedRange', 'UncommentSelectedRange', 'AutoComplete', '-', 'ShowBlocks' ] },
{ name: 'tools', items: [ 'Maximize' ] },
]});
</script>
[EDIT] 仅供参考,我试过 CKEDITOR.replace( ['editor1', 'editor2'], 这也不起作用。
【问题讨论】:
-
在这里查看它是如何完成的:ckeditor.com/latest/samples/tabindex.html(该页面在同一页面上包含 3 个不同的实例,而不是像您的标签一样,但想法是一样的)。
-
不使用该类。你不能轻易地编辑类,这样就不会真正解决问题。这就是为什么我需要使用 CKEDITOR.replace 而不是类。除非您知道使用 ckeditor 类来更改工具栏的简单方法。
标签: javascript ckeditor