Upgraded CKEditor to version 4.5.1

This commit is contained in:
2015-07-28 12:24:16 +02:00
parent b8e058934e
commit 5a8547bd99
3913 changed files with 12400 additions and 166463 deletions
+9 -130
View File
@@ -1,130 +1,9 @@
/**
* @license Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.dialog.add( 'checkbox', function( editor ) {
return {
title: editor.lang.forms.checkboxAndRadio.checkboxTitle,
minWidth: 350,
minHeight: 140,
onShow: function() {
delete this.checkbox;
var element = this.getParentEditor().getSelection().getSelectedElement();
if ( element && element.getAttribute( 'type' ) == 'checkbox' ) {
this.checkbox = element;
this.setupContent( element );
}
},
onOk: function() {
var editor,
element = this.checkbox,
isInsertMode = !element;
if ( isInsertMode ) {
editor = this.getParentEditor();
element = editor.document.createElement( 'input' );
element.setAttribute( 'type', 'checkbox' );
editor.insertElement( element );
}
this.commitContent( { element: element } );
},
contents: [
{
id: 'info',
label: editor.lang.forms.checkboxAndRadio.checkboxTitle,
title: editor.lang.forms.checkboxAndRadio.checkboxTitle,
startupFocus: 'txtName',
elements: [
{
id: 'txtName',
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( data ) {
var element = data.element;
// IE failed to update 'name' property on input elements, protect it now.
if ( this.getValue() )
element.data( 'cke-saved-name', this.getValue() );
else {
element.data( 'cke-saved-name', false );
element.removeAttribute( 'name' );
}
}
},
{
id: 'txtValue',
type: 'text',
label: editor.lang.forms.checkboxAndRadio.value,
'default': '',
accessKey: 'V',
setup: function( element ) {
var value = element.getAttribute( 'value' );
// IE Return 'on' as default attr value.
this.setValue( CKEDITOR.env.ie && value == 'on' ? '' : value );
},
commit: function( data ) {
var element = data.element,
value = this.getValue();
if ( value && !( CKEDITOR.env.ie && value == 'on' ) )
element.setAttribute( 'value', value );
else {
if ( CKEDITOR.env.ie ) {
// Remove attribute 'value' of checkbox (#4721).
var checkbox = new CKEDITOR.dom.element( 'input', element.getDocument() );
element.copyAttributes( checkbox, { value: 1 } );
checkbox.replace( element );
editor.getSelection().selectElement( checkbox );
data.element = checkbox;
} else
element.removeAttribute( 'value' );
}
}
},
{
id: 'cmbSelected',
type: 'checkbox',
label: editor.lang.forms.checkboxAndRadio.selected,
'default': '',
accessKey: 'S',
value: "checked",
setup: function( element ) {
this.setValue( element.getAttribute( 'checked' ) );
},
commit: function( data ) {
var element = data.element;
if ( CKEDITOR.env.ie ) {
var isElementChecked = !!element.getAttribute( 'checked' ),
isChecked = !!this.getValue();
if ( isElementChecked != isChecked ) {
var replace = CKEDITOR.dom.element.createFromHtml( '<input type="checkbox"' + ( isChecked ? ' checked="checked"' : '' )
+ '/>', editor.document );
element.copyAttributes( replace, { type: 1, checked: 1 } );
replace.replace( element );
editor.getSelection().selectElement( replace );
data.element = replace;
}
} else {
var value = this.getValue();
if ( value )
element.setAttribute( 'checked', 'checked' );
else
element.removeAttribute( 'checked' );
}
}
}
]
}
]
};
} );
/*
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.dialog.add("checkbox",function(d){return{title:d.lang.forms.checkboxAndRadio.checkboxTitle,minWidth:350,minHeight:140,onShow:function(){delete this.checkbox;var a=this.getParentEditor().getSelection().getSelectedElement();a&&"checkbox"==a.getAttribute("type")&&(this.checkbox=a,this.setupContent(a))},onOk:function(){var a,b=this.checkbox;b||(a=this.getParentEditor(),b=a.document.createElement("input"),b.setAttribute("type","checkbox"),a.insertElement(b));this.commitContent({element:b})},contents:[{id:"info",
label:d.lang.forms.checkboxAndRadio.checkboxTitle,title:d.lang.forms.checkboxAndRadio.checkboxTitle,startupFocus:"txtName",elements:[{id:"txtName",type:"text",label:d.lang.common.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:"txtValue",type:"text",label:d.lang.forms.checkboxAndRadio.value,
"default":"",accessKey:"V",setup:function(a){a=a.getAttribute("value");this.setValue(CKEDITOR.env.ie&&"on"==a?"":a)},commit:function(a){var b=a.element,c=this.getValue();c&&!(CKEDITOR.env.ie&&"on"==c)?b.setAttribute("value",c):CKEDITOR.env.ie?(c=new CKEDITOR.dom.element("input",b.getDocument()),b.copyAttributes(c,{value:1}),c.replace(b),d.getSelection().selectElement(c),a.element=c):b.removeAttribute("value")}},{id:"cmbSelected",type:"checkbox",label:d.lang.forms.checkboxAndRadio.selected,"default":"",
accessKey:"S",value:"checked",setup:function(a){this.setValue(a.getAttribute("checked"))},commit:function(a){var b=a.element;if(CKEDITOR.env.ie){var c=!!b.getAttribute("checked"),e=!!this.getValue();c!=e&&(c=CKEDITOR.dom.element.createFromHtml('<input type="checkbox"'+(e?' checked="checked"':"")+"/>",d.document),b.copyAttributes(c,{type:1,checked:1}),c.replace(b),d.getSelection().selectElement(c),a.element=c)}else this.getValue()?b.setAttribute("checked","checked"):b.removeAttribute("checked")}},
{id:"required",type:"checkbox",label:d.lang.forms.checkboxAndRadio.required,"default":"",accessKey:"Q",value:"required",setup:function(a){this.setValue(a.getAttribute("required"))},commit:function(a){a=a.element;this.getValue()?a.setAttribute("required","required"):a.removeAttribute("required")}}]}]}});