New: Update ckeditor to version 4 (part 1)

This commit is contained in:
Laurent Destailleur
2014-03-08 12:11:01 +01:00
parent 32c81588b0
commit c65d681d87
4418 changed files with 147049 additions and 127332 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'af', {
toolbar: 'Bron'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'ar', {
toolbar: 'المصدر'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'bg', {
toolbar: 'Източник'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'bn', {
toolbar: 'সোর্স'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'bs', {
toolbar: 'HTML kôd'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'ca', {
toolbar: 'Codi font'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'cs', {
toolbar: 'Zdroj'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'cy', {
toolbar: 'HTML'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'da', {
toolbar: 'Kilde'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'de', {
toolbar: 'Quellcode'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'el', {
toolbar: 'Κώδικας'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'en-au', {
toolbar: 'Source'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'en-ca', {
toolbar: 'Source'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'en-gb', {
toolbar: 'Source'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'en', {
toolbar: 'Source'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'eo', {
toolbar: 'Fonto'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'es', {
toolbar: 'Fuente HTML'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'et', {
toolbar: 'Lähtekood'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'eu', {
toolbar: 'HTML Iturburua'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'fa', {
toolbar: 'منبع'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'fi', {
toolbar: 'Koodi'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'fo', {
toolbar: 'Kelda'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'fr-ca', {
toolbar: 'Source'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'fr', {
toolbar: 'Source'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'gl', {
toolbar: 'Orixe'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'gu', {
toolbar: 'મૂળ કે પ્રાથમિક દસ્તાવેજ'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'he', {
toolbar: 'מקור'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'hi', {
toolbar: 'सोर्स'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'hr', {
toolbar: 'Kôd'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'hu', {
toolbar: 'Forráskód'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'id', {
toolbar: 'Sumber'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'is', {
toolbar: 'Kóði'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'it', {
toolbar: 'Sorgente'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'ja', {
toolbar: 'ソース'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'ka', {
toolbar: 'კოდები'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'km', {
toolbar: 'អក្សរ​កូដ'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'ko', {
toolbar: '소스'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'ku', {
toolbar: 'سەرچاوە'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'lt', {
toolbar: 'Šaltinis'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'lv', {
toolbar: 'HTML kods'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'mk', {
toolbar: 'Source' // MISSING
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'mn', {
toolbar: 'Код'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'ms', {
toolbar: 'Sumber'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'nb', {
toolbar: 'Kilde'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'nl', {
toolbar: 'Broncode'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'no', {
toolbar: 'Kilde'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'pl', {
toolbar: 'Źródło dokumentu'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'pt-br', {
toolbar: 'Código-Fonte'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'pt', {
toolbar: 'Fonte'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'ro', {
toolbar: 'Sursa'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'ru', {
toolbar: 'Источник'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'si', {
toolbar: 'මුලාශ්‍රය'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'sk', {
toolbar: 'Zdroj'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'sl', {
toolbar: 'Izvorna koda'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'sq', {
toolbar: 'Burimi'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'sr-latn', {
toolbar: 'Kôd'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'sr', {
toolbar: 'Kôд'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'sv', {
toolbar: 'Källa'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'th', {
toolbar: 'ดูรหัส HTML'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'tr', {
toolbar: 'Kaynak'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'ug', {
toolbar: 'مەنبە'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'uk', {
toolbar: 'Джерело'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'vi', {
toolbar: 'Mã HTML'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'zh-cn', {
toolbar: '源码'
} );

View File

@@ -0,0 +1,7 @@
/*
Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.plugins.setLang( 'sourcearea', 'zh', {
toolbar: '原始碼'
} );

View File

@@ -1,209 +1,154 @@
/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview The "sourcearea" plugin. It registers the "source" editing
* mode, which displays the raw data being edited in the editor.
*/
CKEDITOR.plugins.add( 'sourcearea',
{
requires : [ 'editingblock' ],
init : function( editor )
{
var sourcearea = CKEDITOR.plugins.sourcearea,
win = CKEDITOR.document.getWindow();
editor.on( 'editingBlockReady', function()
{
var textarea,
onResize;
editor.addMode( 'source',
{
load : function( holderElement, data )
{
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 )
holderElement.setStyle( 'position', 'relative' );
// Create the source area <textarea>.
editor.textarea = textarea = new CKEDITOR.dom.element( 'textarea' );
textarea.setAttributes(
{
dir : 'ltr',
tabIndex : CKEDITOR.env.webkit ? -1 : editor.tabIndex,
'role' : 'textbox',
'aria-label' : editor.lang.editorTitle.replace( '%1', editor.name )
});
textarea.addClass( 'cke_source' );
textarea.addClass( 'cke_enable_context_menu' );
editor.readOnly && textarea.setAttribute( 'readOnly', 'readonly' );
var styles =
{
// IE7 has overflow the <textarea> from wrapping table cell.
width : CKEDITOR.env.ie7Compat ? '99%' : '100%',
height : '100%',
resize : 'none',
outline : 'none',
'text-align' : 'left'
};
// Having to make <textarea> fixed sized to conque the following bugs:
// 1. The textarea height/width='100%' doesn't constraint to the 'td' in IE6/7.
// 2. Unexpected vertical-scrolling behavior happens whenever focus is moving out of editor
// if text content within it has overflowed. (#4762)
if ( CKEDITOR.env.ie )
{
onResize = function()
{
// Holder rectange size is stretched by textarea,
// so hide it just for a moment.
textarea.hide();
textarea.setStyle( 'height', holderElement.$.clientHeight + 'px' );
textarea.setStyle( 'width', holderElement.$.clientWidth + 'px' );
// When we have proper holder size, show textarea again.
textarea.show();
};
editor.on( 'resize', onResize );
win.on( 'resize', onResize );
setTimeout( onResize, 0 );
}
// Reset the holder element and append the
// <textarea> to it.
holderElement.setHtml( '' );
holderElement.append( textarea );
textarea.setStyles( styles );
editor.fire( 'ariaWidget', textarea );
textarea.on( 'blur', function()
{
editor.focusManager.blur();
});
textarea.on( 'focus', function()
{
editor.focusManager.focus();
});
// The editor data "may be dirty" after this point.
editor.mayBeDirty = true;
// Set the <textarea> value.
this.loadData( data );
var keystrokeHandler = editor.keystrokeHandler;
if ( keystrokeHandler )
keystrokeHandler.attach( textarea );
setTimeout( function()
{
editor.mode = 'source';
editor.fire( 'mode', { previousMode : editor._.previousMode } );
},
( CKEDITOR.env.gecko || CKEDITOR.env.webkit ) ? 100 : 0 );
},
loadData : function( data )
{
textarea.setValue( data );
editor.fire( 'dataReady' );
},
getData : function()
{
return textarea.getValue();
},
getSnapshotData : function()
{
return textarea.getValue();
},
unload : function( holderElement )
{
textarea.clearCustomData();
editor.textarea = textarea = null;
if ( onResize )
{
editor.removeListener( 'resize', onResize );
win.removeListener( 'resize', onResize );
}
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 )
holderElement.removeStyle( 'position' );
},
focus : function()
{
textarea.focus();
}
});
});
editor.on( 'readOnly', function()
{
if ( editor.mode == 'source' )
{
if ( editor.readOnly )
editor.textarea.setAttribute( 'readOnly', 'readonly' );
else
editor.textarea.removeAttribute( 'readOnly' );
}
});
editor.addCommand( 'source', sourcearea.commands.source );
if ( editor.ui.addButton )
{
editor.ui.addButton( 'Source',
{
label : editor.lang.source,
command : 'source'
});
}
editor.on( 'mode', function()
{
editor.getCommand( 'source' ).setState(
editor.mode == 'source' ?
CKEDITOR.TRISTATE_ON :
CKEDITOR.TRISTATE_OFF );
});
}
});
/**
* Holds the definition of commands an UI elements included with the sourcearea
* plugin.
* @example
*/
CKEDITOR.plugins.sourcearea =
{
commands :
{
source :
{
modes : { wysiwyg:1, source:1 },
editorFocus : false,
readOnly : 1,
exec : function( editor )
{
if ( editor.mode == 'wysiwyg' )
editor.fire( 'saveSnapshot' );
editor.getCommand( 'source' ).setState( CKEDITOR.TRISTATE_DISABLED );
editor.setMode( editor.mode == 'source' ? 'wysiwyg' : 'source' );
},
canUndo : false
}
}
};
/**
* @license Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
/**
* @fileOverview The "sourcearea" plugin. It registers the "source" editing
* mode, which displays the raw data being edited in the editor.
*/
( function() {
CKEDITOR.plugins.add( 'sourcearea', {
lang: 'af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en,en-au,en-ca,en-gb,eo,es,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE%
icons: 'source,source-rtl', // %REMOVE_LINE_CORE%
hidpi: true, // %REMOVE_LINE_CORE%
init: function( editor ) {
// Source mode isn't available in inline mode yet.
if ( editor.elementMode == CKEDITOR.ELEMENT_MODE_INLINE )
return;
var sourcearea = CKEDITOR.plugins.sourcearea;
editor.addMode( 'source', function( callback ) {
var contentsSpace = editor.ui.space( 'contents' ),
textarea = contentsSpace.getDocument().createElement( 'textarea' );
textarea.setStyles(
CKEDITOR.tools.extend( {
// IE7 has overflow the <textarea> from wrapping table cell.
width: CKEDITOR.env.ie7Compat ? '99%' : '100%',
height: '100%',
resize: 'none',
outline: 'none',
'text-align': 'left'
},
CKEDITOR.tools.cssVendorPrefix( 'tab-size', editor.config.sourceAreaTabSize || 4 ) ) );
// Make sure that source code is always displayed LTR,
// regardless of editor language (#10105).
textarea.setAttribute( 'dir', 'ltr' );
textarea.addClass( 'cke_source cke_reset cke_enable_context_menu' );
editor.ui.space( 'contents' ).append( textarea );
var editable = editor.editable( new sourceEditable( editor, textarea ) );
// Fill the textarea with the current editor data.
editable.setData( editor.getData( 1 ) );
// Having to make <textarea> fixed sized to conquer the following bugs:
// 1. The textarea height/width='100%' doesn't constraint to the 'td' in IE6/7.
// 2. Unexpected vertical-scrolling behavior happens whenever focus is moving out of editor
// if text content within it has overflowed. (#4762)
if ( CKEDITOR.env.ie ) {
editable.attachListener( editor, 'resize', onResize, editable );
editable.attachListener( CKEDITOR.document.getWindow(), 'resize', onResize, editable );
CKEDITOR.tools.setTimeout( onResize, 0, editable );
}
editor.fire( 'ariaWidget', this );
callback();
} );
editor.addCommand( 'source', sourcearea.commands.source );
if ( editor.ui.addButton ) {
editor.ui.addButton( 'Source', {
label: editor.lang.sourcearea.toolbar,
command: 'source',
toolbar: 'mode,10'
} );
}
editor.on( 'mode', function() {
editor.getCommand( 'source' ).setState( editor.mode == 'source' ? CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF );
} );
function onResize() {
// Holder rectange size is stretched by textarea,
// so hide it just for a moment.
this.hide();
this.setStyle( 'height', this.getParent().$.clientHeight + 'px' );
this.setStyle( 'width', this.getParent().$.clientWidth + 'px' );
// When we have proper holder size, show textarea again.
this.show();
}
}
} );
var sourceEditable = CKEDITOR.tools.createClass( {
base: CKEDITOR.editable,
proto: {
setData: function( data ) {
this.setValue( data );
this.editor.fire( 'dataReady' );
},
getData: function() {
return this.getValue();
},
// Insertions are not supported in source editable.
insertHtml: function() {},
insertElement: function() {},
insertText: function() {},
// Read-only support for textarea.
setReadOnly: function( isReadOnly ) {
this[ ( isReadOnly ? 'set' : 'remove' ) + 'Attribute' ]( 'readOnly', 'readonly' );
},
detach: function() {
sourceEditable.baseProto.detach.call( this );
this.clearCustomData();
this.remove();
}
}
} );
} )();
CKEDITOR.plugins.sourcearea = {
commands: {
source: {
modes: { wysiwyg: 1, source: 1 },
editorFocus: false,
readOnly: 1,
exec: function( editor ) {
if ( editor.mode == 'wysiwyg' )
editor.fire( 'saveSnapshot' );
editor.getCommand( 'source' ).setState( CKEDITOR.TRISTATE_DISABLED );
editor.setMode( editor.mode == 'source' ? 'wysiwyg' : 'source' );
},
canUndo: false
}
}
};
/**
* Controls CSS tab-size property of the sourcearea view.
*
* **Note:** Works only with {@link #dataIndentationChars}
* set to `'\t'`. Please consider that not all browsers support CSS
* `tab-size` property yet.
*
* // Set tab-size to 20 characters.
* CKEDITOR.config.sourceAreaTabSize = 20;
*
* @cfg {Number} [sourceAreaTabSize=4]
* @member CKEDITOR.config
* @see CKEDITOR.config#dataIndentationChars
*/