JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.3
[ckeditor.git] / _source / plugins / find / dialogs / find.js
index 5fb9c6e..a84315e 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -71,8 +71,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                // Style object for highlights: (#5018)\r
                // 1. Defined as full match style to avoid compromising ordinary text color styles.\r
                // 2. Must be apply onto inner-most text to avoid conflicting with ordinary text color styles visually.\r
-               var highlightStyle = new CKEDITOR.style( CKEDITOR.tools.extend( { fullMatch : true, childRule : function(){ return 0; } },\r
-                       editor.config.find_highlight ) );\r
+               var highlightStyle = new CKEDITOR.style(\r
+                       CKEDITOR.tools.extend( { attributes : { 'data-cke-highlight': 1 }, fullMatch : 1, ignoreReadonly : 1, childRule : function(){ return 0; } },\r
+                       editor.config.find_highlight, true ) );\r
 \r
                /**\r
                 * Iterator which walk through the specified range char by char. By\r
@@ -646,29 +647,36 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        ]\r
                                                },\r
                                                {\r
-                                                       type : 'vbox',\r
-                                                       padding : 0,\r
+                                                       type : 'fieldset',\r
+                                                       label : CKEDITOR.tools.htmlEncode( lang.findOptions ),\r
+                                                       style : 'margin-top:29px',\r
                                                        children :\r
                                                        [\r
                                                                {\r
-                                                                       type : 'checkbox',\r
-                                                                       id : 'txtFindCaseChk',\r
-                                                                       isChanged : false,\r
-                                                                       style : 'margin-top:28px',\r
-                                                                       label : lang.matchCase\r
-                                                               },\r
-                                                               {\r
-                                                                       type : 'checkbox',\r
-                                                                       id : 'txtFindWordChk',\r
-                                                                       isChanged : false,\r
-                                                                       label : lang.matchWord\r
-                                                               },\r
-                                                               {\r
-                                                                       type : 'checkbox',\r
-                                                                       id : 'txtFindCyclic',\r
-                                                                       isChanged : false,\r
-                                                                       'default' : true,\r
-                                                                       label : lang.matchCyclic\r
+                                                                       type : 'vbox',\r
+                                                                       padding : 0,\r
+                                                                       children :\r
+                                                                       [\r
+                                                                               {\r
+                                                                                       type : 'checkbox',\r
+                                                                                       id : 'txtFindCaseChk',\r
+                                                                                       isChanged : false,\r
+                                                                                       label : lang.matchCase\r
+                                                                               },\r
+                                                                               {\r
+                                                                                       type : 'checkbox',\r
+                                                                                       id : 'txtFindWordChk',\r
+                                                                                       isChanged : false,\r
+                                                                                       label : lang.matchWord\r
+                                                                               },\r
+                                                                               {\r
+                                                                                       type : 'checkbox',\r
+                                                                                       id : 'txtFindCyclic',\r
+                                                                                       isChanged : false,\r
+                                                                                       'default' : true,\r
+                                                                                       label : lang.matchCyclic\r
+                                                                               }\r
+                                                                       ]\r
                                                                }\r
                                                        ]\r
                                                }\r
@@ -768,31 +776,35 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                        ]\r
                                                },\r
                                                {\r
-                                                       type : 'vbox',\r
-                                                       padding : 0,\r
+                                                       type : 'fieldset',\r
+                                                       label : CKEDITOR.tools.htmlEncode( lang.findOptions ),\r
                                                        children :\r
                                                        [\r
                                                                {\r
-                                                                       type : 'checkbox',\r
-                                                                       id : 'txtReplaceCaseChk',\r
-                                                                       isChanged : false,\r
-                                                                       label : lang\r
-                                                                               .matchCase\r
-                                                               },\r
-                                                               {\r
-                                                                       type : 'checkbox',\r
-                                                                       id : 'txtReplaceWordChk',\r
-                                                                       isChanged : false,\r
-                                                                       label : lang\r
-                                                                               .matchWord\r
-                                                               },\r
-                                                               {\r
-                                                                       type : 'checkbox',\r
-                                                                       id : 'txtReplaceCyclic',\r
-                                                                       isChanged : false,\r
-                                                                       'default' : true,\r
-                                                                       label : lang\r
-                                                                               .matchCyclic\r
+                                                                       type : 'vbox',\r
+                                                                       padding : 0,\r
+                                                                       children :\r
+                                                                       [\r
+                                                                               {\r
+                                                                                       type : 'checkbox',\r
+                                                                                       id : 'txtReplaceCaseChk',\r
+                                                                                       isChanged : false,\r
+                                                                                       label : lang.matchCase\r
+                                                                               },\r
+                                                                               {\r
+                                                                                       type : 'checkbox',\r
+                                                                                       id : 'txtReplaceWordChk',\r
+                                                                                       isChanged : false,\r
+                                                                                       label : lang.matchWord\r
+                                                                               },\r
+                                                                               {\r
+                                                                                       type : 'checkbox',\r
+                                                                                       id : 'txtReplaceCyclic',\r
+                                                                                       isChanged : false,\r
+                                                                                       'default' : true,\r
+                                                                                       label : lang.matchCyclic\r
+                                                                               }\r
+                                                                       ]\r
                                                                }\r
                                                        ]\r
                                                }\r
@@ -853,6 +865,14 @@ 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