2 * Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
6 /* exported initSample */
8 if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
9 CKEDITOR.tools.enableHtml5Elements( document );
11 // The trick to keep the editor in the sample quite small
12 // unless user specified own height.
13 CKEDITOR.config.height = 150;
14 CKEDITOR.config.width = 'auto';
16 var initSample = ( function() {
17 var wysiwygareaAvailable = isWysiwygareaAvailable(),
18 isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' );
21 var editorElement = CKEDITOR.document.getById( 'editor' );
24 if ( isBBCodeBuiltIn ) {
25 editorElement.setHtml(
27 'I\'m an instance of [url=http://ckeditor.com]CKEditor[/url].'
31 // Depending on the wysiwygare plugin availability initialize classic or inline editor.
32 if ( wysiwygareaAvailable ) {
33 CKEDITOR.replace( 'editor' );
35 editorElement.setAttribute( 'contenteditable', 'true' );
36 CKEDITOR.inline( 'editor' );
38 // TODO we can consider displaying some info box that
39 // without wysiwygarea the classic editor may not work.
43 function isWysiwygareaAvailable() {
44 // If in development mode, then the wysiwygarea must be available.
45 // Split REV into two strings so builder does not replace it :D.
46 if ( CKEDITOR.revision == ( '%RE' + 'V%' ) ) {
50 return !!CKEDITOR.plugins.get( 'wysiwygarea' );