X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fdialog%2Fplugin.js;h=917d2dd0e371940840514afe96fa3af88b572b8c;hb=055b6b0792ce7dc53d47af606b367c04b927c2ab;hp=5615b11db6c473ade07a0554934a702f78814f74;hpb=8665a7c6c60586526e32e8941fe2896739b6ebfb;p=ckeditor.git diff --git a/_source/plugins/dialog/plugin.js b/_source/plugins/dialog/plugin.js index 5615b11..917d2dd 100644 --- a/_source/plugins/dialog/plugin.js +++ b/_source/plugins/dialog/plugin.js @@ -168,6 +168,9 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; { this.on( 'ok', function( evt ) { + // Dialog confirm might probably introduce content changes (#5415). + editor.fire( 'saveSnapshot' ); + setTimeout( function () { editor.fire( 'saveSnapshot' ); }, 0 ); if ( definition.onOk.call( this, evt ) === false ) evt.data.hide = false; }); @@ -404,7 +407,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; setupFocus(); if ( editor.config.dialog_startupFocusTab - && me._.tabIdList.length > 1 ) + && me._.pageCount > 1 ) { me._.tabBarMode = true; me._.tabs[ me._.currentTabId ][ 0 ].focus(); @@ -938,6 +941,13 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3; */ selectPage : function( id ) { + if ( this._.currentTabId == id ) + return; + + // Returning true means that the event has been canceled + if ( this.fire( 'selectPage', { page : id, currentPage : this._.currentTabId } ) === true ) + return; + // Hide the non-selected tabs and pages. for ( var i in this._.tabs ) { @@ -2948,3 +2958,11 @@ CKEDITOR.plugins.add( 'dialog', * @param {CKEDITOR.editor} editor The editor instance that will use the * dialog. */ + +/** + * Fired when a tab is going to be selected in a dialog + * @name dialog#selectPage + * @event + * @param String page The id of the page that it's gonna be selected. + * @param String currentPage The id of the current page. + */