/** * Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or http://ckeditor.com/license */ /* exported initSample */ if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) CKEDITOR.tools.enableHtml5Elements( document ); // The trick to keep the editor in the sample quite small // unless user specified own height. CKEDITOR.config.height = 250; CKEDITOR.config.width = '100%'; CKEDITOR.editorConfig = function( config ) { config.toolbarGroups = [ { name: 'document', groups: [ 'mode', 'document', 'doctools' ] }, { name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, { name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] }, { name: 'forms', groups: [ 'forms' ] }, '/', { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi', 'paragraph' ] }, { name: 'links', groups: [ 'links' ] }, { name: 'insert', groups: [ 'insert' ] }, '/', { name: 'styles', groups: [ 'styles' ] }, { name: 'colors', groups: [ 'colors' ] }, { name: 'tools', groups: [ 'tools' ] }, { name: 'others', groups: [ 'others' ] }, { name: 'about', groups: [ 'about' ] } ]; config.removeButtons = 'Save,NewPage,Language,Flash,Iframe,Radio,TextField,Textarea,Select,Button,Image,ImageButton,HiddenField,Checkbox,Form,Scayt,PageBreak'; }; var initThai = ( function() { var wysiwygareaAvailable = isWysiwygareaAvailable(), isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' ); return function() { var editorElement = CKEDITOR.document.getById( 'editorthai' ); // :((( if ( isBBCodeBuiltIn ) { editorElement.setHtml( ); } // Depending on the wysiwygare plugin availability initialize classic or inline editor. if ( wysiwygareaAvailable ) { CKEDITOR.replace( 'editorthai' ); } else { editorElement.setAttribute( 'contenteditable', 'true' ); CKEDITOR.inline( 'editorthai' ); // TODO we can consider displaying some info box that // without wysiwygarea the classic editor may not work. } }; function isWysiwygareaAvailable() { // If in development mode, then the wysiwygarea must be available. // Split REV into two strings so builder does not replace it :D. if ( CKEDITOR.revision == ( '%RE' + 'V%' ) ) { return true; } return !!CKEDITOR.plugins.get( 'wysiwygarea' ); } } )(); var initEng = ( function() { var wysiwygareaAvailable = isWysiwygareaAvailable(), isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' ); return function() { var editorElement = CKEDITOR.document.getById( 'editoreng' ); // :((( if ( isBBCodeBuiltIn ) { editorElement.setHtml( ); } // Depending on the wysiwygare plugin availability initialize classic or inline editor. if ( wysiwygareaAvailable ) { CKEDITOR.replace( 'editoreng' ); } else { editorElement.setAttribute( 'contenteditable', 'true' ); CKEDITOR.inline( 'editoreng' ); // TODO we can consider displaying some info box that // without wysiwygarea the classic editor may not work. } }; function isWysiwygareaAvailable() { // If in development mode, then the wysiwygarea must be available. // Split REV into two strings so builder does not replace it :D. if ( CKEDITOR.revision == ( '%RE' + 'V%' ) ) { return true; } return !!CKEDITOR.plugins.get( 'wysiwygarea' ); } } )(); CKEDITOR.on( 'dialogDefinition', function( ev ) { // Take the dialog name and its definition from the event // data. var dialogName = ev.data.name; var dialogDefinition = ev.data.definition; // Check if the definition is from the dialog we're // interested on (the Link and Image dialog). if ( dialogName == 'link' || dialogName == 'image' ) { // remove Upload tab dialogDefinition.removeContents( 'Upload' ); } });