完整的CKEditor v4的单个实例显示有两个工具栏

时间:2019-02-28 18:43:15

标签: ckeditor4.x

我创建了一个具有完整版本CKEditor v4的页面。我在页面上有一个实例,但是有两个收费栏???它是静态页面上的经典实例(无内联)和1(自定义工具栏),但是仅当我专注于文本时,第二个工具栏才显示,我将屏幕截图的附件以及build-config.js和config在页面上。有什么想法吗?

build-config.js:

var CKBUILDER_CONFIG = {
	skin: 'moono-lisa',
	preset: 'full',
	ignore: [
		'.DS_Store',
		'.bender',
		'.editorconfig',
		'.gitattributes',
		'.gitignore',
		'.idea',
		'.jscsrc',
		'.jshintignore',
		'.jshintrc',
		'.mailmap',
		'.npm',
		'.travis.yml',
		'bender-err.log',
		'bender-out.log',
		'bender.ci.js',
		'bender.js',
		'dev',
		'gruntfile.js',
		'less',
		'node_modules',
		'package.json',
		'tests'
	],
	plugins : {
		'a11yhelp' : 1,
		'about' : 1,
		'allowsave' : 1,
		'base64image' : 1,
		'basicstyles' : 1,
		'bidi' : 1,
		'blockquote' : 1,
		'colorbutton' : 1,
		'colordialog' : 1,
		'contextmenu' : 1,
		'dialogadvtab' : 1,
		'divarea' : 1,
		'enterkey' : 1,
		'entities' : 1,
		'filebrowser' : 1,
		'find' : 1,
		'floatingspace' : 1,
		'font' : 1,
		'format' : 1,
		'forms' : 1,
		'horizontalrule' : 1,
		'htmlwriter' : 1,
		'indentblock' : 1,
		'indentlist' : 1,
		'justify' : 1,
		'link' : 1,
		'list' : 1,
		'liststyle' : 1,
		'lite' : 1,
		'loremipsum' : 1,
		'magicline' : 1,
		'maximize' : 1,
		'pagebreak' : 1,
		'pastefromword' : 1,
		'pastetext' : 1,
		'removeformat' : 1,
		'resize' : 1,
		'selectall' : 1,
		'showborders' : 1,
		'showprotected' : 1,
		'specialchar' : 1,
		'stylescombo' : 1,
		'tab' : 1,
		'tableresize' : 1,
		'tableresizerowandcolumn' : 1,
		'tableselection' : 1,
		'tabletools' : 1,
		'texzilla' : 1,
		'undo' : 1,
		'uploadimage' : 1,
		'wordcount' : 1,
		'zoom' : 1
	},
	languages : {
		'en' : 1
	}
};

页面配置:

CKEDITOR.replace(editorId, {
            on: {
                instanceReady: function (ev) {
                    console.log('CKE4 Editor Was Initialized', editorId);

                    var writer = ev.editor.dataProcessor.writer;
                    writer.indentationChars = '    ';

                    var dtd = CKEDITOR.dtd;
                    for (var e in CKEDITOR.tools.extend({}, dtd.$block, dtd.$listItem, dtd.$tableContent)) {
                        ev.editor.dataProcessor.writer.setRules(e, {
                            indent: false,
                            breakBeforeOpen: false,
                            breakAfterOpen: false,
                            breakBeforeClose: false,
                            breakAfterClose: false
                        });
                    }

                    for (var e in CKEDITOR.tools.extend({}, dtd.$list, dtd.$listItem, dtd.$tableContent)) {
                        ev.editor.dataProcessor.writer.setRules(e, {
                            indent: true,
                        });
                    }

                    ev.editor.dataProcessor.writer.setRules('table',
                    {
                        indent: true
                    });

                    ev.editor.dataProcessor.writer.setRules('form',
                    {
                        indent: true
                    });
                }
                ,
                fileUploadResponse: function (evt) {
                    // Prevent the default response handler.
                    evt.stop();

                    // Get XHR and response.
                    var data = evt.data,
                        xhr = data.fileLoader.xhr,
                        response = xhr.responseText.split('|');
                    var json = JSON.parse(evt.data.fileLoader.xhr.responseText);

                    if (json.message != undefined) {
                        // An error occurred during upload.
                        data.message = json.message;
                        evt.cancel();
                    } else {
                        data.url = json.url;//response[0];
                    }
                    //var url = JSON.parse(evt.data.fileLoader.xhr.responseText).url;
                    CKEDITOR.instances[editorId].insertHtml('<img alt="' + json.fileName + '" data-cke-saved-src="' + json.url + '" src="' + json.url + '">');
                }
            },
            filebrowserImageUploadUrl: ImageUploadUrl,
            filebrowserUploadMethod: 'form',
            toolbarLocation: 'top',
            disableNativeSpellChecker: true,
            title: false,
            allowedContent: true,
            pasteFromWordCleanupFile: WordCleanupFile,
            baseFloatZIndex: 15000,
            height: 500,
            wight: 1500,
            wordcount: {
                showCharCount: true,
                showWordCount: true,
                countSpacesAsChars: true,
                countHTML: true,
                countLineBreaks: true,
                wordLimit: 'unlimited'
            }
            ,
            toolbar: [
		        { name: 'tools', items: ['Maximize'] },
                { name: 'document', items: ['Preview', 'Print'] },
		        //{ name: 'clipboard', items: [ 'Paste', 'PasteText', 'PasteFromWord' ] },
                { name: 'clipboard', items: ['Cut', 'Copy', '-', 'Undo', 'Redo'] },
		        { name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] },
		        { name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript'] },
		        { name: 'basicstyles', items: ['RemoveFormat'] },
		        { name: 'colors', items: ['TextColor', 'BGColor'] },
		        { name: 'paragraph', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
		        { name: 'links', items: ['Link', 'Unlink', 'Anchor'] },
		        { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'bidiltr', 'bidirtl'] },
		        { name: 'insert', items: ['base64image', 'Image', 'Table'] },
                { name: 'uploadimage', items: ['uploadimage'] },
		        { name: 'insert', items: ['HorizontalRule', 'PageBreak', 'IPCom'] },
                { name: 'texzilla', items: ['texzilla'] },
		        { name: 'editing', items: ['SelectAll', '-', 'Scayt'] },
                { name: 'zoom', items: ['Zoom'] },
                { name: 'editing', items: ['Find', 'Replace', ] },
                { name: 'tools', items: ['ShowBlocks'] },
                { name: 'lite', items: ['lite-acceptall', 'lite-rejectall', 'lite-acceptone', 'lite-rejectone'] }
            ]
        });

这是当前的样子:

ScreenShot

0 个答案:

没有答案