JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.1
[ckeditor.git] / _source / plugins / find / dialogs / find.js
index c0f7d37..6711fe5 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2010, 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
 \r
@@ -604,7 +604,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        title : lang.title,\r
                        resizable : CKEDITOR.DIALOG_RESIZE_NONE,\r
                        minWidth : 350,\r
-                       minHeight : 165,\r
+                       minHeight : 170,\r
                        buttons : [ CKEDITOR.dialog.cancelButton ],             // Cancel button only.\r
                        contents : [\r
                                {\r
@@ -628,6 +628,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                },\r
                                                                {\r
                                                                        type : 'button',\r
+                                                                       id : 'btnFind',\r
                                                                        align : 'left',\r
                                                                        style : 'width:100%',\r
                                                                        label : lang.find,\r
@@ -693,6 +694,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                },\r
                                                                {\r
                                                                        type : 'button',\r
+                                                                       id : 'btnFindReplace',\r
                                                                        align : 'left',\r
                                                                        style : 'width:100%',\r
                                                                        label : lang.replace,\r
@@ -726,6 +728,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                },\r
                                                                {\r
                                                                        type : 'button',\r
+                                                                       id : 'btnReplaceAll',\r
                                                                        align : 'left',\r
                                                                        style : 'width:100%',\r
                                                                        label : lang.replaceAll,\r
@@ -850,7 +853,17 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                // Establish initial searching start position.\r
                                finder.searchRange = getSearchRange();\r
 \r
+                               // Fill in the find field with selected text.\r
+                               var selectedText = this.getParentEditor().getSelection().getSelectedText(),\r
+                                       patternFieldId = ( startupPage == 'find' ? 'txtFindFind' : 'txtFindReplace' );\r
+\r
+                               var field = this.getContentElement( startupPage, patternFieldId );\r
+                               field.setValue( selectedText );\r
+                               field.select();\r
+\r
                                this.selectPage( startupPage );\r
+\r
+                               this[ ( startupPage == 'find' && this._.editor.readOnly? 'hide' : 'show' ) + 'Page' ]( 'replace');\r
                        },\r
                        onHide : function()\r
                        {\r