Upgraded CKEditor to version 4.5.1
This commit is contained in:
Executable → Regular
+8
-100
@@ -1,100 +1,8 @@
|
||||
/**
|
||||
* @license Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
|
||||
* For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add( 'button', function( editor ) {
|
||||
function commitAttributes( element ) {
|
||||
var val = this.getValue();
|
||||
if ( val ) {
|
||||
element.attributes[ this.id ] = val;
|
||||
if ( this.id == 'name' )
|
||||
element.attributes[ 'data-cke-saved-name' ] = val;
|
||||
} else {
|
||||
delete element.attributes[ this.id ];
|
||||
if ( this.id == 'name' )
|
||||
delete element.attributes[ 'data-cke-saved-name' ];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
title: editor.lang.forms.button.title,
|
||||
minWidth: 350,
|
||||
minHeight: 150,
|
||||
onShow: function() {
|
||||
delete this.button;
|
||||
var element = this.getParentEditor().getSelection().getSelectedElement();
|
||||
if ( element && element.is( 'input' ) ) {
|
||||
var type = element.getAttribute( 'type' );
|
||||
if ( type in { button: 1, reset: 1, submit: 1 } ) {
|
||||
this.button = element;
|
||||
this.setupContent( element );
|
||||
}
|
||||
}
|
||||
},
|
||||
onOk: function() {
|
||||
var editor = this.getParentEditor(),
|
||||
element = this.button,
|
||||
isInsertMode = !element;
|
||||
|
||||
var fake = element ? CKEDITOR.htmlParser.fragment.fromHtml( element.getOuterHtml() ).children[ 0 ] : new CKEDITOR.htmlParser.element( 'input' );
|
||||
this.commitContent( fake );
|
||||
|
||||
var writer = new CKEDITOR.htmlParser.basicWriter();
|
||||
fake.writeHtml( writer );
|
||||
var newElement = CKEDITOR.dom.element.createFromHtml( writer.getHtml(), editor.document );
|
||||
|
||||
if ( isInsertMode )
|
||||
editor.insertElement( newElement );
|
||||
else {
|
||||
newElement.replace( element );
|
||||
editor.getSelection().selectElement( newElement );
|
||||
}
|
||||
},
|
||||
contents: [
|
||||
{
|
||||
id: 'info',
|
||||
label: editor.lang.forms.button.title,
|
||||
title: editor.lang.forms.button.title,
|
||||
elements: [
|
||||
{
|
||||
id: 'name',
|
||||
type: 'text',
|
||||
label: editor.lang.common.name,
|
||||
'default': '',
|
||||
setup: function( element ) {
|
||||
this.setValue( element.data( 'cke-saved-name' ) || element.getAttribute( 'name' ) || '' );
|
||||
},
|
||||
commit: commitAttributes
|
||||
},
|
||||
{
|
||||
id: 'value',
|
||||
type: 'text',
|
||||
label: editor.lang.forms.button.text,
|
||||
accessKey: 'V',
|
||||
'default': '',
|
||||
setup: function( element ) {
|
||||
this.setValue( element.getAttribute( 'value' ) || '' );
|
||||
},
|
||||
commit: commitAttributes
|
||||
},
|
||||
{
|
||||
id: 'type',
|
||||
type: 'select',
|
||||
label: editor.lang.forms.button.type,
|
||||
'default': 'button',
|
||||
accessKey: 'T',
|
||||
items: [
|
||||
[ editor.lang.forms.button.typeBtn, 'button' ],
|
||||
[ editor.lang.forms.button.typeSbm, 'submit' ],
|
||||
[ editor.lang.forms.button.typeRst, 'reset' ]
|
||||
],
|
||||
setup: function( element ) {
|
||||
this.setValue( element.getAttribute( 'type' ) || '' );
|
||||
},
|
||||
commit: commitAttributes
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
} );
|
||||
/*
|
||||
Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
|
||||
For licensing, see LICENSE.md or http://ckeditor.com/license
|
||||
*/
|
||||
CKEDITOR.dialog.add("button",function(b){function d(a){var b=this.getValue();b?(a.attributes[this.id]=b,"name"==this.id&&(a.attributes["data-cke-saved-name"]=b)):(delete a.attributes[this.id],"name"==this.id&&delete a.attributes["data-cke-saved-name"])}return{title:b.lang.forms.button.title,minWidth:350,minHeight:150,onShow:function(){delete this.button;var a=this.getParentEditor().getSelection().getSelectedElement();a&&a.is("input")&&a.getAttribute("type")in{button:1,reset:1,submit:1}&&(this.button=
|
||||
a,this.setupContent(a))},onOk:function(){var a=this.getParentEditor(),b=this.button,d=!b,c=b?CKEDITOR.htmlParser.fragment.fromHtml(b.getOuterHtml()).children[0]:new CKEDITOR.htmlParser.element("input");this.commitContent(c);var e=new CKEDITOR.htmlParser.basicWriter;c.writeHtml(e);c=CKEDITOR.dom.element.createFromHtml(e.getHtml(),a.document);d?a.insertElement(c):(c.replace(b),a.getSelection().selectElement(c))},contents:[{id:"info",label:b.lang.forms.button.title,title:b.lang.forms.button.title,elements:[{id:"name",
|
||||
type:"text",bidi:!0,label:b.lang.common.name,"default":"",setup:function(a){this.setValue(a.data("cke-saved-name")||a.getAttribute("name")||"")},commit:d},{id:"value",type:"text",label:b.lang.forms.button.text,accessKey:"V","default":"",setup:function(a){this.setValue(a.getAttribute("value")||"")},commit:d},{id:"type",type:"select",label:b.lang.forms.button.type,"default":"button",accessKey:"T",items:[[b.lang.forms.button.typeBtn,"button"],[b.lang.forms.button.typeSbm,"submit"],[b.lang.forms.button.typeRst,
|
||||
"reset"]],setup:function(a){this.setValue(a.getAttribute("type")||"")},commit:d}]}]}});
|
||||
Reference in New Issue
Block a user