X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fpanelbutton%2Fplugin.js;h=1bddb4bda1cfc5b3e99186ab3e0ca40593327b97;hb=614511639979907ceb0da3614122a4d8eb963ad4;hp=155fa954a09d1dbf223729caa9def2930793d145;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/panelbutton/plugin.js b/_source/plugins/panelbutton/plugin.js index 155fa95..1bddb4b 100644 --- a/_source/plugins/panelbutton/plugin.js +++ b/_source/plugins/panelbutton/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -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 ); + }; } } });