dojox/editor/plugins/PrettyPrint.js

  • Provides:

    • dojox.editor.plugins.PrettyPrint
  • dojox.editor.plugins.PrettyPrint

    • type
      Function
    • chains:
      • dijit._editor._Plugin: (prototype)
      • dijit._editor._Plugin: (call)
    • summary
  • dojox.editor.plugins.PrettyPrint.indentBy

    • summary
  • dojox.editor.plugins.PrettyPrint.lineLength

    • summary
  • dojox.editor.plugins.PrettyPrint.useDefaultCommand

    • summary
  • dojox.editor.plugins.PrettyPrint.entityMap

    • summary
  • dojox.editor.plugins.PrettyPrint._initButton

    • type
      Function
    • source: [view]
        delete this.command;
    • summary
      Over-ride for creation of the resize button.
  • dojox.editor.plugins.PrettyPrint.setToolbar

    • type
      Function
    • parameters:
      • toolbar: (typeof )
    • source: [view]
        // summary:
        //  Over-ride to do nothing.
        //  We don't want to append a button, we take over getValue.
    • summary
      Over-ride to do nothing.
      We don't want to append a button, we take over getValue.
  • dojox.editor.plugins.PrettyPrint.setEditor

    • type
      Function
    • parameters:
      • editor: (typeof )
    • source: [view]
        this.inherited(arguments);
        var self = this;
        this.editor.onLoadDeferred.addCallback(function(){
         self.editor._prettyprint_getValue = self.editor.getValue;
         self.editor.getValue = function(){
          var val = self.editor._prettyprint_getValue(arguments);
          return dojox.html.format.prettyPrint(val, self.indentBy, self.lineLength, self.entityMap, self.xhtml);
         };


         // The following are implemented as 'performance' functions. Don't prettyprint
         // content on internal state changes, just on calls to actually get values.
         self.editor._prettyprint_endEditing = self.editor._endEditing;
         self.editor._prettyprint_onBlur = self.editor._onBlur;
         self.editor._endEditing = function(ignore_caret){
          var v = self.editor._prettyprint_getValue(true);
          self.editor._undoedSteps=[];//clear undoed steps
          self.editor._steps.push({text: v, bookmark: self.editor._getBookmark()});
         }
         self.editor._onBlur = function(e){
          this.inherited("_onBlur", arguments);
          var _c=self.editor._prettyprint_getValue(true);
          if(_c!=self.editor.savedContent){
           self.editor.onChange(_c);
           self.editor.savedContent=_c;
          }
         }
        });
    • summary
      Over-ride to take over getValue of editor so that
      we can 'pretty' the output.
  • name

    • summary
  • o.plugin

    • summary
  • dojox.editor.plugins

    • type
      Object
    • summary
  • dojox.editor

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary