indvd00m@0: /** indvd00m@0: * Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. indvd00m@0: * For licensing, see LICENSE.md or http://ckeditor.com/license indvd00m@0: */ indvd00m@0: indvd00m@0: /* exported initSample */ indvd00m@0: indvd00m@0: if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) indvd00m@0: CKEDITOR.tools.enableHtml5Elements( document ); indvd00m@0: indvd00m@0: // The trick to keep the editor in the sample quite small indvd00m@0: // unless user specified own height. indvd00m@0: CKEDITOR.config.height = 150; indvd00m@0: CKEDITOR.config.width = 'auto'; indvd00m@0: indvd00m@0: var initSample = ( function() { indvd00m@0: var wysiwygareaAvailable = isWysiwygareaAvailable(), indvd00m@0: isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' ); indvd00m@0: indvd00m@0: return function() { indvd00m@0: var editorElement = CKEDITOR.document.getById( 'editor' ); indvd00m@0: indvd00m@0: // :((( indvd00m@0: if ( isBBCodeBuiltIn ) { indvd00m@0: editorElement.setHtml( indvd00m@0: 'Hello world!\n\n' + indvd00m@0: 'I\'m an instance of [url=http://ckeditor.com]CKEditor[/url].' indvd00m@0: ); indvd00m@0: } indvd00m@0: indvd00m@0: // Depending on the wysiwygare plugin availability initialize classic or inline editor. indvd00m@0: if ( wysiwygareaAvailable ) { indvd00m@0: CKEDITOR.replace( 'editor' ); indvd00m@0: } else { indvd00m@0: editorElement.setAttribute( 'contenteditable', 'true' ); indvd00m@0: CKEDITOR.inline( 'editor' ); indvd00m@0: indvd00m@0: // TODO we can consider displaying some info box that indvd00m@0: // without wysiwygarea the classic editor may not work. indvd00m@0: } indvd00m@0: }; indvd00m@0: indvd00m@0: function isWysiwygareaAvailable() { indvd00m@0: // If in development mode, then the wysiwygarea must be available. indvd00m@0: // Split REV into two strings so builder does not replace it :D. indvd00m@0: if ( CKEDITOR.revision == ( '%RE' + 'V%' ) ) { indvd00m@0: return true; indvd00m@0: } indvd00m@0: indvd00m@0: return !!CKEDITOR.plugins.get( 'wysiwygarea' ); indvd00m@0: } indvd00m@0: } )(); indvd00m@0: