X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fdialogui%2Fplugin.js;h=60f0c8b967965c36d3a5caaf185154611c1f6204;hb=refs%2Ftags%2Fv3.5.3;hp=35c2fdcbeb2a9c56089d9c92b3204bc7bd4d5c34;hpb=e371ddf8abcb89013e20e6d0dd746adec344d0e5;p=ckeditor.git
diff --git a/_source/plugins/dialogui/plugin.js b/_source/plugins/dialogui/plugin.js
index 35c2fdc..60f0c8b 100644
--- a/_source/plugins/dialogui/plugin.js
+++ b/_source/plugins/dialogui/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
*/
@@ -59,9 +59,9 @@ CKEDITOR.plugins.add( 'dialogui' );
return this.getValue() != this.getInitValue();
},
- reset : function()
+ reset : function( noChangeEvent )
{
- this.setValue( this.getInitValue() );
+ this.setValue( this.getInitValue(), noChangeEvent );
},
setInitValue : function()
@@ -124,7 +124,7 @@ CKEDITOR.plugins.add( 'dialogui' );
* @extends CKEDITOR.ui.dialog.uiElement
* @param {CKEDITOR.dialog} dialog
* Parent dialog object.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
*
* - label (Required) The label string.
@@ -204,7 +204,7 @@ CKEDITOR.plugins.add( 'dialogui' );
* @extends CKEDITOR.ui.dialog.labeledElement
* @param {CKEDITOR.dialog} dialog
* Parent dialog object.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
*
* - default (Optional) The default value.
@@ -293,7 +293,7 @@ CKEDITOR.plugins.add( 'dialogui' );
* @example
* @param {CKEDITOR.dialog} dialog
* Parent dialog object.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
*
* - rows (Optional) The number of rows displayed.
@@ -344,7 +344,7 @@ CKEDITOR.plugins.add( 'dialogui' );
* @example
* @param {CKEDITOR.dialog} dialog
* Parent dialog object.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
*
* - checked (Optional) Whether the checkbox is checked
@@ -380,7 +380,7 @@ CKEDITOR.plugins.add( 'dialogui' );
if ( elementDefinition[ 'default' ] )
attributes.checked = 'checked';
- if (typeof myDefinition.controlStyle != 'undefined')
+ if ( typeof myDefinition.controlStyle != 'undefined' )
myDefinition.style = myDefinition.controlStyle;
_.checkbox = new CKEDITOR.ui.dialog.uiElement( dialog, myDefinition, html, 'input', null, attributes );
@@ -400,7 +400,7 @@ CKEDITOR.plugins.add( 'dialogui' );
* @extends CKEDITOR.ui.dialog.labeledElement
* @param {CKEDITOR.dialog} dialog
* Parent dialog object.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
*
* - default (Required) The default value.
@@ -462,7 +462,7 @@ CKEDITOR.plugins.add( 'dialogui' );
cleanInnerDefinition( inputDefinition );
cleanInnerDefinition( labelDefinition );
- if (typeof inputDefinition.controlStyle != 'undefined')
+ if ( typeof inputDefinition.controlStyle != 'undefined' )
inputDefinition.style = inputDefinition.controlStyle;
children.push( new CKEDITOR.ui.dialog.uiElement( dialog, inputDefinition, inputHtml, 'input', null, inputAttributes ) );
@@ -486,7 +486,7 @@ CKEDITOR.plugins.add( 'dialogui' );
* @extends CKEDITOR.ui.dialog.uiElement
* @param {CKEDITOR.dialog} dialog
* Parent dialog object.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
*
* - label (Required) The button label.
@@ -569,7 +569,7 @@ CKEDITOR.plugins.add( 'dialogui' );
* @constructor
* @param {CKEDITOR.dialog} dialog
* Parent dialog object.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
*
* - default (Required) The default value.
@@ -622,7 +622,7 @@ CKEDITOR.plugins.add( 'dialogui' );
CKEDITOR.tools.htmlEncode( item[0] ) );
}
- if (typeof myDefinition.controlStyle != 'undefined')
+ if ( typeof myDefinition.controlStyle != 'undefined' )
myDefinition.style = myDefinition.controlStyle;
_.select = new CKEDITOR.ui.dialog.uiElement( dialog, myDefinition, html, 'select', null, attributes, innerHTML.join( '' ) );
@@ -639,7 +639,7 @@ CKEDITOR.plugins.add( 'dialogui' );
* @constructor
* @param {CKEDITOR.dialog} dialog
* Parent dialog object.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
*
* - validate (Optional) The validation function.
@@ -712,7 +712,7 @@ CKEDITOR.plugins.add( 'dialogui' );
* @constructor
* @param {CKEDITOR.dialog} dialog
* Parent dialog object.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
*
* - for (Required) The file input's page and element Id
@@ -765,7 +765,7 @@ CKEDITOR.plugins.add( 'dialogui' );
* @extends CKEDITOR.ui.dialog.uiElement
* @name CKEDITOR.ui.dialog.html
* @param {CKEDITOR.dialog} dialog Parent dialog object.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition Element definition.
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition Element definition.
* Accepted fields:
*
* - html (Required) HTML code of this element.
@@ -837,7 +837,7 @@ CKEDITOR.plugins.add( 'dialogui' );
* objects in childObjList.
* @param {Array} htmlList
* Array of HTML code that this element will output to.
- * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
* The element definition. Accepted fields:
*
* - label (Optional) The legend of the this fieldset.
@@ -931,7 +931,7 @@ CKEDITOR.plugins.add( 'dialogui' );
{
this._.disabled = false;
var element = this.getElement();
- element && element.removeClass( 'disabled' );
+ element && element.removeClass( 'cke_disabled' );
},
/**
@@ -941,7 +941,7 @@ CKEDITOR.plugins.add( 'dialogui' );
disable : function()
{
this._.disabled = true;
- this.getElement().addClass( 'disabled' );
+ this.getElement().addClass( 'cke_disabled' );
},
isVisible : function()
@@ -1061,7 +1061,7 @@ CKEDITOR.plugins.add( 'dialogui' );
setValue : function( value )
{
!value && ( value = '' );
- return CKEDITOR.ui.dialog.uiElement.prototype.setValue.call( this, value );
+ return CKEDITOR.ui.dialog.uiElement.prototype.setValue.apply( this, arguments );
},
keyboardFocusable : true
@@ -1156,11 +1156,12 @@ CKEDITOR.plugins.add( 'dialogui' );
* Sets the state of the checkbox.
* @example
* @param {Boolean} true to tick the checkbox, false to untick it.
+ * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element.
*/
- setValue : function( checked )
+ setValue : function( checked, noChangeEvent )
{
this.getInputElement().$.checked = checked;
- this.fire( 'change', { value : checked } );
+ !noChangeEvent && this.fire( 'change', { value : checked } );
},
/**
@@ -1222,14 +1223,15 @@ CKEDITOR.plugins.add( 'dialogui' );
* Checks one of the radio buttons in this button group.
* @example
* @param {String} value The value of the button to be chcked.
+ * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element.
*/
- setValue : function( value )
+ setValue : function( value, noChangeEvent )
{
var children = this._.children,
item;
for ( var i = 0 ; ( i < children.length ) && ( item = children[i] ) ; i++ )
item.getElement().$.checked = ( item.getValue() == value );
- this.fire( 'change', { value : value } );
+ !noChangeEvent && this.fire( 'change', { value : value } );
},
/**
@@ -1382,18 +1384,19 @@ CKEDITOR.plugins.add( 'dialogui' );
*/
reset : function()
{
- var frameElement = CKEDITOR.document.getById( this._.frameId ),
+ var _ = this._,
+ frameElement = CKEDITOR.document.getById( _.frameId ),
frameDocument = frameElement.getFrameDocument(),
- elementDefinition = this._.definition,
- buttons = this._.buttons,
+ elementDefinition = _.definition,
+ buttons = _.buttons,
callNumber = this.formLoadedNumber,
unloadNumber = this.formUnloadNumber,
- langDir = this._.dialog._.editor.lang.dir,
- langCode = this._.dialog._.editor.langCode;
+ langDir = _.dialog._.editor.lang.dir,
+ langCode = _.dialog._.editor.langCode;
// The callback function for the iframe, but we must call tools.addFunction only once
// so we store the function number in this.formLoadedNumber
- if (!callNumber)
+ if ( !callNumber )
{
callNumber = this.formLoadedNumber = CKEDITOR.tools.addFunction(
function()
@@ -1457,7 +1460,7 @@ CKEDITOR.plugins.add( 'dialogui' );
getValue : function()
{
- return this.getInputElement().$.value;
+ return this.getInputElement().$.value || '';
},
/***
@@ -1518,3 +1521,17 @@ CKEDITOR.plugins.add( 'dialogui' );
CKEDITOR.dialog.addUIElement( 'html', commonBuilder );
CKEDITOR.dialog.addUIElement( 'fieldset', containerBuilder );
})();
+
+/**
+ * Fired when the value of the uiElement is changed
+ * @name CKEDITOR.ui.dialog.uiElement#change
+ * @event
+ */
+
+/**
+ * Fired when the inner frame created by the element is ready.
+ * Each time the button is used or the dialog is loaded a new
+ * form might be created.
+ * @name CKEDITOR.ui.dialog.fileButton#formLoaded
+ * @event
+ */