vega-ckeditor
Version:
CKEditor-based implementation and add some plugins
129 lines (99 loc) • 6.62 kB
JavaScript
/**
* @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.env.isCompatible = true;
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
var lang = document.documentElement.lang;
lang = lang ? lang : 'zh-cn';
config.language = lang.replace('_', '-').toLowerCase();
// config.uiColor = '#AADC6E';
config.toolbar_none = [{items:[]}];
config.toolbar_Minimal_NoScript = [
{ items: ['Bold', 'Italic', 'Underline', 'TextColor', '-', 'RemoveFormat', 'PasteText','-','uploadpictures'] }
];
config.toolbar_Minimal = [
{ items: ['Bold', 'Italic', 'Underline', 'TextColor', '-', 'RemoveFormat', 'PasteText', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', '-', 'Source', 'uploadpictures', 'CodeSnippet', 'kityformula'] }
];
config.toolbar_editVip = [
{ items: ['Bold', 'Italic', 'Underline', 'TextColor', '-', 'RemoveFormat', 'PasteText', '-', 'NumberedList', 'BulletedList'] }
];
config.toolbar_Simple = [
{ items: ['Bold', 'Italic', 'Underline', 'TextColor', '-', 'RemoveFormat', 'PasteText', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'uploadpictures', 'CodeSnippet', '-', 'Source'] }
];
config.toolbar_Thread = [
{ items: ['Bold', 'Italic', 'Underline', 'TextColor', '-', 'RemoveFormat', 'PasteText', '-', 'Smiley', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'uploadpictures', 'CodeSnippet', '-', 'Source', 'kityformula', '-', 'Maximize'] }
];
config.toolbar_Activity= [
{ items: ['FontSize', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'Bold', 'Italic', 'Underline', 'TextColor', '-', 'RemoveFormat', 'PasteText', '-', 'Smiley', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'uploadpictures', '-', 'Maximize']}
];
config.toolbar_Question = [
{ items: ['Bold', 'Italic', 'Underline', 'TextColor', '-', 'RemoveFormat', 'PasteText', '-', 'QuestionBlank', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', '-', 'Source', 'uploadpictures', 'CodeSnippet', 'kityformula', '-', 'Maximize'] }
];
config.toolbar_Group = [
{ items: ['Bold', 'Italic', 'Underline', 'TextColor', '-', 'RemoveFormat', 'PasteText', '-', 'Smiley', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'uploadpictures', 'CodeSnippet', '-', 'Source', '-', 'Maximize'] }
];
config.toolbar_Detail = [
{ items: ['FontSize', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
{ items: ['Bold', 'Italic', 'Underline', 'TextColor', '-', 'RemoveFormat', 'PasteText', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'uploadpictures', 'CodeSnippet', '-', 'Source', '-', 'Maximize'] }
];
config.toolbar_Task = [
{ items: ['Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat', 'Format'] },
{ items: ['Link', 'Unlink'] },
{ items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
{ items: ['FontSize', 'TextColor', 'BGColor'] },
{ items: ['uploadpictures', 'CodeSnippet', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar', 'Iframe', 'kityformula'] },
{ items: ['PasteText', 'PasteFromWord'] },
{ items: ['Find', '-', 'Source'] }
];
config.toolbar_Full = [
{ items: ['Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat', 'Format'] },
{ items: ['Link', 'Unlink'] },
{ items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
{ items: ['FontSize', 'TextColor', 'BGColor'] },
{ items: ['uploadpictures', 'CodeSnippet', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar', 'Iframe', 'kityformula'] },
{ items: ['PasteText', 'PasteFromWord'] },
{ items: ['Find', '-', 'Source', '-', 'Maximize'] }
];
config.toolbar_Admin = [
{ items: ['Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat', 'Format'] },
{ items: ['Link', 'Unlink'] },
{ items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
{ items: ['FontSize', 'TextColor', 'BGColor'] },
{ items: ['uploadpictures', 'CodeSnippet', 'Flash', 'Table', 'HorizontalRule', 'SpecialChar', 'Iframe'] },
{ items: ['PasteText', 'PasteFromWord'] },
{ items: ['Find', '-', 'Source', '-', 'Maximize', 'xiumi'] }
];
config.toolbar_Article = [
{ items: ['Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat', 'Format'] },
{ items: ['Link', 'Unlink'] },
{ items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
{ items: ['FontSize', 'TextColor', 'BGColor'] },
{ items: ['uploadpictures', 'CodeSnippet', 'Html5video', 'Table', 'HorizontalRule', 'SpecialChar', 'Iframe'] },
{ items: ['PasteText', 'PasteFromWord'] },
{ items: ['Find', '-', 'Source', '-', 'Maximize', 'xiumi'] }
];
config.toolbar_SimpleMini = [
{ items: ['Bold', 'Italic', 'Underline', 'TextColor', '-', 'RemoveFormat', 'PasteText', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink'] }
];
config.resize_enabled = false;
config.title = false;
config.extraAllowedContent = 'img[src,width,height,alt,title]';
config.removePlugins= 'elementspath';
config.extraPlugins = 'questionblank,smiley,table,font,kityformula,codesnippet,uploadpictures,shortUrl,image2,colorbutton,colordialog,justify,flash,find,xiumi,html5video';
// config.dialog_backgroundCoverColor = 'white';
// config.stylesSet = 'my_styles';
config.codeSnippet_theme = 'zenburn';
config.fileSingleSizeLimit = 10;
config.smiley_path = getUrlRelativePath(CKEDITOR.basePath + 'plugins/smiley/images/');
};
function getUrlRelativePath(url) {
var arrUrl = url.split('//');
var start = arrUrl[1].indexOf('/');
var relUrl = arrUrl[1].substring(start);
if (relUrl.indexOf('?') != -1) {
relUrl = relUrl.split('?')[0];
}
return relUrl;
}