B2G/gecko/browser/devtools/styleeditor/StyleEditorChrome.jsm
/**
   * Called when source has been loaded and editor is ready for some action.
   *
   * @param StyleEditor aEditor
   */
Called when source has been loaded and editor is ready for some action.
Called when source has been loaded and editor is ready for some action .
function SEAL_onLoad(aEditor)
  {
    let item = this._view.appendTemplatedItem(STYLE_EDITOR_TEMPLATE, {
      data: {
        editor: aEditor
      },
      disableAnimations: this._alwaysDisableAnimations,
      ordinal: aEditor.styleSheetIndex,
      onCreate: function ASV_onItemCreate(aSummary, aDetails, aData) {
        let editor = aData.editor;
        wire(aSummary, ".stylesheet-enabled", function onToggleEnabled(aEvent) {
          aEvent.stopPropagation();
          aEvent.target.blur();
          editor.enableStyleSheet(editor.styleSheet.disabled);
        });
        wire(aSummary, ".stylesheet-saveButton", function onSaveButton(aEvent) {
          aEvent.stopPropagation();
          aEvent.target.blur();
          editor.saveToFile(editor.savedFile);
        });
        this._updateSummaryForEditor(editor, aSummary);
        aSummary.addEventListener("focus", function onSummaryFocus(aEvent) {
          if (aEvent.target == aSummary) {
            aSummary.querySelector(".stylesheet-name").focus();
          }
        }, false);
        if (editor.hasFlag(StyleEditorFlags.NEW)) {
          this._view.activeSummary = aSummary;
        }
        this._triggerChromeListeners("EditorAdded", [editor]);
      }.bind(this),
      onHide: function ASV_onItemShow(aSummary, aDetails, aData) {
        aData.editor.onHide();
      },
      onShow: function ASV_onItemShow(aSummary, aDetails, aData) {
        let editor = aData.editor;
        if (!editor.inputElement) {
          editor.inputElement = aDetails.querySelector(".stylesheet-editor-input");
        }
        editor.onShow();
      }
    });
  }
function SEAL_onLoad ( aEditor ) { let item = this . _view . appendTemplatedItem ( STYLE_EDITOR_TEMPLATE , { data : { editor : aEditor } , disableAnimations : this . _alwaysDisableAnimations , ordinal : aEditor . styleSheetIndex , onCreate : function ASV_onItemCreate ( aSummary , aDetails , aData ) { let editor = aData . editor ; wire ( aSummary , ".stylesheet-enabled" , function onToggleEnabled ( aEvent ) { aEvent . stopPropagation ( ) ; aEvent . target . blur ( ) ; editor . enableStyleSheet ( editor . styleSheet . disabled ) ; } ) ; wire ( aSummary , ".stylesheet-saveButton" , function onSaveButton ( aEvent ) { aEvent . stopPropagation ( ) ; aEvent . target . blur ( ) ; editor . saveToFile ( editor . savedFile ) ; } ) ; this . _updateSummaryForEditor ( editor , aSummary ) ; aSummary . addEventListener ( "focus" , function onSummaryFocus ( aEvent ) { if ( aEvent . target == aSummary ) { aSummary . querySelector ( ".stylesheet-name" ) . focus ( ) ; } } , false ) ; if ( editor . hasFlag ( StyleEditorFlags . NEW ) ) { this . _view . activeSummary = aSummary ; } this . _triggerChromeListeners ( "EditorAdded" , [ editor ] ) ; } . bind ( this ) , onHide : function ASV_onItemShow ( aSummary , aDetails , aData ) { aData . editor . onHide ( ) ; } , onShow : function ASV_onItemShow ( aSummary , aDetails , aData ) { let editor = aData . editor ; if ( ! editor . inputElement ) { editor . inputElement = aDetails . querySelector ( ".stylesheet-editor-input" ) ; } editor . onShow ( ) ; } } ) ; }
Called when source has been loaded and editor is ready for some action.
Called when source has been loaded and editor is ready for some action .
// autofocus the stylesheet name // autofocus new stylesheets // attach editor to input element the first time it is shown