Path: blob/master/ckeditor_4.6.2/samples/js/sample.js
1005 views
/**1* Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.2* For licensing, see LICENSE.md or http://ckeditor.com/license3*/45/* exported initSample */67if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )8CKEDITOR.tools.enableHtml5Elements( document );910// The trick to keep the editor in the sample quite small11// unless user specified own height.12CKEDITOR.config.height = 150;13CKEDITOR.config.width = 'auto';1415var initSample = ( function() {16var wysiwygareaAvailable = isWysiwygareaAvailable(),17isBBCodeBuiltIn = !!CKEDITOR.plugins.get( 'bbcode' );1819return function() {20var editorElement = CKEDITOR.document.getById( 'editor' );2122// :(((23if ( isBBCodeBuiltIn ) {24editorElement.setHtml(25'Hello world!\n\n' +26'I\'m an instance of [url=http://ckeditor.com]CKEditor[/url].'27);28}2930// Depending on the wysiwygare plugin availability initialize classic or inline editor.31if ( wysiwygareaAvailable ) {32CKEDITOR.replace( 'editor' );33} else {34editorElement.setAttribute( 'contenteditable', 'true' );35CKEDITOR.inline( 'editor' );3637// TODO we can consider displaying some info box that38// without wysiwygarea the classic editor may not work.39}40};4142function isWysiwygareaAvailable() {43// If in development mode, then the wysiwygarea must be available.44// Split REV into two strings so builder does not replace it :D.45if ( CKEDITOR.revision == ( '%RE' + 'V%' ) ) {46return true;47}4849return !!CKEDITOR.plugins.get( 'wysiwygarea' );50}51} )();52535455