1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
/**
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.dialog.add( 'easyimageAlt', function( editor ) {
return {
title: editor.lang.easyimage.commands.altText,
minWidth: 200,
minHeight: 30,
getModel: function() {
var focused = editor.widgets.focused;
if ( focused && focused.name == 'easyimage' ) {
return focused;
}
return null;
},
onOk: function() {
var newAlt = CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtAlt' ) ),
model = this.getModel( editor );
if ( model ) {
model.parts.image.setAttribute( 'alt', newAlt );
}
},
onShow: function() {
var altField = this.getContentElement( 'info', 'txtAlt' ),
model = this.getModel( editor );
if ( model ) {
altField.setValue( model.parts.image.getAttribute( 'alt' ) );
}
altField.focus();
},
contents: [ {
id: 'info',
label: editor.lang.easyimage.commands.altText,
accessKey: 'I',
elements: [ {
type: 'text',
id: 'txtAlt',
label: editor.lang.easyimage.commands.altText
} ]
} ]
};
} );
|