dojox/editor/plugins/FindReplace.js

  • Provides:

    • dojox.editor.plugins.FindReplace
  • dojox.editor.plugins._FindReplaceCloseBox

    • type
      Function
    • chains:
      • dijit._Widget: (prototype)
      • dijit._Widget: (call)
      • dijit._Templated: (call)
    • mixins:
      • dijit._Templated.prototype: (prototype)
    • summary
      Base class for widgets that contains a button labeled X
      to close the tool bar.
  • dojox.editor.plugins._FindReplaceCloseBox.btnId

    • summary
  • dojox.editor.plugins._FindReplaceCloseBox.widget

    • summary
  • dojox.editor.plugins._FindReplaceCloseBox.widgetsInTemplate

    • summary
  • dojox.editor.plugins._FindReplaceCloseBox.templateString

    • summary
  • dojox.editor.plugins._FindReplaceCloseBox.postMixInProperties

    • type
      Function
    • source: [view]
      define("dojox/editor/plugins/FindReplace", ["dojo", "dijit", "dojox", "dojo/string", "dijit/TooltipDialog", "dijit/Toolbar", "dijit/form/CheckBox", "dijit/form/TextBox", "dijit/_editor/_Plugin", "dijit/form/Button", "dojox/editor/plugins/ToolbarLineBreak", "dojo/i18n", "i18n!dojox/editor/plugins/nls/FindReplace"], function(dojo, dijit, dojox) {


      dojo.experimental("dojox.editor.plugins.FindReplace");


      dojo.declare("dojox.editor.plugins._FindReplaceCloseBox", [dijit._Widget, dijit._Templated], {
       // summary:
       //  Base class for widgets that contains a button labeled X
       //  to close the tool bar.

       
       btnId: "",
       widget: null,
       widgetsInTemplate: true,

       
       templateString:
        "" +
         "" +
        "
      ",

       
       postMixInProperties: function(){
        // Set some substitution variables used in the template
        this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
        this.btnId = this.id + "_close";
        this.inherited(arguments);
    • summary
  • dojox.editor.plugins._FindReplaceCloseBox.startup

    • type
      Function
    • source: [view]
        this.connect(this.button, "onClick", "onClick");
    • summary
  • dojox.editor.plugins._FindReplaceCloseBox.onClick

    • type
      Function
    • source: [view]
    • summary
  • dojox.editor.plugins._FindReplaceCloseBox.id

    • summary
  • dojox.editor.plugins._FindReplaceTextBox

    • type
      Function
    • chains:
      • dijit._Widget: (prototype)
      • dijit._Widget: (call)
      • dijit._Templated: (call)
    • mixins:
      • dijit._Templated.prototype: (prototype)
    • summary
      Base class for widgets that contains a label (like "Font:")
      and a TextBox to pick a value.
      Used as Toolbar entry.
  • dojox.editor.plugins._FindReplaceTextBox.textId

    • tags: public
    • type
      String
    • summary
      The id of the enhanced textbox
  • dojox.editor.plugins._FindReplaceTextBox.label

    • tags: public
    • type
      String
    • summary
      The label of the enhanced textbox
      
      
      tooltip: [public] String
      The tooltip of the enhanced textbox when the mouse is hovering on it
  • dojox.editor.plugins._FindReplaceTextBox.toolTip

    • summary
  • dojox.editor.plugins._FindReplaceTextBox.widget

    • summary
  • dojox.editor.plugins._FindReplaceTextBox.widgetsInTemplate

    • summary
  • dojox.editor.plugins._FindReplaceTextBox.templateString

    • summary
  • dojox.editor.plugins._FindReplaceTextBox.postMixInProperties

    • type
      Function
    • source: [view]
      define("dojox/editor/plugins/FindReplace", ["dojo", "dijit", "dojox", "dojo/string", "dijit/TooltipDialog", "dijit/Toolbar", "dijit/form/CheckBox", "dijit/form/TextBox", "dijit/_editor/_Plugin", "dijit/form/Button", "dojox/editor/plugins/ToolbarLineBreak", "dojo/i18n", "i18n!dojox/editor/plugins/nls/FindReplace"], function(dojo, dijit, dojox) {


      dojo.experimental("dojox.editor.plugins.FindReplace");


      dojo.declare("dojox.editor.plugins._FindReplaceCloseBox", [dijit._Widget, dijit._Templated], {
       // summary:
       //  Base class for widgets that contains a button labeled X
       //  to close the tool bar.

       
       btnId: "",
       widget: null,
       widgetsInTemplate: true,

       
       templateString:
        "" +
         "" +
        "
      ",

       
       postMixInProperties: function(){
        // Set some substitution variables used in the template
        this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
        this.btnId = this.id + "_close";
        this.inherited(arguments);
       },
       startup: function(){
        this.connect(this.button, "onClick", "onClick");
       },
       onClick: function(){
       }
      });




      dojo.declare("dojox.editor.plugins._FindReplaceTextBox",
       [dijit._Widget, dijit._Templated],{
       // summary:
       //  Base class for widgets that contains a label (like "Font:")
       //  and a TextBox to pick a value.
       //  Used as Toolbar entry.


       // textId: [public] String
       //  The id of the enhanced textbox
       textId: "",

       
       // label: [public] String
       //  The label of the enhanced textbox
       label: "",

       
       // tooltip: [public] String
       //  The tooltip of the enhanced textbox when the mouse is hovering on it
       toolTip: "",
       widget: null,
       widgetsInTemplate: true,


       templateString:
        "   "title='${tooltip}' tabindex='-1'>" +
         "" +
         "     "tabIndex='0' id='${textId}' dojoAttachPoint='textBox, focusNode' value='' dojoAttachEvent='onKeyPress: _onKeyPress'/>" +
        "
      ",


       postMixInProperties: function(){
        // Set some substitution variables used in the template
        this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
        this.textId = this.id + "_text";

        
        this.inherited(arguments);
    • summary
  • dojox.editor.plugins._FindReplaceTextBox.postCreate

    • type
      Function
    • source: [view]
        this.textBox.set("value", "");
        this.disabled = this.textBox.get("disabled");
        this.connect(this.textBox, "onChange", "onChange");
    • summary
  • dojox.editor.plugins._FindReplaceTextBox._setValueAttr

    • type
      Function
    • parameters:
      • value: (typeof String)
    • source: [view]
      define("dojox/editor/plugins/FindReplace", ["dojo", "dijit", "dojox", "dojo/string", "dijit/TooltipDialog", "dijit/Toolbar", "dijit/form/CheckBox", "dijit/form/TextBox", "dijit/_editor/_Plugin", "dijit/form/Button", "dojox/editor/plugins/ToolbarLineBreak", "dojo/i18n", "i18n!dojox/editor/plugins/nls/FindReplace"], function(dojo, dijit, dojox) {


      dojo.experimental("dojox.editor.plugins.FindReplace");


      dojo.declare("dojox.editor.plugins._FindReplaceCloseBox", [dijit._Widget, dijit._Templated], {
       // summary:
       //  Base class for widgets that contains a button labeled X
       //  to close the tool bar.

       
       btnId: "",
       widget: null,
       widgetsInTemplate: true,

       
       templateString:
        "" +
         "" +
        "
      ",

       
       postMixInProperties: function(){
        // Set some substitution variables used in the template
        this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
        this.btnId = this.id + "_close";
        this.inherited(arguments);
       },
       startup: function(){
        this.connect(this.button, "onClick", "onClick");
       },
       onClick: function(){
       }
      });




      dojo.declare("dojox.editor.plugins._FindReplaceTextBox",
       [dijit._Widget, dijit._Templated],{
       // summary:
       //  Base class for widgets that contains a label (like "Font:")
       //  and a TextBox to pick a value.
       //  Used as Toolbar entry.


       // textId: [public] String
       //  The id of the enhanced textbox
       textId: "",

       
       // label: [public] String
       //  The label of the enhanced textbox
       label: "",

       
       // tooltip: [public] String
       //  The tooltip of the enhanced textbox when the mouse is hovering on it
       toolTip: "",
       widget: null,
       widgetsInTemplate: true,


       templateString:
        "   "title='${tooltip}' tabindex='-1'>" +
         "" +
         "     "tabIndex='0' id='${textId}' dojoAttachPoint='textBox, focusNode' value='' dojoAttachEvent='onKeyPress: _onKeyPress'/>" +
        "
      ",


       postMixInProperties: function(){
        // Set some substitution variables used in the template
        this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
        this.textId = this.id + "_text";

        
        this.inherited(arguments);
       },


       postCreate: function(){
        this.textBox.set("value", "");
        this.disabled = this.textBox.get("disabled");
        this.connect(this.textBox, "onChange", "onChange");
       },


       _setValueAttr: function(/*String*/ value){
        //If the value is not a permitted value, just set empty string to prevent showing the warning icon
        this.value = value;
        this.textBox.set("value", value);
    • summary
  • dojox.editor.plugins._FindReplaceTextBox.focus

    • type
      Function
    • source: [view]
        this.textBox.focus();
    • summary
  • dojox.editor.plugins._FindReplaceTextBox._setDisabledAttr

    • type
      Function
    • parameters:
      • value: (typeof Boolean)
        The boolean value to indicate if the textbox should be disabled or not
    • source: [view]
        this.disabled = value;
        this.textBox.set("disabled", value);
    • summary
      Over-ride for the textbox's 'disabled' attribute so that it can be
      disabled programmatically.
    • tags:
  • dojox.editor.plugins._FindReplaceTextBox.onChange

    • type
      Function
    • parameters:
      • val: (typeof String)
    • source: [view]
        this.value= val;
    • summary
      Stub function for change events on the box.
    • tags:
  • dojox.editor.plugins._FindReplaceTextBox._onKeyPress

    • type
      Function
    • parameters:
      • evt: (typeof Event)
        object passed to this handler
    • source: [view]
        var start = 0;
        var end = 0;

        
        // If CTRL, ALT or SHIFT is not held on
        if(evt.target && !evt.ctrlKey && !evt.altKey && !evt.shiftKey){
         if(evt.keyCode == dojo.keys.LEFT_ARROW){
          start = evt.target.selectionStart;
          end = evt.target.selectionEnd;
          if(start < end){
           dijit.selectInputText(evt.target, start, start);
           dojo.stopEvent(evt);
          }
         }else if(evt.keyCode == dojo.keys.RIGHT_ARROW){
          start = evt.target.selectionStart;
          end = evt.target.selectionEnd;
          if(start < end){
           dijit.selectInputText(evt.target, end, end);
           dojo.stopEvent(evt);
          }
         }
        }
    • summary
      Handle the arrow key events
    • tags:
  • dojox.editor.plugins._FindReplaceTextBox.id

    • summary
  • dojox.editor.plugins._FindReplaceTextBox.disabled

    • summary
  • dojox.editor.plugins._FindReplaceTextBox.value

    • summary
  • dojox.editor.plugins._FindReplaceCheckBox

    • type
      Function
    • chains:
      • dijit._Widget: (prototype)
      • dijit._Widget: (call)
      • dijit._Templated: (call)
    • mixins:
      • dijit._Templated.prototype: (prototype)
    • summary
      Base class for widgets that contains a label (like &quot;Match case: &quot;)
      and a checkbox to indicate if it is checked or not.
      Used as Toolbar entry.
  • dojox.editor.plugins._FindReplaceCheckBox.checkId

    • tags: public
    • type
      String
    • summary
      The id of the enhanced checkbox
  • dojox.editor.plugins._FindReplaceCheckBox.label

    • tags: public
    • type
      String
    • summary
      The label of the enhanced checkbox
  • dojox.editor.plugins._FindReplaceCheckBox.tooltip

    • tags: public
    • type
      String
    • summary
      The tooltip of the enhanced checkbox when the mouse is hovering it
  • dojox.editor.plugins._FindReplaceCheckBox.widget

    • summary
  • dojox.editor.plugins._FindReplaceCheckBox.widgetsInTemplate

    • summary
  • dojox.editor.plugins._FindReplaceCheckBox.templateString

    • summary
  • dojox.editor.plugins._FindReplaceCheckBox.postMixInProperties

    • type
      Function
    • source: [view]
      define("dojox/editor/plugins/FindReplace", ["dojo", "dijit", "dojox", "dojo/string", "dijit/TooltipDialog", "dijit/Toolbar", "dijit/form/CheckBox", "dijit/form/TextBox", "dijit/_editor/_Plugin", "dijit/form/Button", "dojox/editor/plugins/ToolbarLineBreak", "dojo/i18n", "i18n!dojox/editor/plugins/nls/FindReplace"], function(dojo, dijit, dojox) {


      dojo.experimental("dojox.editor.plugins.FindReplace");


      dojo.declare("dojox.editor.plugins._FindReplaceCloseBox", [dijit._Widget, dijit._Templated], {
       // summary:
       //  Base class for widgets that contains a button labeled X
       //  to close the tool bar.

       
       btnId: "",
       widget: null,
       widgetsInTemplate: true,

       
       templateString:
        "" +
         "" +
        "
      ",

       
       postMixInProperties: function(){
        // Set some substitution variables used in the template
        this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
        this.btnId = this.id + "_close";
        this.inherited(arguments);
       },
       startup: function(){
        this.connect(this.button, "onClick", "onClick");
       },
       onClick: function(){
       }
      });




      dojo.declare("dojox.editor.plugins._FindReplaceTextBox",
       [dijit._Widget, dijit._Templated],{
       // summary:
       //  Base class for widgets that contains a label (like "Font:")
       //  and a TextBox to pick a value.
       //  Used as Toolbar entry.


       // textId: [public] String
       //  The id of the enhanced textbox
       textId: "",

       
       // label: [public] String
       //  The label of the enhanced textbox
       label: "",

       
       // tooltip: [public] String
       //  The tooltip of the enhanced textbox when the mouse is hovering on it
       toolTip: "",
       widget: null,
       widgetsInTemplate: true,


       templateString:
        "   "title='${tooltip}' tabindex='-1'>" +
         "" +
         "     "tabIndex='0' id='${textId}' dojoAttachPoint='textBox, focusNode' value='' dojoAttachEvent='onKeyPress: _onKeyPress'/>" +
        "
      ",


       postMixInProperties: function(){
        // Set some substitution variables used in the template
        this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
        this.textId = this.id + "_text";

        
        this.inherited(arguments);
       },


       postCreate: function(){
        this.textBox.set("value", "");
        this.disabled = this.textBox.get("disabled");
        this.connect(this.textBox, "onChange", "onChange");
       },


       _setValueAttr: function(/*String*/ value){
        //If the value is not a permitted value, just set empty string to prevent showing the warning icon
        this.value = value;
        this.textBox.set("value", value);
       },


       focus: function(){
        this.textBox.focus();
       },


       _setDisabledAttr: function(/*Boolean*/ value){
        // summary:
        //  Over-ride for the textbox's 'disabled' attribute so that it can be
        //  disabled programmatically.
        // value:
        //  The boolean value to indicate if the textbox should be disabled or not
        // tags:
        //  private
        this.disabled = value;
        this.textBox.set("disabled", value);
       },


       onChange: function(/*String*/ val){
        // summary:
        //  Stub function for change events on the box.
        // tags:
        //  public
        this.value= val;
       },

       
       _onKeyPress: function(/*Event*/ evt){
        // summary:
        //  Handle the arrow key events
        // evt:
        //  Event object passed to this handler
        // tags:
        //  private
        var start = 0;
        var end = 0;

        
        // If CTRL, ALT or SHIFT is not held on
        if(evt.target && !evt.ctrlKey && !evt.altKey && !evt.shiftKey){
         if(evt.keyCode == dojo.keys.LEFT_ARROW){
          start = evt.target.selectionStart;
          end = evt.target.selectionEnd;
          if(start < end){
           dijit.selectInputText(evt.target, start, start);
           dojo.stopEvent(evt);
          }
         }else if(evt.keyCode == dojo.keys.RIGHT_ARROW){
          start = evt.target.selectionStart;
          end = evt.target.selectionEnd;
          if(start < end){
           dijit.selectInputText(evt.target, end, end);
           dojo.stopEvent(evt);
          }
         }
        }
       }
      });




      dojo.declare("dojox.editor.plugins._FindReplaceCheckBox",
       [dijit._Widget, dijit._Templated],{
       // summary:
       //  Base class for widgets that contains a label (like "Match case: ")
       //  and a checkbox to indicate if it is checked or not.
       //  Used as Toolbar entry.


       // checkId: [public] String
       //  The id of the enhanced checkbox
       checkId: "",

       
       // label: [public] String
       //  The label of the enhanced checkbox
       label: "",

       
       // tooltip: [public] String
       //  The tooltip of the enhanced checkbox when the mouse is hovering it
       tooltip: "",

       
       widget: null,
       widgetsInTemplate: true,


       templateString:
        "   "class='dijit dijitReset dijitInline dijitEditorFindReplaceCheckBox' title='${tooltip}' >" +
         "     "tabIndex='0' id='${checkId}' dojoAttachPoint='checkBox, focusNode' value=''/>" +
         "" +
        "
      ",


       postMixInProperties: function(){
        // Set some substitution variables used in the template
        this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
        this.checkId = this.id + "_check";
        this.inherited(arguments);
    • summary
  • dojox.editor.plugins._FindReplaceCheckBox.postCreate

    • type
      Function
    • source: [view]
        this.checkBox.set("checked", false);
        this.disabled = this.checkBox.get("disabled");
        this.checkBox.isFocusable = function(){ return false; };
    • summary
  • dojox.editor.plugins._FindReplaceCheckBox._setValueAttr

    • type
      Function
    • parameters:
      • value: (typeof Boolean)
    • source: [view]
        this.checkBox.set('value', value);
    • summary
      Passthrough for checkbox.
    • tags:
  • dojox.editor.plugins._FindReplaceCheckBox._getValueAttr

    • type
      Function
    • source: [view]
        return this.checkBox.get('value');
    • summary
      Passthrough for checkbox.
    • tags:
  • dojox.editor.plugins._FindReplaceCheckBox.focus

    • type
      Function
    • source: [view]
        this.checkBox.focus();
    • summary
      Handle the focus event when this widget gets focused
    • tags:
  • dojox.editor.plugins._FindReplaceCheckBox._setDisabledAttr

    • type
      Function
    • parameters:
      • value: (typeof Boolean)
        The flag that indicates if the checkbox is disabled or not.
    • source: [view]
        this.disabled = value;
        this.checkBox.set("disabled", value);
    • summary
      Over-ride for the button's 'disabled' attribute so that it can be
      disabled programmatically.
    • tags:
  • dojox.editor.plugins._FindReplaceCheckBox.id

    • summary
  • dojox.editor.plugins._FindReplaceCheckBox.disabled

    • summary
  • dojox.editor.plugins._FindReplaceCheckBox.checkBox.isFocusable

    • summary
  • dojox.editor.plugins._FindReplaceCheckBox.postCreate.checkBox.isFocusable

    • type
      Function
    • source: [view]
        this.checkBox.isFocusable = function(){ return false;
    • summary
  • dojox.editor.plugins._FindReplaceToolbar

    • type
      Function
    • chains:
      • dijit.Toolbar: (prototype)
      • dijit.Toolbar: (call)
    • summary
      A toolbar that derived from dijit.Toolbar, which
      eliminates some unnecessary event response such as LEFT_ARROW pressing
      and click bubbling.
  • dojox.editor.plugins._FindReplaceToolbar.postCreate

    • type
      Function
    • source: [view]
        this.connectKeyNavHandlers([], []); // Prevent arrow key navigation
        this.connect(this.containerNode, "onclick", "_onToolbarEvent");
        this.connect(this.containerNode, "onkeydown", "_onToolbarEvent");
        dojo.addClass(this.domNode, "dijitToolbar");
    • summary
  • dojox.editor.plugins._FindReplaceToolbar.addChild

    • type
      Function
    • parameters:
      • widget: (typeof dijit._Widget)
      • insertIndex: (typeof int)
    • source: [view]
        dijit._KeyNavContainer.superclass.addChild.apply(this, arguments);
    • summary
      Add a child to our _Container and prevent the default
      arrow key navigation function. This function may bring in
      side effect
    • chains:
      • dijit._KeyNavContainer.superclass.addChild: (call)
  • dojox.editor.plugins._FindReplaceToolbar._onToolbarEvent

    • type
      Function
    • parameters:
      • evt: (typeof Event)
    • source: [view]
      define("dojox/editor/plugins/FindReplace", ["dojo", "dijit", "dojox", "dojo/string", "dijit/TooltipDialog", "dijit/Toolbar", "dijit/form/CheckBox", "dijit/form/TextBox", "dijit/_editor/_Plugin", "dijit/form/Button", "dojox/editor/plugins/ToolbarLineBreak", "dojo/i18n", "i18n!dojox/editor/plugins/nls/FindReplace"], function(dojo, dijit, dojox) {


      dojo.experimental("dojox.editor.plugins.FindReplace");


      dojo.declare("dojox.editor.plugins._FindReplaceCloseBox", [dijit._Widget, dijit._Templated], {
       // summary:
       //  Base class for widgets that contains a button labeled X
       //  to close the tool bar.

       
       btnId: "",
       widget: null,
       widgetsInTemplate: true,

       
       templateString:
        "" +
         "" +
        "
      ",

       
       postMixInProperties: function(){
        // Set some substitution variables used in the template
        this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
        this.btnId = this.id + "_close";
        this.inherited(arguments);
       },
       startup: function(){
        this.connect(this.button, "onClick", "onClick");
       },
       onClick: function(){
       }
      });




      dojo.declare("dojox.editor.plugins._FindReplaceTextBox",
       [dijit._Widget, dijit._Templated],{
       // summary:
       //  Base class for widgets that contains a label (like "Font:")
       //  and a TextBox to pick a value.
       //  Used as Toolbar entry.


       // textId: [public] String
       //  The id of the enhanced textbox
       textId: "",

       
       // label: [public] String
       //  The label of the enhanced textbox
       label: "",

       
       // tooltip: [public] String
       //  The tooltip of the enhanced textbox when the mouse is hovering on it
       toolTip: "",
       widget: null,
       widgetsInTemplate: true,


       templateString:
        "   "title='${tooltip}' tabindex='-1'>" +
         "" +
         "     "tabIndex='0' id='${textId}' dojoAttachPoint='textBox, focusNode' value='' dojoAttachEvent='onKeyPress: _onKeyPress'/>" +
        "
      ",


       postMixInProperties: function(){
        // Set some substitution variables used in the template
        this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
        this.textId = this.id + "_text";

        
        this.inherited(arguments);
       },


       postCreate: function(){
        this.textBox.set("value", "");
        this.disabled = this.textBox.get("disabled");
        this.connect(this.textBox, "onChange", "onChange");
       },


       _setValueAttr: function(/*String*/ value){
        //If the value is not a permitted value, just set empty string to prevent showing the warning icon
        this.value = value;
        this.textBox.set("value", value);
       },


       focus: function(){
        this.textBox.focus();
       },


       _setDisabledAttr: function(/*Boolean*/ value){
        // summary:
        //  Over-ride for the textbox's 'disabled' attribute so that it can be
        //  disabled programmatically.
        // value:
        //  The boolean value to indicate if the textbox should be disabled or not
        // tags:
        //  private
        this.disabled = value;
        this.textBox.set("disabled", value);
       },


       onChange: function(/*String*/ val){
        // summary:
        //  Stub function for change events on the box.
        // tags:
        //  public
        this.value= val;
       },

       
       _onKeyPress: function(/*Event*/ evt){
        // summary:
        //  Handle the arrow key events
        // evt:
        //  Event object passed to this handler
        // tags:
        //  private
        var start = 0;
        var end = 0;

        
        // If CTRL, ALT or SHIFT is not held on
        if(evt.target && !evt.ctrlKey && !evt.altKey && !evt.shiftKey){
         if(evt.keyCode == dojo.keys.LEFT_ARROW){
          start = evt.target.selectionStart;
          end = evt.target.selectionEnd;
          if(start < end){
           dijit.selectInputText(evt.target, start, start);
           dojo.stopEvent(evt);
          }
         }else if(evt.keyCode == dojo.keys.RIGHT_ARROW){
          start = evt.target.selectionStart;
          end = evt.target.selectionEnd;
          if(start < end){
           dijit.selectInputText(evt.target, end, end);
           dojo.stopEvent(evt);
          }
         }
        }
       }
      });




      dojo.declare("dojox.editor.plugins._FindReplaceCheckBox",
       [dijit._Widget, dijit._Templated],{
       // summary:
       //  Base class for widgets that contains a label (like "Match case: ")
       //  and a checkbox to indicate if it is checked or not.
       //  Used as Toolbar entry.


       // checkId: [public] String
       //  The id of the enhanced checkbox
       checkId: "",

       
       // label: [public] String
       //  The label of the enhanced checkbox
       label: "",

       
       // tooltip: [public] String
       //  The tooltip of the enhanced checkbox when the mouse is hovering it
       tooltip: "",

       
       widget: null,
       widgetsInTemplate: true,


       templateString:
        "   "class='dijit dijitReset dijitInline dijitEditorFindReplaceCheckBox' title='${tooltip}' >" +
         "     "tabIndex='0' id='${checkId}' dojoAttachPoint='checkBox, focusNode' value=''/>" +
         "" +
        "
      ",


       postMixInProperties: function(){
        // Set some substitution variables used in the template
        this.id = dijit.getUniqueId(this.declaredClass.replace(/\./g,"_"));
        this.checkId = this.id + "_check";
        this.inherited(arguments);
       },


       postCreate: function(){
        this.checkBox.set("checked", false);
        this.disabled = this.checkBox.get("disabled");
        this.checkBox.isFocusable = function(){ return false; };
       },


       _setValueAttr: function(/*Boolean*/ value){
        // summary:
        //  Passthrough for checkbox.
        // tags:
        //  private
        this.checkBox.set('value', value);
       },


       _getValueAttr: function(){
        // summary:
        //  Passthrough for checkbox.
        // tags:
        //  private
        return this.checkBox.get('value');
       },


       focus: function(){
        // summary:
        //  Handle the focus event when this widget gets focused
        // tags:
        //  private
        this.checkBox.focus();
       },


       _setDisabledAttr: function(/*Boolean*/ value){
        // summary:
        //  Over-ride for the button's 'disabled' attribute so that it can be
        //  disabled programmatically.
        // value:
        //  The flag that indicates if the checkbox is disabled or not.
        // tags:
        //  private
        this.disabled = value;
        this.checkBox.set("disabled", value);
       }
      });




      dojo.declare("dojox.editor.plugins._FindReplaceToolbar", dijit.Toolbar, {
       // summary:
       //  A toolbar that derived from dijit.Toolbar, which
       //  eliminates some unnecessary event response such as LEFT_ARROW pressing
       //  and click bubbling.


       postCreate: function(){
        this.connectKeyNavHandlers([], []); // Prevent arrow key navigation
        this.connect(this.containerNode, "onclick", "_onToolbarEvent");
        this.connect(this.containerNode, "onkeydown", "_onToolbarEvent");
        dojo.addClass(this.domNode, "dijitToolbar");
       },

       
       addChild: function(/*dijit._Widget*/ widget, /*int?*/ insertIndex){
        // summary:
        //  Add a child to our _Container and prevent the default
        //  arrow key navigation function. This function may bring in
        //  side effect
        dijit._KeyNavContainer.superclass.addChild.apply(this, arguments);
       },

       
       _onToolbarEvent: function(/*Event*/ evt){
        // Editor may have special treatment to some events, so stop the bubbling.
        // evt:
        //  The Event object
        // tages:
        //  private
        evt.stopPropagation();
    • summary
  • dojox.editor.plugins.FindReplace

    • type
      Function
    • chains:
      • dijit._editor._Plugin: (prototype)
      • dijit._editor._Plugin: (call)
    • summary
      This plugin provides a Find/Replace cabability for the editor.
      Note that this plugin is NOT supported on Opera currently, as opera
      does not implement a window.find or equiv function.
  • dojox.editor.plugins.FindReplace.buttonClass

    • tags: protected
    • type
      Define
    • summary
      the class of button the editor uses.
  • dojox.editor.plugins.FindReplace.iconClassPrefix

    • tags: const
    • type
      String
    • summary
      The CSS class name for the button node is formed from `iconClassPrefix` and `command`
  • dojox.editor.plugins.FindReplace.editor

    • tags: protected
    • type
      The
    • summary
      editor this plugin belongs to
  • dojox.editor.plugins.FindReplace.button

    • tags: protected
    • type
      The
    • summary
      toggle button
  • dojox.editor.plugins.FindReplace._frToolbar

    • tags: private
    • type
      The
    • summary
      toolbar that contain all the entries and buttons
  • dojox.editor.plugins.FindReplace._closeBox

    • tags: private
    • type
      The
    • summary
      close button of the F/R toolbar
  • dojox.editor.plugins.FindReplace._findField

    • tags: private
    • type
      The
    • summary
      Find field of the F/R toolbar
  • dojox.editor.plugins.FindReplace._replaceField

    • tags: private
    • type
      The
    • summary
      Replace field of the F/R toolbar
  • dojox.editor.plugins.FindReplace._findButton

    • tags: private
    • type
      The
    • summary
      Find button of the F/R toolbar
  • dojox.editor.plugins.FindReplace._replaceButton

    • tags: private
    • type
      The
    • summary
      Replace button of the F/R toolbar
  • dojox.editor.plugins.FindReplace._replaceAllButton

    • tags: private
    • type
      The
    • summary
      ReplaceAll button of the F/R toolbar
  • dojox.editor.plugins.FindReplace._caseSensitive

    • tags: private
    • type
      The
    • summary
      case sensitive checkbox
  • dojox.editor.plugins.FindReplace._backwards

    • tags: private
    • type
      The
    • summary
      backwards checkbox
  • dojox.editor.plugins.FindReplace._promDialog

    • tags: private
    • type
      The
    • summary
      prompt message box that shows the user some messages
      such as the end of a search, the end of a replacement, etc.
  • dojox.editor.plugins.FindReplace._promDialogTimeout

    • summary
  • dojox.editor.plugins.FindReplace._strings

    • tags: private
    • type
      The
    • summary
      array that contains globalized strings
  • dojox.editor.plugins.FindReplace._initButton

    • type
      Function
    • source: [view]
        this._strings = dojo.i18n.getLocalization("dojox.editor.plugins", "FindReplace");
        this.button = new dijit.form.ToggleButton({
         label: this._strings["findReplace"],
         showLabel: false,
         iconClass: this.iconClassPrefix + " dijitEditorIconFindString",
         tabIndex: "-1",
         onChange: dojo.hitch(this, "_toggleFindReplace")
        });
        if(dojo.isOpera){
         // Not currently supported on Opera!
         this.button.set("disabled", true);
        }
        //Link up so that if the toggle is disabled, then the view of Find/Replace is closed.
        this.connect(this.button, "set", dojo.hitch(this, function(attr, val){
         if(attr === "disabled"){
          this._toggleFindReplace((!val && this._displayed), true, true);
         }
        }));
    • summary
      Over-ride for creation of the resize button.
  • dojox.editor.plugins.FindReplace.setEditor

    • type
      Function
    • parameters:
      • editor: (typeof )
    • source: [view]
        this.editor = editor;
        this._initButton();
    • summary
      This is a callback handler that set a reference to the editor this plugin
      hosts in
  • dojox.editor.plugins.FindReplace.toggle

    • type
      Function
    • source: [view]
        this.button.set("checked", !this.button.get("checked"));
    • summary
      Function to allow programmatic toggling of the find toolbar.
    • tags:
  • dojox.editor.plugins.FindReplace._toggleFindReplace

    • type
      Function
    • parameters:
      • show: (typeof Boolean)
        Indicate if the toolbar is shown or not
      • ignoreState: (typeof Boolean)
        Indicate if the status should be ignored or not
        blurEditor:
        Indicate if the focus should be removed from the editor or not
      • buttonDisabled: (typeof Boolean)
    • source: [view]
        var size = dojo.marginBox(this.editor.domNode);
        if(show && !dojo.isOpera){
         dojo.style(this._frToolbar.domNode, "display", "block");
         // Auto populate the Find field
         this._populateFindField();
         if(!ignoreState){
          this._displayed = true;
         }
        }else{
         dojo.style(this._frToolbar.domNode, "display", "none");
         if(!ignoreState){
          this._displayed = false;
         }

         
         // If the toggle button is disabled, it is most likely that
         // another plugin such as ViewSource disables it.
         // So we do not need to focus the text area of the editor to
         // prevent the editor from an invalid status.
         // Please refer to dijit._editor.plugins.ViewSource for more details.
         if(!buttonDisabled){
          this.editor.focus();
         }
        }


        // Resize the editor.
        this.editor.resize({h: size.h});
    • summary
      Function to toggle whether or not find/replace is displayed.
    • tags:
  • dojox.editor.plugins.FindReplace._populateFindField

    • type
      Function
    • source: [view]
        var ed = this.editor;
        var win = ed.window;
        var selectedTxt = dojo.withGlobal(ed.window, "getSelectedText", dijit._editor.selection, [null]);
        if(this._findField && this._findField.textBox){
         if(selectedTxt){
          this._findField.textBox.set("value", selectedTxt);
         }
         this._findField.textBox.focus();
         dijit.selectInputText(this._findField.textBox.focusNode);
        }
    • summary
      Populate the Find field with selected text when dialog initially displayed.
      Auto-select text in Find field after it is populated.
      If nothing selected, restore previous entry from the same session.
    • tags:
  • dojox.editor.plugins.FindReplace.setToolbar

    • type
      Function
    • parameters:
      • toolbar: (typeof dijit.Toolbar)
        The current toolbar of the editor
    • source: [view]
        this.inherited(arguments);
        if(!dojo.isOpera){
         var _tb = this._frToolbar = new dojox.editor.plugins._FindReplaceToolbar();
         dojo.style(_tb.domNode, "display", "none");
         dojo.place(_tb.domNode, toolbar.domNode, "after");
         _tb.startup();


         // IE6 will put the close box in a new line when its style is "float: right".
         // So place the close box ahead of the other fields, which makes it align with
         // the other components.
         this._closeBox = new dojox.editor.plugins._FindReplaceCloseBox();
         _tb.addChild(this._closeBox);

         
         // Define the search/replace fields.
         this._findField = new dojox.editor.plugins._FindReplaceTextBox(
          {label: this._strings["findLabel"], tooltip: this._strings["findTooltip"]});
         _tb.addChild(this._findField);

         
         this._replaceField = new dojox.editor.plugins._FindReplaceTextBox(
          {label: this._strings["replaceLabel"], tooltip: this._strings["replaceTooltip"]});
         _tb.addChild(this._replaceField);


         // Define the Find/Replace/ReplaceAll buttons.
         _tb.addChild(new dojox.editor.plugins.ToolbarLineBreak());

         
         this._findButton = new dijit.form.Button({label: this._strings["findButton"], showLabel: true,
          iconClass: this.iconClassPrefix + " dijitEditorIconFind"});
         this._findButton.titleNode.title = this._strings["findButtonTooltip"];
         _tb.addChild(this._findButton);

         
         this._replaceButton = new dijit.form.Button({label: this._strings["replaceButton"], showLabel: true,
          iconClass: this.iconClassPrefix + " dijitEditorIconReplace"});
         this._replaceButton.titleNode.title = this._strings["replaceButtonTooltip"];
         _tb.addChild(this._replaceButton);

         
         this._replaceAllButton = new dijit.form.Button({label: this._strings["replaceAllButton"], showLabel: true,
          iconClass: this.iconClassPrefix + " dijitEditorIconReplaceAll"});
         this._replaceAllButton.titleNode.title = this._strings["replaceAllButtonTooltip"];
         _tb.addChild(this._replaceAllButton);

         
         // Define the option checkboxes.
         this._caseSensitive = new dojox.editor.plugins._FindReplaceCheckBox(
          {label: this._strings["matchCase"], tooltip: this._strings["matchCaseTooltip"]});
         _tb.addChild(this._caseSensitive);

         
         this._backwards = new dojox.editor.plugins._FindReplaceCheckBox(
          {label: this._strings["backwards"], tooltip: this._strings["backwardsTooltip"]});
         _tb.addChild(this._backwards);


         // Set initial states, buttons should be disabled unless content is
         // present in the fields.
         this._findButton.set("disabled", true);
         this._replaceButton.set("disabled", true);
         this._replaceAllButton.set("disabled", true);


         // Connect the event to the status of the items
         this.connect(this._findField, "onChange", "_checkButtons");
         this.connect(this._findField, "onKeyDown", "_onFindKeyDown");
         this.connect(this._replaceField, "onKeyDown", "_onReplaceKeyDown");


         // Connect up the actual search events.
         this.connect(this._findButton, "onClick", "_find");
         this.connect(this._replaceButton, "onClick", "_replace");
         this.connect(this._replaceAllButton, "onClick", "_replaceAll");

         
         // Connect up the close event
         this.connect(this._closeBox, "onClick", "toggle");

         
         // Prompt for the message
         this._promDialog = new dijit.TooltipDialog();
         this._promDialog.startup();
         this._promDialog.set("content", "");
        }
    • summary
      Over-ride so that find/replace toolbar is appended after the current toolbar.
    • tags:
  • dojox.editor.plugins.FindReplace._checkButtons

    • type
      Function
    • source: [view]
        var fText = this._findField.get("value");


        if(fText){
         // Only enable if find text is not empty or just blank/spaces.
         this._findButton.set("disabled", false);
         this._replaceButton.set("disabled", false);
         this._replaceAllButton.set("disabled", false);
        }else{
         this._findButton.set("disabled", true);
         this._replaceButton.set("disabled", true);
         this._replaceAllButton.set("disabled", true);
        }
    • summary
      Ensure that all the buttons are in a correct status
      when certain events are fired.
  • dojox.editor.plugins.FindReplace._onFindKeyDown

    • type
      Function
    • parameters:
      • evt: (typeof )
    • source: [view]
        if(evt.keyCode == dojo.keys.ENTER){
         // Perform the default search action
         this._find();
         dojo.stopEvent(evt);
        }
    • summary
  • dojox.editor.plugins.FindReplace._onReplaceKeyDown

    • type
      Function
    • parameters:
      • evt: (typeof )
    • source: [view]
        if(evt.keyCode == dojo.keys.ENTER){
         // Perform the default replace action
         if(!this._replace()) this._replace();
         dojo.stopEvent(evt);
        }
    • summary
  • dojox.editor.plugins.FindReplace._find

    • type
      Function
    • parameters:
      • showMessage: (typeof Boolean)
        Indicated whether the tooltip is shown or not when the search reaches the end
    • source: [view]
        var txt = this._findField.get("value") || "";
        if(txt){
         var caseSensitive = this._caseSensitive.get("value");
         var backwards = this._backwards.get("value");
         var isFound = this._findText(txt, caseSensitive, backwards);
         if(!isFound && showMessage){
          this._promDialog.set("content", dojo.string.substitute(
           this._strings["eofDialogText"], {"0": this._strings["eofDialogTextFind"]}));
          dijit.popup.open({popup: this._promDialog, around: this._findButton.domNode});
          this._promDialogTimeout = setTimeout(dojo.hitch(this, function(){
           clearTimeout(this._promDialogTimeout);
           this._promDialogTimeout = null;
           dijit.popup.close(this._promDialog);
          }), 3000);
          setTimeout(dojo.hitch(this, function(){
           this.editor.focus();
          }), 0);
         }
         return isFound;
        }

        
        return false;
    • summary
      This function invokes a find on the editor document with the noted options for
      find.
    • tags:
    • return_summary
      Boolean indicating if the content was found or not.
  • dojox.editor.plugins.FindReplace._replace

    • type
      Function
    • parameters:
      • showMessage: (typeof Boolean)
        Indicate if the prompt message is shown or not when the replacement
        reaches the end
    • source: [view]
        var isReplaced = false;
        var ed = this.editor;
        ed.focus();
        var txt = this._findField.get("value") || "";
        var repTxt = this._replaceField.get("value") || "";

        
        if(txt){
         var caseSensitive = this._caseSensitive.get("value");
         // Check if it is forced to be forwards or backwards
         var backwards = this._backwards.get("value");

         
         //Replace the current selected text if it matches the pattern
         var selected = dojo.withGlobal(ed.window, "getSelectedText", dijit._editor.selection, [null]);
         // Handle checking/replacing current selection. For some reason on Moz
         // leading whitespace is trimmed, so we have to trim it down on this check
         // or we don't always replace. Moz bug!
         if(dojo.isMoz){
          txt = dojo.trim(txt);
          selected = dojo.trim(selected);
         }

         
         var regExp = this._filterRegexp(txt, !caseSensitive);
         if(selected && regExp.test(selected)){
          ed.execCommand("inserthtml", repTxt);
          isReplaced = true;

         
          if(backwards){
           // Move to the beginning of the replaced text
           // to avoid the infinite recursive replace
           this._findText(repTxt, caseSensitive, backwards);
           dojo.withGlobal(ed.window, "collapse", dijit._editor.selection, [true]);
          }
         }

         
         if(!this._find(false) && showMessage){ // Find the next
          this._promDialog.set("content", dojo.string.substitute(
           this._strings["eofDialogText"], {"0": this._strings["eofDialogTextReplace"]}));
          dijit.popup.open({popup: this._promDialog, around: this._replaceButton.domNode});
          this._promDialogTimeout = setTimeout(dojo.hitch(this, function(){
           clearTimeout(this._promDialogTimeout);
           this._promDialogTimeout = null;
           dijit.popup.close(this._promDialog);
          }), 3000);
          setTimeout(dojo.hitch(this, function(){
           this.editor.focus();
          }), 0);
         }
         return isReplaced;
         }
         return null;
    • summary
      This function invokes a replace on the editor document with the noted options for replace
    • tags:
    • return_summary
      Boolean indicating if the content was replaced or not.
  • dojox.editor.plugins.FindReplace._replaceAll

    • type
      Function
    • parameters:
      • showMessage: (typeof Boolean)
        Indicate if the prompt message is shown or not when the action is done.
    • source: [view]
        var replaced = 0;
        var backwards = this._backwards.get("value");

        
        if(backwards){
         this.editor.placeCursorAtEnd();
        }else{
         this.editor.placeCursorAtStart();
        }

        
        // The _replace will return false if the current selection deos not match
        // the searched text. So try the first attempt so that the selection
        // is always the searched text if there is one that matches
        if(this._replace(false)) { replaced++; }
        // Do the replace via timeouts to avoid locking the browser up for a lot of replaces.
        var loopBody = dojo.hitch(this, function(){
         if(this._replace(false)){
          replaced++;
          setTimeout(loopBody, 10);
         }else{
          if(showMessage){
           this._promDialog.set("content", dojo.string.substitute(
            this._strings["replaceDialogText"], {"0": "" + replaced}));
           dijit.popup.open({
            popup: this._promDialog,
            around: this._replaceAllButton.domNode
           });
           this._promDialogTimeout = setTimeout(dojo.hitch(this, function(){
            clearTimeout(this._promDialogTimeout);
            this._promDialogTimeout = null;
            dijit.popup.close(this._promDialog);
           }), 3000);
           setTimeout(dojo.hitch(this, function(){
            this._findField.focus();
            this._findField.textBox.focusNode.select();
           }), 0);
          }
         }
        });
        loopBody();
    • summary
      This function replaces all the matched content on the editor document
      with the noted options for replace
    • tags:
  • dojox.editor.plugins.FindReplace._findText

    • type
      Function
    • parameters:
      • txt: (typeof String)
        The text to locate in the document.
      • caseSensitive: (typeof Boolean)
        Whether or ot to search case-sensitively.
      • backwards: (typeof Boolean)
        Whether or not to search backwards in the document.
    • source: [view]
        var ed = this.editor;
        var win = ed.window;
        var found = false;
        if(txt){
         if(win.find){
          found = win.find(txt, caseSensitive, backwards, false, false, false, false);
         }else{
          var doc = ed.document;
          if(doc.selection){
           /* IE */
           // Focus to restore position/selection,
           // then shift to search from current position.
           this.editor.focus();
           var txtRg = doc.body.createTextRange();
           var curPos = doc.selection?doc.selection.createRange():null;
           if(curPos){
            if(backwards){
             txtRg.setEndPoint("EndToStart", curPos);
            }else{
             txtRg.setEndPoint("StartToEnd", curPos);
            }
           }
           var flags = caseSensitive?4:0;
           if(backwards){
            flags = flags | 1;
           }
           //flags = flags |
           found = txtRg.findText(txt,txtRg.text.length,flags);
           if(found){
            txtRg.select();
           }
          }
         }
        }
        return found;
    • summary
      This function invokes a find with specific options
    • tags:
    • return_summary
      Boolean indicating if the content was found or not.
  • dojox.editor.plugins.FindReplace._filterRegexp

    • type
      Function
    • parameters:
      • pattern: (typeof String)
        string
        A simple matching pattern to convert that follows basic rules:
        * Means match anything, so ca* means match anything starting with ca
        ? Means match single character.  So, b?b will match to bob and bab, and so on.
        \ is an escape character.  So for example, \* means do not treat * as a match, but literal character *.
        To use a \ as a character in the string, it must be escaped.  So in the pattern it should be
        represented by \\ to be treated as an ordinary \ character instead of an escape.
      • ignoreCase: (typeof Boolean)
        An optional flag to indicate if the pattern matching should be treated as case-sensitive or not when comparing
        By default, it is assumed case sensitive.
    • source: [view]
        var rxp = "";
        var c = null;
        for(var i = 0; i < pattern.length; i++){
         c = pattern.charAt(i);
         switch(c){
          case '\\':
           rxp += c;
           i++;
           rxp += pattern.charAt(i);
           break;
          case '$':
          case '^':
          case '/':
          case '+':
          case '.':
          case '|':
          case '(':
          case ')':
          case '{':
          case '}':
          case '[':
          case ']':
           rxp += "\\"; //fallthrough
          default:
           rxp += c;
         }
        }
        rxp = "^" + rxp + "$";
        if(ignoreCase){
         return new RegExp(rxp,"mi"); //RegExp
        }else{
         return new RegExp(rxp,"m"); //RegExp
        }
    • summary
      Helper function to convert a simple pattern to a regular expression for matching.
    • description
      Returns a regular expression object that conforms to the defined conversion rules.
      For example:
      ca*   -> /^ca.*$/
      *ca*  -> /^.*ca.*$/
      *c\*a*  -> /^.*c\*a.*$/
      *c\*a?*  -> /^.*c\*a..*$/
      and so on.
    • tags:
    • returns
      RegExp
  • dojox.editor.plugins.FindReplace.updateState

    • type
      Function
    • source: [view]
        this.button.set("disabled", this.get("disabled"));
    • summary
      Over-ride for button state control for disabled to work.
  • dojox.editor.plugins.FindReplace.destroy

    • type
      Function
    • source: [view]
        this.inherited(arguments);
        if(this._promDialogTimeout){
         clearTimeout(this._promDialogTimeout);
         this._promDialogTimeout = null;
         dijit.popup.close(this._promDialog);
        }
        if(this._frToolbar){
         this._frToolbar.destroyRecursive();
         this._frToolbar = null;
        }
        if(this._promDialog){
         this._promDialog.destroyRecursive();
         this._promDialog = null;
        }
    • summary
      Cleanup of our custom toolbar.
  • dojox.editor.plugins.FindReplace._displayed

    • summary
  • dojox.editor.plugins.FindReplace._findButton.titleNode.title

    • summary
  • dojox.editor.plugins.FindReplace._replaceButton.titleNode.title

    • summary
  • dojox.editor.plugins.FindReplace._replaceAllButton.titleNode.title

    • summary
  • name

    • summary
  • o.plugin

    • summary
  • dojox.editor.plugins

    • type
      Object
    • summary
  • dojox.editor

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary