X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpanelbutton%2Fplugin.js;h=44d5699c76ba669e73e49e5ce5227aaa2f112012;hb=4e70ea24db840898be8cc21c950363a52a2a6aba;hp=9d84fa2cd4425bce942759ae7461ebf86e1d1795;hpb=941b0a9ba4e673e292510d80a5a86806994b8ea6;p=ckeditor.git diff --git a/_source/plugins/panelbutton/plugin.js b/_source/plugins/panelbutton/plugin.js index 9d84fa2..44d5699 100644 --- a/_source/plugins/panelbutton/plugin.js +++ b/_source/plugins/panelbutton/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -17,7 +17,7 @@ CKEDITOR.plugins.add( 'panelbutton', * @constant * @example */ -CKEDITOR.UI_PANELBUTTON = 4; +CKEDITOR.UI_PANELBUTTON = 'panelbutton'; (function() { @@ -57,6 +57,11 @@ CKEDITOR.UI_PANELBUTTON = 4; && panelDefinition.parent.getDocument() ) || CKEDITOR.document; + panelDefinition.block = + { + attributes : panelDefinition.attributes + }; + this.hasArrow = true; this.click = clickFn; @@ -88,8 +93,10 @@ CKEDITOR.UI_PANELBUTTON = 4; return; var panelDefinition = this._.panelDefinition || {}, + panelBlockDefinition = this._.panelDefinition.block, panelParentElement = panelDefinition.parent || CKEDITOR.document.getBody(), panel = this._.panel = new CKEDITOR.ui.floatPanel( editor, panelParentElement, panelDefinition ), + block = panel.addBlock( _.id, panelBlockDefinition ), me = this; panel.onShow = function() @@ -97,7 +104,6 @@ CKEDITOR.UI_PANELBUTTON = 4; if ( me.className ) this.element.getFirst().addClass( me.className + '_panel' ); - _.oldState = me._.state; me.setState( CKEDITOR.TRISTATE_ON ); _.on = 1; @@ -106,16 +112,16 @@ CKEDITOR.UI_PANELBUTTON = 4; me.onOpen(); }; - panel.onHide = function() + panel.onHide = function( preventOnClose ) { if ( me.className ) this.element.getFirst().removeClass( me.className + '_panel' ); - me.setState( _.oldState ); + me.setState( me.modes && me.modes[ editor.mode ] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED ); _.on = 0; - if ( me.onClose ) + if ( !preventOnClose && me.onClose ) me.onClose(); }; @@ -126,13 +132,13 @@ CKEDITOR.UI_PANELBUTTON = 4; }; if ( this.onBlock ) - this.onBlock( panel, _.id ); + this.onBlock( panel, block ); - panel.getBlock( _.id ).onHide = function() - { - _.on = 0; - me.setState( CKEDITOR.TRISTATE_OFF ); - }; + block.onHide = function() + { + _.on = 0; + me.setState( CKEDITOR.TRISTATE_OFF ); + }; } } });