JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6
[ckeditor.git] / _source / plugins / dialog / plugin.js
index ce28799..dcb566b 100644 (file)
@@ -859,6 +859,16 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                        return function(){ this.foreach( fn ); return this; };\r
                })(),\r
 \r
+\r
+               /**\r
+                * Calls the {@link CKEDITOR.dialog.definition.uiElement#setup} method of each of the UI elements, with the arguments passed through it.\r
+                * It is usually being called when the dialog is opened, to put the initial value inside the field.\r
+                * @example\r
+                * dialogObj.setupContent();\r
+                * @example\r
+                * var timestamp = ( new Date() ).valueOf();\r
+                * dialogObj.setupContent( timestamp );\r
+                */\r
                setupContent : function()\r
                {\r
                        var args = arguments;\r
@@ -869,6 +879,15 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                                });\r
                },\r
 \r
+               /**\r
+                * Calls the {@link CKEDITOR.dialog.definition.uiElement#commit} method of each of the UI elements, with the arguments passed through it.\r
+                * It is usually being called when the user confirms the dialog, to process the values.\r
+                * @example\r
+                * dialogObj.commitContent();\r
+                * @example\r
+                * var timestamp = ( new Date() ).valueOf();\r
+                * dialogObj.commitContent( timestamp );\r
+                */\r
                commitContent : function()\r
                {\r
                        var args = arguments;\r
@@ -1139,6 +1158,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                 * @param {String} pageId id of dialog page.\r
                 * @param {String} elementId id of UI element.\r
                 * @example\r
+                * dialogObj.getContentElement( 'tabId', 'elementId' ).setValue( 'Example' );\r
                 * @returns {CKEDITOR.ui.dialog.uiElement} The dialog UI element.\r
                 */\r
                getContentElement : function( pageId, elementId )\r
@@ -1152,6 +1172,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                 * @param {String} pageId id of dialog page.\r
                 * @param {String} elementId id of UI element.\r
                 * @example\r
+                * alert( dialogObj.getValueOf( 'tabId', 'elementId' ) );\r
                 * @returns {Object} The value of the UI element.\r
                 */\r
                getValueOf : function( pageId, elementId )\r
@@ -1165,6 +1186,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                 * @param {String} elementId id of the UI element.\r
                 * @param {Object} value The new value of the UI element.\r
                 * @example\r
+                * dialogObj.setValueOf( 'tabId', 'elementId', 'Example' );\r
                 */\r
                setValueOf : function( pageId, elementId, value )\r
                {\r
@@ -1905,6 +1927,11 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
        var covers = {},\r
                currentCover;\r
 \r
+       function cancelEvent( ev )\r
+       {\r
+               ev.data.preventDefault(1);\r
+       }\r
+\r
        function showCover( editor )\r
        {\r
                var win = CKEDITOR.document.getWindow();\r
@@ -1965,6 +1992,10 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                        coverElement = CKEDITOR.dom.element.createFromHtml( html.join( '' ) );\r
                        coverElement.setOpacity( backgroundCoverOpacity != undefined ? backgroundCoverOpacity : 0.5 );\r
 \r
+                       coverElement.on( 'keydown', cancelEvent );\r
+                       coverElement.on( 'keypress', cancelEvent );\r
+                       coverElement.on( 'keyup', cancelEvent );\r
+\r
                        coverElement.appendTo( CKEDITOR.document.getBody() );\r
                        covers[ coverKey ] = coverElement;\r
                }\r
@@ -2210,6 +2241,9 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                                        classes[ 'cke_dialog_ui_' + elementDefinition.type ] = 1;\r
                                if ( elementDefinition.className )\r
                                        classes[ elementDefinition.className ] = 1;\r
+                               if ( elementDefinition.disabled )\r
+                                       classes[ 'cke_disabled' ] = 1;\r
+\r
                                var attributeClasses = ( attributes['class'] && attributes['class'].split ) ? attributes['class'].split( ' ' ) : [];\r
                                for ( i = 0 ; i < attributeClasses.length ; i++ )\r
                                {\r
@@ -2694,7 +2728,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                 */\r
                disable : function()\r
                {\r
-                       var element = this.getInputElement();\r
+                       var element = this.getElement();\r
                        element.setAttribute( 'disabled', 'true' );\r
                        element.addClass( 'cke_disabled' );\r
                },\r
@@ -2705,7 +2739,7 @@ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
                 */\r
                enable : function()\r
                {\r
-                       var element = this.getInputElement();\r
+                       var element = this.getElement();\r
                        element.removeAttribute( 'disabled' );\r
                        element.removeClass( 'cke_disabled' );\r
                },\r