CKEDITOR.editorConfig = function( config ) {
config.toolbarCanCollapse = true;
config.browserContextMenuOnCtrl= true;
config.extraPlugins = 'allowsave,autogrow,brclear,nbsp,richcombo,floatpanel,panel,listblock,button,ckwebspeech,tweetabletext,loremipsum,clipboard,notification,toolbar,autolink,widget,lineutils,widgetselection,selectall,htmlwriter,undo,wordcount,contextmenu,menu,codesnippet,dialog,dialogui,emojione,ckawesome,simplebutton,imageresizerowandcolumn,imagebrowser,filebrowser,popup,youtube,table';
config.wordcount = {
showParagraphs: true,
showWordCount: true,
showCharCount: true,
countSpacesAsChars: true,
countHTML: false,
maxWordCount: -1,
maxCharCount: -1,
filter: new CKEDITOR.htmlParser.filter({
elements: {
div: function( element ) {
if(element.attributes.class == 'mediaembed') {
return false;
}
}
}
})
};

if (matchMedia){
const mq = window.matchMedia("(min-width: 1225px)");
mq.addListener(WidthChange);
WidthChange(mq);
}
function WidthChange(mq){
if (mq.matches){

config.toolbar = [
{ name: 'document', items: [ 'Source', '-', 'Preview' ] },
{ name: 'tools', items: [ 'Maximize', 'ShowBlocks' ] },
{ name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'about', items: [ 'About' ] },
{ name: 'paragraph', items: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'Subscript', 'Superscript', '-', 'NumberedList', 'BulletedList' ] },
{ name: 'paragraph2', items: [ 'Outdent', 'Indent', '-', 'Blockquote', '-', 'BidiLtr', 'BidiRtl' ] },
'/',
{ name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo' ] },
{ name: 'basicstyles2', items: [  'CopyFormatting', 'RemoveFormat', '-', 'CodeSnippet', 'CreateDiv', 'Table', 'brclear' ] },
{ name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll' ] },
{ name: 'links', items: [ 'Link', 'Unlink', 'Image', 'Youtube', '-', 'Anchor', 'HorizontalRule' ] },
{ name: 'insert', items: [ 'Smiley', 'Emojione', '-', 'SpecialChar', 'Iframe' ] },
{ name: 'others', items: [ 'ckwebspeech', '-', 'TweetableText', '-', 'ckawesome', 'simplebutton' ] },
'/',
{ name: 'styles', items: [ 'Styles', 'Format', 'FontSize', 'Loremipsum' ] }
];

}else{

config.toolbar = [
{ name: 'document', items: [ 'Source', '-', 'Preview' ] },
{ name: 'tools', items: [ 'Maximize', 'ShowBlocks' ] },
{ name: 'basicstyles', items: [ 'Bold', 'Italic', 'Underline', 'Strike' ] },
{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
{ name: 'about', items: [ 'About' ] },
'/',
{ name: 'paragraph', items: [ 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'Subscript', 'Superscript', '-', 'NumberedList', 'BulletedList' ] },
{ name: 'paragraph2', items: [ 'Outdent', 'Indent', '-', 'Blockquote', '-', 'BidiLtr', 'BidiRtl' ] },
'/',
{ name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo' ] },
{ name: 'basicstyles2', items: [  'CopyFormatting', 'RemoveFormat', '-', 'CodeSnippet', 'CreateDiv', 'Table', 'brclear' ] },
{ name: 'editing', items: [ 'Find', 'Replace', '-', 'SelectAll' ] },
'/',
{ name: 'links', items: [ 'Link', 'Unlink', 'Image', 'Youtube', '-', 'Anchor', 'HorizontalRule' ] },
{ name: 'insert', items: [ 'Smiley', 'Emojione', '-', 'SpecialChar', 'Iframe' ] },
{ name: 'others', items: [ 'ckwebspeech', '-', 'TweetableText', '-', 'ckawesome', 'simplebutton' ] },
'/',
{ name: 'styles', items: [ 'Styles', 'Format', 'FontSize', 'Loremipsum' ] }
];

} // ./mq.matches
} // ./function WidthChange

};