123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371 |
- /**
- * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md or http://ckeditor.com/license
- */
- ( function() {
- var imageDialog = function( editor, dialogType ) {
- // Load image preview.
- var IMAGE = 1,
- LINK = 2,
- PREVIEW = 4,
- CLEANUP = 8,
- regexGetSize = /^\s*(\d+)((px)|\%)?\s*$/i,
- regexGetSizeOrEmpty = /(^\s*(\d+)((px)|\%)?\s*$)|^$/i,
- pxLengthRegex = /^\d+px$/;
- var onSizeChange = function() {
- var value = this.getValue(),
- // This = input element.
- dialog = this.getDialog(),
- aMatch = value.match( regexGetSize ); // Check value
- if ( aMatch ) {
- if ( aMatch[ 2 ] == '%' ) // % is allowed - > unlock ratio.
- switchLockRatio( dialog, false ); // Unlock.
- value = aMatch[ 1 ];
- }
- // Only if ratio is locked
- if ( dialog.lockRatio ) {
- var oImageOriginal = dialog.originalElement;
- if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' ) {
- if ( this.id == 'txtHeight' ) {
- if ( value && value != '0' )
- value = Math.round( oImageOriginal.$.width * ( value / oImageOriginal.$.height ) );
- if ( !isNaN( value ) )
- dialog.setValueOf( 'info', 'txtWidth', value );
- }
- // this.id = txtWidth.
- else {
- if ( value && value != '0' )
- value = Math.round( oImageOriginal.$.height * ( value / oImageOriginal.$.width ) );
- if ( !isNaN( value ) )
- dialog.setValueOf( 'info', 'txtHeight', value );
- }
- }
- }
- updatePreview( dialog );
- };
- var updatePreview = function( dialog ) {
- //Don't load before onShow.
- if ( !dialog.originalElement || !dialog.preview )
- return 1;
- // Read attributes and update imagePreview;
- dialog.commitContent( PREVIEW, dialog.preview );
- return 0;
- };
- // Custom commit dialog logic, where we're intended to give inline style
- // field (txtdlgGenStyle) higher priority to avoid overwriting styles contribute
- // by other fields.
- function commitContent() {
- var args = arguments;
- var inlineStyleField = this.getContentElement( 'advanced', 'txtdlgGenStyle' );
- inlineStyleField && inlineStyleField.commit.apply( inlineStyleField, args );
- this.foreach( function( widget ) {
- if ( widget.commit && widget.id != 'txtdlgGenStyle' )
- widget.commit.apply( widget, args );
- } );
- }
- // Avoid recursions.
- var incommit;
- // Synchronous field values to other impacted fields is required, e.g. border
- // size change should alter inline-style text as well.
- function commitInternally( targetFields ) {
- if ( incommit )
- return;
- incommit = 1;
- var dialog = this.getDialog(),
- element = dialog.imageElement;
- if ( element ) {
- // Commit this field and broadcast to target fields.
- this.commit( IMAGE, element );
- targetFields = [].concat( targetFields );
- var length = targetFields.length,
- field;
- for ( var i = 0; i < length; i++ ) {
- field = dialog.getContentElement.apply( dialog, targetFields[ i ].split( ':' ) );
- // May cause recursion.
- field && field.setup( IMAGE, element );
- }
- }
- incommit = 0;
- }
- var switchLockRatio = function( dialog, value ) {
- if ( !dialog.getContentElement( 'info', 'ratioLock' ) )
- return null;
- var oImageOriginal = dialog.originalElement;
- // Dialog may already closed. (#5505)
- if ( !oImageOriginal )
- return null;
- // Check image ratio and original image ratio, but respecting user's preference.
- if ( value == 'check' ) {
- if ( !dialog.userlockRatio && oImageOriginal.getCustomData( 'isReady' ) == 'true' ) {
- var width = dialog.getValueOf( 'info', 'txtWidth' ),
- height = dialog.getValueOf( 'info', 'txtHeight' ),
- originalRatio = oImageOriginal.$.width * 1000 / oImageOriginal.$.height,
- thisRatio = width * 1000 / height;
- dialog.lockRatio = false; // Default: unlock ratio
- if ( !width && !height )
- dialog.lockRatio = true;
- else if ( !isNaN( originalRatio ) && !isNaN( thisRatio ) ) {
- if ( Math.round( originalRatio ) == Math.round( thisRatio ) )
- dialog.lockRatio = true;
- }
- }
- } else if ( value !== undefined )
- dialog.lockRatio = value;
- else {
- dialog.userlockRatio = 1;
- dialog.lockRatio = !dialog.lockRatio;
- }
- var ratioButton = CKEDITOR.document.getById( btnLockSizesId );
- if ( dialog.lockRatio )
- ratioButton.removeClass( 'cke_btn_unlocked' );
- else
- ratioButton.addClass( 'cke_btn_unlocked' );
- ratioButton.setAttribute( 'aria-checked', dialog.lockRatio );
- // Ratio button hc presentation - WHITE SQUARE / BLACK SQUARE
- if ( CKEDITOR.env.hc ) {
- var icon = ratioButton.getChild( 0 );
- icon.setHtml( dialog.lockRatio ? CKEDITOR.env.ie ? '\u25A0' : '\u25A3' : CKEDITOR.env.ie ? '\u25A1' : '\u25A2' );
- }
- return dialog.lockRatio;
- };
- var resetSize = function( dialog, emptyValues ) {
- var oImageOriginal = dialog.originalElement,
- ready = oImageOriginal.getCustomData( 'isReady' ) == 'true';
- if ( ready ) {
- var widthField = dialog.getContentElement( 'info', 'txtWidth' ),
- heightField = dialog.getContentElement( 'info', 'txtHeight' ),
- widthValue, heightValue;
- if ( emptyValues ) {
- widthValue = 0;
- heightValue = 0;
- } else {
- widthValue = oImageOriginal.$.width;
- heightValue = oImageOriginal.$.height;
- }
- widthField && widthField.setValue( widthValue );
- heightField && heightField.setValue( heightValue );
- }
- updatePreview( dialog );
- };
- var setupDimension = function( type, element ) {
- if ( type != IMAGE )
- return;
- function checkDimension( size, defaultValue ) {
- var aMatch = size.match( regexGetSize );
- if ( aMatch ) {
- // % is allowed.
- if ( aMatch[ 2 ] == '%' ) {
- aMatch[ 1 ] += '%';
- switchLockRatio( dialog, false ); // Unlock ratio
- }
- return aMatch[ 1 ];
- }
- return defaultValue;
- }
- var dialog = this.getDialog(),
- value = '',
- dimension = this.id == 'txtWidth' ? 'width' : 'height',
- size = element.getAttribute( dimension );
- if ( size )
- value = checkDimension( size, value );
- value = checkDimension( element.getStyle( dimension ), value );
- this.setValue( value );
- };
- var previewPreloader;
- var onImgLoadEvent = function() {
- // Image is ready.
- var original = this.originalElement,
- loader = CKEDITOR.document.getById( imagePreviewLoaderId );
- original.setCustomData( 'isReady', 'true' );
- original.removeListener( 'load', onImgLoadEvent );
- original.removeListener( 'error', onImgLoadErrorEvent );
- original.removeListener( 'abort', onImgLoadErrorEvent );
- // Hide loader.
- if ( loader )
- loader.setStyle( 'display', 'none' );
- // New image -> new dimensions
- if ( !this.dontResetSize ) {
- resetSize( this, editor.config.image_prefillDimensions === false );
- }
- if ( this.firstLoad ) {
- CKEDITOR.tools.setTimeout( function() {
- switchLockRatio( this, 'check' );
- }, 0, this );
- }
- this.firstLoad = false;
- this.dontResetSize = false;
- // Possible fix for #12818.
- updatePreview( this );
- };
- var onImgLoadErrorEvent = function() {
- // Error. Image is not loaded.
- var original = this.originalElement,
- loader = CKEDITOR.document.getById( imagePreviewLoaderId );
- original.removeListener( 'load', onImgLoadEvent );
- original.removeListener( 'error', onImgLoadErrorEvent );
- original.removeListener( 'abort', onImgLoadErrorEvent );
- // Set Error image.
- var noimage = CKEDITOR.getUrl( CKEDITOR.plugins.get( 'image' ).path + 'images/noimage.png' );
- if ( this.preview )
- this.preview.setAttribute( 'src', noimage );
- // Hide loader.
- if ( loader )
- loader.setStyle( 'display', 'none' );
- switchLockRatio( this, false ); // Unlock.
- };
- var numbering = function( id ) {
- return CKEDITOR.tools.getNextId() + '_' + id;
- },
- btnLockSizesId = numbering( 'btnLockSizes' ),
- btnResetSizeId = numbering( 'btnResetSize' ),
- imagePreviewLoaderId = numbering( 'ImagePreviewLoader' ),
- previewLinkId = numbering( 'previewLink' ),
- previewImageId = numbering( 'previewImage' );
- return {
- title: editor.lang.image[ dialogType == 'image' ? 'title' : 'titleButton' ],
- minWidth: 420,
- minHeight: 360,
- onShow: function() {
- this.imageElement = false;
- this.linkElement = false;
- // Default: create a new element.
- this.imageEditMode = false;
- this.linkEditMode = false;
- this.lockRatio = true;
- this.userlockRatio = 0;
- this.dontResetSize = false;
- this.firstLoad = true;
- this.addLink = false;
- var editor = this.getParentEditor(),
- sel = editor.getSelection(),
- element = sel && sel.getSelectedElement(),
- link = element && editor.elementPath( element ).contains( 'a', 1 ),
- loader = CKEDITOR.document.getById( imagePreviewLoaderId );
- // Hide loader.
- if ( loader )
- loader.setStyle( 'display', 'none' );
- // Create the preview before setup the dialog contents.
- previewPreloader = new CKEDITOR.dom.element( 'img', editor.document );
- this.preview = CKEDITOR.document.getById( previewImageId );
- // Copy of the image
- this.originalElement = editor.document.createElement( 'img' );
- this.originalElement.setAttribute( 'alt', '' );
- this.originalElement.setCustomData( 'isReady', 'false' );
- if ( link ) {
- this.linkElement = link;
- this.linkEditMode = true;
- // If there is an existing link, by default keep it (true).
- // It will be removed if certain conditions are met and Link tab is enabled. (#13351)
- this.addLink = true;
- // Look for Image element.
- var linkChildren = link.getChildren();
- if ( linkChildren.count() == 1 ) {
- var childTag = linkChildren.getItem( 0 );
- if ( childTag.type == CKEDITOR.NODE_ELEMENT ) {
- if ( childTag.is( 'img' ) || childTag.is( 'input' ) ) {
- this.imageElement = linkChildren.getItem( 0 );
- if ( this.imageElement.is( 'img' ) )
- this.imageEditMode = 'img';
- else if ( this.imageElement.is( 'input' ) )
- this.imageEditMode = 'input';
- }
- }
- }
- // Fill out all fields.
- if ( dialogType == 'image' )
- this.setupContent( LINK, link );
- }
- // Edit given image element instead the one from selection.
- if ( this.customImageElement ) {
- this.imageEditMode = 'img';
- this.imageElement = this.customImageElement;
- delete this.customImageElement;
- }
- else if ( element && element.getName() == 'img' && !element.data( 'cke-realelement' ) ||
- element && element.getName() == 'input' && element.getAttribute( 'type' ) == 'image' ) {
- this.imageEditMode = element.getName();
- this.imageElement = element;
- }
- if ( this.imageEditMode ) {
- // Use the original element as a buffer from since we don't want
- // temporary changes to be committed, e.g. if the dialog is canceled.
- this.cleanImageElement = this.imageElement;
- this.imageElement = this.cleanImageElement.clone( true, true );
- // Fill out all fields.
- this.setupContent( IMAGE, this.imageElement );
- }
- // Refresh LockRatio button
- switchLockRatio( this, true );
- // Dont show preview if no URL given.
- if ( !CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtUrl' ) ) ) {
- this.preview.removeAttribute( 'src' );
- this.preview.setStyle( 'display', 'none' );
- }
- },
- onOk: function() {
- // Edit existing Image.
- if ( this.imageEditMode ) {
- var imgTagName = this.imageEditMode;
- // Image dialog and Input element.
- if ( dialogType == 'image' && imgTagName == 'input' && confirm( editor.lang.image.button2Img ) ) { // jshint ignore:line
- // Replace INPUT-> IMG
- imgTagName = 'img';
- this.imageElement = editor.document.createElement( 'img' );
- this.imageElement.setAttribute( 'alt', '' );
- editor.insertElement( this.imageElement );
- }
- // ImageButton dialog and Image element.
- else if ( dialogType != 'image' && imgTagName == 'img' && confirm( editor.lang.image.img2Button ) ) { // jshint ignore:line
- // Replace IMG -> INPUT
- imgTagName = 'input';
- this.imageElement = editor.document.createElement( 'input' );
- this.imageElement.setAttributes( {
- type: 'image',
- alt: ''
- } );
- editor.insertElement( this.imageElement );
- } else {
- // Restore the original element before all commits.
- this.imageElement = this.cleanImageElement;
- delete this.cleanImageElement;
- }
- }
- // Create a new image.
- else {
- // Image dialog -> create IMG element.
- if ( dialogType == 'image' )
- this.imageElement = editor.document.createElement( 'img' );
- else {
- this.imageElement = editor.document.createElement( 'input' );
- this.imageElement.setAttribute( 'type', 'image' );
- }
- this.imageElement.setAttribute( 'alt', '' );
- }
- // Create a new link.
- if ( !this.linkEditMode )
- this.linkElement = editor.document.createElement( 'a' );
- // Set attributes.
- this.commitContent( IMAGE, this.imageElement );
- this.commitContent( LINK, this.linkElement );
- //console.log();
- if ( /.*\.jpg$|.*\.png$|.*\.gif$/i.test( this.linkElement.getAttribute('data-cke-saved-href') ) )
- this.linkElement.setAttribute('rel','lightbox');
- // Remove empty style attribute.
- if ( !this.imageElement.getAttribute( 'style' ) )
- this.imageElement.removeAttribute( 'style' );
- // Insert a new Image.
- if ( !this.imageEditMode ) {
- if ( this.addLink ) {
- if ( !this.linkEditMode ) {
- // Insert a new link.
- editor.insertElement( this.linkElement );
- this.linkElement.append( this.imageElement, false );
- } else {
- // We already have a link in editor.
- if ( this.linkElement.equals( editor.getSelection().getSelectedElement() ) ) {
- // If the link is selected outside, replace it's content rather than the link itself. ([<a>foo</a>])
- this.linkElement.setHtml( '' );
- this.linkElement.append( this.imageElement, false );
- } else {
- // Only inside of the link is selected, so replace it with image. (<a>[foo]</a>, <a>[f]oo</a>)
- editor.insertElement( this.imageElement );
- }
- }
- } else {
- editor.insertElement( this.imageElement );
- }
- }
- // Image already exists.
- else {
- // Add a new link element.
- if ( !this.linkEditMode && this.addLink ) {
- editor.insertElement( this.linkElement );
- this.imageElement.appendTo( this.linkElement );
- }
- // Remove Link, Image exists.
- else if ( this.linkEditMode && !this.addLink ) {
- editor.getSelection().selectElement( this.linkElement );
- editor.insertElement( this.imageElement );
- }
- }
- },
- onLoad: function() {
- if ( dialogType != 'image' )
- this.hidePage( 'Link' ); //Hide Link tab.
- var doc = this._.element.getDocument();
- if ( this.getContentElement( 'info', 'ratioLock' ) ) {
- this.addFocusable( doc.getById( btnResetSizeId ), 5 );
- this.addFocusable( doc.getById( btnLockSizesId ), 5 );
- }
- this.commitContent = commitContent;
- },
- onHide: function() {
- if ( this.preview )
- this.commitContent( CLEANUP, this.preview );
- if ( this.originalElement ) {
- this.originalElement.removeListener( 'load', onImgLoadEvent );
- this.originalElement.removeListener( 'error', onImgLoadErrorEvent );
- this.originalElement.removeListener( 'abort', onImgLoadErrorEvent );
- this.originalElement.remove();
- this.originalElement = false; // Dialog is closed.
- }
- delete this.imageElement;
- },
- contents: [ {
- id: 'info',
- label: editor.lang.image.infoTab,
- accessKey: 'I',
- elements: [ {
- type: 'vbox',
- padding: 0,
- children: [ {
- type: 'hbox',
- widths: [ '280px', '110px' ],
- align: 'right',
- children: [ {
- id: 'txtUrl',
- type: 'text',
- label: editor.lang.common.url,
- required: true,
- onChange: function() {
- var dialog = this.getDialog(),
- newUrl = this.getValue();
- // Update original image.
- // Prevent from load before onShow.
- if ( newUrl.length > 0 ) {
- dialog = this.getDialog();
- var original = dialog.originalElement;
- if ( dialog.preview ) {
- dialog.preview.removeStyle( 'display' );
- }
- original.setCustomData( 'isReady', 'false' );
- // Show loader.
- var loader = CKEDITOR.document.getById( imagePreviewLoaderId );
- if ( loader )
- loader.setStyle( 'display', '' );
- original.on( 'load', onImgLoadEvent, dialog );
- original.on( 'error', onImgLoadErrorEvent, dialog );
- original.on( 'abort', onImgLoadErrorEvent, dialog );
- original.setAttribute( 'src', newUrl );
- if ( dialog.preview ) {
- // Query the preloader to figure out the url impacted by based href.
- previewPreloader.setAttribute( 'src', newUrl );
- dialog.preview.setAttribute( 'src', previewPreloader.$.src );
- updatePreview( dialog );
- }
- }
- // Dont show preview if no URL given.
- else if ( dialog.preview ) {
- dialog.preview.removeAttribute( 'src' );
- dialog.preview.setStyle( 'display', 'none' );
- }
- },
- setup: function( type, element ) {
- if ( type == IMAGE ) {
- var url = element.data( 'cke-saved-src' ) || element.getAttribute( 'src' );
- var field = this;
- this.getDialog().dontResetSize = true;
- field.setValue( url ); // And call this.onChange()
- // Manually set the initial value.(#4191)
- field.setInitValue();
- }
- },
- commit: function( type, element ) {
- if ( type == IMAGE && ( this.getValue() || this.isChanged() ) ) {
- element.data( 'cke-saved-src', this.getValue() );
- element.setAttribute( 'src', this.getValue() );
- } else if ( type == CLEANUP ) {
- element.setAttribute( 'src', '' ); // If removeAttribute doesn't work.
- element.removeAttribute( 'src' );
- }
- },
- validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.image.urlMissing )
- },
- {
- type: 'button',
- id: 'browse',
- // v-align with the 'txtUrl' field.
- // TODO: We need something better than a fixed size here.
- style: 'display:inline-block;margin-top:14px;',
- align: 'center',
- label: editor.lang.common.browseServer,
- hidden: true,
- filebrowser: 'info:txtUrl'
- } ]
- } ]
- },
- {
- type: 'text',
- id: 'txtGenTitle',
- requiredContent: 'img[title]',
- label: editor.lang.common.advisoryTitle,
- 'default': '',
- onChange: function() {
- updatePreview( this.getDialog() );
- },
- setup: function( type, element ) {
- if ( type == IMAGE )
- this.setValue( element.getAttribute( 'title' ) );
- },
- commit: function( type, element ) {
- if ( type == IMAGE ) {
- if ( this.getValue() || this.isChanged() )
- element.setAttribute( 'title', this.getValue() );
- } else if ( type == PREVIEW )
- element.setAttribute( 'title', this.getValue() );
- else if ( type == CLEANUP ) {
- element.removeAttribute( 'title' );
- }
- }
- },
- {
- type: 'text',
- id: 'txtGenCredit',
- requiredContent: 'img[rel-credit]',
- label: editor.lang.image.relcredit,
- 'default': '',
- onChange: function() {
- updatePreview( this.getDialog() );
- },
- setup: function( type, element ) {
- if ( type == IMAGE )
- this.setValue( element.getAttribute( 'rel-credit' ) );
- },
- commit: function( type, element ) {
- if ( type == IMAGE ) {
- if ( this.getValue() || this.isChanged() )
- element.setAttribute( 'rel-credit', this.getValue() );
- } else if ( type == PREVIEW )
- element.setAttribute( 'rel-credit', this.getValue() );
- else if ( type == CLEANUP ) {
- element.removeAttribute( 'rel-credit' );
- }
- }
- },
- {
- id: 'txtAlt',
- type: 'text',
- label: editor.lang.image.alt,
- accessKey: 'T',
- 'default': '',
- onChange: function() {
- updatePreview( this.getDialog() );
- },
- setup: function( type, element ) {
- if ( type == IMAGE )
- this.setValue( element.getAttribute( 'alt' ) );
- },
- commit: function( type, element ) {
- if ( type == IMAGE ) {
- if ( this.getValue() || this.isChanged() )
- element.setAttribute( 'alt', this.getValue() );
- } else if ( type == PREVIEW )
- element.setAttribute( 'alt', this.getValue() );
- else if ( type == CLEANUP ) {
- element.removeAttribute( 'alt' );
- }
- }
- },
- {
- type: 'hbox',
- children: [ {
- id: 'basic',
- type: 'vbox',
- children: [ {
- type: 'hbox',
- requiredContent: 'img{width,height}',
- widths: [ '50%', '50%' ],
- children: [ {
- type: 'vbox',
- padding: 1,
- children: [ {
- type: 'text',
- width: '45px',
- id: 'txtWidth',
- label: editor.lang.common.width,
- onKeyUp: onSizeChange,
- onChange: function() {
- commitInternally.call( this, 'advanced:txtdlgGenStyle' );
- },
- validate: function() {
- var aMatch = this.getValue().match( regexGetSizeOrEmpty ),
- isValid = !!( aMatch && parseInt( aMatch[ 1 ], 10 ) !== 0 );
- if ( !isValid )
- alert( editor.lang.common.invalidWidth ); // jshint ignore:line
- return isValid;
- },
- setup: setupDimension,
- commit: function( type, element ) {
- var value = this.getValue();
- if ( type == IMAGE ) {
- if ( value && editor.activeFilter.check( 'img{width,height}' ) )
- element.setStyle( 'width', CKEDITOR.tools.cssLength( value ) );
- else
- element.removeStyle( 'width' );
- element.removeAttribute( 'width' );
- } else if ( type == PREVIEW ) {
- var aMatch = value.match( regexGetSize );
- if ( !aMatch ) {
- var oImageOriginal = this.getDialog().originalElement;
- if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' )
- element.setStyle( 'width', oImageOriginal.$.width + 'px' );
- } else {
- element.setStyle( 'width', CKEDITOR.tools.cssLength( value ) );
- }
- } else if ( type == CLEANUP ) {
- element.removeAttribute( 'width' );
- element.removeStyle( 'width' );
- }
- }
- },
- {
- type: 'text',
- id: 'txtHeight',
- width: '45px',
- label: editor.lang.common.height,
- onKeyUp: onSizeChange,
- onChange: function() {
- commitInternally.call( this, 'advanced:txtdlgGenStyle' );
- },
- validate: function() {
- var aMatch = this.getValue().match( regexGetSizeOrEmpty ),
- isValid = !!( aMatch && parseInt( aMatch[ 1 ], 10 ) !== 0 );
- if ( !isValid )
- alert( editor.lang.common.invalidHeight ); // jshint ignore:line
- return isValid;
- },
- setup: setupDimension,
- commit: function( type, element ) {
- var value = this.getValue();
- if ( type == IMAGE ) {
- if ( value && editor.activeFilter.check( 'img{width,height}' ) )
- element.setStyle( 'height', CKEDITOR.tools.cssLength( value ) );
- else
- element.removeStyle( 'height' );
- element.removeAttribute( 'height' );
- } else if ( type == PREVIEW ) {
- var aMatch = value.match( regexGetSize );
- if ( !aMatch ) {
- var oImageOriginal = this.getDialog().originalElement;
- if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' )
- element.setStyle( 'height', oImageOriginal.$.height + 'px' );
- } else {
- element.setStyle( 'height', CKEDITOR.tools.cssLength( value ) );
- }
- } else if ( type == CLEANUP ) {
- element.removeAttribute( 'height' );
- element.removeStyle( 'height' );
- }
- }
- } ]
- },
- {
- id: 'ratioLock',
- type: 'html',
- style: 'margin-top:30px;width:40px;height:40px;',
- onLoad: function() {
- // Activate Reset button
- var resetButton = CKEDITOR.document.getById( btnResetSizeId ),
- ratioButton = CKEDITOR.document.getById( btnLockSizesId );
- if ( resetButton ) {
- resetButton.on( 'click', function( evt ) {
- resetSize( this );
- evt.data && evt.data.preventDefault();
- }, this.getDialog() );
- resetButton.on( 'mouseover', function() {
- this.addClass( 'cke_btn_over' );
- }, resetButton );
- resetButton.on( 'mouseout', function() {
- this.removeClass( 'cke_btn_over' );
- }, resetButton );
- }
- // Activate (Un)LockRatio button
- if ( ratioButton ) {
- ratioButton.on( 'click', function( evt ) {
- switchLockRatio( this );
- var oImageOriginal = this.originalElement,
- width = this.getValueOf( 'info', 'txtWidth' );
- if ( oImageOriginal.getCustomData( 'isReady' ) == 'true' && width ) {
- var height = oImageOriginal.$.height / oImageOriginal.$.width * width;
- if ( !isNaN( height ) ) {
- this.setValueOf( 'info', 'txtHeight', Math.round( height ) );
- updatePreview( this );
- }
- }
- evt.data && evt.data.preventDefault();
- }, this.getDialog() );
- ratioButton.on( 'mouseover', function() {
- this.addClass( 'cke_btn_over' );
- }, ratioButton );
- ratioButton.on( 'mouseout', function() {
- this.removeClass( 'cke_btn_over' );
- }, ratioButton );
- }
- },
- html: '<div>' +
- '<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.lockRatio +
- '" class="cke_btn_locked" id="' + btnLockSizesId + '" role="checkbox"><span class="cke_icon"></span><span class="cke_label">' + editor.lang.image.lockRatio + '</span></a>' +
- '<a href="javascript:void(0)" tabindex="-1" title="' + editor.lang.image.resetSize +
- '" class="cke_btn_reset" id="' + btnResetSizeId + '" role="button"><span class="cke_label">' + editor.lang.image.resetSize + '</span></a>' +
- '</div>'
- } ]
- },
- {
- type: 'vbox',
- padding: 1,
- children: [ {
- type: 'text',
- id: 'txtBorder',
- requiredContent: 'img{border-width}',
- width: '60px',
- label: editor.lang.image.border,
- 'default': '',
- onKeyUp: function() {
- updatePreview( this.getDialog() );
- },
- onChange: function() {
- commitInternally.call( this, 'advanced:txtdlgGenStyle' );
- },
- validate: CKEDITOR.dialog.validate.integer( editor.lang.image.validateBorder ),
- setup: function( type, element ) {
- if ( type == IMAGE ) {
- var value,
- borderStyle = element.getStyle( 'border-width' );
- borderStyle = borderStyle && borderStyle.match( /^(\d+px)(?: \1 \1 \1)?$/ );
- value = borderStyle && parseInt( borderStyle[ 1 ], 10 );
- isNaN( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'border' ) );
- this.setValue( value );
- }
- },
- commit: function( type, element ) {
- var value = parseInt( this.getValue(), 10 );
- if ( type == IMAGE || type == PREVIEW ) {
- if ( !isNaN( value ) ) {
- element.setStyle( 'border-width', CKEDITOR.tools.cssLength( value ) );
- element.setStyle( 'border-style', 'solid' );
- } else if ( !value && this.isChanged() ) {
- element.removeStyle( 'border' );
- }
- if ( type == IMAGE )
- element.removeAttribute( 'border' );
- } else if ( type == CLEANUP ) {
- element.removeAttribute( 'border' );
- element.removeStyle( 'border-width' );
- element.removeStyle( 'border-style' );
- element.removeStyle( 'border-color' );
- }
- }
- },
- {
- type: 'text',
- id: 'txtHSpace',
- requiredContent: 'img{margin-left,margin-right}',
- width: '60px',
- label: editor.lang.image.hSpace,
- 'default': '',
- onKeyUp: function() {
- updatePreview( this.getDialog() );
- },
- onChange: function() {
- commitInternally.call( this, 'advanced:txtdlgGenStyle' );
- },
- validate: CKEDITOR.dialog.validate.integer( editor.lang.image.validateHSpace ),
- setup: function( type, element ) {
- if ( type == IMAGE ) {
- var value, marginLeftPx, marginRightPx,
- marginLeftStyle = element.getStyle( 'margin-left' ),
- marginRightStyle = element.getStyle( 'margin-right' );
- marginLeftStyle = marginLeftStyle && marginLeftStyle.match( pxLengthRegex );
- marginRightStyle = marginRightStyle && marginRightStyle.match( pxLengthRegex );
- marginLeftPx = parseInt( marginLeftStyle, 10 );
- marginRightPx = parseInt( marginRightStyle, 10 );
- value = ( marginLeftPx == marginRightPx ) && marginLeftPx;
- isNaN( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'hspace' ) );
- this.setValue( value );
- }
- },
- commit: function( type, element ) {
- var value = parseInt( this.getValue(), 10 );
- if ( type == IMAGE || type == PREVIEW ) {
- if ( !isNaN( value ) ) {
- element.setStyle( 'margin-left', CKEDITOR.tools.cssLength( value ) );
- element.setStyle( 'margin-right', CKEDITOR.tools.cssLength( value ) );
- } else if ( !value && this.isChanged() ) {
- element.removeStyle( 'margin-left' );
- element.removeStyle( 'margin-right' );
- }
- if ( type == IMAGE )
- element.removeAttribute( 'hspace' );
- } else if ( type == CLEANUP ) {
- element.removeAttribute( 'hspace' );
- element.removeStyle( 'margin-left' );
- element.removeStyle( 'margin-right' );
- }
- }
- },
- {
- type: 'text',
- id: 'txtVSpace',
- requiredContent: 'img{margin-top,margin-bottom}',
- width: '60px',
- label: editor.lang.image.vSpace,
- 'default': '',
- onKeyUp: function() {
- updatePreview( this.getDialog() );
- },
- onChange: function() {
- commitInternally.call( this, 'advanced:txtdlgGenStyle' );
- },
- validate: CKEDITOR.dialog.validate.integer( editor.lang.image.validateVSpace ),
- setup: function( type, element ) {
- if ( type == IMAGE ) {
- var value, marginTopPx, marginBottomPx,
- marginTopStyle = element.getStyle( 'margin-top' ),
- marginBottomStyle = element.getStyle( 'margin-bottom' );
- marginTopStyle = marginTopStyle && marginTopStyle.match( pxLengthRegex );
- marginBottomStyle = marginBottomStyle && marginBottomStyle.match( pxLengthRegex );
- marginTopPx = parseInt( marginTopStyle, 10 );
- marginBottomPx = parseInt( marginBottomStyle, 10 );
- value = ( marginTopPx == marginBottomPx ) && marginTopPx;
- isNaN( parseInt( value, 10 ) ) && ( value = element.getAttribute( 'vspace' ) );
- this.setValue( value );
- }
- },
- commit: function( type, element ) {
- var value = parseInt( this.getValue(), 10 );
- if ( type == IMAGE || type == PREVIEW ) {
- if ( !isNaN( value ) ) {
- element.setStyle( 'margin-top', CKEDITOR.tools.cssLength( value ) );
- element.setStyle( 'margin-bottom', CKEDITOR.tools.cssLength( value ) );
- } else if ( !value && this.isChanged() ) {
- element.removeStyle( 'margin-top' );
- element.removeStyle( 'margin-bottom' );
- }
- if ( type == IMAGE )
- element.removeAttribute( 'vspace' );
- } else if ( type == CLEANUP ) {
- element.removeAttribute( 'vspace' );
- element.removeStyle( 'margin-top' );
- element.removeStyle( 'margin-bottom' );
- }
- }
- },
- {
- id: 'cmbAlign',
- requiredContent: 'img{float}',
- type: 'select',
- widths: [ '35%', '65%' ],
- style: 'width:100px',
- label: editor.lang.common.align,
- 'default': '',
- items: [
- [ editor.lang.common.notSet, '' ],
- [ editor.lang.common.alignLeft, 'left' ],
- [ editor.lang.common.alignRight, 'right' ]
- // Backward compatible with v2 on setup when specified as attribute value,
- // while these values are no more available as select options.
- // [ editor.lang.image.alignAbsBottom , 'absBottom'],
- // [ editor.lang.image.alignAbsMiddle , 'absMiddle'],
- // [ editor.lang.image.alignBaseline , 'baseline'],
- // [ editor.lang.image.alignTextTop , 'text-top'],
- // [ editor.lang.image.alignBottom , 'bottom'],
- // [ editor.lang.image.alignMiddle , 'middle'],
- // [ editor.lang.image.alignTop , 'top']
- ],
- onChange: function() {
- updatePreview( this.getDialog() );
- commitInternally.call( this, 'advanced:txtdlgGenStyle' );
- },
- setup: function( type, element ) {
- if ( type == IMAGE ) {
- var value = element.getStyle( 'float' );
- switch ( value ) {
- // Ignore those unrelated values.
- case 'inherit':
- case 'none':
- value = '';
- }
- !value && ( value = ( element.getAttribute( 'align' ) || '' ).toLowerCase() );
- this.setValue( value );
- }
- },
- commit: function( type, element ) {
- var value = this.getValue();
- if ( type == IMAGE || type == PREVIEW ) {
- if ( value )
- element.setStyle( 'float', value );
- else
- element.removeStyle( 'float' );
- if ( type == IMAGE ) {
- value = ( element.getAttribute( 'align' ) || '' ).toLowerCase();
- switch ( value ) {
- // we should remove it only if it matches "left" or "right",
- // otherwise leave it intact.
- case 'left':
- case 'right':
- element.removeAttribute( 'align' );
- }
- }
- } else if ( type == CLEANUP ) {
- element.removeStyle( 'float' );
- }
- }
- }
- ]
- } ]
- },
- {
- type: 'vbox',
- height: '250px',
- children: [ {
- type: 'html',
- id: 'htmlPreview',
- style: 'width:95%;',
- html: '<div>' + CKEDITOR.tools.htmlEncode( editor.lang.common.preview ) + '<br>' +
- '<div id="' + imagePreviewLoaderId + '" class="ImagePreviewLoader" style="display:none"><div class="loading"> </div></div>' +
- '<div class="ImagePreviewBox"><table><tr><td>' +
- '<a href="javascript:void(0)" target="_blank" onclick="return false;" id="' + previewLinkId + '">' +
- '<img id="' + previewImageId + '" alt="" /><img id="idlogo" style="display:none;position: relative;top: -39px;left: 190px;" /></a>' +
- // jscs:disable maximumLineLength
- ( editor.config.image_previewText || 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. ' +
- 'Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, ' +
- 'nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.' ) +
- // jscs:enable maximumLineLength
- '<div id="fileload"></div>'+
- '</td></tr></table></div></div>'
- },
- {
- id: 'cmbLogo',
- // requiredContent: 'img{float}',
- type: 'select',
- widths: [ '35%', '65%' ],
- style: 'width:120px;',
- label: 'Лого',
- 'default': '',
- items: [
- [ editor.lang.common.notSet, '' ],
- [ 'На тёмный фон', 'logo' ],
- [ 'На светлый фон', 'logo2' ]
- ],
- onChange: function() {
- //var oImageOriginal = this.dialog.originalElement;
- var dialog = this.getDialog()
- console.log(this.getValue());
- console.log(dialog.originalElement.$);
- w = dialog.originalElement.$.width;
- sw = '190';
- switch ( this.getValue() ) {
- case 'logo':
- $('#idlogo').css('display','block');
- $('#idlogo').css('left', sw+'px');
- $('#idlogo').attr('src','/img/logo_white.svg');
- break;
- case 'logo2':
- $('#idlogo').css('display','block');
- $('#idlogo').css('left', sw+'px');
- $('#idlogo').attr('src','/img/logo.svg');
- break;
- default:
- $('#idlogo').css('display','none');
- }
- updatePreview( this.getDialog() );
- commitInternally.call( this, 'advanced:txtdlgGenStyle' );
- },
- setup: function( type, element ) {
- if ( type == IMAGE ) {
- }
- },
- commit: function( type, element ) {
- var value = this.getValue();
- if ( type == IMAGE || type == PREVIEW ) {
- if ( value ){}
- if ( type == IMAGE ) {
- switch ( value ) {
- case 'logo':
- case 'logo2':
- var files = element.$.attributes['data-cke-saved-src'];
- $(element).load('/admin/utils/addlogo.php?file='+files.value+'&logo='+value, function(str){
- console.log(this.$.attributes['data-cke-saved-src'].value);
- this.$.attributes['data-cke-saved-src'].value +='?' + (+new Date());
- this.$.attributes['src'].value +='?' + (+new Date());
- });
- break;
- }
- }
- }
- }
- } ]
- } ]
- } ]
- },
- {
- id: 'Link',
- requiredContent: 'a[href]',
- label: editor.lang.image.linkTab,
- padding: 0,
- elements: [ {
- id: 'txtUrl',
- type: 'text',
- label: editor.lang.common.url,
- style: 'width: 100%',
- 'default': '',
- setup: function( type, element ) {
- if ( type == LINK ) {
- var href = element.data( 'cke-saved-href' );
- if ( !href )
- href = element.getAttribute( 'href' );
- this.setValue( href );
- }
- },
- commit: function( type, element ) {
- if ( type == LINK ) {
- if ( this.getValue() || this.isChanged() ) {
- var url = this.getValue();
- element.data( 'cke-saved-href', url );
- element.setAttribute( 'href', url );
- if ( this.getValue() || !editor.config.image_removeLinkByEmptyURL )
- this.getDialog().addLink = true;
- else
- this.getDialog().addLink = false;
- }
- }
- }
- },
- {
- type: 'button',
- id: 'browse',
- filebrowser: {
- action: 'Browse',
- target: 'Link:txtUrl',
- url: editor.config.filebrowserImageBrowseLinkUrl
- },
- style: 'float:right',
- hidden: true,
- label: editor.lang.common.browseServer
- },
- {
- id: 'cmbTarget',
- type: 'select',
- requiredContent: 'a[target]',
- label: editor.lang.common.target,
- 'default': '',
- items: [
- [ editor.lang.common.notSet, '' ],
- [ editor.lang.common.targetNew, '_blank' ],
- [ editor.lang.common.targetTop, '_top' ],
- [ editor.lang.common.targetSelf, '_self' ],
- [ editor.lang.common.targetParent, '_parent' ]
- ],
- setup: function( type, element ) {
- if ( type == LINK )
- this.setValue( element.getAttribute( 'target' ) || '' );
- },
- commit: function( type, element ) {
- if ( type == LINK ) {
- if ( this.getValue() || this.isChanged() )
- element.setAttribute( 'target', this.getValue() );
- }
- }
- } ]
- },
- /* {
- id: 'Upload',
- hidden: true,
- filebrowser: 'uploadButton',
- label: editor.lang.image.upload,
- elements: [ {
- type: 'file',
- id: 'upload',
- label: editor.lang.image.btnUpload,
- style: 'height:40px',
- size: 38
- },
- {
- type: 'fileButton',
- id: 'uploadButton',
- filebrowser: 'info:txtUrl',
- label: editor.lang.image.btnUpload,
- 'for': [ 'Upload', 'upload' ]
- } ]
- },*/
- {
- id: 'advanced',
- label: editor.lang.common.advancedTab,
- elements: [ {
- type: 'hbox',
- widths: [ '50%', '25%', '25%' ],
- children: [ {
- type: 'text',
- id: 'linkId',
- requiredContent: 'img[id]',
- label: editor.lang.common.id,
- setup: function( type, element ) {
- if ( type == IMAGE )
- this.setValue( element.getAttribute( 'id' ) );
- },
- commit: function( type, element ) {
- if ( type == IMAGE ) {
- if ( this.getValue() || this.isChanged() )
- element.setAttribute( 'id', this.getValue() );
- }
- }
- },
- {
- id: 'cmbLangDir',
- type: 'select',
- requiredContent: 'img[dir]',
- style: 'width : 100px;',
- label: editor.lang.common.langDir,
- 'default': '',
- items: [
- [ editor.lang.common.notSet, '' ],
- [ editor.lang.common.langDirLtr, 'ltr' ],
- [ editor.lang.common.langDirRtl, 'rtl' ]
- ],
- setup: function( type, element ) {
- if ( type == IMAGE )
- this.setValue( element.getAttribute( 'dir' ) );
- },
- commit: function( type, element ) {
- if ( type == IMAGE ) {
- if ( this.getValue() || this.isChanged() )
- element.setAttribute( 'dir', this.getValue() );
- }
- }
- },
- {
- type: 'text',
- id: 'txtLangCode',
- requiredContent: 'img[lang]',
- label: editor.lang.common.langCode,
- 'default': '',
- setup: function( type, element ) {
- if ( type == IMAGE )
- this.setValue( element.getAttribute( 'lang' ) );
- },
- commit: function( type, element ) {
- if ( type == IMAGE ) {
- if ( this.getValue() || this.isChanged() )
- element.setAttribute( 'lang', this.getValue() );
- }
- }
- } ]
- },
- {
- type: 'text',
- id: 'txtGenLongDescr',
- requiredContent: 'img[longdesc]',
- label: editor.lang.common.longDescr,
- setup: function( type, element ) {
- if ( type == IMAGE )
- this.setValue( element.getAttribute( 'longDesc' ) );
- },
- commit: function( type, element ) {
- if ( type == IMAGE ) {
- if ( this.getValue() || this.isChanged() )
- element.setAttribute( 'longDesc', this.getValue() );
- }
- }
- },
- {
- type: 'hbox',
- widths: [ '50%', '50%' ],
- children: [ {
- type: 'select',
- id: 'txtGenClass',
- requiredContent: 'img(cke-xyz)', // Random text like 'xyz' will check if all are allowed.
- label: editor.lang.common.cssClass,
- items: [
- [ 'нет', '' ],
- [ 'zooming', 'play-zoom' ],
- [ 'сепия', 'sepia' ],
- [ 'Ч/Б', 'grayscale' ]
- ],
- 'default': '',
- setup: function( type, element ) {
- if ( type == IMAGE )
- this.setValue( element.getAttribute( 'class' ) );
- },
- commit: function( type, element ) {
- if ( type == IMAGE ) {
- if ( this.getValue() || this.isChanged() )
- element.setAttribute( 'class', this.getValue() );
- }
- }
- }/*,
- {
- type: 'text',
- id: 'txtGenTitle',
- requiredContent: 'img[title]',
- label: editor.lang.common.advisoryTitle,
- 'default': '',
- onChange: function() {
- updatePreview( this.getDialog() );
- },
- setup: function( type, element ) {
- if ( type == IMAGE )
- this.setValue( element.getAttribute( 'title' ) );
- },
- commit: function( type, element ) {
- if ( type == IMAGE ) {
- if ( this.getValue() || this.isChanged() )
- element.setAttribute( 'title', this.getValue() );
- } else if ( type == PREVIEW )
- element.setAttribute( 'title', this.getValue() );
- else if ( type == CLEANUP ) {
- element.removeAttribute( 'title' );
- }
- }
- }*/ ]
- },
- {
- type: 'text',
- id: 'txtdlgGenStyle',
- requiredContent: 'img{cke-xyz}', // Random text like 'xyz' will check if all are allowed.
- label: editor.lang.common.cssStyle,
- validate: CKEDITOR.dialog.validate.inlineStyle( editor.lang.common.invalidInlineStyle ),
- 'default': '',
- setup: function( type, element ) {
- if ( type == IMAGE ) {
- var genStyle = element.getAttribute( 'style' );
- if ( !genStyle && element.$.style.cssText )
- genStyle = element.$.style.cssText;
- this.setValue( genStyle );
- var height = element.$.style.height,
- width = element.$.style.width,
- aMatchH = ( height ? height : '' ).match( regexGetSize ),
- aMatchW = ( width ? width : '' ).match( regexGetSize );
- this.attributesInStyle = {
- height: !!aMatchH,
- width: !!aMatchW
- };
- }
- },
- onChange: function() {
- commitInternally.call(
- this, [
- 'info:cmbFloat',
- 'info:cmbAlign',
- 'info:txtVSpace',
- 'info:txtHSpace',
- 'info:txtBorder',
- 'info:txtWidth',
- 'info:txtHeight'
- ]
- );
- updatePreview( this );
- },
- commit: function( type, element ) {
- if ( type == IMAGE && ( this.getValue() || this.isChanged() ) )
- element.setAttribute( 'style', this.getValue() );
- }
- } ]
- } ]
- };
- };
- CKEDITOR.dialog.add( 'image', function( editor ) {
- return imageDialog( editor, 'image' );
- } );
- CKEDITOR.dialog.add( 'imagebutton', function( editor ) {
- return imageDialog( editor, 'imagebutton' );
- } );
- } )();
|