X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Ffind%2Fdialogs%2Ffind.js;h=a84315e9fea45c4c15f81dd84616f71237986a66;hb=2f22c0c38f17e75be5541089076885442aaa2377;hp=ccf4cf62da0abb6646ddc954f80b261681c5c6e3;hpb=48b1db88210b4160dce439c6e3e32e14af8c106b;p=ckeditor.git diff --git a/_source/plugins/find/dialogs/find.js b/_source/plugins/find/dialogs/find.js index ccf4cf6..a84315e 100644 --- a/_source/plugins/find/dialogs/find.js +++ b/_source/plugins/find/dialogs/find.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -71,8 +71,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Style object for highlights: (#5018) // 1. Defined as full match style to avoid compromising ordinary text color styles. // 2. Must be apply onto inner-most text to avoid conflicting with ordinary text color styles visually. - var highlightStyle = new CKEDITOR.style( CKEDITOR.tools.extend( { fullMatch : true, childRule : function(){ return 0; } }, - editor.config.find_highlight ) ); + var highlightStyle = new CKEDITOR.style( + CKEDITOR.tools.extend( { attributes : { 'data-cke-highlight': 1 }, fullMatch : 1, ignoreReadonly : 1, childRule : function(){ return 0; } }, + editor.config.find_highlight, true ) ); /** * Iterator which walk through the specified range char by char. By @@ -628,6 +629,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license }, { type : 'button', + id : 'btnFind', align : 'left', style : 'width:100%', label : lang.find, @@ -645,29 +647,36 @@ For licensing, see LICENSE.html or http://ckeditor.com/license ] }, { - type : 'vbox', - padding : 0, + type : 'fieldset', + label : CKEDITOR.tools.htmlEncode( lang.findOptions ), + style : 'margin-top:29px', children : [ { - type : 'checkbox', - id : 'txtFindCaseChk', - isChanged : false, - style : 'margin-top:28px', - label : lang.matchCase - }, - { - type : 'checkbox', - id : 'txtFindWordChk', - isChanged : false, - label : lang.matchWord - }, - { - type : 'checkbox', - id : 'txtFindCyclic', - isChanged : false, - 'default' : true, - label : lang.matchCyclic + type : 'vbox', + padding : 0, + children : + [ + { + type : 'checkbox', + id : 'txtFindCaseChk', + isChanged : false, + label : lang.matchCase + }, + { + type : 'checkbox', + id : 'txtFindWordChk', + isChanged : false, + label : lang.matchWord + }, + { + type : 'checkbox', + id : 'txtFindCyclic', + isChanged : false, + 'default' : true, + label : lang.matchCyclic + } + ] } ] } @@ -693,6 +702,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license }, { type : 'button', + id : 'btnFindReplace', align : 'left', style : 'width:100%', label : lang.replace, @@ -726,6 +736,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license }, { type : 'button', + id : 'btnReplaceAll', align : 'left', style : 'width:100%', label : lang.replaceAll, @@ -765,31 +776,35 @@ For licensing, see LICENSE.html or http://ckeditor.com/license ] }, { - type : 'vbox', - padding : 0, + type : 'fieldset', + label : CKEDITOR.tools.htmlEncode( lang.findOptions ), children : [ { - type : 'checkbox', - id : 'txtReplaceCaseChk', - isChanged : false, - label : lang - .matchCase - }, - { - type : 'checkbox', - id : 'txtReplaceWordChk', - isChanged : false, - label : lang - .matchWord - }, - { - type : 'checkbox', - id : 'txtReplaceCyclic', - isChanged : false, - 'default' : true, - label : lang - .matchCyclic + type : 'vbox', + padding : 0, + children : + [ + { + type : 'checkbox', + id : 'txtReplaceCaseChk', + isChanged : false, + label : lang.matchCase + }, + { + type : 'checkbox', + id : 'txtReplaceWordChk', + isChanged : false, + label : lang.matchWord + }, + { + type : 'checkbox', + id : 'txtReplaceCyclic', + isChanged : false, + 'default' : true, + label : lang.matchCyclic + } + ] } ] } @@ -850,7 +865,17 @@ For licensing, see LICENSE.html or http://ckeditor.com/license // Establish initial searching start position. finder.searchRange = getSearchRange(); + // Fill in the find field with selected text. + var selectedText = this.getParentEditor().getSelection().getSelectedText(), + patternFieldId = ( startupPage == 'find' ? 'txtFindFind' : 'txtFindReplace' ); + + var field = this.getContentElement( startupPage, patternFieldId ); + field.setValue( selectedText ); + field.select(); + this.selectPage( startupPage ); + + this[ ( startupPage == 'find' && this._.editor.readOnly? 'hide' : 'show' ) + 'Page' ]( 'replace'); }, onHide : function() {