http://gw.ablueman.co.uk/tabbednotepad.php
我有3个ckeditor textareas,这三个都是相同的,但与main或class有很大的不同。
如果我放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>
编辑仅供参考,我尝试了CKEDITOR.replace( 'editor1','editor2',这也不起作用。
发布于 2014-09-18 21:52:45
您可以使用一个文本区域id数组,并通过jquery和foreach调用一个CKEDITOR.replace。例如:
var areas = Array('editor1', 'editor2', 'editor3');
$.each(areas, function (i, area) {
CKEDITOR.replace(area, {
customConfig: '/Scripts/ckeditor/config.mini.js'
});
});
发布于 2016-05-30 14:52:27
Ckeditor 4允许您使用基于类名的编辑器替换多个文本区域:
CKEDITOR.replaceAll('className');
docs
发布于 2014-02-12 04:35:56
您不能同时使用多个ids调用CKEDITOR.replace。
Its definition声明第一个参数是ID或元素,第二个参数是配置选项。
https://stackoverflow.com/questions/21702019
复制相似问题