JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.1
[ckeditor.git] / _source / plugins / forms / dialogs / select.js
index c8b43d3..aee101b 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 CKEDITOR.dialog.add( 'select', function( editor )\r
@@ -73,7 +73,7 @@ CKEDITOR.dialog.add( 'select', function( editor )
        function removeAllOptions( combo )\r
        {\r
                combo = getSelect( combo );\r
-               while( combo.getChild( 0 ) && combo.getChild( 0 ).remove() )\r
+               while ( combo.getChild( 0 ) && combo.getChild( 0 ).remove() )\r
                { /*jsl:pass*/ }\r
        }\r
        // Moves the selected option by a number of steps (also negative).\r
@@ -160,7 +160,18 @@ CKEDITOR.dialog.add( 'select', function( editor )
                        this.commitContent( element );\r
 \r
                        if ( isInsertMode )\r
+                       {\r
                                editor.insertElement( element );\r
+                               if ( CKEDITOR.env.ie )\r
+                               {\r
+                                       var sel = editor.getSelection(),\r
+                                               bms = sel.createBookmarks();\r
+                                       setTimeout(function()\r
+                                       {\r
+                                               sel.selectBookmarks( bms );\r
+                                       }, 0 );\r
+                               }\r
+                       }\r
                },\r
                contents : [\r
                        {\r
@@ -177,16 +188,15 @@ CKEDITOR.dialog.add( 'select', function( editor )
                                                label : editor.lang.common.name,\r
                                                'default' : '',\r
                                                accessKey : 'N',\r
-                                               align : 'center',\r
                                                style : 'width:350px',\r
                                                setup : function( name, element )\r
                                                {\r
                                                        if ( name == 'clear' )\r
-                                                               this.setValue( '' );\r
+                                                               this.setValue( this[ 'default' ] || '' );\r
                                                        else if ( name == 'select' )\r
                                                        {\r
                                                                this.setValue(\r
-                                                                               element.getAttribute( '_cke_saved_name' ) ||\r
+                                                                               element.data( 'cke-saved-name' ) ||\r
                                                                                element.getAttribute( 'name' ) ||\r
                                                                                '' );\r
                                                        }\r
@@ -194,10 +204,10 @@ CKEDITOR.dialog.add( 'select', function( editor )
                                                commit : function( element )\r
                                                {\r
                                                        if ( this.getValue() )\r
-                                                               element.setAttribute( '_cke_saved_name', this.getValue() );\r
+                                                               element.data( 'cke-saved-name', this.getValue() );\r
                                                        else\r
                                                        {\r
-                                                               element.removeAttribute( '_cke_saved_name' ) ;\r
+                                                               element.data( 'cke-saved-name', false );\r
                                                                element.removeAttribute( 'name' );\r
                                                        }\r
                                                }\r
@@ -226,13 +236,11 @@ CKEDITOR.dialog.add( 'select', function( editor )
                                        {\r
                                                type : 'hbox',\r
                                                widths : [ '175px', '170px' ],\r
-                                               align : 'center',\r
                                                children :\r
                                                [\r
                                                        {\r
                                                                id : 'txtSize',\r
                                                                type : 'text',\r
-                                                               align : 'center',\r
                                                                labelLayout : 'horizontal',\r
                                                                label : editor.lang.select.size,\r
                                                                'default' : '',\r
@@ -271,7 +279,6 @@ CKEDITOR.dialog.add( 'select', function( editor )
                                        {\r
                                                type : 'hbox',\r
                                                widths : [ '115px', '115px' ,'100px' ],\r
-                                               align : 'top',\r
                                                children :\r
                                                [\r
                                                        {\r
@@ -397,6 +404,7 @@ CKEDITOR.dialog.add( 'select', function( editor )
                                                                [\r
                                                                        {\r
                                                                                type : 'button',\r
+                                                                               id : 'btnAdd',\r
                                                                                style : '',\r
                                                                                label : editor.lang.select.btnAdd,\r
                                                                                title : editor.lang.select.btnAdd,\r
@@ -420,6 +428,7 @@ CKEDITOR.dialog.add( 'select', function( editor )
                                                                        },\r
                                                                        {\r
                                                                                type : 'button',\r
+                                                                               id : 'btnModify',\r
                                                                                label : editor.lang.select.btnModify,\r
                                                                                title : editor.lang.select.btnModify,\r
                                                                                style : 'width:100%;',\r
@@ -442,6 +451,7 @@ CKEDITOR.dialog.add( 'select', function( editor )
                                                                        },\r
                                                                        {\r
                                                                                type : 'button',\r
+                                                                               id : 'btnUp',\r
                                                                                style : 'width:100%;',\r
                                                                                label : editor.lang.select.btnUp,\r
                                                                                title : editor.lang.select.btnUp,\r
@@ -458,6 +468,7 @@ CKEDITOR.dialog.add( 'select', function( editor )
                                                                        },\r
                                                                        {\r
                                                                                type : 'button',\r
+                                                                               id : 'btnDown',\r
                                                                                style : 'width:100%;',\r
                                                                                label : editor.lang.select.btnDown,\r
                                                                                title : editor.lang.select.btnDown,\r
@@ -483,6 +494,7 @@ CKEDITOR.dialog.add( 'select', function( editor )
                                                [\r
                                                        {\r
                                                                type : 'button',\r
+                                                               id : 'btnSetValue',\r
                                                                label : editor.lang.select.btnSetValue,\r
                                                                title : editor.lang.select.btnSetValue,\r
                                                                onClick : function()\r
@@ -496,6 +508,7 @@ CKEDITOR.dialog.add( 'select', function( editor )
                                                        },\r
                                                        {\r
                                                                type : 'button',\r
+                                                               id : 'btnDelete',\r
                                                                label : editor.lang.select.btnDelete,\r
                                                                title : editor.lang.select.btnDelete,\r
                                                                onClick : function()\r