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