JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.4
[ckeditor.git] / _source / plugins / find / dialogs / find.js
index 6711fe5..5f8c342 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
@@ -154,7 +155,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                if ( this._.matchWord && !currentTextNode\r
                                                         || this._.walker._.end )\r
                                                        break;\r
-                                       }\r
+                                               }\r
                                        // Found a fresh text node.\r
                                        this.textNode = currentTextNode;\r
                                        if ( currentTextNode )\r
@@ -494,8 +495,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                                                                tail = cursors[ cursors.length - 1 ],\r
                                                                head = cursors[ 0 ];\r
 \r
-                                                       var headWalker = new characterWalker( getRangeBeforeCursor( head ), true ),\r
-                                                               tailWalker = new characterWalker( getRangeAfterCursor( tail ), true );\r
+                                                       var rangeBefore = getRangeBeforeCursor( head ),\r
+                                                               rangeAfter = getRangeAfterCursor( tail );\r
+\r
+                                                       // The word boundary checks requires to trim the text nodes. (#9036)\r
+                                                       rangeBefore.trim();\r
+                                                       rangeAfter.trim();\r
+\r
+                                                       var headWalker = new characterWalker( rangeBefore, true ),\r
+                                                               tailWalker = new characterWalker( rangeAfter, true );\r
 \r
                                                        if ( ! ( isWordSeparator( headWalker.back().character )\r
                                                                                && isWordSeparator( tailWalker.next().character ) ) )\r
@@ -646,29 +654,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 +783,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