summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2014-06-07 07:54:37 +0100
committerlsces <lester@lsces.co.uk>2014-06-07 07:54:37 +0100
commit090bb311ef748e4503645ebe6de881dcede15620 (patch)
treec69e3103834e1410bcd019424463e95b2b63d25c /plugins
parent8820e0e7f586626f0bb5837f26329bac3299a195 (diff)
downloadckeditor-090bb311ef748e4503645ebe6de881dcede15620.tar.gz
ckeditor-090bb311ef748e4503645ebe6de881dcede15620.tar.bz2
ckeditor-090bb311ef748e4503645ebe6de881dcede15620.zip
Upgrade to version 4.3
Diffstat (limited to 'plugins')
-rwxr-xr-x[-rw-r--r--]plugins/forms/dialogs/select.js523
-rwxr-xr-x[-rw-r--r--]plugins/forms/dialogs/textarea.js126
-rwxr-xr-x[-rw-r--r--]plugins/forms/dialogs/textfield.js192
-rwxr-xr-x[-rw-r--r--]plugins/iframe/dialogs/iframe.js228
-rwxr-xr-x[-rw-r--r--]plugins/link/dialogs/anchor.js128
-rwxr-xr-x[-rw-r--r--]plugins/link/dialogs/link.js1325
-rwxr-xr-x[-rw-r--r--]plugins/link/images/anchor.pngbin566 -> 763 bytes
-rwxr-xr-x[-rw-r--r--]plugins/liststyle/dialogs/liststyle.js209
-rwxr-xr-x[-rw-r--r--]plugins/pastefromword/filter/default.js1242
9 files changed, 134 insertions, 3839 deletions
diff --git a/plugins/forms/dialogs/select.js b/plugins/forms/dialogs/select.js
index 53aaf58..734d033 100644..100755
--- a/plugins/forms/dialogs/select.js
+++ b/plugins/forms/dialogs/select.js
@@ -1,503 +1,20 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-CKEDITOR.dialog.add( 'select', function( editor ) {
- // Add a new option to a SELECT object (combo or list).
- function addOption( combo, optionText, optionValue, documentObject, index ) {
- combo = getSelect( combo );
- var oOption;
- if ( documentObject )
- oOption = documentObject.createElement( "OPTION" );
- else
- oOption = document.createElement( "OPTION" );
-
- if ( combo && oOption && oOption.getName() == 'option' ) {
- if ( CKEDITOR.env.ie ) {
- if ( !isNaN( parseInt( index, 10 ) ) )
- combo.$.options.add( oOption.$, index );
- else
- combo.$.options.add( oOption.$ );
-
- oOption.$.innerHTML = optionText.length > 0 ? optionText : '';
- oOption.$.value = optionValue;
- } else {
- if ( index !== null && index < combo.getChildCount() )
- combo.getChild( index < 0 ? 0 : index ).insertBeforeMe( oOption );
- else
- combo.append( oOption );
-
- oOption.setText( optionText.length > 0 ? optionText : '' );
- oOption.setValue( optionValue );
- }
- } else
- return false;
-
- return oOption;
- }
- // Remove all selected options from a SELECT object.
- function removeSelectedOptions( combo ) {
- combo = getSelect( combo );
-
- // Save the selected index
- var iSelectedIndex = getSelectedIndex( combo );
-
- // Remove all selected options.
- for ( var i = combo.getChildren().count() - 1; i >= 0; i-- ) {
- if ( combo.getChild( i ).$.selected )
- combo.getChild( i ).remove();
- }
-
- // Reset the selection based on the original selected index.
- setSelectedIndex( combo, iSelectedIndex );
- }
- //Modify option from a SELECT object.
- function modifyOption( combo, index, title, value ) {
- combo = getSelect( combo );
- if ( index < 0 )
- return false;
- var child = combo.getChild( index );
- child.setText( title );
- child.setValue( value );
- return child;
- }
-
- function removeAllOptions( combo ) {
- combo = getSelect( combo );
- while ( combo.getChild( 0 ) && combo.getChild( 0 ).remove() ) {
- /*jsl:pass*/
- }
- }
- // Moves the selected option by a number of steps (also negative).
- function changeOptionPosition( combo, steps, documentObject ) {
- combo = getSelect( combo );
- var iActualIndex = getSelectedIndex( combo );
- if ( iActualIndex < 0 )
- return false;
-
- var iFinalIndex = iActualIndex + steps;
- iFinalIndex = ( iFinalIndex < 0 ) ? 0 : iFinalIndex;
- iFinalIndex = ( iFinalIndex >= combo.getChildCount() ) ? combo.getChildCount() - 1 : iFinalIndex;
-
- if ( iActualIndex == iFinalIndex )
- return false;
-
- var oOption = combo.getChild( iActualIndex ),
- sText = oOption.getText(),
- sValue = oOption.getValue();
-
- oOption.remove();
-
- oOption = addOption( combo, sText, sValue, ( !documentObject ) ? null : documentObject, iFinalIndex );
- setSelectedIndex( combo, iFinalIndex );
- return oOption;
- }
-
- function getSelectedIndex( combo ) {
- combo = getSelect( combo );
- return combo ? combo.$.selectedIndex : -1;
- }
-
- function setSelectedIndex( combo, index ) {
- combo = getSelect( combo );
- if ( index < 0 )
- return null;
- var count = combo.getChildren().count();
- combo.$.selectedIndex = ( index >= count ) ? ( count - 1 ) : index;
- return combo;
- }
-
- function getOptions( combo ) {
- combo = getSelect( combo );
- return combo ? combo.getChildren() : false;
- }
-
- function getSelect( obj ) {
- if ( obj && obj.domId && obj.getInputElement().$ ) // Dialog element.
- return obj.getInputElement();
- else if ( obj && obj.$ )
- return obj;
- return false;
- }
-
- return {
- title: editor.lang.forms.select.title,
- minWidth: CKEDITOR.env.ie ? 460 : 395,
- minHeight: CKEDITOR.env.ie ? 320 : 300,
- onShow: function() {
- delete this.selectBox;
- this.setupContent( 'clear' );
- var element = this.getParentEditor().getSelection().getSelectedElement();
- if ( element && element.getName() == "select" ) {
- this.selectBox = element;
- this.setupContent( element.getName(), element );
-
- // Load Options into dialog.
- var objOptions = getOptions( element );
- for ( var i = 0; i < objOptions.count(); i++ )
- this.setupContent( 'option', objOptions.getItem( i ) );
- }
- },
- onOk: function() {
- var editor = this.getParentEditor(),
- element = this.selectBox,
- isInsertMode = !element;
-
- if ( isInsertMode )
- element = editor.document.createElement( 'select' );
- this.commitContent( element );
-
- if ( isInsertMode ) {
- editor.insertElement( element );
- if ( CKEDITOR.env.ie ) {
- var sel = editor.getSelection(),
- bms = sel.createBookmarks();
- setTimeout( function() {
- sel.selectBookmarks( bms );
- }, 0 );
- }
- }
- },
- contents: [
- {
- id: 'info',
- label: editor.lang.forms.select.selectInfo,
- title: editor.lang.forms.select.selectInfo,
- accessKey: '',
- elements: [
- {
- id: 'txtName',
- type: 'text',
- widths: [ '25%', '75%' ],
- labelLayout: 'horizontal',
- label: editor.lang.common.name,
- 'default': '',
- accessKey: 'N',
- style: 'width:350px',
- setup: function( name, element ) {
- if ( name == 'clear' )
- this.setValue( this[ 'default' ] || '' );
- else if ( name == 'select' ) {
- this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' );
- }
- },
- commit: function( element ) {
- if ( this.getValue() )
- element.data( 'cke-saved-name', this.getValue() );
- else {
- element.data( 'cke-saved-name', false );
- element.removeAttribute( 'name' );
- }
- }
- },
- {
- id: 'txtValue',
- type: 'text',
- widths: [ '25%', '75%' ],
- labelLayout: 'horizontal',
- label: editor.lang.forms.select.value,
- style: 'width:350px',
- 'default': '',
- className: 'cke_disabled',
- onLoad: function() {
- this.getInputElement().setAttribute( 'readOnly', true );
- },
- setup: function( name, element ) {
- if ( name == 'clear' )
- this.setValue( '' );
- else if ( name == 'option' && element.getAttribute( 'selected' ) )
- this.setValue( element.$.value );
- }
- },
- {
- type: 'hbox',
- widths: [ '175px', '170px' ],
- children: [
- {
- id: 'txtSize',
- type: 'text',
- labelLayout: 'horizontal',
- label: editor.lang.forms.select.size,
- 'default': '',
- accessKey: 'S',
- style: 'width:175px',
- validate: function() {
- var func = CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed );
- return ( ( this.getValue() === '' ) || func.apply( this ) );
- },
- setup: function( name, element ) {
- if ( name == 'select' )
- this.setValue( element.getAttribute( 'size' ) || '' );
- if ( CKEDITOR.env.webkit )
- this.getInputElement().setStyle( 'width', '86px' );
- },
- commit: function( element ) {
- if ( this.getValue() )
- element.setAttribute( 'size', this.getValue() );
- else
- element.removeAttribute( 'size' );
- }
- },
- {
- type: 'html',
- html: '<span>' + CKEDITOR.tools.htmlEncode( editor.lang.forms.select.lines ) + '</span>'
- }
- ]
- },
- {
- type: 'html',
- html: '<span>' + CKEDITOR.tools.htmlEncode( editor.lang.forms.select.opAvail ) + '</span>'
- },
- {
- type: 'hbox',
- widths: [ '115px', '115px', '100px' ],
- children: [
- {
- type: 'vbox',
- children: [
- {
- id: 'txtOptName',
- type: 'text',
- label: editor.lang.forms.select.opText,
- style: 'width:115px',
- setup: function( name, element ) {
- if ( name == 'clear' )
- this.setValue( "" );
- }
- },
- {
- type: 'select',
- id: 'cmbName',
- label: '',
- title: '',
- size: 5,
- style: 'width:115px;height:75px',
- items: [],
- onChange: function() {
- var dialog = this.getDialog(),
- values = dialog.getContentElement( 'info', 'cmbValue' ),
- optName = dialog.getContentElement( 'info', 'txtOptName' ),
- optValue = dialog.getContentElement( 'info', 'txtOptValue' ),
- iIndex = getSelectedIndex( this );
-
- setSelectedIndex( values, iIndex );
- optName.setValue( this.getValue() );
- optValue.setValue( values.getValue() );
- },
- setup: function( name, element ) {
- if ( name == 'clear' )
- removeAllOptions( this );
- else if ( name == 'option' )
- addOption( this, element.getText(), element.getText(), this.getDialog().getParentEditor().document );
- },
- commit: function( element ) {
- var dialog = this.getDialog(),
- optionsNames = getOptions( this ),
- optionsValues = getOptions( dialog.getContentElement( 'info', 'cmbValue' ) ),
- selectValue = dialog.getContentElement( 'info', 'txtValue' ).getValue();
-
- removeAllOptions( element );
-
- for ( var i = 0; i < optionsNames.count(); i++ ) {
- var oOption = addOption( element, optionsNames.getItem( i ).getValue(), optionsValues.getItem( i ).getValue(), dialog.getParentEditor().document );
- if ( optionsValues.getItem( i ).getValue() == selectValue ) {
- oOption.setAttribute( 'selected', 'selected' );
- oOption.selected = true;
- }
- }
- }
- }
- ]
- },
- {
- type: 'vbox',
- children: [
- {
- id: 'txtOptValue',
- type: 'text',
- label: editor.lang.forms.select.opValue,
- style: 'width:115px',
- setup: function( name, element ) {
- if ( name == 'clear' )
- this.setValue( "" );
- }
- },
- {
- type: 'select',
- id: 'cmbValue',
- label: '',
- size: 5,
- style: 'width:115px;height:75px',
- items: [],
- onChange: function() {
- var dialog = this.getDialog(),
- names = dialog.getContentElement( 'info', 'cmbName' ),
- optName = dialog.getContentElement( 'info', 'txtOptName' ),
- optValue = dialog.getContentElement( 'info', 'txtOptValue' ),
- iIndex = getSelectedIndex( this );
-
- setSelectedIndex( names, iIndex );
- optName.setValue( names.getValue() );
- optValue.setValue( this.getValue() );
- },
- setup: function( name, element ) {
- if ( name == 'clear' )
- removeAllOptions( this );
- else if ( name == 'option' ) {
- var oValue = element.getValue();
- addOption( this, oValue, oValue, this.getDialog().getParentEditor().document );
- if ( element.getAttribute( 'selected' ) == 'selected' )
- this.getDialog().getContentElement( 'info', 'txtValue' ).setValue( oValue );
- }
- }
- }
- ]
- },
- {
- type: 'vbox',
- padding: 5,
- children: [
- {
- type: 'button',
- id: 'btnAdd',
- style: '',
- label: editor.lang.forms.select.btnAdd,
- title: editor.lang.forms.select.btnAdd,
- style: 'width:100%;',
- onClick: function() {
- //Add new option.
- var dialog = this.getDialog(),
- parentEditor = dialog.getParentEditor(),
- optName = dialog.getContentElement( 'info', 'txtOptName' ),
- optValue = dialog.getContentElement( 'info', 'txtOptValue' ),
- names = dialog.getContentElement( 'info', 'cmbName' ),
- values = dialog.getContentElement( 'info', 'cmbValue' );
-
- addOption( names, optName.getValue(), optName.getValue(), dialog.getParentEditor().document );
- addOption( values, optValue.getValue(), optValue.getValue(), dialog.getParentEditor().document );
-
- optName.setValue( "" );
- optValue.setValue( "" );
- }
- },
- {
- type: 'button',
- id: 'btnModify',
- label: editor.lang.forms.select.btnModify,
- title: editor.lang.forms.select.btnModify,
- style: 'width:100%;',
- onClick: function() {
- //Modify selected option.
- var dialog = this.getDialog(),
- optName = dialog.getContentElement( 'info', 'txtOptName' ),
- optValue = dialog.getContentElement( 'info', 'txtOptValue' ),
- names = dialog.getContentElement( 'info', 'cmbName' ),
- values = dialog.getContentElement( 'info', 'cmbValue' ),
- iIndex = getSelectedIndex( names );
-
- if ( iIndex >= 0 ) {
- modifyOption( names, iIndex, optName.getValue(), optName.getValue() );
- modifyOption( values, iIndex, optValue.getValue(), optValue.getValue() );
- }
- }
- },
- {
- type: 'button',
- id: 'btnUp',
- style: 'width:100%;',
- label: editor.lang.forms.select.btnUp,
- title: editor.lang.forms.select.btnUp,
- onClick: function() {
- //Move up.
- var dialog = this.getDialog(),
- names = dialog.getContentElement( 'info', 'cmbName' ),
- values = dialog.getContentElement( 'info', 'cmbValue' );
-
- changeOptionPosition( names, -1, dialog.getParentEditor().document );
- changeOptionPosition( values, -1, dialog.getParentEditor().document );
- }
- },
- {
- type: 'button',
- id: 'btnDown',
- style: 'width:100%;',
- label: editor.lang.forms.select.btnDown,
- title: editor.lang.forms.select.btnDown,
- onClick: function() {
- //Move down.
- var dialog = this.getDialog(),
- names = dialog.getContentElement( 'info', 'cmbName' ),
- values = dialog.getContentElement( 'info', 'cmbValue' );
-
- changeOptionPosition( names, 1, dialog.getParentEditor().document );
- changeOptionPosition( values, 1, dialog.getParentEditor().document );
- }
- }
- ]
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '40%', '20%', '40%' ],
- children: [
- {
- type: 'button',
- id: 'btnSetValue',
- label: editor.lang.forms.select.btnSetValue,
- title: editor.lang.forms.select.btnSetValue,
- onClick: function() {
- //Set as default value.
- var dialog = this.getDialog(),
- values = dialog.getContentElement( 'info', 'cmbValue' ),
- txtValue = dialog.getContentElement( 'info', 'txtValue' );
- txtValue.setValue( values.getValue() );
- }
- },
- {
- type: 'button',
- id: 'btnDelete',
- label: editor.lang.forms.select.btnDelete,
- title: editor.lang.forms.select.btnDelete,
- onClick: function() {
- // Delete option.
- var dialog = this.getDialog(),
- names = dialog.getContentElement( 'info', 'cmbName' ),
- values = dialog.getContentElement( 'info', 'cmbValue' ),
- optName = dialog.getContentElement( 'info', 'txtOptName' ),
- optValue = dialog.getContentElement( 'info', 'txtOptValue' );
-
- removeSelectedOptions( names );
- removeSelectedOptions( values );
-
- optName.setValue( "" );
- optValue.setValue( "" );
- }
- },
- {
- id: 'chkMulti',
- type: 'checkbox',
- label: editor.lang.forms.select.chkMulti,
- 'default': '',
- accessKey: 'M',
- value: "checked",
- setup: function( name, element ) {
- if ( name == 'select' )
- this.setValue( element.getAttribute( 'multiple' ) );
- if ( CKEDITOR.env.webkit )
- this.getElement().getParent().setStyle( 'vertical-align', 'middle' );
- },
- commit: function( element ) {
- if ( this.getValue() )
- element.setAttribute( 'multiple', this.getValue() );
- else
- element.removeAttribute( 'multiple' );
- }
- }
- ]
- }
- ]
- }
- ]
- };
-});
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("select",function(c){function h(a,b,e,d,c){a=f(a);d=d?d.createElement("OPTION"):document.createElement("OPTION");if(a&&d&&"option"==d.getName())CKEDITOR.env.ie?(isNaN(parseInt(c,10))?a.$.options.add(d.$):a.$.options.add(d.$,c),d.$.innerHTML=0<b.length?b:"",d.$.value=e):(null!==c&&c<a.getChildCount()?a.getChild(0>c?0:c).insertBeforeMe(d):a.append(d),d.setText(0<b.length?b:""),d.setValue(e));else return!1;return d}function m(a){for(var a=f(a),b=g(a),e=a.getChildren().count()-1;0<=
+e;e--)a.getChild(e).$.selected&&a.getChild(e).remove();i(a,b)}function n(a,b,e,d){a=f(a);if(0>b)return!1;a=a.getChild(b);a.setText(e);a.setValue(d);return a}function k(a){for(a=f(a);a.getChild(0)&&a.getChild(0).remove(););}function j(a,b,e){var a=f(a),d=g(a);if(0>d)return!1;b=d+b;b=0>b?0:b;b=b>=a.getChildCount()?a.getChildCount()-1:b;if(d==b)return!1;var d=a.getChild(d),c=d.getText(),o=d.getValue();d.remove();d=h(a,c,o,!e?null:e,b);i(a,b);return d}function g(a){return(a=f(a))?a.$.selectedIndex:-1}
+function i(a,b){a=f(a);if(0>b)return null;var e=a.getChildren().count();a.$.selectedIndex=b>=e?e-1:b;return a}function l(a){return(a=f(a))?a.getChildren():!1}function f(a){return a&&a.domId&&a.getInputElement().$?a.getInputElement():a&&a.$?a:!1}return{title:c.lang.forms.select.title,minWidth:CKEDITOR.env.ie?460:395,minHeight:CKEDITOR.env.ie?320:300,onShow:function(){delete this.selectBox;this.setupContent("clear");var a=this.getParentEditor().getSelection().getSelectedElement();if(a&&"select"==a.getName()){this.selectBox=
+a;this.setupContent(a.getName(),a);for(var a=l(a),b=0;b<a.count();b++)this.setupContent("option",a.getItem(b))}},onOk:function(){var a=this.getParentEditor(),b=this.selectBox,e=!b;e&&(b=a.document.createElement("select"));this.commitContent(b);if(e&&(a.insertElement(b),CKEDITOR.env.ie)){var d=a.getSelection(),c=d.createBookmarks();setTimeout(function(){d.selectBookmarks(c)},0)}},contents:[{id:"info",label:c.lang.forms.select.selectInfo,title:c.lang.forms.select.selectInfo,accessKey:"",elements:[{id:"txtName",
+type:"text",widths:["25%","75%"],labelLayout:"horizontal",label:c.lang.common.name,"default":"",accessKey:"N",style:"width:350px",setup:function(a,b){"clear"==a?this.setValue(this["default"]||""):"select"==a&&this.setValue(b.data("cke-saved-name")||b.getAttribute("name")||"")},commit:function(a){this.getValue()?a.data("cke-saved-name",this.getValue()):(a.data("cke-saved-name",!1),a.removeAttribute("name"))}},{id:"txtValue",type:"text",widths:["25%","75%"],labelLayout:"horizontal",label:c.lang.forms.select.value,
+style:"width:350px","default":"",className:"cke_disabled",onLoad:function(){this.getInputElement().setAttribute("readOnly",!0)},setup:function(a,b){"clear"==a?this.setValue(""):"option"==a&&b.getAttribute("selected")&&this.setValue(b.$.value)}},{type:"hbox",widths:["175px","170px"],children:[{id:"txtSize",type:"text",labelLayout:"horizontal",label:c.lang.forms.select.size,"default":"",accessKey:"S",style:"width:175px",validate:function(){var a=CKEDITOR.dialog.validate.integer(c.lang.common.validateNumberFailed);
+return""===this.getValue()||a.apply(this)},setup:function(a,b){"select"==a&&this.setValue(b.getAttribute("size")||"");CKEDITOR.env.webkit&&this.getInputElement().setStyle("width","86px")},commit:function(a){this.getValue()?a.setAttribute("size",this.getValue()):a.removeAttribute("size")}},{type:"html",html:"<span>"+CKEDITOR.tools.htmlEncode(c.lang.forms.select.lines)+"</span>"}]},{type:"html",html:"<span>"+CKEDITOR.tools.htmlEncode(c.lang.forms.select.opAvail)+"</span>"},{type:"hbox",widths:["115px",
+"115px","100px"],children:[{type:"vbox",children:[{id:"txtOptName",type:"text",label:c.lang.forms.select.opText,style:"width:115px",setup:function(a){"clear"==a&&this.setValue("")}},{type:"select",id:"cmbName",label:"",title:"",size:5,style:"width:115px;height:75px",items:[],onChange:function(){var a=this.getDialog(),b=a.getContentElement("info","cmbValue"),e=a.getContentElement("info","txtOptName"),a=a.getContentElement("info","txtOptValue"),d=g(this);i(b,d);e.setValue(this.getValue());a.setValue(b.getValue())},
+setup:function(a,b){"clear"==a?k(this):"option"==a&&h(this,b.getText(),b.getText(),this.getDialog().getParentEditor().document)},commit:function(a){var b=this.getDialog(),e=l(this),d=l(b.getContentElement("info","cmbValue")),c=b.getContentElement("info","txtValue").getValue();k(a);for(var f=0;f<e.count();f++){var g=h(a,e.getItem(f).getValue(),d.getItem(f).getValue(),b.getParentEditor().document);d.getItem(f).getValue()==c&&(g.setAttribute("selected","selected"),g.selected=!0)}}}]},{type:"vbox",children:[{id:"txtOptValue",
+type:"text",label:c.lang.forms.select.opValue,style:"width:115px",setup:function(a){"clear"==a&&this.setValue("")}},{type:"select",id:"cmbValue",label:"",size:5,style:"width:115px;height:75px",items:[],onChange:function(){var a=this.getDialog(),b=a.getContentElement("info","cmbName"),e=a.getContentElement("info","txtOptName"),a=a.getContentElement("info","txtOptValue"),d=g(this);i(b,d);e.setValue(b.getValue());a.setValue(this.getValue())},setup:function(a,b){if("clear"==a)k(this);else if("option"==
+a){var e=b.getValue();h(this,e,e,this.getDialog().getParentEditor().document);"selected"==b.getAttribute("selected")&&this.getDialog().getContentElement("info","txtValue").setValue(e)}}}]},{type:"vbox",padding:5,children:[{type:"button",id:"btnAdd",style:"",label:c.lang.forms.select.btnAdd,title:c.lang.forms.select.btnAdd,style:"width:100%;",onClick:function(){var a=this.getDialog();a.getParentEditor();var b=a.getContentElement("info","txtOptName"),e=a.getContentElement("info","txtOptValue"),d=a.getContentElement("info",
+"cmbName"),c=a.getContentElement("info","cmbValue");h(d,b.getValue(),b.getValue(),a.getParentEditor().document);h(c,e.getValue(),e.getValue(),a.getParentEditor().document);b.setValue("");e.setValue("")}},{type:"button",id:"btnModify",label:c.lang.forms.select.btnModify,title:c.lang.forms.select.btnModify,style:"width:100%;",onClick:function(){var a=this.getDialog(),b=a.getContentElement("info","txtOptName"),e=a.getContentElement("info","txtOptValue"),d=a.getContentElement("info","cmbName"),a=a.getContentElement("info",
+"cmbValue"),c=g(d);0<=c&&(n(d,c,b.getValue(),b.getValue()),n(a,c,e.getValue(),e.getValue()))}},{type:"button",id:"btnUp",style:"width:100%;",label:c.lang.forms.select.btnUp,title:c.lang.forms.select.btnUp,onClick:function(){var a=this.getDialog(),b=a.getContentElement("info","cmbName"),c=a.getContentElement("info","cmbValue");j(b,-1,a.getParentEditor().document);j(c,-1,a.getParentEditor().document)}},{type:"button",id:"btnDown",style:"width:100%;",label:c.lang.forms.select.btnDown,title:c.lang.forms.select.btnDown,
+onClick:function(){var a=this.getDialog(),b=a.getContentElement("info","cmbName"),c=a.getContentElement("info","cmbValue");j(b,1,a.getParentEditor().document);j(c,1,a.getParentEditor().document)}}]}]},{type:"hbox",widths:["40%","20%","40%"],children:[{type:"button",id:"btnSetValue",label:c.lang.forms.select.btnSetValue,title:c.lang.forms.select.btnSetValue,onClick:function(){var a=this.getDialog(),b=a.getContentElement("info","cmbValue");a.getContentElement("info","txtValue").setValue(b.getValue())}},
+{type:"button",id:"btnDelete",label:c.lang.forms.select.btnDelete,title:c.lang.forms.select.btnDelete,onClick:function(){var a=this.getDialog(),b=a.getContentElement("info","cmbName"),c=a.getContentElement("info","cmbValue"),d=a.getContentElement("info","txtOptName"),a=a.getContentElement("info","txtOptValue");m(b);m(c);d.setValue("");a.setValue("")}},{id:"chkMulti",type:"checkbox",label:c.lang.forms.select.chkMulti,"default":"",accessKey:"M",value:"checked",setup:function(a,b){"select"==a&&this.setValue(b.getAttribute("multiple"));
+CKEDITOR.env.webkit&&this.getElement().getParent().setStyle("vertical-align","middle")},commit:function(a){this.getValue()?a.setAttribute("multiple",this.getValue()):a.removeAttribute("multiple")}}]}]}]}}); \ No newline at end of file
diff --git a/plugins/forms/dialogs/textarea.js b/plugins/forms/dialogs/textarea.js
index 87eb2f3..46f670b 100644..100755
--- a/plugins/forms/dialogs/textarea.js
+++ b/plugins/forms/dialogs/textarea.js
@@ -1,118 +1,8 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-CKEDITOR.dialog.add( 'textarea', function( editor ) {
- return {
- title: editor.lang.forms.textarea.title,
- minWidth: 350,
- minHeight: 220,
- onShow: function() {
- delete this.textarea;
-
- var element = this.getParentEditor().getSelection().getSelectedElement();
- if ( element && element.getName() == "textarea" ) {
- this.textarea = element;
- this.setupContent( element );
- }
- },
- onOk: function() {
- var editor,
- element = this.textarea,
- isInsertMode = !element;
-
- if ( isInsertMode ) {
- editor = this.getParentEditor();
- element = editor.document.createElement( 'textarea' );
- }
- this.commitContent( element );
-
- if ( isInsertMode )
- editor.insertElement( element );
- },
- contents: [
- {
- id: 'info',
- label: editor.lang.forms.textarea.title,
- title: editor.lang.forms.textarea.title,
- elements: [
- {
- id: '_cke_saved_name',
- type: 'text',
- label: editor.lang.common.name,
- 'default': '',
- accessKey: 'N',
- setup: function( element ) {
- this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' );
- },
- commit: function( element ) {
- if ( this.getValue() )
- element.data( 'cke-saved-name', this.getValue() );
- else {
- element.data( 'cke-saved-name', false );
- element.removeAttribute( 'name' );
- }
- }
- },
- {
- type: 'hbox',
- widths: [ '50%', '50%' ],
- children: [
- {
- id: 'cols',
- type: 'text',
- label: editor.lang.forms.textarea.cols,
- 'default': '',
- accessKey: 'C',
- style: 'width:50px',
- validate: CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ),
- setup: function( element ) {
- var value = element.hasAttribute( 'cols' ) && element.getAttribute( 'cols' );
- this.setValue( value || '' );
- },
- commit: function( element ) {
- if ( this.getValue() )
- element.setAttribute( 'cols', this.getValue() );
- else
- element.removeAttribute( 'cols' );
- }
- },
- {
- id: 'rows',
- type: 'text',
- label: editor.lang.forms.textarea.rows,
- 'default': '',
- accessKey: 'R',
- style: 'width:50px',
- validate: CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed ),
- setup: function( element ) {
- var value = element.hasAttribute( 'rows' ) && element.getAttribute( 'rows' );
- this.setValue( value || '' );
- },
- commit: function( element ) {
- if ( this.getValue() )
- element.setAttribute( 'rows', this.getValue() );
- else
- element.removeAttribute( 'rows' );
- }
- }
- ]
- },
- {
- id: 'value',
- type: 'textarea',
- label: editor.lang.forms.textfield.value,
- 'default': '',
- setup: function( element ) {
- this.setValue( element.$.defaultValue );
- },
- commit: function( element ) {
- element.$.value = element.$.defaultValue = this.getValue();
- }
- }
-
- ]
- }
- ]
- };
-});
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("textarea",function(b){return{title:b.lang.forms.textarea.title,minWidth:350,minHeight:220,onShow:function(){delete this.textarea;var a=this.getParentEditor().getSelection().getSelectedElement();a&&"textarea"==a.getName()&&(this.textarea=a,this.setupContent(a))},onOk:function(){var a,b=this.textarea,c=!b;c&&(a=this.getParentEditor(),b=a.document.createElement("textarea"));this.commitContent(b);c&&a.insertElement(b)},contents:[{id:"info",label:b.lang.forms.textarea.title,title:b.lang.forms.textarea.title,
+elements:[{id:"_cke_saved_name",type:"text",label:b.lang.common.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){this.getValue()?a.data("cke-saved-name",this.getValue()):(a.data("cke-saved-name",!1),a.removeAttribute("name"))}},{type:"hbox",widths:["50%","50%"],children:[{id:"cols",type:"text",label:b.lang.forms.textarea.cols,"default":"",accessKey:"C",style:"width:50px",validate:CKEDITOR.dialog.validate.integer(b.lang.common.validateNumberFailed),
+setup:function(a){this.setValue(a.hasAttribute("cols")&&a.getAttribute("cols")||"")},commit:function(a){this.getValue()?a.setAttribute("cols",this.getValue()):a.removeAttribute("cols")}},{id:"rows",type:"text",label:b.lang.forms.textarea.rows,"default":"",accessKey:"R",style:"width:50px",validate:CKEDITOR.dialog.validate.integer(b.lang.common.validateNumberFailed),setup:function(a){this.setValue(a.hasAttribute("rows")&&a.getAttribute("rows")||"")},commit:function(a){this.getValue()?a.setAttribute("rows",
+this.getValue()):a.removeAttribute("rows")}}]},{id:"value",type:"textarea",label:b.lang.forms.textfield.value,"default":"",setup:function(a){this.setValue(a.$.defaultValue)},commit:function(a){a.$.value=a.$.defaultValue=this.getValue()}}]}]}}); \ No newline at end of file
diff --git a/plugins/forms/dialogs/textfield.js b/plugins/forms/dialogs/textfield.js
index e612f9f..f855d24 100644..100755
--- a/plugins/forms/dialogs/textfield.js
+++ b/plugins/forms/dialogs/textfield.js
@@ -1,182 +1,10 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-CKEDITOR.dialog.add( 'textfield', function( editor ) {
- var autoAttributes = { value:1,size:1,maxLength:1 };
-
- var acceptedTypes = { email:1,password:1,search:1,tel:1,text:1,url:1 };
-
- function autoCommit( data ) {
- var element = data.element;
- var value = this.getValue();
-
- value ? element.setAttribute( this.id, value ) : element.removeAttribute( this.id );
- }
-
- function autoSetup( element ) {
- var value = element.hasAttribute( this.id ) && element.getAttribute( this.id );
- this.setValue( value || '' );
- }
-
- return {
- title: editor.lang.forms.textfield.title,
- minWidth: 350,
- minHeight: 150,
- onShow: function() {
- delete this.textField;
-
- var element = this.getParentEditor().getSelection().getSelectedElement();
- if ( element && element.getName() == "input" && ( acceptedTypes[ element.getAttribute( 'type' ) ] || !element.getAttribute( 'type' ) ) ) {
- this.textField = element;
- this.setupContent( element );
- }
- },
- onOk: function() {
- var editor = this.getParentEditor(),
- element = this.textField,
- isInsertMode = !element;
-
- if ( isInsertMode ) {
- element = editor.document.createElement( 'input' );
- element.setAttribute( 'type', 'text' );
- }
-
- var data = { element: element };
-
- if ( isInsertMode )
- editor.insertElement( data.element );
-
- this.commitContent( data );
-
- // Element might be replaced by commitment.
- if ( !isInsertMode )
- editor.getSelection().selectElement( data.element );
- },
- onLoad: function() {
- this.foreach( function( contentObj ) {
- if ( contentObj.getValue ) {
- if ( !contentObj.setup )
- contentObj.setup = autoSetup;
- if ( !contentObj.commit )
- contentObj.commit = autoCommit;
- }
- });
- },
- contents: [
- {
- id: 'info',
- label: editor.lang.forms.textfield.title,
- title: editor.lang.forms.textfield.title,
- elements: [
- {
- type: 'hbox',
- widths: [ '50%', '50%' ],
- children: [
- {
- id: '_cke_saved_name',
- type: 'text',
- label: editor.lang.forms.textfield.name,
- 'default': '',
- accessKey: 'N',
- setup: function( element ) {
- this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' );
- },
- commit: function( data ) {
- var element = data.element;
-
- if ( this.getValue() )
- element.data( 'cke-saved-name', this.getValue() );
- else {
- element.data( 'cke-saved-name', false );
- element.removeAttribute( 'name' );
- }
- }
- },
- {
- id: 'value',
- type: 'text',
- label: editor.lang.forms.textfield.value,
- 'default': '',
- accessKey: 'V',
- commit: function( data ) {
- if ( CKEDITOR.env.ie && !this.getValue() ) {
- var element = data.element,
- fresh = new CKEDITOR.dom.element( 'input', editor.document );
- element.copyAttributes( fresh, { value:1 } );
- fresh.replace( element );
- data.element = fresh;
- } else
- autoCommit.call( this, data );
- }
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '50%', '50%' ],
- children: [
- {
- id: 'size',
- type: 'text',
- label: editor.lang.forms.textfield.charWidth,
- 'default': '',
- accessKey: 'C',
- style: 'width:50px',
- validate: CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed )
- },
- {
- id: 'maxLength',
- type: 'text',
- label: editor.lang.forms.textfield.maxChars,
- 'default': '',
- accessKey: 'M',
- style: 'width:50px',
- validate: CKEDITOR.dialog.validate.integer( editor.lang.common.validateNumberFailed )
- }
- ],
- onLoad: function() {
- // Repaint the style for IE7 (#6068)
- if ( CKEDITOR.env.ie7Compat )
- this.getElement().setStyle( 'zoom', '100%' );
- }
- },
- {
- id: 'type',
- type: 'select',
- label: editor.lang.forms.textfield.type,
- 'default': 'text',
- accessKey: 'M',
- items: [
- [ editor.lang.forms.textfield.typeEmail, 'email' ],
- [ editor.lang.forms.textfield.typePass, 'password' ],
- [ editor.lang.forms.textfield.typeSearch, 'search' ],
- [ editor.lang.forms.textfield.typeTel, 'tel' ],
- [ editor.lang.forms.textfield.typeText, 'text' ],
- [ editor.lang.forms.textfield.typeUrl, 'url' ]
- ],
- setup: function( element ) {
- this.setValue( element.getAttribute( 'type' ) );
- },
- commit: function( data ) {
- var element = data.element;
-
- if ( CKEDITOR.env.ie ) {
- var elementType = element.getAttribute( 'type' );
- var myType = this.getValue();
-
- if ( elementType != myType ) {
- var replace = CKEDITOR.dom.element.createFromHtml( '<input type="' + myType + '"></input>', editor.document );
- element.copyAttributes( replace, { type:1 } );
- replace.replace( element );
- data.element = replace;
- }
- } else
- element.setAttribute( 'type', this.getValue() );
- }
- }
- ]
- }
- ]
- };
-});
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("textfield",function(b){function e(a){var a=a.element,c=this.getValue();c?a.setAttribute(this.id,c):a.removeAttribute(this.id)}function f(a){this.setValue(a.hasAttribute(this.id)&&a.getAttribute(this.id)||"")}var g={email:1,password:1,search:1,tel:1,text:1,url:1};return{title:b.lang.forms.textfield.title,minWidth:350,minHeight:150,onShow:function(){delete this.textField;var a=this.getParentEditor().getSelection().getSelectedElement();if(a&&"input"==a.getName()&&(g[a.getAttribute("type")]||
+!a.getAttribute("type")))this.textField=a,this.setupContent(a)},onOk:function(){var a=this.getParentEditor(),c=this.textField,b=!c;b&&(c=a.document.createElement("input"),c.setAttribute("type","text"));c={element:c};b&&a.insertElement(c.element);this.commitContent(c);b||a.getSelection().selectElement(c.element)},onLoad:function(){this.foreach(function(a){if(a.getValue&&(a.setup||(a.setup=f),!a.commit))a.commit=e})},contents:[{id:"info",label:b.lang.forms.textfield.title,title:b.lang.forms.textfield.title,
+elements:[{type:"hbox",widths:["50%","50%"],children:[{id:"_cke_saved_name",type:"text",label:b.lang.forms.textfield.name,"default":"",accessKey:"N",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:function(a){a=a.element;this.getValue()?a.data("cke-saved-name",this.getValue()):(a.data("cke-saved-name",!1),a.removeAttribute("name"))}},{id:"value",type:"text",label:b.lang.forms.textfield.value,"default":"",accessKey:"V",commit:function(a){if(CKEDITOR.env.ie&&
+!this.getValue()){var c=a.element,d=new CKEDITOR.dom.element("input",b.document);c.copyAttributes(d,{value:1});d.replace(c);a.element=d}else e.call(this,a)}}]},{type:"hbox",widths:["50%","50%"],children:[{id:"size",type:"text",label:b.lang.forms.textfield.charWidth,"default":"",accessKey:"C",style:"width:50px",validate:CKEDITOR.dialog.validate.integer(b.lang.common.validateNumberFailed)},{id:"maxLength",type:"text",label:b.lang.forms.textfield.maxChars,"default":"",accessKey:"M",style:"width:50px",
+validate:CKEDITOR.dialog.validate.integer(b.lang.common.validateNumberFailed)}],onLoad:function(){CKEDITOR.env.ie7Compat&&this.getElement().setStyle("zoom","100%")}},{id:"type",type:"select",label:b.lang.forms.textfield.type,"default":"text",accessKey:"M",items:[[b.lang.forms.textfield.typeEmail,"email"],[b.lang.forms.textfield.typePass,"password"],[b.lang.forms.textfield.typeSearch,"search"],[b.lang.forms.textfield.typeTel,"tel"],[b.lang.forms.textfield.typeText,"text"],[b.lang.forms.textfield.typeUrl,
+"url"]],setup:function(a){this.setValue(a.getAttribute("type"))},commit:function(a){var c=a.element;if(CKEDITOR.env.ie){var d=c.getAttribute("type"),e=this.getValue();d!=e&&(d=CKEDITOR.dom.element.createFromHtml('<input type="'+e+'"></input>',b.document),c.copyAttributes(d,{type:1}),d.replace(c),a.element=d)}else c.setAttribute("type",this.getValue())}}]}]}}); \ No newline at end of file
diff --git a/plugins/iframe/dialogs/iframe.js b/plugins/iframe/dialogs/iframe.js
index ea11339..b33ee5e 100644..100755
--- a/plugins/iframe/dialogs/iframe.js
+++ b/plugins/iframe/dialogs/iframe.js
@@ -1,218 +1,10 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-(function() {
- // Map 'true' and 'false' values to match W3C's specifications
- // http://www.w3.org/TR/REC-html40/present/frames.html#h-16.5
- var checkboxValues = {
- scrolling: { 'true': 'yes', 'false': 'no' },
- frameborder: { 'true': '1', 'false': '0' }
- };
-
- function loadValue( iframeNode ) {
- var isCheckbox = this instanceof CKEDITOR.ui.dialog.checkbox;
- if ( iframeNode.hasAttribute( this.id ) ) {
- var value = iframeNode.getAttribute( this.id );
- if ( isCheckbox )
- this.setValue( checkboxValues[ this.id ][ 'true' ] == value.toLowerCase() );
- else
- this.setValue( value );
- }
- }
-
- function commitValue( iframeNode ) {
- var isRemove = this.getValue() === '',
- isCheckbox = this instanceof CKEDITOR.ui.dialog.checkbox,
- value = this.getValue();
- if ( isRemove )
- iframeNode.removeAttribute( this.att || this.id );
- else if ( isCheckbox )
- iframeNode.setAttribute( this.id, checkboxValues[ this.id ][ value ] );
- else
- iframeNode.setAttribute( this.att || this.id, value );
- }
-
- CKEDITOR.dialog.add( 'iframe', function( editor ) {
- var iframeLang = editor.lang.iframe,
- commonLang = editor.lang.common,
- dialogadvtab = editor.plugins.dialogadvtab;
- return {
- title: iframeLang.title,
- minWidth: 350,
- minHeight: 260,
- onShow: function() {
- // Clear previously saved elements.
- this.fakeImage = this.iframeNode = null;
-
- var fakeImage = this.getSelectedElement();
- if ( fakeImage && fakeImage.data( 'cke-real-element-type' ) && fakeImage.data( 'cke-real-element-type' ) == 'iframe' ) {
- this.fakeImage = fakeImage;
-
- var iframeNode = editor.restoreRealElement( fakeImage );
- this.iframeNode = iframeNode;
-
- this.setupContent( iframeNode );
- }
- },
- onOk: function() {
- var iframeNode;
- if ( !this.fakeImage )
- iframeNode = new CKEDITOR.dom.element( 'iframe' );
- else
- iframeNode = this.iframeNode;
-
- // A subset of the specified attributes/styles
- // should also be applied on the fake element to
- // have better visual effect. (#5240)
- var extraStyles = {},
- extraAttributes = {};
- this.commitContent( iframeNode, extraStyles, extraAttributes );
-
- // Refresh the fake image.
- var newFakeImage = editor.createFakeElement( iframeNode, 'cke_iframe', 'iframe', true );
- newFakeImage.setAttributes( extraAttributes );
- newFakeImage.setStyles( extraStyles );
- if ( this.fakeImage ) {
- newFakeImage.replace( this.fakeImage );
- editor.getSelection().selectElement( newFakeImage );
- } else
- editor.insertElement( newFakeImage );
- },
- contents: [
- {
- id: 'info',
- label: commonLang.generalTab,
- accessKey: 'I',
- elements: [
- {
- type: 'vbox',
- padding: 0,
- children: [
- {
- id: 'src',
- type: 'text',
- label: commonLang.url,
- required: true,
- validate: CKEDITOR.dialog.validate.notEmpty( iframeLang.noUrl ),
- setup: loadValue,
- commit: commitValue
- }
- ]
- },
- {
- type: 'hbox',
- children: [
- {
- id: 'width',
- type: 'text',
- requiredContent: 'iframe[width]',
- style: 'width:100%',
- labelLayout: 'vertical',
- label: commonLang.width,
- validate: CKEDITOR.dialog.validate.htmlLength( commonLang.invalidHtmlLength.replace( '%1', commonLang.width ) ),
- setup: loadValue,
- commit: commitValue
- },
- {
- id: 'height',
- type: 'text',
- requiredContent: 'iframe[height]',
- style: 'width:100%',
- labelLayout: 'vertical',
- label: commonLang.height,
- validate: CKEDITOR.dialog.validate.htmlLength( commonLang.invalidHtmlLength.replace( '%1', commonLang.height ) ),
- setup: loadValue,
- commit: commitValue
- },
- {
- id: 'align',
- type: 'select',
- requiredContent: 'iframe[align]',
- 'default': '',
- items: [
- [ commonLang.notSet, '' ],
- [ commonLang.alignLeft, 'left' ],
- [ commonLang.alignRight, 'right' ],
- [ commonLang.alignTop, 'top' ],
- [ commonLang.alignMiddle, 'middle' ],
- [ commonLang.alignBottom, 'bottom' ]
- ],
- style: 'width:100%',
- labelLayout: 'vertical',
- label: commonLang.align,
- setup: function( iframeNode, fakeImage ) {
- loadValue.apply( this, arguments );
- if ( fakeImage ) {
- var fakeImageAlign = fakeImage.getAttribute( 'align' );
- this.setValue( fakeImageAlign && fakeImageAlign.toLowerCase() || '' );
- }
- },
- commit: function( iframeNode, extraStyles, extraAttributes ) {
- commitValue.apply( this, arguments );
- if ( this.getValue() )
- extraAttributes.align = this.getValue();
- }
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '50%', '50%' ],
- children: [
- {
- id: 'scrolling',
- type: 'checkbox',
- requiredContent: 'iframe[scrolling]',
- label: iframeLang.scrolling,
- setup: loadValue,
- commit: commitValue
- },
- {
- id: 'frameborder',
- type: 'checkbox',
- requiredContent: 'iframe[frameborder]',
- label: iframeLang.border,
- setup: loadValue,
- commit: commitValue
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '50%', '50%' ],
- children: [
- {
- id: 'name',
- type: 'text',
- requiredContent: 'iframe[name]',
- label: commonLang.name,
- setup: loadValue,
- commit: commitValue
- },
- {
- id: 'title',
- type: 'text',
- requiredContent: 'iframe[title]',
- label: commonLang.advisoryTitle,
- setup: loadValue,
- commit: commitValue
- }
- ]
- },
- {
- id: 'longdesc',
- type: 'text',
- requiredContent: 'iframe[longdesc]',
- label: commonLang.longDescr,
- setup: loadValue,
- commit: commitValue
- }
- ]
- },
- dialogadvtab && dialogadvtab.createAdvancedTab( editor, { id:1,classes:1,styles:1 }, 'iframe' )
- ]
- };
- });
-})();
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+(function(){function c(b){var c=this instanceof CKEDITOR.ui.dialog.checkbox;b.hasAttribute(this.id)&&(b=b.getAttribute(this.id),c?this.setValue(e[this.id]["true"]==b.toLowerCase()):this.setValue(b))}function d(b){var c=""===this.getValue(),a=this instanceof CKEDITOR.ui.dialog.checkbox,d=this.getValue();c?b.removeAttribute(this.att||this.id):a?b.setAttribute(this.id,e[this.id][d]):b.setAttribute(this.att||this.id,d)}var e={scrolling:{"true":"yes","false":"no"},frameborder:{"true":"1","false":"0"}};
+CKEDITOR.dialog.add("iframe",function(b){var f=b.lang.iframe,a=b.lang.common,e=b.plugins.dialogadvtab;return{title:f.title,minWidth:350,minHeight:260,onShow:function(){this.fakeImage=this.iframeNode=null;var a=this.getSelectedElement();a&&(a.data("cke-real-element-type")&&"iframe"==a.data("cke-real-element-type"))&&(this.fakeImage=a,this.iframeNode=a=b.restoreRealElement(a),this.setupContent(a))},onOk:function(){var a;a=this.fakeImage?this.iframeNode:new CKEDITOR.dom.element("iframe");var c={},d=
+{};this.commitContent(a,c,d);a=b.createFakeElement(a,"cke_iframe","iframe",!0);a.setAttributes(d);a.setStyles(c);this.fakeImage?(a.replace(this.fakeImage),b.getSelection().selectElement(a)):b.insertElement(a)},contents:[{id:"info",label:a.generalTab,accessKey:"I",elements:[{type:"vbox",padding:0,children:[{id:"src",type:"text",label:a.url,required:!0,validate:CKEDITOR.dialog.validate.notEmpty(f.noUrl),setup:c,commit:d}]},{type:"hbox",children:[{id:"width",type:"text",requiredContent:"iframe[width]",
+style:"width:100%",labelLayout:"vertical",label:a.width,validate:CKEDITOR.dialog.validate.htmlLength(a.invalidHtmlLength.replace("%1",a.width)),setup:c,commit:d},{id:"height",type:"text",requiredContent:"iframe[height]",style:"width:100%",labelLayout:"vertical",label:a.height,validate:CKEDITOR.dialog.validate.htmlLength(a.invalidHtmlLength.replace("%1",a.height)),setup:c,commit:d},{id:"align",type:"select",requiredContent:"iframe[align]","default":"",items:[[a.notSet,""],[a.alignLeft,"left"],[a.alignRight,
+"right"],[a.alignTop,"top"],[a.alignMiddle,"middle"],[a.alignBottom,"bottom"]],style:"width:100%",labelLayout:"vertical",label:a.align,setup:function(a,b){c.apply(this,arguments);if(b){var d=b.getAttribute("align");this.setValue(d&&d.toLowerCase()||"")}},commit:function(a,b,c){d.apply(this,arguments);this.getValue()&&(c.align=this.getValue())}}]},{type:"hbox",widths:["50%","50%"],children:[{id:"scrolling",type:"checkbox",requiredContent:"iframe[scrolling]",label:f.scrolling,setup:c,commit:d},{id:"frameborder",
+type:"checkbox",requiredContent:"iframe[frameborder]",label:f.border,setup:c,commit:d}]},{type:"hbox",widths:["50%","50%"],children:[{id:"name",type:"text",requiredContent:"iframe[name]",label:a.name,setup:c,commit:d},{id:"title",type:"text",requiredContent:"iframe[title]",label:a.advisoryTitle,setup:c,commit:d}]},{id:"longdesc",type:"text",requiredContent:"iframe[longdesc]",label:a.longDescr,setup:c,commit:d}]},e&&e.createAdvancedTab(b,{id:1,classes:1,styles:1},"iframe")]}})})(); \ No newline at end of file
diff --git a/plugins/link/dialogs/anchor.js b/plugins/link/dialogs/anchor.js
index daa4660..562417a 100644..100755
--- a/plugins/link/dialogs/anchor.js
+++ b/plugins/link/dialogs/anchor.js
@@ -1,120 +1,8 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-CKEDITOR.dialog.add( 'anchor', function( editor ) {
- // Function called in onShow to load selected element.
- var loadElements = function( element ) {
- this._.selectedElement = element;
-
- var attributeValue = element.data( 'cke-saved-name' );
- this.setValueOf( 'info', 'txtName', attributeValue || '' );
- };
-
- function createFakeAnchor( editor, anchor ) {
- return editor.createFakeElement( anchor, 'cke_anchor', 'anchor' );
- }
-
- return {
- title: editor.lang.link.anchor.title,
- minWidth: 300,
- minHeight: 60,
- onOk: function() {
- var name = CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtName' ) );
- var attributes = {
- id: name,
- name: name,
- 'data-cke-saved-name': name
- };
-
- if ( this._.selectedElement ) {
- if ( this._.selectedElement.data( 'cke-realelement' ) ) {
- var newFake = createFakeAnchor( editor, editor.document.createElement( 'a', { attributes: attributes } ) );
- newFake.replace( this._.selectedElement );
- } else
- this._.selectedElement.setAttributes( attributes );
- } else {
- var sel = editor.getSelection(),
- range = sel && sel.getRanges()[ 0 ];
-
- // Empty anchor
- if ( range.collapsed ) {
- if ( CKEDITOR.plugins.link.synAnchorSelector )
- attributes[ 'class' ] = 'cke_anchor_empty';
-
- if ( CKEDITOR.plugins.link.emptyAnchorFix ) {
- attributes[ 'contenteditable' ] = 'false';
- attributes[ 'data-cke-editable' ] = 1;
- }
-
- var anchor = editor.document.createElement( 'a', { attributes: attributes } );
-
- // Transform the anchor into a fake element for browsers that need it.
- if ( CKEDITOR.plugins.link.fakeAnchor )
- anchor = createFakeAnchor( editor, anchor );
-
- range.insertNode( anchor );
- } else {
- if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
- attributes[ 'class' ] = 'cke_anchor';
-
- // Apply style.
- var style = new CKEDITOR.style({ element: 'a', attributes: attributes } );
- style.type = CKEDITOR.STYLE_INLINE;
- editor.applyStyle( style );
- }
- }
- },
-
- onHide: function() {
- delete this._.selectedElement;
- },
-
- onShow: function() {
- var selection = editor.getSelection(),
- fullySelected = selection.getSelectedElement(),
- partialSelected;
-
- // Detect the anchor under selection.
- if ( fullySelected ) {
- if ( CKEDITOR.plugins.link.fakeAnchor ) {
- var realElement = CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, fullySelected );
- realElement && loadElements.call( this, realElement );
- this._.selectedElement = fullySelected;
- } else if ( fullySelected.is( 'a' ) && fullySelected.hasAttribute( 'name' ) )
- loadElements.call( this, fullySelected );
- } else {
- partialSelected = CKEDITOR.plugins.link.getSelectedLink( editor );
- if ( partialSelected ) {
- loadElements.call( this, partialSelected );
- selection.selectElement( partialSelected );
- }
- }
-
- this.getContentElement( 'info', 'txtName' ).focus();
- },
- contents: [
- {
- id: 'info',
- label: editor.lang.link.anchor.title,
- accessKey: 'I',
- elements: [
- {
- type: 'text',
- id: 'txtName',
- label: editor.lang.link.anchor.name,
- required: true,
- validate: function() {
- if ( !this.getValue() ) {
- alert( editor.lang.link.anchor.errorName );
- return false;
- }
- return true;
- }
- }
- ]
- }
- ]
- };
-});
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("anchor",function(c){var d=function(a){this._.selectedElement=a;this.setValueOf("info","txtName",a.data("cke-saved-name")||"")};return{title:c.lang.link.anchor.title,minWidth:300,minHeight:60,onOk:function(){var a=CKEDITOR.tools.trim(this.getValueOf("info","txtName")),a={id:a,name:a,"data-cke-saved-name":a};if(this._.selectedElement)this._.selectedElement.data("cke-realelement")?(a=c.document.createElement("a",{attributes:a}),c.createFakeElement(a,"cke_anchor","anchor").replace(this._.selectedElement)):
+this._.selectedElement.setAttributes(a);else{var b=c.getSelection(),b=b&&b.getRanges()[0];b.collapsed?(CKEDITOR.plugins.link.synAnchorSelector&&(a["class"]="cke_anchor_empty"),CKEDITOR.plugins.link.emptyAnchorFix&&(a.contenteditable="false",a["data-cke-editable"]=1),a=c.document.createElement("a",{attributes:a}),CKEDITOR.plugins.link.fakeAnchor&&(a=c.createFakeElement(a,"cke_anchor","anchor")),b.insertNode(a)):(CKEDITOR.env.ie&&9>CKEDITOR.env.version&&(a["class"]="cke_anchor"),a=new CKEDITOR.style({element:"a",
+attributes:a}),a.type=CKEDITOR.STYLE_INLINE,c.applyStyle(a))}},onHide:function(){delete this._.selectedElement},onShow:function(){var a=c.getSelection(),b=a.getSelectedElement();if(b)CKEDITOR.plugins.link.fakeAnchor?((a=CKEDITOR.plugins.link.tryRestoreFakeAnchor(c,b))&&d.call(this,a),this._.selectedElement=b):b.is("a")&&b.hasAttribute("name")&&d.call(this,b);else if(b=CKEDITOR.plugins.link.getSelectedLink(c))d.call(this,b),a.selectElement(b);this.getContentElement("info","txtName").focus()},contents:[{id:"info",
+label:c.lang.link.anchor.title,accessKey:"I",elements:[{type:"text",id:"txtName",label:c.lang.link.anchor.name,required:!0,validate:function(){return!this.getValue()?(alert(c.lang.link.anchor.errorName),!1):!0}}]}]}}); \ No newline at end of file
diff --git a/plugins/link/dialogs/link.js b/plugins/link/dialogs/link.js
index cf0b26f..37085d3 100644..100755
--- a/plugins/link/dialogs/link.js
+++ b/plugins/link/dialogs/link.js
@@ -1,1288 +1,37 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-CKEDITOR.dialog.add( 'link', function( editor ) {
- var plugin = CKEDITOR.plugins.link;
- // Handles the event when the "Target" selection box is changed.
- var targetChanged = function() {
- var dialog = this.getDialog(),
- popupFeatures = dialog.getContentElement( 'target', 'popupFeatures' ),
- targetName = dialog.getContentElement( 'target', 'linkTargetName' ),
- value = this.getValue();
-
- if ( !popupFeatures || !targetName )
- return;
-
- popupFeatures = popupFeatures.getElement();
- popupFeatures.hide();
- targetName.setValue( '' );
-
- switch ( value ) {
- case 'frame':
- targetName.setLabel( editor.lang.link.targetFrameName );
- targetName.getElement().show();
- break;
- case 'popup':
- popupFeatures.show();
- targetName.setLabel( editor.lang.link.targetPopupName );
- targetName.getElement().show();
- break;
- default:
- targetName.setValue( value );
- targetName.getElement().hide();
- break;
- }
-
- };
-
- // Handles the event when the "Type" selection box is changed.
- var linkTypeChanged = function() {
- var dialog = this.getDialog(),
- partIds = [ 'urlOptions', 'anchorOptions', 'emailOptions' ],
- typeValue = this.getValue(),
- uploadTab = dialog.definition.getContents( 'upload' ),
- uploadInitiallyHidden = uploadTab && uploadTab.hidden;
-
- if ( typeValue == 'url' ) {
- if ( editor.config.linkShowTargetTab )
- dialog.showPage( 'target' );
- if ( !uploadInitiallyHidden )
- dialog.showPage( 'upload' );
- } else {
- dialog.hidePage( 'target' );
- if ( !uploadInitiallyHidden )
- dialog.hidePage( 'upload' );
- }
-
- for ( var i = 0; i < partIds.length; i++ ) {
- var element = dialog.getContentElement( 'info', partIds[ i ] );
- if ( !element )
- continue;
-
- element = element.getElement().getParent().getParent();
- if ( partIds[ i ] == typeValue + 'Options' )
- element.show();
- else
- element.hide();
- }
-
- dialog.layout();
- };
-
- // Loads the parameters in a selected link to the link dialog fields.
- var javascriptProtocolRegex = /^javascript:/,
- emailRegex = /^mailto:([^?]+)(?:\?(.+))?$/,
- emailSubjectRegex = /subject=([^;?:@&=$,\/]*)/,
- emailBodyRegex = /body=([^;?:@&=$,\/]*)/,
- anchorRegex = /^#(.*)$/,
- urlRegex = /^((?:http|https|ftp|news):\/\/)?(.*)$/,
- selectableTargets = /^(_(?:self|top|parent|blank))$/,
- encodedEmailLinkRegex = /^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,
- functionCallProtectedEmailLinkRegex = /^javascript:([^(]+)\(([^)]+)\)$/;
-
- var popupRegex = /\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/;
- var popupFeaturesRegex = /(?:^|,)([^=]+)=(\d+|yes|no)/gi;
-
- var parseLink = function( editor, element ) {
- var href = ( element && ( element.data( 'cke-saved-href' ) || element.getAttribute( 'href' ) ) ) || '',
- javascriptMatch, emailMatch, anchorMatch, urlMatch,
- retval = {};
-
- if ( ( javascriptMatch = href.match( javascriptProtocolRegex ) ) ) {
- if ( emailProtection == 'encode' ) {
- href = href.replace( encodedEmailLinkRegex, function( match, protectedAddress, rest ) {
- return 'mailto:' +
- String.fromCharCode.apply( String, protectedAddress.split( ',' ) ) +
- ( rest && unescapeSingleQuote( rest ) );
- });
- }
- // Protected email link as function call.
- else if ( emailProtection ) {
- href.replace( functionCallProtectedEmailLinkRegex, function( match, funcName, funcArgs ) {
- if ( funcName == compiledProtectionFunction.name ) {
- retval.type = 'email';
- var email = retval.email = {};
-
- var paramRegex = /[^,\s]+/g,
- paramQuoteRegex = /(^')|('$)/g,
- paramsMatch = funcArgs.match( paramRegex ),
- paramsMatchLength = paramsMatch.length,
- paramName, paramVal;
-
- for ( var i = 0; i < paramsMatchLength; i++ ) {
- paramVal = decodeURIComponent( unescapeSingleQuote( paramsMatch[ i ].replace( paramQuoteRegex, '' ) ) );
- paramName = compiledProtectionFunction.params[ i ].toLowerCase();
- email[ paramName ] = paramVal;
- }
- email.address = [ email.name, email.domain ].join( '@' );
- }
- });
- }
- }
-
- if ( !retval.type ) {
- if ( ( anchorMatch = href.match( anchorRegex ) ) ) {
- retval.type = 'anchor';
- retval.anchor = {};
- retval.anchor.name = retval.anchor.id = anchorMatch[ 1 ];
- }
- // Protected email link as encoded string.
- else if ( ( emailMatch = href.match( emailRegex ) ) ) {
- var subjectMatch = href.match( emailSubjectRegex ),
- bodyMatch = href.match( emailBodyRegex );
-
- retval.type = 'email';
- var email = ( retval.email = {} );
- email.address = emailMatch[ 1 ];
- subjectMatch && ( email.subject = decodeURIComponent( subjectMatch[ 1 ] ) );
- bodyMatch && ( email.body = decodeURIComponent( bodyMatch[ 1 ] ) );
- }
- // urlRegex matches empty strings, so need to check for href as well.
- else if ( href && ( urlMatch = href.match( urlRegex ) ) ) {
- retval.type = 'url';
- retval.url = {};
- retval.url.protocol = urlMatch[ 1 ];
- retval.url.url = urlMatch[ 2 ];
- } else
- retval.type = 'url';
- }
-
- // Load target and popup settings.
- if ( element ) {
- var target = element.getAttribute( 'target' );
- retval.target = {};
- retval.adv = {};
-
- // IE BUG: target attribute is an empty string instead of null in IE if it's not set.
- if ( !target ) {
- var onclick = element.data( 'cke-pa-onclick' ) || element.getAttribute( 'onclick' ),
- onclickMatch = onclick && onclick.match( popupRegex );
- if ( onclickMatch ) {
- retval.target.type = 'popup';
- retval.target.name = onclickMatch[ 1 ];
-
- var featureMatch;
- while ( ( featureMatch = popupFeaturesRegex.exec( onclickMatch[ 2 ] ) ) ) {
- // Some values should remain numbers (#7300)
- if ( ( featureMatch[ 2 ] == 'yes' || featureMatch[ 2 ] == '1' ) && !( featureMatch[ 1 ] in { height:1,width:1,top:1,left:1 } ) )
- retval.target[ featureMatch[ 1 ] ] = true;
- else if ( isFinite( featureMatch[ 2 ] ) )
- retval.target[ featureMatch[ 1 ] ] = featureMatch[ 2 ];
- }
- }
- } else {
- var targetMatch = target.match( selectableTargets );
- if ( targetMatch )
- retval.target.type = retval.target.name = target;
- else {
- retval.target.type = 'frame';
- retval.target.name = target;
- }
- }
-
- var me = this;
- var advAttr = function( inputName, attrName ) {
- var value = element.getAttribute( attrName );
- if ( value !== null )
- retval.adv[ inputName ] = value || '';
- };
- advAttr( 'advId', 'id' );
- advAttr( 'advLangDir', 'dir' );
- advAttr( 'advAccessKey', 'accessKey' );
-
- retval.adv.advName = element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '';
- advAttr( 'advLangCode', 'lang' );
- advAttr( 'advTabIndex', 'tabindex' );
- advAttr( 'advTitle', 'title' );
- advAttr( 'advContentType', 'type' );
- CKEDITOR.plugins.link.synAnchorSelector ? retval.adv.advCSSClasses = getLinkClass( element ) : advAttr( 'advCSSClasses', 'class' );
- advAttr( 'advCharset', 'charset' );
- advAttr( 'advStyles', 'style' );
- advAttr( 'advRel', 'rel' );
- }
-
- // Find out whether we have any anchors in the editor.
- var anchors = retval.anchors = [],
- i, count, item;
-
- // For some browsers we set contenteditable="false" on anchors, making document.anchors not to include them, so we must traverse the links manually (#7893).
- if ( CKEDITOR.plugins.link.emptyAnchorFix ) {
- var links = editor.document.getElementsByTag( 'a' );
- for ( i = 0, count = links.count(); i < count; i++ ) {
- item = links.getItem( i );
- if ( item.data( 'cke-saved-name' ) || item.hasAttribute( 'name' ) )
- anchors.push({ name: item.data( 'cke-saved-name' ) || item.getAttribute( 'name' ), id: item.getAttribute( 'id' ) } );
- }
- } else {
- var anchorList = new CKEDITOR.dom.nodeList( editor.document.$.anchors );
- for ( i = 0, count = anchorList.count(); i < count; i++ ) {
- item = anchorList.getItem( i );
- anchors[ i ] = { name: item.getAttribute( 'name' ), id: item.getAttribute( 'id' ) };
- }
- }
-
- if ( CKEDITOR.plugins.link.fakeAnchor ) {
- var imgs = editor.document.getElementsByTag( 'img' );
- for ( i = 0, count = imgs.count(); i < count; i++ ) {
- if ( ( item = CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, imgs.getItem( i ) ) ) )
- anchors.push({ name: item.getAttribute( 'name' ), id: item.getAttribute( 'id' ) } );
- }
- }
-
- // Record down the selected element in the dialog.
- this._.selectedElement = element;
- return retval;
- };
-
- var setupParams = function( page, data ) {
- if ( data[ page ] )
- this.setValue( data[ page ][ this.id ] || '' );
- };
-
- var setupPopupParams = function( data ) {
- return setupParams.call( this, 'target', data );
- };
-
- var setupAdvParams = function( data ) {
- return setupParams.call( this, 'adv', data );
- };
-
- var commitParams = function( page, data ) {
- if ( !data[ page ] )
- data[ page ] = {};
-
- data[ page ][ this.id ] = this.getValue() || '';
- };
-
- var commitPopupParams = function( data ) {
- return commitParams.call( this, 'target', data );
- };
-
- var commitAdvParams = function( data ) {
- return commitParams.call( this, 'adv', data );
- };
-
- function unescapeSingleQuote( str ) {
- return str.replace( /\\'/g, '\'' );
- }
-
- function escapeSingleQuote( str ) {
- return str.replace( /'/g, '\\$&' );
- }
-
- var emailProtection = editor.config.emailProtection || '';
-
- // Compile the protection function pattern.
- if ( emailProtection && emailProtection != 'encode' ) {
- var compiledProtectionFunction = {};
-
- emailProtection.replace( /^([^(]+)\(([^)]+)\)$/, function( match, funcName, params ) {
- compiledProtectionFunction.name = funcName;
- compiledProtectionFunction.params = [];
- params.replace( /[^,\s]+/g, function( param ) {
- compiledProtectionFunction.params.push( param );
- });
- });
- }
-
- function protectEmailLinkAsFunction( email ) {
- var retval,
- name = compiledProtectionFunction.name,
- params = compiledProtectionFunction.params,
- paramName, paramValue;
-
- retval = [ name, '(' ];
- for ( var i = 0; i < params.length; i++ ) {
- paramName = params[ i ].toLowerCase();
- paramValue = email[ paramName ];
-
- i > 0 && retval.push( ',' );
- retval.push( '\'', paramValue ? escapeSingleQuote( encodeURIComponent( email[ paramName ] ) ) : '', '\'' );
- }
- retval.push( ')' );
- return retval.join( '' );
- }
-
- function protectEmailAddressAsEncodedString( address ) {
- var charCode,
- length = address.length,
- encodedChars = [];
- for ( var i = 0; i < length; i++ ) {
- charCode = address.charCodeAt( i );
- encodedChars.push( charCode );
- }
- return 'String.fromCharCode(' + encodedChars.join( ',' ) + ')';
- }
-
- function getLinkClass( ele ) {
- var className = ele.getAttribute( 'class' );
- return className ? className.replace( /\s*(?:cke_anchor_empty|cke_anchor)(?:\s*$)?/g, '' ) : '';
- }
-
- var commonLang = editor.lang.common,
- linkLang = editor.lang.link;
-
- return {
- title: linkLang.title,
- minWidth: 350,
- minHeight: 230,
- contents: [
- {
- id: 'info',
- label: linkLang.info,
- title: linkLang.info,
- elements: [
- {
- id: 'linkType',
- type: 'select',
- label: linkLang.type,
- 'default': 'url',
- items: [
- [ linkLang.toUrl, 'url' ],
- [ linkLang.toAnchor, 'anchor' ],
- [ linkLang.toEmail, 'email' ]
- ],
- onChange: linkTypeChanged,
- setup: function( data ) {
- if ( data.type )
- this.setValue( data.type );
- },
- commit: function( data ) {
- data.type = this.getValue();
- }
- },
- {
- type: 'vbox',
- id: 'urlOptions',
- children: [
- {
- type: 'hbox',
- widths: [ '25%', '75%' ],
- children: [
- {
- id: 'protocol',
- type: 'select',
- label: commonLang.protocol,
- 'default': 'http://',
- items: [
- // Force 'ltr' for protocol names in BIDI. (#5433)
- [ 'http://\u200E', 'http://' ],
- [ 'https://\u200E', 'https://' ],
- [ 'ftp://\u200E', 'ftp://' ],
- [ 'news://\u200E', 'news://' ],
- [ linkLang.other, '' ]
- ],
- setup: function( data ) {
- if ( data.url )
- this.setValue( data.url.protocol || '' );
- },
- commit: function( data ) {
- if ( !data.url )
- data.url = {};
-
- data.url.protocol = this.getValue();
- }
- },
- {
- type: 'text',
- id: 'url',
- label: commonLang.url,
- required: true,
- onLoad: function() {
- this.allowOnChange = true;
- },
- onKeyUp: function() {
- this.allowOnChange = false;
- var protocolCmb = this.getDialog().getContentElement( 'info', 'protocol' ),
- url = this.getValue(),
- urlOnChangeProtocol = /^(http|https|ftp|news):\/\/(?=.)/i,
- urlOnChangeTestOther = /^((javascript:)|[#\/\.\?])/i;
-
- var protocol = urlOnChangeProtocol.exec( url );
- if ( protocol ) {
- this.setValue( url.substr( protocol[ 0 ].length ) );
- protocolCmb.setValue( protocol[ 0 ].toLowerCase() );
- } else if ( urlOnChangeTestOther.test( url ) )
- protocolCmb.setValue( '' );
-
- this.allowOnChange = true;
- },
- onChange: function() {
- if ( this.allowOnChange ) // Dont't call on dialog load.
- this.onKeyUp();
- },
- validate: function() {
- var dialog = this.getDialog();
-
- if ( dialog.getContentElement( 'info', 'linkType' ) && dialog.getValueOf( 'info', 'linkType' ) != 'url' )
- return true;
-
- if ( (/javascript\:/).test( this.getValue() ) ) {
- alert( commonLang.invalidValue );
- return false;
- }
-
- if ( this.getDialog().fakeObj ) // Edit Anchor.
- return true;
-
- var func = CKEDITOR.dialog.validate.notEmpty( linkLang.noUrl );
- return func.apply( this );
- },
- setup: function( data ) {
- this.allowOnChange = false;
- if ( data.url )
- this.setValue( data.url.url );
- this.allowOnChange = true;
-
- },
- commit: function( data ) {
- // IE will not trigger the onChange event if the mouse has been used
- // to carry all the operations #4724
- this.onChange();
-
- if ( !data.url )
- data.url = {};
-
- data.url.url = this.getValue();
- this.allowOnChange = false;
- }
- }
- ],
- setup: function( data ) {
- if ( !this.getDialog().getContentElement( 'info', 'linkType' ) )
- this.getElement().show();
- }
- },
- {
- type: 'button',
- id: 'browse',
- hidden: 'true',
- filebrowser: 'info:url',
- label: commonLang.browseServer
- }
- ]
- },
- {
- type: 'vbox',
- id: 'anchorOptions',
- width: 260,
- align: 'center',
- padding: 0,
- children: [
- {
- type: 'fieldset',
- id: 'selectAnchorText',
- label: linkLang.selectAnchor,
- setup: function( data ) {
- if ( data.anchors.length > 0 )
- this.getElement().show();
- else
- this.getElement().hide();
- },
- children: [
- {
- type: 'hbox',
- id: 'selectAnchor',
- children: [
- {
- type: 'select',
- id: 'anchorName',
- 'default': '',
- label: linkLang.anchorName,
- style: 'width: 100%;',
- items: [
- [ '' ]
- ],
- setup: function( data ) {
- this.clear();
- this.add( '' );
- for ( var i = 0; i < data.anchors.length; i++ ) {
- if ( data.anchors[ i ].name )
- this.add( data.anchors[ i ].name );
- }
-
- if ( data.anchor )
- this.setValue( data.anchor.name );
-
- var linkType = this.getDialog().getContentElement( 'info', 'linkType' );
- if ( linkType && linkType.getValue() == 'email' )
- this.focus();
- },
- commit: function( data ) {
- if ( !data.anchor )
- data.anchor = {};
-
- data.anchor.name = this.getValue();
- }
- },
- {
- type: 'select',
- id: 'anchorId',
- 'default': '',
- label: linkLang.anchorId,
- style: 'width: 100%;',
- items: [
- [ '' ]
- ],
- setup: function( data ) {
- this.clear();
- this.add( '' );
- for ( var i = 0; i < data.anchors.length; i++ ) {
- if ( data.anchors[ i ].id )
- this.add( data.anchors[ i ].id );
- }
-
- if ( data.anchor )
- this.setValue( data.anchor.id );
- },
- commit: function( data ) {
- if ( !data.anchor )
- data.anchor = {};
-
- data.anchor.id = this.getValue();
- }
- }
- ],
- setup: function( data ) {
- if ( data.anchors.length > 0 )
- this.getElement().show();
- else
- this.getElement().hide();
- }
- }
- ]
- },
- {
- type: 'html',
- id: 'noAnchors',
- style: 'text-align: center;',
- html: '<div role="note" tabIndex="-1">' + CKEDITOR.tools.htmlEncode( linkLang.noAnchors ) + '</div>',
- // Focus the first element defined in above html.
- focus: true,
- setup: function( data ) {
- if ( data.anchors.length < 1 )
- this.getElement().show();
- else
- this.getElement().hide();
- }
- }
- ],
- setup: function( data ) {
- if ( !this.getDialog().getContentElement( 'info', 'linkType' ) )
- this.getElement().hide();
- }
- },
- {
- type: 'vbox',
- id: 'emailOptions',
- padding: 1,
- children: [
- {
- type: 'text',
- id: 'emailAddress',
- label: linkLang.emailAddress,
- required: true,
- validate: function() {
- var dialog = this.getDialog();
-
- if ( !dialog.getContentElement( 'info', 'linkType' ) || dialog.getValueOf( 'info', 'linkType' ) != 'email' )
- return true;
-
- var func = CKEDITOR.dialog.validate.notEmpty( linkLang.noEmail );
- return func.apply( this );
- },
- setup: function( data ) {
- if ( data.email )
- this.setValue( data.email.address );
-
- var linkType = this.getDialog().getContentElement( 'info', 'linkType' );
- if ( linkType && linkType.getValue() == 'email' )
- this.select();
- },
- commit: function( data ) {
- if ( !data.email )
- data.email = {};
-
- data.email.address = this.getValue();
- }
- },
- {
- type: 'text',
- id: 'emailSubject',
- label: linkLang.emailSubject,
- setup: function( data ) {
- if ( data.email )
- this.setValue( data.email.subject );
- },
- commit: function( data ) {
- if ( !data.email )
- data.email = {};
-
- data.email.subject = this.getValue();
- }
- },
- {
- type: 'textarea',
- id: 'emailBody',
- label: linkLang.emailBody,
- rows: 3,
- 'default': '',
- setup: function( data ) {
- if ( data.email )
- this.setValue( data.email.body );
- },
- commit: function( data ) {
- if ( !data.email )
- data.email = {};
-
- data.email.body = this.getValue();
- }
- }
- ],
- setup: function( data ) {
- if ( !this.getDialog().getContentElement( 'info', 'linkType' ) )
- this.getElement().hide();
- }
- }
- ]
- },
- {
- id: 'target',
- requiredContent: 'a[target]', // This is not fully correct, because some target option requires JS.
- label: linkLang.target,
- title: linkLang.target,
- elements: [
- {
- type: 'hbox',
- widths: [ '50%', '50%' ],
- children: [
- {
- type: 'select',
- id: 'linkTargetType',
- label: commonLang.target,
- 'default': 'notSet',
- style: 'width : 100%;',
- 'items': [
- [ commonLang.notSet, 'notSet' ],
- [ linkLang.targetFrame, 'frame' ],
- [ linkLang.targetPopup, 'popup' ],
- [ commonLang.targetNew, '_blank' ],
- [ commonLang.targetTop, '_top' ],
- [ commonLang.targetSelf, '_self' ],
- [ commonLang.targetParent, '_parent' ]
- ],
- onChange: targetChanged,
- setup: function( data ) {
- if ( data.target )
- this.setValue( data.target.type || 'notSet' );
- targetChanged.call( this );
- },
- commit: function( data ) {
- if ( !data.target )
- data.target = {};
-
- data.target.type = this.getValue();
- }
- },
- {
- type: 'text',
- id: 'linkTargetName',
- label: linkLang.targetFrameName,
- 'default': '',
- setup: function( data ) {
- if ( data.target )
- this.setValue( data.target.name );
- },
- commit: function( data ) {
- if ( !data.target )
- data.target = {};
-
- data.target.name = this.getValue().replace( /\W/gi, '' );
- }
- }
- ]
- },
- {
- type: 'vbox',
- width: '100%',
- align: 'center',
- padding: 2,
- id: 'popupFeatures',
- children: [
- {
- type: 'fieldset',
- label: linkLang.popupFeatures,
- children: [
- {
- type: 'hbox',
- children: [
- {
- type: 'checkbox',
- id: 'resizable',
- label: linkLang.popupResizable,
- setup: setupPopupParams,
- commit: commitPopupParams
- },
- {
- type: 'checkbox',
- id: 'status',
- label: linkLang.popupStatusBar,
- setup: setupPopupParams,
- commit: commitPopupParams
-
- }
- ]
- },
- {
- type: 'hbox',
- children: [
- {
- type: 'checkbox',
- id: 'location',
- label: linkLang.popupLocationBar,
- setup: setupPopupParams,
- commit: commitPopupParams
-
- },
- {
- type: 'checkbox',
- id: 'toolbar',
- label: linkLang.popupToolbar,
- setup: setupPopupParams,
- commit: commitPopupParams
-
- }
- ]
- },
- {
- type: 'hbox',
- children: [
- {
- type: 'checkbox',
- id: 'menubar',
- label: linkLang.popupMenuBar,
- setup: setupPopupParams,
- commit: commitPopupParams
-
- },
- {
- type: 'checkbox',
- id: 'fullscreen',
- label: linkLang.popupFullScreen,
- setup: setupPopupParams,
- commit: commitPopupParams
-
- }
- ]
- },
- {
- type: 'hbox',
- children: [
- {
- type: 'checkbox',
- id: 'scrollbars',
- label: linkLang.popupScrollBars,
- setup: setupPopupParams,
- commit: commitPopupParams
-
- },
- {
- type: 'checkbox',
- id: 'dependent',
- label: linkLang.popupDependent,
- setup: setupPopupParams,
- commit: commitPopupParams
-
- }
- ]
- },
- {
- type: 'hbox',
- children: [
- {
- type: 'text',
- widths: [ '50%', '50%' ],
- labelLayout: 'horizontal',
- label: commonLang.width,
- id: 'width',
- setup: setupPopupParams,
- commit: commitPopupParams
-
- },
- {
- type: 'text',
- labelLayout: 'horizontal',
- widths: [ '50%', '50%' ],
- label: linkLang.popupLeft,
- id: 'left',
- setup: setupPopupParams,
- commit: commitPopupParams
-
- }
- ]
- },
- {
- type: 'hbox',
- children: [
- {
- type: 'text',
- labelLayout: 'horizontal',
- widths: [ '50%', '50%' ],
- label: commonLang.height,
- id: 'height',
- setup: setupPopupParams,
- commit: commitPopupParams
-
- },
- {
- type: 'text',
- labelLayout: 'horizontal',
- label: linkLang.popupTop,
- widths: [ '50%', '50%' ],
- id: 'top',
- setup: setupPopupParams,
- commit: commitPopupParams
-
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- id: 'upload',
- label: linkLang.upload,
- title: linkLang.upload,
- hidden: true,
- filebrowser: 'uploadButton',
- elements: [
- {
- type: 'file',
- id: 'upload',
- label: commonLang.upload,
- style: 'height:40px',
- size: 29
- },
- {
- type: 'fileButton',
- id: 'uploadButton',
- label: commonLang.uploadSubmit,
- filebrowser: 'info:url',
- 'for': [ 'upload', 'upload' ]
- }
- ]
- },
- {
- id: 'advanced',
- label: linkLang.advanced,
- title: linkLang.advanced,
- elements: [
- {
- type: 'vbox',
- padding: 1,
- children: [
- {
- type: 'hbox',
- widths: [ '45%', '35%', '20%' ],
- children: [
- {
- type: 'text',
- id: 'advId',
- requiredContent: 'a[id]',
- label: linkLang.id,
- setup: setupAdvParams,
- commit: commitAdvParams
- },
- {
- type: 'select',
- id: 'advLangDir',
- requiredContent: 'a[dir]',
- label: linkLang.langDir,
- 'default': '',
- style: 'width:110px',
- items: [
- [ commonLang.notSet, '' ],
- [ linkLang.langDirLTR, 'ltr' ],
- [ linkLang.langDirRTL, 'rtl' ]
- ],
- setup: setupAdvParams,
- commit: commitAdvParams
- },
- {
- type: 'text',
- id: 'advAccessKey',
- requiredContent: 'a[accesskey]',
- width: '80px',
- label: linkLang.acccessKey,
- maxLength: 1,
- setup: setupAdvParams,
- commit: commitAdvParams
-
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '45%', '35%', '20%' ],
- children: [
- {
- type: 'text',
- label: linkLang.name,
- id: 'advName',
- requiredContent: 'a[name]',
- setup: setupAdvParams,
- commit: commitAdvParams
-
- },
- {
- type: 'text',
- label: linkLang.langCode,
- id: 'advLangCode',
- requiredContent: 'a[lang]',
- width: '110px',
- 'default': '',
- setup: setupAdvParams,
- commit: commitAdvParams
-
- },
- {
- type: 'text',
- label: linkLang.tabIndex,
- id: 'advTabIndex',
- requiredContent: 'a[tabindex]',
- width: '80px',
- maxLength: 5,
- setup: setupAdvParams,
- commit: commitAdvParams
-
- }
- ]
- }
- ]
- },
- {
- type: 'vbox',
- padding: 1,
- children: [
- {
- type: 'hbox',
- widths: [ '45%', '55%' ],
- children: [
- {
- type: 'text',
- label: linkLang.advisoryTitle,
- requiredContent: 'a[title]',
- 'default': '',
- id: 'advTitle',
- setup: setupAdvParams,
- commit: commitAdvParams
-
- },
- {
- type: 'text',
- label: linkLang.advisoryContentType,
- requiredContent: 'a[type]',
- 'default': '',
- id: 'advContentType',
- setup: setupAdvParams,
- commit: commitAdvParams
-
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '45%', '55%' ],
- children: [
- {
- type: 'text',
- label: linkLang.cssClasses,
- requiredContent: 'a(cke-xyz)', // Random text like 'xyz' will check if all are allowed.
- 'default': '',
- id: 'advCSSClasses',
- setup: setupAdvParams,
- commit: commitAdvParams
-
- },
- {
- type: 'text',
- label: linkLang.charset,
- requiredContent: 'a[charset]',
- 'default': '',
- id: 'advCharset',
- setup: setupAdvParams,
- commit: commitAdvParams
-
- }
- ]
- },
- {
- type: 'hbox',
- widths: [ '45%', '55%' ],
- children: [
- {
- type: 'text',
- label: linkLang.rel,
- requiredContent: 'a[rel]',
- 'default': '',
- id: 'advRel',
- setup: setupAdvParams,
- commit: commitAdvParams
- },
- {
- type: 'text',
- label: linkLang.styles,
- requiredContent: 'a{cke-xyz}', // Random text like 'xyz' will check if all are allowed.
- 'default': '',
- id: 'advStyles',
- validate: CKEDITOR.dialog.validate.inlineStyle( editor.lang.common.invalidInlineStyle ),
- setup: setupAdvParams,
- commit: commitAdvParams
- }
- ]
- }
- ]
- }
- ]
- }
- ],
- onShow: function() {
- var editor = this.getParentEditor(),
- selection = editor.getSelection(),
- element = null;
-
- // Fill in all the relevant fields if there's already one link selected.
- if ( ( element = plugin.getSelectedLink( editor ) ) && element.hasAttribute( 'href' ) )
- selection.selectElement( element );
- else
- element = null;
-
- this.setupContent( parseLink.apply( this, [ editor, element ] ) );
- },
- onOk: function() {
- var attributes = {},
- removeAttributes = [],
- data = {},
- me = this,
- editor = this.getParentEditor();
-
- this.commitContent( data );
-
- // Compose the URL.
- switch ( data.type || 'url' ) {
- case 'url':
- var protocol = ( data.url && data.url.protocol != undefined ) ? data.url.protocol : 'http://',
- url = ( data.url && CKEDITOR.tools.trim( data.url.url ) ) || '';
- attributes[ 'data-cke-saved-href' ] = ( url.indexOf( '/' ) === 0 ) ? url : protocol + url;
- break;
- case 'anchor':
- var name = ( data.anchor && data.anchor.name ),
- id = ( data.anchor && data.anchor.id );
- attributes[ 'data-cke-saved-href' ] = '#' + ( name || id || '' );
- break;
- case 'email':
-
- var linkHref,
- email = data.email,
- address = email.address;
-
- switch ( emailProtection ) {
- case '':
- case 'encode':
- {
- var subject = encodeURIComponent( email.subject || '' ),
- body = encodeURIComponent( email.body || '' );
-
- // Build the e-mail parameters first.
- var argList = [];
- subject && argList.push( 'subject=' + subject );
- body && argList.push( 'body=' + body );
- argList = argList.length ? '?' + argList.join( '&' ) : '';
-
- if ( emailProtection == 'encode' ) {
- linkHref = [ 'javascript:void(location.href=\'mailto:\'+',
- protectEmailAddressAsEncodedString( address ) ];
- // parameters are optional.
- argList && linkHref.push( '+\'', escapeSingleQuote( argList ), '\'' );
-
- linkHref.push( ')' );
- } else
- linkHref = [ 'mailto:', address, argList ];
-
- break;
- }
- default:
- {
- // Separating name and domain.
- var nameAndDomain = address.split( '@', 2 );
- email.name = nameAndDomain[ 0 ];
- email.domain = nameAndDomain[ 1 ];
-
- linkHref = [ 'javascript:', protectEmailLinkAsFunction( email ) ];
- }
- }
-
- attributes[ 'data-cke-saved-href' ] = linkHref.join( '' );
- break;
- }
-
- // Popups and target.
- if ( data.target ) {
- if ( data.target.type == 'popup' ) {
- var onclickList = [ 'window.open(this.href, \'',
- data.target.name || '', '\', \'' ];
- var featureList = [ 'resizable', 'status', 'location', 'toolbar', 'menubar', 'fullscreen',
- 'scrollbars', 'dependent' ];
- var featureLength = featureList.length;
- var addFeature = function( featureName ) {
- if ( data.target[ featureName ] )
- featureList.push( featureName + '=' + data.target[ featureName ] );
- };
-
- for ( var i = 0; i < featureLength; i++ )
- featureList[ i ] = featureList[ i ] + ( data.target[ featureList[ i ] ] ? '=yes' : '=no' );
- addFeature( 'width' );
- addFeature( 'left' );
- addFeature( 'height' );
- addFeature( 'top' );
-
- onclickList.push( featureList.join( ',' ), '\'); return false;' );
- attributes[ 'data-cke-pa-onclick' ] = onclickList.join( '' );
-
- // Add the "target" attribute. (#5074)
- removeAttributes.push( 'target' );
- } else {
- if ( data.target.type != 'notSet' && data.target.name )
- attributes.target = data.target.name;
- else
- removeAttributes.push( 'target' );
-
- removeAttributes.push( 'data-cke-pa-onclick', 'onclick' );
- }
- }
-
- // Advanced attributes.
- if ( data.adv ) {
- var advAttr = function( inputName, attrName ) {
- var value = data.adv[ inputName ];
- if ( value )
- attributes[ attrName ] = value;
- else
- removeAttributes.push( attrName );
- };
-
- advAttr( 'advId', 'id' );
- advAttr( 'advLangDir', 'dir' );
- advAttr( 'advAccessKey', 'accessKey' );
-
- if ( data.adv[ 'advName' ] )
- attributes[ 'name' ] = attributes[ 'data-cke-saved-name' ] = data.adv[ 'advName' ];
- else
- removeAttributes = removeAttributes.concat( [ 'data-cke-saved-name', 'name' ] );
-
- advAttr( 'advLangCode', 'lang' );
- advAttr( 'advTabIndex', 'tabindex' );
- advAttr( 'advTitle', 'title' );
- advAttr( 'advContentType', 'type' );
- advAttr( 'advCSSClasses', 'class' );
- advAttr( 'advCharset', 'charset' );
- advAttr( 'advStyles', 'style' );
- advAttr( 'advRel', 'rel' );
- }
-
-
- var selection = editor.getSelection();
-
- // Browser need the "href" fro copy/paste link to work. (#6641)
- attributes.href = attributes[ 'data-cke-saved-href' ];
-
- if ( !this._.selectedElement ) {
- var range = selection.getRanges( 1 )[ 0 ];
-
- // Use link URL as text with a collapsed cursor.
- if ( range.collapsed ) {
- // Short mailto link text view (#5736).
- var text = new CKEDITOR.dom.text( data.type == 'email' ? data.email.address : attributes[ 'data-cke-saved-href' ], editor.document );
- range.insertNode( text );
- range.selectNodeContents( text );
- }
-
- // Apply style.
- var style = new CKEDITOR.style({ element: 'a', attributes: attributes } );
- style.type = CKEDITOR.STYLE_INLINE; // need to override... dunno why.
- style.applyToRange( range );
- range.select();
- } else {
- // We're only editing an existing link, so just overwrite the attributes.
- var element = this._.selectedElement,
- href = element.data( 'cke-saved-href' ),
- textView = element.getHtml();
-
- element.setAttributes( attributes );
- element.removeAttributes( removeAttributes );
-
- if ( data.adv && data.adv.advName && CKEDITOR.plugins.link.synAnchorSelector )
- element.addClass( element.getChildCount() ? 'cke_anchor' : 'cke_anchor_empty' );
-
- // Update text view when user changes protocol (#4612).
- if ( href == textView || data.type == 'email' && textView.indexOf( '@' ) != -1 ) {
- // Short mailto link text view (#5736).
- element.setHtml( data.type == 'email' ? data.email.address : attributes[ 'data-cke-saved-href' ] );
- }
-
- selection.selectElement( element );
- delete this._.selectedElement;
- }
- },
- onLoad: function() {
- if ( !editor.config.linkShowAdvancedTab )
- this.hidePage( 'advanced' ); //Hide Advanded tab.
-
- if ( !editor.config.linkShowTargetTab )
- this.hidePage( 'target' ); //Hide Target tab.
- },
- // Inital focus on 'url' field if link is of type URL.
- onFocus: function() {
- var linkType = this.getContentElement( 'info', 'linkType' ),
- urlField;
- if ( linkType && linkType.getValue() == 'url' ) {
- urlField = this.getContentElement( 'info', 'url' );
- urlField.select();
- }
- }
- };
-});
-
-/**
- * The e-mail address anti-spam protection option. The protection will be
- * applied when creating or modifying e-mail links through the editor interface.
- *
- * Two methods of protection can be choosed:
- *
- * 1. The e-mail parts (name, domain and any other query string) are
- * assembled into a function call pattern. Such function must be
- * provided by the developer in the pages that will use the contents.
- * 2. Only the e-mail address is obfuscated into a special string that
- * has no meaning for humans or spam bots, but which is properly
- * rendered and accepted by the browser.
- *
- * Both approaches require JavaScript to be enabled.
- *
- * // href="mailto:tester@ckeditor.com?subject=subject&body=body"
- * config.emailProtection = '';
- *
- * // href="<a href=\"javascript:void(location.href=\'mailto:\'+String.fromCharCode(116,101,115,116,101,114,64,99,107,101,100,105,116,111,114,46,99,111,109)+\'?subject=subject&body=body\')\">e-mail</a>"
- * config.emailProtection = 'encode';
- *
- * // href="javascript:mt('tester','ckeditor.com','subject','body')"
- * config.emailProtection = 'mt(NAME,DOMAIN,SUBJECT,BODY)';
- *
- * @since 3.1
- * @cfg {String} [emailProtection='' (empty string = disabled)]
- * @member CKEDITOR.config
- */
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+CKEDITOR.dialog.add("link",function(n){var p,q;function r(a){return a.replace(/'/g,"\\$&")}function t(a){var g,c=p,d,e;g=[q,"("];for(var b=0;b<c.length;b++)d=c[b].toLowerCase(),e=a[d],0<b&&g.push(","),g.push("'",e?r(encodeURIComponent(a[d])):"","'");g.push(")");return g.join("")}function u(a){for(var g,c=a.length,d=[],e=0;e<c;e++)g=a.charCodeAt(e),d.push(g);return"String.fromCharCode("+d.join(",")+")"}function v(a){return(a=a.getAttribute("class"))?a.replace(/\s*(?:cke_anchor_empty|cke_anchor)(?:\s*$)?/g,
+""):""}var w=CKEDITOR.plugins.link,s=function(){var a=this.getDialog(),g=a.getContentElement("target","popupFeatures"),a=a.getContentElement("target","linkTargetName"),c=this.getValue();if(g&&a)switch(g=g.getElement(),g.hide(),a.setValue(""),c){case "frame":a.setLabel(n.lang.link.targetFrameName);a.getElement().show();break;case "popup":g.show();a.setLabel(n.lang.link.targetPopupName);a.getElement().show();break;default:a.setValue(c),a.getElement().hide()}},x=/^javascript:/,y=/^mailto:([^?]+)(?:\?(.+))?$/,
+z=/subject=([^;?:@&=$,\/]*)/,A=/body=([^;?:@&=$,\/]*)/,B=/^#(.*)$/,C=/^((?:http|https|ftp|news):\/\/)?(.*)$/,D=/^(_(?:self|top|parent|blank))$/,E=/^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/,F=/^javascript:([^(]+)\(([^)]+)\)$/,G=/\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/,H=/(?:^|,)([^=]+)=(\d+|yes|no)/gi,I=function(a,g){var c=g&&(g.data("cke-saved-href")||g.getAttribute("href"))||"",d,e,b=
+{};c.match(x)&&("encode"==o?c=c.replace(E,function(a,c,b){return"mailto:"+String.fromCharCode.apply(String,c.split(","))+(b&&b.replace(/\\'/g,"'"))}):o&&c.replace(F,function(a,c,d){if(c==q){b.type="email";for(var a=b.email={},c=/(^')|('$)/g,d=d.match(/[^,\s]+/g),e=d.length,g,f,h=0;h<e;h++)g=decodeURIComponent,f=d[h].replace(c,"").replace(/\\'/g,"'"),f=g(f),g=p[h].toLowerCase(),a[g]=f;a.address=[a.name,a.domain].join("@")}}));if(!b.type)if(d=c.match(B))b.type="anchor",b.anchor={},b.anchor.name=b.anchor.id=
+d[1];else if(d=c.match(y)){e=c.match(z);c=c.match(A);b.type="email";var f=b.email={};f.address=d[1];e&&(f.subject=decodeURIComponent(e[1]));c&&(f.body=decodeURIComponent(c[1]))}else c&&(e=c.match(C))?(b.type="url",b.url={},b.url.protocol=e[1],b.url.url=e[2]):b.type="url";if(g){d=g.getAttribute("target");b.target={};b.adv={};if(d)d.match(D)?b.target.type=b.target.name=d:(b.target.type="frame",b.target.name=d);else if(d=(d=g.data("cke-pa-onclick")||g.getAttribute("onclick"))&&d.match(G)){b.target.type=
+"popup";for(b.target.name=d[1];c=H.exec(d[2]);)("yes"==c[2]||"1"==c[2])&&!(c[1]in{height:1,width:1,top:1,left:1})?b.target[c[1]]=!0:isFinite(c[2])&&(b.target[c[1]]=c[2])}d=function(a,c){var d=g.getAttribute(c);null!==d&&(b.adv[a]=d||"")};d("advId","id");d("advLangDir","dir");d("advAccessKey","accessKey");b.adv.advName=g.data("cke-saved-name")||g.getAttribute("name")||"";d("advLangCode","lang");d("advTabIndex","tabindex");d("advTitle","title");d("advContentType","type");CKEDITOR.plugins.link.synAnchorSelector?
+b.adv.advCSSClasses=v(g):d("advCSSClasses","class");d("advCharset","charset");d("advStyles","style");d("advRel","rel")}d=b.anchors=[];var h;if(CKEDITOR.plugins.link.emptyAnchorFix){f=a.document.getElementsByTag("a");c=0;for(e=f.count();c<e;c++)if(h=f.getItem(c),h.data("cke-saved-name")||h.hasAttribute("name"))d.push({name:h.data("cke-saved-name")||h.getAttribute("name"),id:h.getAttribute("id")})}else{f=new CKEDITOR.dom.nodeList(a.document.$.anchors);c=0;for(e=f.count();c<e;c++)h=f.getItem(c),d[c]=
+{name:h.getAttribute("name"),id:h.getAttribute("id")}}if(CKEDITOR.plugins.link.fakeAnchor){f=a.document.getElementsByTag("img");c=0;for(e=f.count();c<e;c++)(h=CKEDITOR.plugins.link.tryRestoreFakeAnchor(a,f.getItem(c)))&&d.push({name:h.getAttribute("name"),id:h.getAttribute("id")})}this._.selectedElement=g;return b},j=function(a){a.target&&this.setValue(a.target[this.id]||"")},k=function(a){a.adv&&this.setValue(a.adv[this.id]||"")},l=function(a){a.target||(a.target={});a.target[this.id]=this.getValue()||
+""},m=function(a){a.adv||(a.adv={});a.adv[this.id]=this.getValue()||""},o=n.config.emailProtection||"";o&&"encode"!=o&&(q=p=void 0,o.replace(/^([^(]+)\(([^)]+)\)$/,function(a,b,c){q=b;p=[];c.replace(/[^,\s]+/g,function(a){p.push(a)})}));var i=n.lang.common,b=n.lang.link;return{title:b.title,minWidth:350,minHeight:230,contents:[{id:"info",label:b.info,title:b.info,elements:[{id:"linkType",type:"select",label:b.type,"default":"url",items:[[b.toUrl,"url"],[b.toAnchor,"anchor"],[b.toEmail,"email"]],onChange:function(){var a=
+this.getDialog(),b=["urlOptions","anchorOptions","emailOptions"],c=this.getValue(),d=a.definition.getContents("upload"),d=d&&d.hidden;if(c=="url"){n.config.linkShowTargetTab&&a.showPage("target");d||a.showPage("upload")}else{a.hidePage("target");d||a.hidePage("upload")}for(d=0;d<b.length;d++){var e=a.getContentElement("info",b[d]);if(e){e=e.getElement().getParent().getParent();b[d]==c+"Options"?e.show():e.hide()}}a.layout()},setup:function(a){a.type&&this.setValue(a.type)},commit:function(a){a.type=
+this.getValue()}},{type:"vbox",id:"urlOptions",children:[{type:"hbox",widths:["25%","75%"],children:[{id:"protocol",type:"select",label:i.protocol,"default":"http://",items:[["http://‎","http://"],["https://‎","https://"],["ftp://‎","ftp://"],["news://‎","news://"],[b.other,""]],setup:function(a){a.url&&this.setValue(a.url.protocol||"")},commit:function(a){if(!a.url)a.url={};a.url.protocol=this.getValue()}},{type:"text",id:"url",label:i.url,required:!0,onLoad:function(){this.allowOnChange=true},onKeyUp:function(){this.allowOnChange=
+false;var a=this.getDialog().getContentElement("info","protocol"),b=this.getValue(),c=/^((javascript:)|[#\/\.\?])/i,d=/^(http|https|ftp|news):\/\/(?=.)/i.exec(b);if(d){this.setValue(b.substr(d[0].length));a.setValue(d[0].toLowerCase())}else c.test(b)&&a.setValue("");this.allowOnChange=true},onChange:function(){if(this.allowOnChange)this.onKeyUp()},validate:function(){var a=this.getDialog();if(a.getContentElement("info","linkType")&&a.getValueOf("info","linkType")!="url")return true;if(/javascript\:/.test(this.getValue())){alert(i.invalidValue);
+return false}return this.getDialog().fakeObj?true:CKEDITOR.dialog.validate.notEmpty(b.noUrl).apply(this)},setup:function(a){this.allowOnChange=false;a.url&&this.setValue(a.url.url);this.allowOnChange=true},commit:function(a){this.onChange();if(!a.url)a.url={};a.url.url=this.getValue();this.allowOnChange=false}}],setup:function(){this.getDialog().getContentElement("info","linkType")||this.getElement().show()}},{type:"button",id:"browse",hidden:"true",filebrowser:"info:url",label:i.browseServer}]},
+{type:"vbox",id:"anchorOptions",width:260,align:"center",padding:0,children:[{type:"fieldset",id:"selectAnchorText",label:b.selectAnchor,setup:function(a){a.anchors.length>0?this.getElement().show():this.getElement().hide()},children:[{type:"hbox",id:"selectAnchor",children:[{type:"select",id:"anchorName","default":"",label:b.anchorName,style:"width: 100%;",items:[[""]],setup:function(a){this.clear();this.add("");for(var b=0;b<a.anchors.length;b++)a.anchors[b].name&&this.add(a.anchors[b].name);a.anchor&&
+this.setValue(a.anchor.name);(a=this.getDialog().getContentElement("info","linkType"))&&a.getValue()=="email"&&this.focus()},commit:function(a){if(!a.anchor)a.anchor={};a.anchor.name=this.getValue()}},{type:"select",id:"anchorId","default":"",label:b.anchorId,style:"width: 100%;",items:[[""]],setup:function(a){this.clear();this.add("");for(var b=0;b<a.anchors.length;b++)a.anchors[b].id&&this.add(a.anchors[b].id);a.anchor&&this.setValue(a.anchor.id)},commit:function(a){if(!a.anchor)a.anchor={};a.anchor.id=
+this.getValue()}}],setup:function(a){a.anchors.length>0?this.getElement().show():this.getElement().hide()}}]},{type:"html",id:"noAnchors",style:"text-align: center;",html:'<div role="note" tabIndex="-1">'+CKEDITOR.tools.htmlEncode(b.noAnchors)+"</div>",focus:!0,setup:function(a){a.anchors.length<1?this.getElement().show():this.getElement().hide()}}],setup:function(){this.getDialog().getContentElement("info","linkType")||this.getElement().hide()}},{type:"vbox",id:"emailOptions",padding:1,children:[{type:"text",
+id:"emailAddress",label:b.emailAddress,required:!0,validate:function(){var a=this.getDialog();return!a.getContentElement("info","linkType")||a.getValueOf("info","linkType")!="email"?true:CKEDITOR.dialog.validate.notEmpty(b.noEmail).apply(this)},setup:function(a){a.email&&this.setValue(a.email.address);(a=this.getDialog().getContentElement("info","linkType"))&&a.getValue()=="email"&&this.select()},commit:function(a){if(!a.email)a.email={};a.email.address=this.getValue()}},{type:"text",id:"emailSubject",
+label:b.emailSubject,setup:function(a){a.email&&this.setValue(a.email.subject)},commit:function(a){if(!a.email)a.email={};a.email.subject=this.getValue()}},{type:"textarea",id:"emailBody",label:b.emailBody,rows:3,"default":"",setup:function(a){a.email&&this.setValue(a.email.body)},commit:function(a){if(!a.email)a.email={};a.email.body=this.getValue()}}],setup:function(){this.getDialog().getContentElement("info","linkType")||this.getElement().hide()}}]},{id:"target",requiredContent:"a[target]",label:b.target,
+title:b.target,elements:[{type:"hbox",widths:["50%","50%"],children:[{type:"select",id:"linkTargetType",label:i.target,"default":"notSet",style:"width : 100%;",items:[[i.notSet,"notSet"],[b.targetFrame,"frame"],[b.targetPopup,"popup"],[i.targetNew,"_blank"],[i.targetTop,"_top"],[i.targetSelf,"_self"],[i.targetParent,"_parent"]],onChange:s,setup:function(a){a.target&&this.setValue(a.target.type||"notSet");s.call(this)},commit:function(a){if(!a.target)a.target={};a.target.type=this.getValue()}},{type:"text",
+id:"linkTargetName",label:b.targetFrameName,"default":"",setup:function(a){a.target&&this.setValue(a.target.name)},commit:function(a){if(!a.target)a.target={};a.target.name=this.getValue().replace(/\W/gi,"")}}]},{type:"vbox",width:"100%",align:"center",padding:2,id:"popupFeatures",children:[{type:"fieldset",label:b.popupFeatures,children:[{type:"hbox",children:[{type:"checkbox",id:"resizable",label:b.popupResizable,setup:j,commit:l},{type:"checkbox",id:"status",label:b.popupStatusBar,setup:j,commit:l}]},
+{type:"hbox",children:[{type:"checkbox",id:"location",label:b.popupLocationBar,setup:j,commit:l},{type:"checkbox",id:"toolbar",label:b.popupToolbar,setup:j,commit:l}]},{type:"hbox",children:[{type:"checkbox",id:"menubar",label:b.popupMenuBar,setup:j,commit:l},{type:"checkbox",id:"fullscreen",label:b.popupFullScreen,setup:j,commit:l}]},{type:"hbox",children:[{type:"checkbox",id:"scrollbars",label:b.popupScrollBars,setup:j,commit:l},{type:"checkbox",id:"dependent",label:b.popupDependent,setup:j,commit:l}]},
+{type:"hbox",children:[{type:"text",widths:["50%","50%"],labelLayout:"horizontal",label:i.width,id:"width",setup:j,commit:l},{type:"text",labelLayout:"horizontal",widths:["50%","50%"],label:b.popupLeft,id:"left",setup:j,commit:l}]},{type:"hbox",children:[{type:"text",labelLayout:"horizontal",widths:["50%","50%"],label:i.height,id:"height",setup:j,commit:l},{type:"text",labelLayout:"horizontal",label:b.popupTop,widths:["50%","50%"],id:"top",setup:j,commit:l}]}]}]}]},{id:"upload",label:b.upload,title:b.upload,
+hidden:!0,filebrowser:"uploadButton",elements:[{type:"file",id:"upload",label:i.upload,style:"height:40px",size:29},{type:"fileButton",id:"uploadButton",label:i.uploadSubmit,filebrowser:"info:url","for":["upload","upload"]}]},{id:"advanced",label:b.advanced,title:b.advanced,elements:[{type:"vbox",padding:1,children:[{type:"hbox",widths:["45%","35%","20%"],children:[{type:"text",id:"advId",requiredContent:"a[id]",label:b.id,setup:k,commit:m},{type:"select",id:"advLangDir",requiredContent:"a[dir]",
+label:b.langDir,"default":"",style:"width:110px",items:[[i.notSet,""],[b.langDirLTR,"ltr"],[b.langDirRTL,"rtl"]],setup:k,commit:m},{type:"text",id:"advAccessKey",requiredContent:"a[accesskey]",width:"80px",label:b.acccessKey,maxLength:1,setup:k,commit:m}]},{type:"hbox",widths:["45%","35%","20%"],children:[{type:"text",label:b.name,id:"advName",requiredContent:"a[name]",setup:k,commit:m},{type:"text",label:b.langCode,id:"advLangCode",requiredContent:"a[lang]",width:"110px","default":"",setup:k,commit:m},
+{type:"text",label:b.tabIndex,id:"advTabIndex",requiredContent:"a[tabindex]",width:"80px",maxLength:5,setup:k,commit:m}]}]},{type:"vbox",padding:1,children:[{type:"hbox",widths:["45%","55%"],children:[{type:"text",label:b.advisoryTitle,requiredContent:"a[title]","default":"",id:"advTitle",setup:k,commit:m},{type:"text",label:b.advisoryContentType,requiredContent:"a[type]","default":"",id:"advContentType",setup:k,commit:m}]},{type:"hbox",widths:["45%","55%"],children:[{type:"text",label:b.cssClasses,
+requiredContent:"a(cke-xyz)","default":"",id:"advCSSClasses",setup:k,commit:m},{type:"text",label:b.charset,requiredContent:"a[charset]","default":"",id:"advCharset",setup:k,commit:m}]},{type:"hbox",widths:["45%","55%"],children:[{type:"text",label:b.rel,requiredContent:"a[rel]","default":"",id:"advRel",setup:k,commit:m},{type:"text",label:b.styles,requiredContent:"a{cke-xyz}","default":"",id:"advStyles",validate:CKEDITOR.dialog.validate.inlineStyle(n.lang.common.invalidInlineStyle),setup:k,commit:m}]}]}]}],
+onShow:function(){var a=this.getParentEditor(),b=a.getSelection(),c=null;(c=w.getSelectedLink(a))&&c.hasAttribute("href")?b.getSelectedElement()||b.selectElement(c):c=null;this.setupContent(I.apply(this,[a,c]))},onOk:function(){var a={},b=[],c={},d=this.getParentEditor();this.commitContent(c);switch(c.type||"url"){case "url":var e=c.url&&c.url.protocol!=void 0?c.url.protocol:"http://",i=c.url&&CKEDITOR.tools.trim(c.url.url)||"";a["data-cke-saved-href"]=i.indexOf("/")===0?i:e+i;break;case "anchor":e=
+c.anchor&&c.anchor.id;a["data-cke-saved-href"]="#"+(c.anchor&&c.anchor.name||e||"");break;case "email":var f=c.email,e=f.address;switch(o){case "":case "encode":var i=encodeURIComponent(f.subject||""),h=encodeURIComponent(f.body||""),f=[];i&&f.push("subject="+i);h&&f.push("body="+h);f=f.length?"?"+f.join("&"):"";if(o=="encode"){e=["javascript:void(location.href='mailto:'+",u(e)];f&&e.push("+'",r(f),"'");e.push(")")}else e=["mailto:",e,f];break;default:e=e.split("@",2);f.name=e[0];f.domain=e[1];e=
+["javascript:",t(f)]}a["data-cke-saved-href"]=e.join("")}if(c.target)if(c.target.type=="popup"){for(var e=["window.open(this.href, '",c.target.name||"","', '"],j=["resizable","status","location","toolbar","menubar","fullscreen","scrollbars","dependent"],i=j.length,f=function(a){c.target[a]&&j.push(a+"="+c.target[a])},h=0;h<i;h++)j[h]=j[h]+(c.target[j[h]]?"=yes":"=no");f("width");f("left");f("height");f("top");e.push(j.join(","),"'); return false;");a["data-cke-pa-onclick"]=e.join("");b.push("target")}else{c.target.type!=
+"notSet"&&c.target.name?a.target=c.target.name:b.push("target");b.push("data-cke-pa-onclick","onclick")}if(c.adv){e=function(d,e){var f=c.adv[d];f?a[e]=f:b.push(e)};e("advId","id");e("advLangDir","dir");e("advAccessKey","accessKey");c.adv.advName?a.name=a["data-cke-saved-name"]=c.adv.advName:b=b.concat(["data-cke-saved-name","name"]);e("advLangCode","lang");e("advTabIndex","tabindex");e("advTitle","title");e("advContentType","type");e("advCSSClasses","class");e("advCharset","charset");e("advStyles",
+"style");e("advRel","rel")}e=d.getSelection();a.href=a["data-cke-saved-href"];if(this._.selectedElement){d=this._.selectedElement;i=d.data("cke-saved-href");f=d.getHtml();d.setAttributes(a);d.removeAttributes(b);c.adv&&(c.adv.advName&&CKEDITOR.plugins.link.synAnchorSelector)&&d.addClass(d.getChildCount()?"cke_anchor":"cke_anchor_empty");if(i==f||c.type=="email"&&f.indexOf("@")!=-1){d.setHtml(c.type=="email"?c.email.address:a["data-cke-saved-href"]);e.selectElement(d)}delete this._.selectedElement}else{e=
+e.getRanges()[0];if(e.collapsed){d=new CKEDITOR.dom.text(c.type=="email"?c.email.address:a["data-cke-saved-href"],d.document);e.insertNode(d);e.selectNodeContents(d)}d=new CKEDITOR.style({element:"a",attributes:a});d.type=CKEDITOR.STYLE_INLINE;d.applyToRange(e);e.select()}},onLoad:function(){n.config.linkShowAdvancedTab||this.hidePage("advanced");n.config.linkShowTargetTab||this.hidePage("target")},onFocus:function(){var a=this.getContentElement("info","linkType");if(a&&a.getValue()=="url"){a=this.getContentElement("info",
+"url");a.select()}}}}); \ No newline at end of file
diff --git a/plugins/link/images/anchor.png b/plugins/link/images/anchor.png
index 5025df5..c946ba5 100644..100755
--- a/plugins/link/images/anchor.png
+++ b/plugins/link/images/anchor.png
Binary files differ
diff --git a/plugins/liststyle/dialogs/liststyle.js b/plugins/liststyle/dialogs/liststyle.js
index 5cefb3f..6dba713 100644..100755
--- a/plugins/liststyle/dialogs/liststyle.js
+++ b/plugins/liststyle/dialogs/liststyle.js
@@ -1,199 +1,10 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-(function() {
- function getListElement( editor, listTag ) {
- var range;
- try {
- range = editor.getSelection().getRanges()[ 0 ];
- } catch ( e ) {
- return null;
- }
-
- range.shrink( CKEDITOR.SHRINK_TEXT );
- return editor.elementPath( range.getCommonAncestor() ).contains( listTag, 1 );
- }
-
- var listItem = function( node ) {
- return node.type == CKEDITOR.NODE_ELEMENT && node.is( 'li' );
- };
-
- var mapListStyle = {
- 'a': 'lower-alpha',
- 'A': 'upper-alpha',
- 'i': 'lower-roman',
- 'I': 'upper-roman',
- '1': 'decimal',
- 'disc': 'disc',
- 'circle': 'circle',
- 'square': 'square'
- };
-
- function listStyle( editor, startupPage ) {
- var lang = editor.lang.liststyle;
- if ( startupPage == 'bulletedListStyle' ) {
- return {
- title: lang.bulletedTitle,
- minWidth: 300,
- minHeight: 50,
- contents: [
- {
- id: 'info',
- accessKey: 'I',
- elements: [
- {
- type: 'select',
- label: lang.type,
- id: 'type',
- align: 'center',
- style: 'width:150px',
- items: [
- [ lang.notset, '' ],
- [ lang.circle, 'circle' ],
- [ lang.disc, 'disc' ],
- [ lang.square, 'square' ]
- ],
- setup: function( element ) {
- var value = element.getStyle( 'list-style-type' ) || mapListStyle[ element.getAttribute( 'type' ) ] || element.getAttribute( 'type' ) || '';
-
- this.setValue( value );
- },
- commit: function( element ) {
- var value = this.getValue();
- if ( value )
- element.setStyle( 'list-style-type', value );
- else
- element.removeStyle( 'list-style-type' );
- }
- }
- ]
- }
- ],
- onShow: function() {
- var editor = this.getParentEditor(),
- element = getListElement( editor, 'ul' );
-
- element && this.setupContent( element );
- },
- onOk: function() {
- var editor = this.getParentEditor(),
- element = getListElement( editor, 'ul' );
-
- element && this.commitContent( element );
- }
- };
- } else if ( startupPage == 'numberedListStyle' ) {
-
- var listStyleOptions = [
- [ lang.notset, '' ],
- [ lang.lowerRoman, 'lower-roman' ],
- [ lang.upperRoman, 'upper-roman' ],
- [ lang.lowerAlpha, 'lower-alpha' ],
- [ lang.upperAlpha, 'upper-alpha' ],
- [ lang.decimal, 'decimal' ]
- ];
-
- if ( !CKEDITOR.env.ie || CKEDITOR.env.version > 7 ) {
- listStyleOptions.concat( [
- [ lang.armenian, 'armenian' ],
- [ lang.decimalLeadingZero, 'decimal-leading-zero' ],
- [ lang.georgian, 'georgian' ],
- [ lang.lowerGreek, 'lower-greek' ]
- ] );
- }
-
- return {
- title: lang.numberedTitle,
- minWidth: 300,
- minHeight: 50,
- contents: [
- {
- id: 'info',
- accessKey: 'I',
- elements: [
- {
- type: 'hbox',
- widths: [ '25%', '75%' ],
- children: [
- {
- label: lang.start,
- type: 'text',
- id: 'start',
- validate: CKEDITOR.dialog.validate.integer( lang.validateStartNumber ),
- setup: function( element ) {
- // List item start number dominates.
- var value = element.getFirst( listItem ).getAttribute( 'value' ) || element.getAttribute( 'start' ) || 1;
- value && this.setValue( value );
- },
- commit: function( element ) {
- var firstItem = element.getFirst( listItem );
- var oldStart = firstItem.getAttribute( 'value' ) || element.getAttribute( 'start' ) || 1;
-
- // Force start number on list root.
- element.getFirst( listItem ).removeAttribute( 'value' );
- var val = parseInt( this.getValue(), 10 );
- if ( isNaN( val ) )
- element.removeAttribute( 'start' );
- else
- element.setAttribute( 'start', val );
-
- // Update consequent list item numbering.
- var nextItem = firstItem,
- conseq = oldStart,
- startNumber = isNaN( val ) ? 1 : val;
- while ( ( nextItem = nextItem.getNext( listItem ) ) && conseq++ ) {
- if ( nextItem.getAttribute( 'value' ) == conseq )
- nextItem.setAttribute( 'value', startNumber + conseq - oldStart );
- }
- }
- },
- {
- type: 'select',
- label: lang.type,
- id: 'type',
- style: 'width: 100%;',
- items: listStyleOptions,
- setup: function( element ) {
- var value = element.getStyle( 'list-style-type' ) || mapListStyle[ element.getAttribute( 'type' ) ] || element.getAttribute( 'type' ) || '';
-
- this.setValue( value );
- },
- commit: function( element ) {
- var value = this.getValue();
- if ( value )
- element.setStyle( 'list-style-type', value );
- else
- element.removeStyle( 'list-style-type' );
- }
- }
- ]
- }
- ]
- }
- ],
- onShow: function() {
- var editor = this.getParentEditor(),
- element = getListElement( editor, 'ol' );
-
- element && this.setupContent( element );
- },
- onOk: function() {
- var editor = this.getParentEditor(),
- element = getListElement( editor, 'ol' );
-
- element && this.commitContent( element );
- }
- };
- }
- }
-
- CKEDITOR.dialog.add( 'numberedListStyle', function( editor ) {
- return listStyle( editor, 'numberedListStyle' );
- });
-
- CKEDITOR.dialog.add( 'bulletedListStyle', function( editor ) {
- return listStyle( editor, 'bulletedListStyle' );
- });
-})();
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+(function(){function d(c,d){var b;try{b=c.getSelection().getRanges()[0]}catch(f){return null}b.shrink(CKEDITOR.SHRINK_TEXT);return c.elementPath(b.getCommonAncestor()).contains(d,1)}function e(c,e){var b=c.lang.liststyle;if("bulletedListStyle"==e)return{title:b.bulletedTitle,minWidth:300,minHeight:50,contents:[{id:"info",accessKey:"I",elements:[{type:"select",label:b.type,id:"type",align:"center",style:"width:150px",items:[[b.notset,""],[b.circle,"circle"],[b.disc,"disc"],[b.square,"square"]],setup:function(a){this.setValue(a.getStyle("list-style-type")||
+h[a.getAttribute("type")]||a.getAttribute("type")||"")},commit:function(a){var b=this.getValue();b?a.setStyle("list-style-type",b):a.removeStyle("list-style-type")}}]}],onShow:function(){var a=this.getParentEditor();(a=d(a,"ul"))&&this.setupContent(a)},onOk:function(){var a=this.getParentEditor();(a=d(a,"ul"))&&this.commitContent(a)}};if("numberedListStyle"==e){var g=[[b.notset,""],[b.lowerRoman,"lower-roman"],[b.upperRoman,"upper-roman"],[b.lowerAlpha,"lower-alpha"],[b.upperAlpha,"upper-alpha"],
+[b.decimal,"decimal"]];(!CKEDITOR.env.ie||7<CKEDITOR.env.version)&&g.concat([[b.armenian,"armenian"],[b.decimalLeadingZero,"decimal-leading-zero"],[b.georgian,"georgian"],[b.lowerGreek,"lower-greek"]]);return{title:b.numberedTitle,minWidth:300,minHeight:50,contents:[{id:"info",accessKey:"I",elements:[{type:"hbox",widths:["25%","75%"],children:[{label:b.start,type:"text",id:"start",validate:CKEDITOR.dialog.validate.integer(b.validateStartNumber),setup:function(a){this.setValue(a.getFirst(f).getAttribute("value")||
+a.getAttribute("start")||1)},commit:function(a){var b=a.getFirst(f),c=b.getAttribute("value")||a.getAttribute("start")||1;a.getFirst(f).removeAttribute("value");var d=parseInt(this.getValue(),10);isNaN(d)?a.removeAttribute("start"):a.setAttribute("start",d);a=b;b=c;for(d=isNaN(d)?1:d;(a=a.getNext(f))&&b++;)a.getAttribute("value")==b&&a.setAttribute("value",d+b-c)}},{type:"select",label:b.type,id:"type",style:"width: 100%;",items:g,setup:function(a){this.setValue(a.getStyle("list-style-type")||h[a.getAttribute("type")]||
+a.getAttribute("type")||"")},commit:function(a){var b=this.getValue();b?a.setStyle("list-style-type",b):a.removeStyle("list-style-type")}}]}]}],onShow:function(){var a=this.getParentEditor();(a=d(a,"ol"))&&this.setupContent(a)},onOk:function(){var a=this.getParentEditor();(a=d(a,"ol"))&&this.commitContent(a)}}}}var f=function(c){return c.type==CKEDITOR.NODE_ELEMENT&&c.is("li")},h={a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman",1:"decimal",disc:"disc",circle:"circle",square:"square"};
+CKEDITOR.dialog.add("numberedListStyle",function(c){return e(c,"numberedListStyle")});CKEDITOR.dialog.add("bulletedListStyle",function(c){return e(c,"bulletedListStyle")})})(); \ No newline at end of file
diff --git a/plugins/pastefromword/filter/default.js b/plugins/pastefromword/filter/default.js
index 61b7506..cc7a2e9 100644..100755
--- a/plugins/pastefromword/filter/default.js
+++ b/plugins/pastefromword/filter/default.js
@@ -1,1211 +1,31 @@
-/**
- * @license Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.html or http://ckeditor.com/license
- */
-
-(function() {
- var fragmentPrototype = CKEDITOR.htmlParser.fragment.prototype,
- elementPrototype = CKEDITOR.htmlParser.element.prototype;
-
- fragmentPrototype.onlyChild = elementPrototype.onlyChild = function() {
- var children = this.children,
- count = children.length,
- firstChild = ( count == 1 ) && children[ 0 ];
- return firstChild || null;
- };
-
- elementPrototype.removeAnyChildWithName = function( tagName ) {
- var children = this.children,
- childs = [],
- child;
-
- for ( var i = 0; i < children.length; i++ ) {
- child = children[ i ];
- if ( !child.name )
- continue;
-
- if ( child.name == tagName ) {
- childs.push( child );
- children.splice( i--, 1 );
- }
- childs = childs.concat( child.removeAnyChildWithName( tagName ) );
- }
- return childs;
- };
-
- elementPrototype.getAncestor = function( tagNameRegex ) {
- var parent = this.parent;
- while ( parent && !( parent.name && parent.name.match( tagNameRegex ) ) )
- parent = parent.parent;
- return parent;
- };
-
- fragmentPrototype.firstChild = elementPrototype.firstChild = function( evaluator ) {
- var child;
-
- for ( var i = 0; i < this.children.length; i++ ) {
- child = this.children[ i ];
- if ( evaluator( child ) )
- return child;
- else if ( child.name ) {
- child = child.firstChild( evaluator );
- if ( child )
- return child;
- }
- }
-
- return null;
- };
-
- // Adding a (set) of styles to the element's 'style' attributes.
- elementPrototype.addStyle = function( name, value, isPrepend ) {
- var styleText,
- addingStyleText = '';
- // name/value pair.
- if ( typeof value == 'string' )
- addingStyleText += name + ':' + value + ';';
- else {
- // style literal.
- if ( typeof name == 'object' ) {
- for ( var style in name ) {
- if ( name.hasOwnProperty( style ) )
- addingStyleText += style + ':' + name[ style ] + ';';
- }
- }
- // raw style text form.
- else
- addingStyleText += name;
-
- isPrepend = value;
- }
-
- if ( !this.attributes )
- this.attributes = {};
-
- styleText = this.attributes.style || '';
-
- styleText = ( isPrepend ? [ addingStyleText, styleText ] : [ styleText, addingStyleText ] ).join( ';' );
-
- this.attributes.style = styleText.replace( /^;|;(?=;)/, '' );
- };
-
- // Retrieve a style property value of the element.
- elementPrototype.getStyle = function( name ) {
- var styles = this.attributes.style;
- if ( styles ) {
- styles = CKEDITOR.tools.parseCssText( styles, 1 );
- return styles[ name ];
- }
- };
-
- /**
- * Return the DTD-valid parent tag names of the specified one.
- *
- * @member CKEDITOR.dtd
- * @param {String} tagName
- * @returns {Object}
- */
- CKEDITOR.dtd.parentOf = function( tagName ) {
- var result = {};
- for ( var tag in this ) {
- if ( tag.indexOf( '$' ) == -1 && this[ tag ][ tagName ] )
- result[ tag ] = 1;
- }
- return result;
- };
-
- // 1. move consistent list item styles up to list root.
- // 2. clear out unnecessary list item numbering.
- function postProcessList( list ) {
- var children = list.children,
- child, attrs,
- count = list.children.length,
- match, mergeStyle,
- styleTypeRegexp = /list-style-type:(.*?)(?:;|$)/,
- stylesFilter = CKEDITOR.plugins.pastefromword.filters.stylesFilter;
-
- attrs = list.attributes;
- if ( styleTypeRegexp.exec( attrs.style ) )
- return;
-
- for ( var i = 0; i < count; i++ ) {
- child = children[ i ];
-
- if ( child.attributes.value && Number( child.attributes.value ) == i + 1 )
- delete child.attributes.value;
-
- match = styleTypeRegexp.exec( child.attributes.style );
-
- if ( match ) {
- if ( match[ 1 ] == mergeStyle || !mergeStyle )
- mergeStyle = match[ 1 ];
- else {
- mergeStyle = null;
- break;
- }
- }
- }
-
- if ( mergeStyle ) {
- for ( i = 0; i < count; i++ ) {
- attrs = children[ i ].attributes;
- attrs.style && ( attrs.style = stylesFilter( [ [ 'list-style-type' ] ] )( attrs.style ) || '' );
- }
-
- list.addStyle( 'list-style-type', mergeStyle );
- }
- }
-
- var cssLengthRelativeUnit = /^([.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz){1}?/i;
- var emptyMarginRegex = /^(?:\b0[^\s]*\s*){1,4}$/; // e.g. 0px 0pt 0px
- var romanLiternalPattern = '^m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$',
- lowerRomanLiteralRegex = new RegExp( romanLiternalPattern ),
- upperRomanLiteralRegex = new RegExp( romanLiternalPattern.toUpperCase() );
-
- var orderedPatterns = { 'decimal': /\d+/, 'lower-roman': lowerRomanLiteralRegex, 'upper-roman': upperRomanLiteralRegex, 'lower-alpha': /^[a-z]+$/, 'upper-alpha': /^[A-Z]+$/ },
- unorderedPatterns = { 'disc': /[l\u00B7\u2002]/, 'circle': /[\u006F\u00D8]/, 'square': /[\u006E\u25C6]/ },
- listMarkerPatterns = { 'ol': orderedPatterns, 'ul': unorderedPatterns },
- romans = [ [ 1000, 'M' ], [ 900, 'CM' ], [ 500, 'D' ], [ 400, 'CD' ], [ 100, 'C' ], [ 90, 'XC' ], [ 50, 'L' ], [ 40, 'XL' ], [ 10, 'X' ], [ 9, 'IX' ], [ 5, 'V' ], [ 4, 'IV' ], [ 1, 'I' ] ],
- alpahbets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-
- // Convert roman numbering back to decimal.
- function fromRoman( str ) {
- str = str.toUpperCase();
- var l = romans.length,
- retVal = 0;
- for ( var i = 0; i < l; ++i ) {
- for ( var j = romans[ i ], k = j[ 1 ].length; str.substr( 0, k ) == j[ 1 ]; str = str.substr( k ) )
- retVal += j[ 0 ];
- }
- return retVal;
- }
-
- // Convert alphabet numbering back to decimal.
- function fromAlphabet( str ) {
- str = str.toUpperCase();
- var l = alpahbets.length,
- retVal = 1;
- for ( var x = 1; str.length > 0; x *= l ) {
- retVal += alpahbets.indexOf( str.charAt( str.length - 1 ) ) * x;
- str = str.substr( 0, str.length - 1 );
- }
- return retVal;
- }
-
- var listBaseIndent = 0,
- previousListItemMargin = null,
- previousListId;
-
- var plugin = ( CKEDITOR.plugins.pastefromword = {
- utils: {
- // Create a <cke:listbullet> which indicate an list item type.
- createListBulletMarker: function( bullet, bulletText ) {
- var marker = new CKEDITOR.htmlParser.element( 'cke:listbullet' );
- marker.attributes = { 'cke:listsymbol': bullet[ 0 ] };
- marker.add( new CKEDITOR.htmlParser.text( bulletText ) );
- return marker;
- },
-
- isListBulletIndicator: function( element ) {
- var styleText = element.attributes && element.attributes.style;
- if ( /mso-list\s*:\s*Ignore/i.test( styleText ) )
- return true;
- },
-
- isContainingOnlySpaces: function( element ) {
- var text;
- return ( ( text = element.onlyChild() ) && ( /^(:?\s|&nbsp;)+$/ ).test( text.value ) );
- },
-
- resolveList: function( element ) {
- // <cke:listbullet> indicate a list item.
- var attrs = element.attributes,
- listMarker;
-
- if ( ( listMarker = element.removeAnyChildWithName( 'cke:listbullet' ) ) && listMarker.length && ( listMarker = listMarker[ 0 ] ) ) {
- element.name = 'cke:li';
-
- if ( attrs.style ) {
- attrs.style = plugin.filters.stylesFilter( [
- // Text-indent is not representing list item level any more.
- [ 'text-indent' ],
- [ 'line-height' ],
- // First attempt is to resolve indent level from on a constant margin increment.
- [ ( /^margin(:?-left)?$/ ), null, function( margin ) {
- // Deal with component/short-hand form.
- var values = margin.split( ' ' );
- margin = CKEDITOR.tools.convertToPx( values[ 3 ] || values[ 1 ] || values[ 0 ] );
-
- // Figure out the indent unit by checking the first time of incrementation.
- if ( !listBaseIndent && previousListItemMargin !== null && margin > previousListItemMargin )
- listBaseIndent = margin - previousListItemMargin;
-
- previousListItemMargin = margin;
-
- attrs[ 'cke:indent' ] = listBaseIndent && ( Math.ceil( margin / listBaseIndent ) + 1 ) || 1;
- }],
- // The best situation: "mso-list:l0 level1 lfo2" tells the belonged list root, list item indentation, etc.
- [ ( /^mso-list$/ ), null, function( val ) {
- val = val.split( ' ' );
- var listId = Number( val[ 0 ].match( /\d+/ ) ),
- indent = Number( val[ 1 ].match( /\d+/ ) );
-
- if ( indent == 1 ) {
- listId !== previousListId && ( attrs[ 'cke:reset' ] = 1 );
- previousListId = listId;
- }
- attrs[ 'cke:indent' ] = indent;
- }]
- ] )( attrs.style, element ) || '';
- }
-
- // First level list item might be presented without a margin.
-
-
- // In case all above doesn't apply.
- if ( !attrs[ 'cke:indent' ] ) {
- previousListItemMargin = 0;
- attrs[ 'cke:indent' ] = 1;
- }
-
- // Inherit attributes from bullet.
- CKEDITOR.tools.extend( attrs, listMarker.attributes );
- return true;
- }
- // Current list disconnected.
- else
- previousListId = previousListItemMargin = listBaseIndent = null;
-
- return false;
- },
-
- // Providing a shorthand style then retrieve one or more style component values.
- getStyleComponents: (function() {
- var calculator = CKEDITOR.dom.element.createFromHtml( '<div style="position:absolute;left:-9999px;top:-9999px;"></div>', CKEDITOR.document );
- CKEDITOR.document.getBody().append( calculator );
-
- return function( name, styleValue, fetchList ) {
- calculator.setStyle( name, styleValue );
- var styles = {},
- count = fetchList.length;
- for ( var i = 0; i < count; i++ )
- styles[ fetchList[ i ] ] = calculator.getStyle( fetchList[ i ] );
-
- return styles;
- };
- })(),
-
- listDtdParents: CKEDITOR.dtd.parentOf( 'ol' )
- },
-
- filters: {
- // Transform a normal list into flat list items only presentation.
- // E.g. <ul><li>level1<ol><li>level2</li></ol></li> =>
- // <cke:li cke:listtype="ul" cke:indent="1">level1</cke:li>
- // <cke:li cke:listtype="ol" cke:indent="2">level2</cke:li>
- flattenList: function( element, level ) {
- level = typeof level == 'number' ? level : 1;
-
- var attrs = element.attributes,
- listStyleType;
-
- // All list items are of the same type.
- switch ( attrs.type ) {
- case 'a':
- listStyleType = 'lower-alpha';
- break;
- case '1':
- listStyleType = 'decimal';
- break;
- // TODO: Support more list style type from MS-Word.
- }
-
- var children = element.children,
- child;
-
- for ( var i = 0; i < children.length; i++ ) {
- child = children[ i ];
-
- if ( child.name in CKEDITOR.dtd.$listItem ) {
- var attributes = child.attributes,
- listItemChildren = child.children,
- count = listItemChildren.length,
- last = listItemChildren[ count - 1 ];
-
- // Move out nested list.
- if ( last.name in CKEDITOR.dtd.$list ) {
- element.add( last, i + 1 );
-
- // Remove the parent list item if it's just a holder.
- if ( !--listItemChildren.length )
- children.splice( i--, 1 );
- }
-
- child.name = 'cke:li';
-
- // Inherit numbering from list root on the first list item.
- attrs.start && !i && ( attributes.value = attrs.start );
-
- plugin.filters.stylesFilter( [
- [ 'tab-stops', null, function( val ) {
- var margin = val.split( ' ' )[ 1 ].match( cssLengthRelativeUnit );
- margin && ( previousListItemMargin = CKEDITOR.tools.convertToPx( margin[ 0 ] ) );
- }],
- ( level == 1 ? [ 'mso-list', null, function( val ) {
- val = val.split( ' ' );
- var listId = Number( val[ 0 ].match( /\d+/ ) );
- listId !== previousListId && ( attributes[ 'cke:reset' ] = 1 );
- previousListId = listId;
- }] : null )
- ] )( attributes.style );
-
- attributes[ 'cke:indent' ] = level;
- attributes[ 'cke:listtype' ] = element.name;
- attributes[ 'cke:list-style-type' ] = listStyleType;
- }
- // Flatten sub list.
- else if ( child.name in CKEDITOR.dtd.$list ) {
- // Absorb sub list children.
- arguments.callee.apply( this, [ child, level + 1 ] );
- children = children.slice( 0, i ).concat( child.children ).concat( children.slice( i + 1 ) );
- element.children = [];
- for ( var j = 0, num = children.length; j < num; j++ )
- element.add( children[ j ] );
- }
- }
-
- delete element.name;
-
- // We're loosing tag name here, signalize this element as a list.
- attrs[ 'cke:list' ] = 1;
- },
-
- // Try to collect all list items among the children and establish one
- // or more HTML list structures for them.
- // @param element
- assembleList: function( element ) {
- var children = element.children,
- child, listItem, // The current processing cke:li element.
- listItemAttrs, listItemIndent, // Indent level of current list item.
- lastIndent, lastListItem, // The previous one just been added to the list.
- list, // Current staging list and it's parent list if any.
- openedLists = [],
- previousListStyleType, previousListType;
-
- // Properties of the list item are to be resolved from the list bullet.
- var bullet, listType, listStyleType, itemNumeric;
-
- for ( var i = 0; i < children.length; i++ ) {
- child = children[ i ];
-
- if ( 'cke:li' == child.name ) {
- child.name = 'li';
- listItem = child;
- listItemAttrs = listItem.attributes;
- bullet = listItemAttrs[ 'cke:listsymbol' ];
- bullet = bullet && bullet.match( /^(?:[(]?)([^\s]+?)([.)]?)$/ );
- listType = listStyleType = itemNumeric = null;
-
- if ( listItemAttrs[ 'cke:ignored' ] ) {
- children.splice( i--, 1 );
- continue;
- }
-
-
- // This's from a new list root.
- listItemAttrs[ 'cke:reset' ] && ( list = lastIndent = lastListItem = null );
-
- // List item indent level might come from a real list indentation or
- // been resolved from a pseudo list item's margin value, even get
- // no indentation at all.
- listItemIndent = Number( listItemAttrs[ 'cke:indent' ] );
-
- // We're moving out of the current list, cleaning up.
- if ( listItemIndent != lastIndent )
- previousListType = previousListStyleType = null;
-
- // List type and item style are already resolved.
- if ( !bullet ) {
- listType = listItemAttrs[ 'cke:listtype' ] || 'ol';
- listStyleType = listItemAttrs[ 'cke:list-style-type' ];
- } else {
- // Probably share the same list style type with previous list item,
- // give it priority to avoid ambiguous between C(Alpha) and C.(Roman).
- if ( previousListType && listMarkerPatterns[ previousListType ][ previousListStyleType ].test( bullet[ 1 ] ) ) {
- listType = previousListType;
- listStyleType = previousListStyleType;
- } else {
- for ( var type in listMarkerPatterns ) {
- for ( var style in listMarkerPatterns[ type ] ) {
- if ( listMarkerPatterns[ type ][ style ].test( bullet[ 1 ] ) ) {
- // Small numbering has higher priority, when dealing with ambiguous
- // between C(Alpha) and C.(Roman).
- if ( type == 'ol' && ( /alpha|roman/ ).test( style ) ) {
- var num = /roman/.test( style ) ? fromRoman( bullet[ 1 ] ) : fromAlphabet( bullet[ 1 ] );
- if ( !itemNumeric || num < itemNumeric ) {
- itemNumeric = num;
- listType = type;
- listStyleType = style;
- }
- } else {
- listType = type;
- listStyleType = style;
- break;
- }
- }
- }
- }
- }
-
- // Simply use decimal/disc for the rest forms of unrepresentable
- // numerals, e.g. Chinese..., but as long as there a second part
- // included, it has a bigger chance of being a order list ;)
- !listType && ( listType = bullet[ 2 ] ? 'ol' : 'ul' );
- }
-
- previousListType = listType;
- previousListStyleType = listStyleType || ( listType == 'ol' ? 'decimal' : 'disc' );
- if ( listStyleType && listStyleType != ( listType == 'ol' ? 'decimal' : 'disc' ) )
- listItem.addStyle( 'list-style-type', listStyleType );
-
- // Figure out start numbering.
- if ( listType == 'ol' && bullet ) {
- switch ( listStyleType ) {
- case 'decimal':
- itemNumeric = Number( bullet[ 1 ] );
- break;
- case 'lower-roman':
- case 'upper-roman':
- itemNumeric = fromRoman( bullet[ 1 ] );
- break;
- case 'lower-alpha':
- case 'upper-alpha':
- itemNumeric = fromAlphabet( bullet[ 1 ] );
- break;
- }
-
- // Always create the numbering, swipe out unnecessary ones later.
- listItem.attributes.value = itemNumeric;
- }
-
- // Start the list construction.
- if ( !list ) {
- openedLists.push( list = new CKEDITOR.htmlParser.element( listType ) );
- list.add( listItem );
- children[ i ] = list;
- } else {
- if ( listItemIndent > lastIndent ) {
- openedLists.push( list = new CKEDITOR.htmlParser.element( listType ) );
- list.add( listItem );
- lastListItem.add( list );
- } else if ( listItemIndent < lastIndent ) {
- // There might be a negative gap between two list levels. (#4944)
- var diff = lastIndent - listItemIndent,
- parent;
- while ( diff-- && ( parent = list.parent ) )
- list = parent.parent;
-
- list.add( listItem );
- } else
- list.add( listItem );
-
- children.splice( i--, 1 );
- }
-
- lastListItem = listItem;
- lastIndent = listItemIndent;
- } else if ( list )
- list = lastIndent = lastListItem = null;
- }
-
- for ( i = 0; i < openedLists.length; i++ )
- postProcessList( openedLists[ i ] );
-
- list = lastIndent = lastListItem = previousListId = previousListItemMargin = listBaseIndent = null;
- },
-
- // A simple filter which always rejecting.
- falsyFilter: function( value ) {
- return false;
- },
-
- // A filter dedicated on the 'style' attribute filtering, e.g. dropping/replacing style properties.
- // @param styles {Array} in form of [ styleNameRegexp, styleValueRegexp,
- // newStyleValue/newStyleGenerator, newStyleName ] where only the first
- // parameter is mandatory.
- // @param whitelist {Boolean} Whether the {@param styles} will be considered as a white-list.
- stylesFilter: function( styles, whitelist ) {
- return function( styleText, element ) {
- var rules = [];
- // html-encoded quote might be introduced by 'font-family'
- // from MS-Word which confused the following regexp. e.g.
- //'font-family: &quot;Lucida, Console&quot;'
- ( styleText || '' ).replace( /&quot;/g, '"' ).replace( /\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g, function( match, name, value ) {
- name = name.toLowerCase();
- name == 'font-family' && ( value = value.replace( /["']/g, '' ) );
-
- var namePattern, valuePattern, newValue, newName;
- for ( var i = 0; i < styles.length; i++ ) {
- if ( styles[ i ] ) {
- namePattern = styles[ i ][ 0 ];
- valuePattern = styles[ i ][ 1 ];
- newValue = styles[ i ][ 2 ];
- newName = styles[ i ][ 3 ];
-
- if ( name.match( namePattern ) && ( !valuePattern || value.match( valuePattern ) ) ) {
- name = newName || name;
- whitelist && ( newValue = newValue || value );
-
- if ( typeof newValue == 'function' )
- newValue = newValue( value, element, name );
-
- // Return an couple indicate both name and value
- // changed.
- if ( newValue && newValue.push )
- name = newValue[ 0 ], newValue = newValue[ 1 ];
-
- if ( typeof newValue == 'string' )
- rules.push( [ name, newValue ] );
- return;
- }
- }
- }
-
- !whitelist && rules.push( [ name, value ] );
-
- });
-
- for ( var i = 0; i < rules.length; i++ )
- rules[ i ] = rules[ i ].join( ':' );
- return rules.length ? ( rules.join( ';' ) + ';' ) : false;
- };
- },
-
- // Migrate the element by decorate styles on it.
- // @param styleDefinition
- // @param variables
- elementMigrateFilter: function( styleDefinition, variables ) {
- return styleDefinition ? function( element ) {
- var styleDef = variables ? new CKEDITOR.style( styleDefinition, variables )._.definition : styleDefinition;
- element.name = styleDef.element;
- CKEDITOR.tools.extend( element.attributes, CKEDITOR.tools.clone( styleDef.attributes ) );
- element.addStyle( CKEDITOR.style.getStyleText( styleDef ) );
- } : function(){};
- },
-
- // Migrate styles by creating a new nested stylish element.
- // @param styleDefinition
- styleMigrateFilter: function( styleDefinition, variableName ) {
-
- var elementMigrateFilter = this.elementMigrateFilter;
- return styleDefinition ? function( value, element ) {
- // Build an stylish element first.
- var styleElement = new CKEDITOR.htmlParser.element( null ),
- variables = {};
-
- variables[ variableName ] = value;
- elementMigrateFilter( styleDefinition, variables )( styleElement );
- // Place the new element inside the existing span.
- styleElement.children = element.children;
- element.children = [ styleElement ];
-
- // #10285 - later on styleElement will replace element if element won't have any attributes.
- // However, in some cases styleElement is identical to element and therefore should not be filtered
- // to avoid inf loop. Unfortunately calling element.filterChildren() does not prevent from that (#10327).
- // However, we can assume that we don't need to filter styleElement at all, so it is safe to replace
- // its filter method.
- styleElement.filter = function() {};
- styleElement.parent = element;
- } : function(){};
- },
-
- // A filter which remove cke-namespaced-attribute on
- // all none-cke-namespaced elements.
- // @param value
- // @param element
- bogusAttrFilter: function( value, element ) {
- if ( element.name.indexOf( 'cke:' ) == -1 )
- return false;
- },
-
- // A filter which will be used to apply inline css style according the stylesheet
- // definition rules, is generated lazily when filtering.
- applyStyleFilter: null
-
- },
-
- getRules: function( editor, filter ) {
- var dtd = CKEDITOR.dtd,
- blockLike = CKEDITOR.tools.extend( {}, dtd.$block, dtd.$listItem, dtd.$tableContent ),
- config = editor.config,
- filters = this.filters,
- falsyFilter = filters.falsyFilter,
- stylesFilter = filters.stylesFilter,
- elementMigrateFilter = filters.elementMigrateFilter,
- styleMigrateFilter = CKEDITOR.tools.bind( this.filters.styleMigrateFilter, this.filters ),
- createListBulletMarker = this.utils.createListBulletMarker,
- flattenList = filters.flattenList,
- assembleList = filters.assembleList,
- isListBulletIndicator = this.utils.isListBulletIndicator,
- containsNothingButSpaces = this.utils.isContainingOnlySpaces,
- resolveListItem = this.utils.resolveList,
- convertToPx = function( value ) {
- value = CKEDITOR.tools.convertToPx( value );
- return isNaN( value ) ? value : value + 'px';
- },
- getStyleComponents = this.utils.getStyleComponents,
- listDtdParents = this.utils.listDtdParents,
- removeFontStyles = config.pasteFromWordRemoveFontStyles !== false,
- removeStyles = config.pasteFromWordRemoveStyles !== false;
-
- return {
-
- elementNames: [
- // Remove script, meta and link elements.
- [ ( /meta|link|script/ ), '' ]
- ],
-
- root: function( element ) {
- element.filterChildren( filter );
- assembleList( element );
- },
-
- elements: {
- '^': function( element ) {
- // Transform CSS style declaration to inline style.
- var applyStyleFilter;
- if ( CKEDITOR.env.gecko && ( applyStyleFilter = filters.applyStyleFilter ) )
- applyStyleFilter( element );
- },
-
- $: function( element ) {
- var tagName = element.name || '',
- attrs = element.attributes;
-
- // Convert length unit of width/height on blocks to
- // a more editor-friendly way (px).
- if ( tagName in blockLike && attrs.style ) {
- attrs.style = stylesFilter( [ [ ( /^(:?width|height)$/ ), null, convertToPx ] ] )( attrs.style ) || '';
- }
-
- // Processing headings.
- if ( tagName.match( /h\d/ ) ) {
- element.filterChildren( filter );
- // Is the heading actually a list item?
- if ( resolveListItem( element ) )
- return;
-
- // Adapt heading styles to editor's convention.
- elementMigrateFilter( config[ 'format_' + tagName ] )( element );
- }
- // Remove inline elements which contain only empty spaces.
- else if ( tagName in dtd.$inline ) {
- element.filterChildren( filter );
- if ( containsNothingButSpaces( element ) )
- delete element.name;
- }
- // Remove element with ms-office namespace,
- // with it's content preserved, e.g. 'o:p'.
- else if ( tagName.indexOf( ':' ) != -1 && tagName.indexOf( 'cke' ) == -1 ) {
- element.filterChildren( filter );
-
- // Restore image real link from vml.
- if ( tagName == 'v:imagedata' ) {
- var href = element.attributes[ 'o:href' ];
- if ( href )
- element.attributes.src = href;
- element.name = 'img';
- return;
- }
- delete element.name;
- }
-
- // Assembling list items into a whole list.
- if ( tagName in listDtdParents ) {
- element.filterChildren( filter );
- assembleList( element );
- }
- },
-
- // We'll drop any style sheet, but Firefox conclude
- // certain styles in a single style element, which are
- // required to be changed into inline ones.
- 'style': function( element ) {
- if ( CKEDITOR.env.gecko ) {
- // Grab only the style definition section.
- var styleDefSection = element.onlyChild().value.match( /\/\* Style Definitions \*\/([\s\S]*?)\/\*/ ),
- styleDefText = styleDefSection && styleDefSection[ 1 ],
- rules = {}; // Storing the parsed result.
-
- if ( styleDefText ) {
- styleDefText
- // Remove line-breaks.
- .replace( /[\n\r]/g, '' )
- // Extract selectors and style properties.
- .replace( /(.+?)\{(.+?)\}/g, function( rule, selectors, styleBlock ) {
- selectors = selectors.split( ',' );
- var length = selectors.length,
- selector;
- for ( var i = 0; i < length; i++ ) {
- // Assume MS-Word mostly generate only simple
- // selector( [Type selector][Class selector]).
- CKEDITOR.tools.trim( selectors[ i ] ).replace( /^(\w+)(\.[\w-]+)?$/g, function( match, tagName, className ) {
- tagName = tagName || '*';
- className = className.substring( 1, className.length );
-
- // Reject MS-Word Normal styles.
- if ( className.match( /MsoNormal/ ) )
- return;
-
- if ( !rules[ tagName ] )
- rules[ tagName ] = {};
- if ( className )
- rules[ tagName ][ className ] = styleBlock;
- else
- rules[ tagName ] = styleBlock;
- });
- }
- });
-
- filters.applyStyleFilter = function( element ) {
- var name = rules[ '*' ] ? '*' : element.name,
- className = element.attributes && element.attributes[ 'class' ],
- style;
- if ( name in rules ) {
- style = rules[ name ];
- if ( typeof style == 'object' )
- style = style[ className ];
- // Maintain style rules priorities.
- style && element.addStyle( style, true );
- }
- };
- }
- }
- return false;
- },
-
- 'p': function( element ) {
- // A a fall-back approach to resolve list item in browsers
- // that doesn't include "mso-list:Ignore" on list bullets,
- // note it's not perfect as not all list style (e.g. "heading list") is shipped
- // with this pattern. (#6662)
- if ( ( /MsoListParagraph/i ).exec( element.attributes[ 'class' ] ) || element.getStyle( 'mso-list' ) ) {
- var bulletText = element.firstChild( function( node ) {
- return node.type == CKEDITOR.NODE_TEXT && !containsNothingButSpaces( node.parent );
- });
-
- var bullet = bulletText && bulletText.parent;
- if ( bullet ) {
- bullet.addStyle( 'mso-list', 'Ignore' );
- }
- }
-
- element.filterChildren( filter );
-
- // Is the paragraph actually a list item?
- if ( resolveListItem( element ) )
- return;
-
- // Adapt paragraph formatting to editor's convention
- // according to enter-mode.
- if ( config.enterMode == CKEDITOR.ENTER_BR ) {
- // We suffer from attribute/style lost in this situation.
- delete element.name;
- element.add( new CKEDITOR.htmlParser.element( 'br' ) );
- } else
- elementMigrateFilter( config[ 'format_' + ( config.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ] )( element );
- },
-
- 'div': function( element ) {
- // Aligned table with no text surrounded is represented by a wrapper div, from which
- // table cells inherit as text-align styles, which is wrong.
- // Instead we use a clear-float div after the table to properly achieve the same layout.
- var singleChild = element.onlyChild();
- if ( singleChild && singleChild.name == 'table' ) {
- var attrs = element.attributes;
- singleChild.attributes = CKEDITOR.tools.extend( singleChild.attributes, attrs );
- attrs.style && singleChild.addStyle( attrs.style );
-
- var clearFloatDiv = new CKEDITOR.htmlParser.element( 'div' );
- clearFloatDiv.addStyle( 'clear', 'both' );
- element.add( clearFloatDiv );
- delete element.name;
- }
- },
-
- 'td': function( element ) {
- // 'td' in 'thead' is actually <th>.
- if ( element.getAncestor( 'thead' ) )
- element.name = 'th';
- },
-
- // MS-Word sometimes present list as a mixing of normal list
- // and pseudo-list, normalize the previous ones into pseudo form.
- 'ol': flattenList,
- 'ul': flattenList,
- 'dl': flattenList,
-
- 'font': function( element ) {
- // Drop the font tag if it comes from list bullet text.
- if ( isListBulletIndicator( element.parent ) ) {
- delete element.name;
- return;
- }
-
- element.filterChildren( filter );
-
- var attrs = element.attributes,
- styleText = attrs.style,
- parent = element.parent;
-
- if ( 'font' == parent.name ) // Merge nested <font> tags.
- {
- CKEDITOR.tools.extend( parent.attributes, element.attributes );
- styleText && parent.addStyle( styleText );
- delete element.name;
- }
- // Convert the merged into a span with all attributes preserved.
- else {
- styleText = styleText || '';
- // IE's having those deprecated attributes, normalize them.
- if ( attrs.color ) {
- attrs.color != '#000000' && ( styleText += 'color:' + attrs.color + ';' );
- delete attrs.color;
- }
- if ( attrs.face ) {
- styleText += 'font-family:' + attrs.face + ';';
- delete attrs.face;
- }
- // TODO: Mapping size in ranges of xx-small,
- // x-small, small, medium, large, x-large, xx-large.
- if ( attrs.size ) {
- styleText += 'font-size:' +
- ( attrs.size > 3 ? 'large' : ( attrs.size < 3 ? 'small' : 'medium' ) ) + ';';
- delete attrs.size;
- }
-
- element.name = 'span';
- element.addStyle( styleText );
- }
- },
-
- 'span': function( element ) {
- // Remove the span if it comes from list bullet text.
- if ( isListBulletIndicator( element.parent ) )
- return false;
-
- element.filterChildren( filter );
- if ( containsNothingButSpaces( element ) ) {
- delete element.name;
- return null;
- }
-
- // List item bullet type is supposed to be indicated by
- // the text of a span with style 'mso-list : Ignore' or an image.
- if ( isListBulletIndicator( element ) ) {
- var listSymbolNode = element.firstChild( function( node ) {
- return node.value || node.name == 'img';
- });
-
- var listSymbol = listSymbolNode && ( listSymbolNode.value || 'l.' ),
- listType = listSymbol && listSymbol.match( /^(?:[(]?)([^\s]+?)([.)]?)$/ );
-
- if ( listType ) {
- var marker = createListBulletMarker( listType, listSymbol );
- // Some non-existed list items might be carried by an inconsequential list, indicate by "mso-hide:all/display:none",
- // those are to be removed later, now mark it with "cke:ignored".
- var ancestor = element.getAncestor( 'span' );
- if ( ancestor && ( / mso-hide:\s*all|display:\s*none / ).test( ancestor.attributes.style ) )
- marker.attributes[ 'cke:ignored' ] = 1;
- return marker;
- }
- }
-
- // Update the src attribute of image element with href.
- var children = element.children,
- attrs = element.attributes,
- styleText = attrs && attrs.style,
- firstChild = children && children[ 0 ];
-
- // Assume MS-Word mostly carry font related styles on <span>,
- // adapting them to editor's convention.
- if ( styleText ) {
- attrs.style = stylesFilter( [
- // Drop 'inline-height' style which make lines overlapping.
- [ 'line-height' ],
- [ ( /^font-family$/ ), null, !removeFontStyles ? styleMigrateFilter( config[ 'font_style' ], 'family' ) : null ],
- [ ( /^font-size$/ ), null, !removeFontStyles ? styleMigrateFilter( config[ 'fontSize_style' ], 'size' ) : null ],
- [ ( /^color$/ ), null, !removeFontStyles ? styleMigrateFilter( config[ 'colorButton_foreStyle' ], 'color' ) : null ],
- [ ( /^background-color$/ ), null, !removeFontStyles ? styleMigrateFilter( config[ 'colorButton_backStyle' ], 'color' ) : null ]
- ] )( styleText, element ) || '';
- }
-
- if ( !attrs.style )
- delete attrs.style;
-
- if ( CKEDITOR.tools.isEmpty( attrs ) )
- delete element.name;
-
- return null;
- },
-
- // Migrate basic style formats to editor configured ones.
- 'b': elementMigrateFilter( config[ 'coreStyles_bold' ] ),
- 'i': elementMigrateFilter( config[ 'coreStyles_italic' ] ),
- 'u': elementMigrateFilter( config[ 'coreStyles_underline' ] ),
- 's': elementMigrateFilter( config[ 'coreStyles_strike' ] ),
- 'sup': elementMigrateFilter( config[ 'coreStyles_superscript' ] ),
- 'sub': elementMigrateFilter( config[ 'coreStyles_subscript' ] ),
- // Editor doesn't support anchor with content currently (#3582),
- // drop such anchors with content preserved.
- 'a': function( element ) {
- var attrs = element.attributes;
- if ( attrs && !attrs.href && attrs.name )
- delete element.name;
- else if ( CKEDITOR.env.webkit && attrs.href && attrs.href.match( /file:\/\/\/[\S]+#/i ) )
- attrs.href = attrs.href.replace( /file:\/\/\/[^#]+/i, '' );
- },
- 'cke:listbullet': function( element ) {
- if ( element.getAncestor( /h\d/ ) && !config.pasteFromWordNumberedHeadingToList )
- delete element.name;
- }
- },
-
- attributeNames: [
- // Remove onmouseover and onmouseout events (from MS Word comments effect)
- [ ( /^onmouse(:?out|over)/ ), '' ],
- // Onload on image element.
- [ ( /^onload$/ ), '' ],
- // Remove office and vml attribute from elements.
- [ ( /(?:v|o):\w+/ ), '' ],
- // Remove lang/language attributes.
- [ ( /^lang/ ), '' ]
- ],
-
- attributes: {
- 'style': stylesFilter( removeStyles ?
- // Provide a white-list of styles that we preserve, those should
- // be the ones that could later be altered with editor tools.
- [
- // Leave list-style-type
- [ ( /^list-style-type$/ ), null ],
-
- // Preserve margin-left/right which used as default indent style in the editor.
- [ ( /^margin$|^margin-(?!bottom|top)/ ), null, function( value, element, name ) {
- if ( element.name in { p:1,div:1 } ) {
- var indentStyleName = config.contentsLangDirection == 'ltr' ? 'margin-left' : 'margin-right';
-
- // Extract component value from 'margin' shorthand.
- if ( name == 'margin' ) {
- value = getStyleComponents( name, value, [ indentStyleName ] )[ indentStyleName ];
- } else if ( name != indentStyleName )
- return null;
-
- if ( value && !emptyMarginRegex.test( value ) )
- return [ indentStyleName, value ];
- }
-
- return null;
- }],
-
- // Preserve clear float style.
- [ ( /^clear$/ ) ],
-
- [ ( /^border.*|margin.*|vertical-align|float$/ ), null, function( value, element ) {
- if ( element.name == 'img' )
- return value;
- }],
-
- [ ( /^width|height$/ ), null, function( value, element ) {
- if ( element.name in { table:1,td:1,th:1,img:1 } )
- return value;
- }]
- ] :
- // Otherwise provide a black-list of styles that we remove.
- [
- [ ( /^mso-/ ) ],
- // Fixing color values.
- [ ( /-color$/ ), null, function( value ) {
- if ( value == 'transparent' )
- return false;
- if ( CKEDITOR.env.gecko )
- return value.replace( /-moz-use-text-color/g, 'transparent' );
- }],
- // Remove empty margin values, e.g. 0.00001pt 0em 0pt
- [ ( /^margin$/ ), emptyMarginRegex ],
- [ 'text-indent', '0cm' ],
- [ 'page-break-before' ],
- [ 'tab-stops' ],
- [ 'display', 'none' ],
- removeFontStyles ? [ ( /font-?/ ) ] : null
- ], removeStyles ),
-
- // Prefer width styles over 'width' attributes.
- 'width': function( value, element ) {
- if ( element.name in dtd.$tableContent )
- return false;
- },
- // Prefer border styles over table 'border' attributes.
- 'border': function( value, element ) {
- if ( element.name in dtd.$tableContent )
- return false;
- },
-
- // Only Firefox carry style sheet from MS-Word, which
- // will be applied by us manually. For other browsers
- // the css className is useless.
- 'class': falsyFilter,
-
- // MS-Word always generate 'background-color' along with 'bgcolor',
- // simply drop the deprecated attributes.
- 'bgcolor': falsyFilter,
-
- // Deprecate 'valign' attribute in favor of 'vertical-align'.
- 'valign': removeStyles ? falsyFilter : function( value, element ) {
- element.addStyle( 'vertical-align', value );
- return false;
- }
- },
-
- // Fore none-IE, some useful data might be buried under these IE-conditional
- // comments where RegExp were the right approach to dig them out where usual approach
- // is transform it into a fake element node which hold the desired data.
- comment: !CKEDITOR.env.ie ? function( value, node ) {
- var imageInfo = value.match( /<img.*?>/ ),
- listInfo = value.match( /^\[if !supportLists\]([\s\S]*?)\[endif\]$/ );
-
- // Seek for list bullet indicator.
- if ( listInfo ) {
- // Bullet symbol could be either text or an image.
- var listSymbol = listInfo[ 1 ] || ( imageInfo && 'l.' ),
- listType = listSymbol && listSymbol.match( />(?:[(]?)([^\s]+?)([.)]?)</ );
- return createListBulletMarker( listType, listSymbol );
- }
-
- // Reveal the <img> element in conditional comments for Firefox.
- if ( CKEDITOR.env.gecko && imageInfo ) {
- var img = CKEDITOR.htmlParser.fragment.fromHtml( imageInfo[ 0 ] ).children[ 0 ],
- previousComment = node.previous,
- // Try to dig the real image link from vml markup from previous comment text.
- imgSrcInfo = previousComment && previousComment.value.match( /<v:imagedata[^>]*o:href=['"](.*?)['"]/ ),
- imgSrc = imgSrcInfo && imgSrcInfo[ 1 ];
-
- // Is there a real 'src' url to be used?
- imgSrc && ( img.attributes.src = imgSrc );
- return img;
- }
-
- return false;
- } : falsyFilter
- };
- }
- });
-
- // The paste processor here is just a reduced copy of html data processor.
- var pasteProcessor = function() {
- this.dataFilter = new CKEDITOR.htmlParser.filter();
- };
-
- pasteProcessor.prototype = {
- toHtml: function( data ) {
- var fragment = CKEDITOR.htmlParser.fragment.fromHtml( data ),
- writer = new CKEDITOR.htmlParser.basicWriter();
-
- fragment.writeHtml( writer, this.dataFilter );
- return writer.getHtml( true );
- }
- };
-
- CKEDITOR.cleanWord = function( data, editor ) {
- // Firefox will be confused by those downlevel-revealed IE conditional
- // comments, fixing them first( convert it to upperlevel-revealed one ).
- // e.g. <![if !vml]>...<![endif]>
- if ( CKEDITOR.env.gecko )
- data = data.replace( /(<!--\[if[^<]*?\])-->([\S\s]*?)<!--(\[endif\]-->)/gi, '$1$2$3' );
-
- // #9456 - Webkit doesn't wrap list number with span, which is crucial for filter to recognize list.
- //
- // <p class="MsoListParagraphCxSpLast" style="text-indent:-18.0pt;mso-list:l0 level1 lfo2">
- // <!--[if !supportLists]-->
- // 3.<span style="font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
- // <!--[endif]-->Test3<o:p></o:p>
- // </p>
- //
- // Transform to:
- //
- // <p class="MsoListParagraphCxSpLast" style="text-indent:-18.0pt;mso-list:l0 level1 lfo2">
- // <!--[if !supportLists]-->
- // <span>
- // 3.<span style="font-size: 7pt; line-height: normal; font-family: 'Times New Roman';">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
- // </span>
- // <!--[endif]-->Test3<o:p></o:p>
- // </p>
- if ( CKEDITOR.env.webkit ) {
- data = data.replace( /(class="MsoListParagraph[^>]+><!--\[if !supportLists\]-->)([^<]+<span[^<]+<\/span>)(<!--\[endif\]-->)/gi, '$1<span>$2</span>$3' );
- }
-
- var dataProcessor = new pasteProcessor(),
- dataFilter = dataProcessor.dataFilter;
-
- // These rules will have higher priorities than default ones.
- dataFilter.addRules( CKEDITOR.plugins.pastefromword.getRules( editor, dataFilter ) );
-
- // Allow extending data filter rules.
- editor.fire( 'beforeCleanWord', { filter: dataFilter } );
-
- try {
- data = dataProcessor.toHtml( data );
- } catch ( e ) {
- alert( editor.lang.pastefromword.error );
- }
-
- // Below post processing those things that are unable to delivered by filter rules.
-
- // Remove 'cke' namespaced attribute used in filter rules as marker.
- data = data.replace( /cke:.*?".*?"/g, '' );
-
- // Remove empty style attribute.
- data = data.replace( /style=""/g, '' );
-
- // Remove the dummy spans ( having no inline style ).
- data = data.replace( /<span>/g, '' );
-
- return data;
- };
-})();
-
-/**
- * Whether to ignore all font related formatting styles, including:
- *
- * * font size;
- * * font family;
- * * font foreground/background color.
- *
- * config.pasteFromWordRemoveFontStyles = false;
- *
- * @since 3.1
- * @cfg {Boolean} [pasteFromWordRemoveFontStyles=true]
- * @member CKEDITOR.config
- */
-
-/**
- * Whether to transform MS Word outline numbered headings into lists.
- *
- * config.pasteFromWordNumberedHeadingToList = true;
- *
- * @since 3.1
- * @cfg {Boolean} [pasteFromWordNumberedHeadingToList=false]
- * @member CKEDITOR.config
- */
-
-/**
- * Whether to remove element styles that can't be managed with the editor. Note
- * that this doesn't handle the font specific styles, which depends on the
- * {@link #pasteFromWordRemoveFontStyles} setting instead.
- *
- * config.pasteFromWordRemoveStyles = false;
- *
- * @since 3.1
- * @cfg {Boolean} [pasteFromWordRemoveStyles=true]
- * @member CKEDITOR.config
- */
+/*
+ Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
+ For licensing, see LICENSE.md or http://ckeditor.com/license
+*/
+(function(){function y(a){for(var a=a.toUpperCase(),c=z.length,b=0,f=0;f<c;++f)for(var d=z[f],e=d[1].length;a.substr(0,e)==d[1];a=a.substr(e))b+=d[0];return b}function A(a){for(var a=a.toUpperCase(),c=B.length,b=1,f=1;0<a.length;f*=c)b+=B.indexOf(a.charAt(a.length-1))*f,a=a.substr(0,a.length-1);return b}var C=CKEDITOR.htmlParser.fragment.prototype,o=CKEDITOR.htmlParser.element.prototype;C.onlyChild=o.onlyChild=function(){var a=this.children;return 1==a.length&&a[0]||null};o.removeAnyChildWithName=
+function(a){for(var c=this.children,b=[],f,d=0;d<c.length;d++)f=c[d],f.name&&(f.name==a&&(b.push(f),c.splice(d--,1)),b=b.concat(f.removeAnyChildWithName(a)));return b};o.getAncestor=function(a){for(var c=this.parent;c&&(!c.name||!c.name.match(a));)c=c.parent;return c};C.firstChild=o.firstChild=function(a){for(var c,b=0;b<this.children.length;b++)if(c=this.children[b],a(c)||c.name&&(c=c.firstChild(a)))return c;return null};o.addStyle=function(a,c,b){var f="";if("string"==typeof c)f+=a+":"+c+";";else{if("object"==
+typeof a)for(var d in a)a.hasOwnProperty(d)&&(f+=d+":"+a[d]+";");else f+=a;b=c}this.attributes||(this.attributes={});a=this.attributes.style||"";a=(b?[f,a]:[a,f]).join(";");this.attributes.style=a.replace(/^;|;(?=;)/,"")};o.getStyle=function(a){var c=this.attributes.style;if(c)return c=CKEDITOR.tools.parseCssText(c,1),c[a]};CKEDITOR.dtd.parentOf=function(a){var c={},b;for(b in this)-1==b.indexOf("$")&&this[b][a]&&(c[b]=1);return c};var H=/^([.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz){1}?/i,
+D=/^(?:\b0[^\s]*\s*){1,4}$/,x={ol:{decimal:/\d+/,"lower-roman":/^m{0,4}(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})$/,"upper-roman":/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/,"lower-alpha":/^[a-z]+$/,"upper-alpha":/^[A-Z]+$/},ul:{disc:/[l\u00B7\u2002]/,circle:/[\u006F\u00D8]/,square:/[\u006E\u25C6]/}},z=[[1E3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],B="ABCDEFGHIJKLMNOPQRSTUVWXYZ",s=0,t=null,w,E=CKEDITOR.plugins.pastefromword=
+{utils:{createListBulletMarker:function(a,c){var b=new CKEDITOR.htmlParser.element("cke:listbullet");b.attributes={"cke:listsymbol":a[0]};b.add(new CKEDITOR.htmlParser.text(c));return b},isListBulletIndicator:function(a){if(/mso-list\s*:\s*Ignore/i.test(a.attributes&&a.attributes.style))return!0},isContainingOnlySpaces:function(a){var c;return(c=a.onlyChild())&&/^(:?\s|&nbsp;)+$/.test(c.value)},resolveList:function(a){var c=a.attributes,b;if((b=a.removeAnyChildWithName("cke:listbullet"))&&b.length&&
+(b=b[0]))return a.name="cke:li",c.style&&(c.style=E.filters.stylesFilter([["text-indent"],["line-height"],[/^margin(:?-left)?$/,null,function(a){a=a.split(" ");a=CKEDITOR.tools.convertToPx(a[3]||a[1]||a[0]);!s&&(null!==t&&a>t)&&(s=a-t);t=a;c["cke:indent"]=s&&Math.ceil(a/s)+1||1}],[/^mso-list$/,null,function(a){var a=a.split(" "),b=Number(a[0].match(/\d+/)),a=Number(a[1].match(/\d+/));1==a&&(b!==w&&(c["cke:reset"]=1),w=b);c["cke:indent"]=a}]])(c.style,a)||""),c["cke:indent"]||(t=0,c["cke:indent"]=
+1),CKEDITOR.tools.extend(c,b.attributes),!0;w=t=s=null;return!1},getStyleComponents:function(){var a=CKEDITOR.dom.element.createFromHtml('<div style="position:absolute;left:-9999px;top:-9999px;"></div>',CKEDITOR.document);CKEDITOR.document.getBody().append(a);return function(c,b,f){a.setStyle(c,b);for(var c={},b=f.length,d=0;d<b;d++)c[f[d]]=a.getStyle(f[d]);return c}}(),listDtdParents:CKEDITOR.dtd.parentOf("ol")},filters:{flattenList:function(a,c){var c="number"==typeof c?c:1,b=a.attributes,f;switch(b.type){case "a":f=
+"lower-alpha";break;case "1":f="decimal"}for(var d=a.children,e,h=0;h<d.length;h++)if(e=d[h],e.name in CKEDITOR.dtd.$listItem){var j=e.attributes,g=e.children,m=g[g.length-1];m.name in CKEDITOR.dtd.$list&&(a.add(m,h+1),--g.length||d.splice(h--,1));e.name="cke:li";b.start&&!h&&(j.value=b.start);E.filters.stylesFilter([["tab-stops",null,function(a){(a=a.split(" ")[1].match(H))&&(t=CKEDITOR.tools.convertToPx(a[0]))}],1==c?["mso-list",null,function(a){a=a.split(" ");a=Number(a[0].match(/\d+/));a!==w&&
+(j["cke:reset"]=1);w=a}]:null])(j.style);j["cke:indent"]=c;j["cke:listtype"]=a.name;j["cke:list-style-type"]=f}else if(e.name in CKEDITOR.dtd.$list){arguments.callee.apply(this,[e,c+1]);d=d.slice(0,h).concat(e.children).concat(d.slice(h+1));a.children=[];e=0;for(g=d.length;e<g;e++)a.add(d[e]);d=a.children}delete a.name;b["cke:list"]=1},assembleList:function(a){for(var c=a.children,b,f,d,e,h,j,a=[],g,m,i,l,k,p,n=0;n<c.length;n++)if(b=c[n],"cke:li"==b.name)if(b.name="li",f=b.attributes,i=(i=f["cke:listsymbol"])&&
+i.match(/^(?:[(]?)([^\s]+?)([.)]?)$/),l=k=p=null,f["cke:ignored"])c.splice(n--,1);else{f["cke:reset"]&&(j=e=h=null);d=Number(f["cke:indent"]);d!=e&&(m=g=null);if(i){if(m&&x[m][g].test(i[1]))l=m,k=g;else for(var q in x)for(var u in x[q])if(x[q][u].test(i[1]))if("ol"==q&&/alpha|roman/.test(u)){if(g=/roman/.test(u)?y(i[1]):A(i[1]),!p||g<p)p=g,l=q,k=u}else{l=q;k=u;break}!l&&(l=i[2]?"ol":"ul")}else l=f["cke:listtype"]||"ol",k=f["cke:list-style-type"];m=l;g=k||("ol"==l?"decimal":"disc");k&&k!=("ol"==l?
+"decimal":"disc")&&b.addStyle("list-style-type",k);if("ol"==l&&i){switch(k){case "decimal":p=Number(i[1]);break;case "lower-roman":case "upper-roman":p=y(i[1]);break;case "lower-alpha":case "upper-alpha":p=A(i[1])}b.attributes.value=p}if(j){if(d>e)a.push(j=new CKEDITOR.htmlParser.element(l)),j.add(b),h.add(j);else{if(d<e){e-=d;for(var r;e--&&(r=j.parent);)j=r.parent}j.add(b)}c.splice(n--,1)}else a.push(j=new CKEDITOR.htmlParser.element(l)),j.add(b),c[n]=j;h=b;e=d}else j&&(j=e=h=null);for(n=0;n<a.length;n++)if(j=
+a[n],q=j.children,g=g=void 0,u=j.children.length,r=g=void 0,c=/list-style-type:(.*?)(?:;|$)/,e=CKEDITOR.plugins.pastefromword.filters.stylesFilter,g=j.attributes,!c.exec(g.style)){for(h=0;h<u;h++)if(g=q[h],g.attributes.value&&Number(g.attributes.value)==h+1&&delete g.attributes.value,g=c.exec(g.attributes.style))if(g[1]==r||!r)r=g[1];else{r=null;break}if(r){for(h=0;h<u;h++)g=q[h].attributes,g.style&&(g.style=e([["list-style-type"]])(g.style)||"");j.addStyle("list-style-type",r)}}w=t=s=null},falsyFilter:function(){return!1},
+stylesFilter:function(a,c){return function(b,f){var d=[];(b||"").replace(/&quot;/g,'"').replace(/\s*([^ :;]+)\s*:\s*([^;]+)\s*(?=;|$)/g,function(b,e,g){e=e.toLowerCase();"font-family"==e&&(g=g.replace(/["']/g,""));for(var m,i,l,k=0;k<a.length;k++)if(a[k]&&(b=a[k][0],m=a[k][1],i=a[k][2],l=a[k][3],e.match(b)&&(!m||g.match(m)))){e=l||e;c&&(i=i||g);"function"==typeof i&&(i=i(g,f,e));i&&i.push&&(e=i[0],i=i[1]);"string"==typeof i&&d.push([e,i]);return}!c&&d.push([e,g])});for(var e=0;e<d.length;e++)d[e]=
+d[e].join(":");return d.length?d.join(";")+";":!1}},elementMigrateFilter:function(a,c){return a?function(b){var f=c?(new CKEDITOR.style(a,c))._.definition:a;b.name=f.element;CKEDITOR.tools.extend(b.attributes,CKEDITOR.tools.clone(f.attributes));b.addStyle(CKEDITOR.style.getStyleText(f))}:function(){}},styleMigrateFilter:function(a,c){var b=this.elementMigrateFilter;return a?function(f,d){var e=new CKEDITOR.htmlParser.element(null),h={};h[c]=f;b(a,h)(e);e.children=d.children;d.children=[e];e.filter=
+function(){};e.parent=d}:function(){}},bogusAttrFilter:function(a,c){if(-1==c.name.indexOf("cke:"))return!1},applyStyleFilter:null},getRules:function(a,c){var b=CKEDITOR.dtd,f=CKEDITOR.tools.extend({},b.$block,b.$listItem,b.$tableContent),d=a.config,e=this.filters,h=e.falsyFilter,j=e.stylesFilter,g=e.elementMigrateFilter,m=CKEDITOR.tools.bind(this.filters.styleMigrateFilter,this.filters),i=this.utils.createListBulletMarker,l=e.flattenList,k=e.assembleList,p=this.utils.isListBulletIndicator,n=this.utils.isContainingOnlySpaces,
+q=this.utils.resolveList,u=function(a){a=CKEDITOR.tools.convertToPx(a);return isNaN(a)?a:a+"px"},r=this.utils.getStyleComponents,t=this.utils.listDtdParents,o=!1!==d.pasteFromWordRemoveFontStyles,s=!1!==d.pasteFromWordRemoveStyles;return{elementNames:[[/meta|link|script/,""]],root:function(a){a.filterChildren(c);k(a)},elements:{"^":function(a){var c;CKEDITOR.env.gecko&&(c=e.applyStyleFilter)&&c(a)},$:function(a){var v=a.name||"",e=a.attributes;v in f&&e.style&&(e.style=j([[/^(:?width|height)$/,null,
+u]])(e.style)||"");if(v.match(/h\d/)){a.filterChildren(c);if(q(a))return;g(d["format_"+v])(a)}else if(v in b.$inline)a.filterChildren(c),n(a)&&delete a.name;else if(-1!=v.indexOf(":")&&-1==v.indexOf("cke")){a.filterChildren(c);if("v:imagedata"==v){if(v=a.attributes["o:href"])a.attributes.src=v;a.name="img";return}delete a.name}v in t&&(a.filterChildren(c),k(a))},style:function(a){if(CKEDITOR.env.gecko){var a=(a=a.onlyChild().value.match(/\/\* Style Definitions \*\/([\s\S]*?)\/\*/))&&a[1],c={};a&&
+(a.replace(/[\n\r]/g,"").replace(/(.+?)\{(.+?)\}/g,function(a,b,F){for(var b=b.split(","),a=b.length,d=0;d<a;d++)CKEDITOR.tools.trim(b[d]).replace(/^(\w+)(\.[\w-]+)?$/g,function(a,b,d){b=b||"*";d=d.substring(1,d.length);d.match(/MsoNormal/)||(c[b]||(c[b]={}),d?c[b][d]=F:c[b]=F)})}),e.applyStyleFilter=function(a){var b=c["*"]?"*":a.name,d=a.attributes&&a.attributes["class"];b in c&&(b=c[b],"object"==typeof b&&(b=b[d]),b&&a.addStyle(b,!0))})}return!1},p:function(a){if(/MsoListParagraph/i.exec(a.attributes["class"])||
+a.getStyle("mso-list")){var b=a.firstChild(function(a){return a.type==CKEDITOR.NODE_TEXT&&!n(a.parent)});(b=b&&b.parent)&&b.addStyle("mso-list","Ignore")}a.filterChildren(c);q(a)||(d.enterMode==CKEDITOR.ENTER_BR?(delete a.name,a.add(new CKEDITOR.htmlParser.element("br"))):g(d["format_"+(d.enterMode==CKEDITOR.ENTER_P?"p":"div")])(a))},div:function(a){var c=a.onlyChild();if(c&&"table"==c.name){var b=a.attributes;c.attributes=CKEDITOR.tools.extend(c.attributes,b);b.style&&c.addStyle(b.style);c=new CKEDITOR.htmlParser.element("div");
+c.addStyle("clear","both");a.add(c);delete a.name}},td:function(a){a.getAncestor("thead")&&(a.name="th")},ol:l,ul:l,dl:l,font:function(a){if(p(a.parent))delete a.name;else{a.filterChildren(c);var b=a.attributes,d=b.style,e=a.parent;"font"==e.name?(CKEDITOR.tools.extend(e.attributes,a.attributes),d&&e.addStyle(d),delete a.name):(d=d||"",b.color&&("#000000"!=b.color&&(d+="color:"+b.color+";"),delete b.color),b.face&&(d+="font-family:"+b.face+";",delete b.face),b.size&&(d+="font-size:"+(3<b.size?"large":
+3>b.size?"small":"medium")+";",delete b.size),a.name="span",a.addStyle(d))}},span:function(a){if(p(a.parent))return!1;a.filterChildren(c);if(n(a))return delete a.name,null;if(p(a)){var b=a.firstChild(function(a){return a.value||"img"==a.name}),e=(b=b&&(b.value||"l."))&&b.match(/^(?:[(]?)([^\s]+?)([.)]?)$/);if(e)return b=i(e,b),(a=a.getAncestor("span"))&&/ mso-hide:\s*all|display:\s*none /.test(a.attributes.style)&&(b.attributes["cke:ignored"]=1),b}if(e=(b=a.attributes)&&b.style)b.style=j([["line-height"],
+[/^font-family$/,null,!o?m(d.font_style,"family"):null],[/^font-size$/,null,!o?m(d.fontSize_style,"size"):null],[/^color$/,null,!o?m(d.colorButton_foreStyle,"color"):null],[/^background-color$/,null,!o?m(d.colorButton_backStyle,"color"):null]])(e,a)||"";b.style||delete b.style;CKEDITOR.tools.isEmpty(b)&&delete a.name;return null},b:g(d.coreStyles_bold),i:g(d.coreStyles_italic),u:g(d.coreStyles_underline),s:g(d.coreStyles_strike),sup:g(d.coreStyles_superscript),sub:g(d.coreStyles_subscript),a:function(a){a=
+a.attributes;a.href&&a.href.match(/^file:\/\/\/[\S]+#/i)&&(a.href=a.href.replace(/^file:\/\/\/[^#]+/i,""))},"cke:listbullet":function(a){a.getAncestor(/h\d/)&&!d.pasteFromWordNumberedHeadingToList&&delete a.name}},attributeNames:[[/^onmouse(:?out|over)/,""],[/^onload$/,""],[/(?:v|o):\w+/,""],[/^lang/,""]],attributes:{style:j(s?[[/^list-style-type$/,null],[/^margin$|^margin-(?!bottom|top)/,null,function(a,b,c){if(b.name in{p:1,div:1}){b="ltr"==d.contentsLangDirection?"margin-left":"margin-right";if("margin"==
+c)a=r(c,a,[b])[b];else if(c!=b)return null;if(a&&!D.test(a))return[b,a]}return null}],[/^clear$/],[/^border.*|margin.*|vertical-align|float$/,null,function(a,b){if("img"==b.name)return a}],[/^width|height$/,null,function(a,b){if(b.name in{table:1,td:1,th:1,img:1})return a}]]:[[/^mso-/],[/-color$/,null,function(a){if("transparent"==a)return!1;if(CKEDITOR.env.gecko)return a.replace(/-moz-use-text-color/g,"transparent")}],[/^margin$/,D],["text-indent","0cm"],["page-break-before"],["tab-stops"],["display",
+"none"],o?[/font-?/]:null],s),width:function(a,c){if(c.name in b.$tableContent)return!1},border:function(a,c){if(c.name in b.$tableContent)return!1},"class":h,bgcolor:h,valign:s?h:function(a,b){b.addStyle("vertical-align",a);return!1}},comment:!CKEDITOR.env.ie?function(a,b){var c=a.match(/<img.*?>/),d=a.match(/^\[if !supportLists\]([\s\S]*?)\[endif\]$/);return d?(d=(c=d[1]||c&&"l.")&&c.match(/>(?:[(]?)([^\s]+?)([.)]?)</),i(d,c)):CKEDITOR.env.gecko&&c?(c=CKEDITOR.htmlParser.fragment.fromHtml(c[0]).children[0],
+(d=(d=(d=b.previous)&&d.value.match(/<v:imagedata[^>]*o:href=['"](.*?)['"]/))&&d[1])&&(c.attributes.src=d),c):!1}:h}}},G=function(){this.dataFilter=new CKEDITOR.htmlParser.filter};G.prototype={toHtml:function(a){var a=CKEDITOR.htmlParser.fragment.fromHtml(a),c=new CKEDITOR.htmlParser.basicWriter;a.writeHtml(c,this.dataFilter);return c.getHtml(!0)}};CKEDITOR.cleanWord=function(a,c){CKEDITOR.env.gecko&&(a=a.replace(/(<\!--\[if[^<]*?\])--\>([\S\s]*?)<\!--(\[endif\]--\>)/gi,"$1$2$3"));CKEDITOR.env.webkit&&
+(a=a.replace(/(class="MsoListParagraph[^>]+><\!--\[if !supportLists\]--\>)([^<]+<span[^<]+<\/span>)(<\!--\[endif\]--\>)/gi,"$1<span>$2</span>$3"));var b=new G,f=b.dataFilter;f.addRules(CKEDITOR.plugins.pastefromword.getRules(c,f));c.fire("beforeCleanWord",{filter:f});try{a=b.toHtml(a)}catch(d){alert(c.lang.pastefromword.error)}a=a.replace(/cke:.*?".*?"/g,"");a=a.replace(/style=""/g,"");return a=a.replace(/<span>/g,"")}})(); \ No newline at end of file