Infocatcher / Custom_Buttons

Buttons for Custom Buttons extension for Firefox (and other Gecko-based applications)
38 stars 11 forks source link

[Orion Editor] Doesn't work since Firefox 27.0a1 (2013-09-24) #17

Open Infocatcher opened 11 years ago

Infocatcher commented 11 years ago

https://bugzilla.mozilla.org/show_bug.cgi?id=816756 See chrome://browser/content/devtools/scratchpad.js Old:

Cu.import("resource:///modules/source-editor.jsm");
    this.editor = new SourceEditor();

    let config = {
      mode: SourceEditor.MODES.JAVASCRIPT,
      showLineNumbers: true,
      initialText: initialText,
      contextMenu: "scratchpad-text-popup",
    };

    let editorPlaceholder = document.getElementById("scratchpad-editor");
    this.editor.init(editorPlaceholder, config,
                     this._onEditorLoad.bind(this, state));

New:

const require   = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools.require;
// ...
const Editor    = require("devtools/sourceeditor/editor");
    this.editor = new Editor({
      mode: Editor.modes.js,
      value: initialText,
      lineNumbers: true,
      contextMenu: "scratchpad-text-popup"
    });

    this.editor.appendTo(document.querySelector("#scratchpad-editor")).then(() => {
      var lines = initialText.split("\n");

      this.editor.on("change", this._onChanged);
      this.editor.focus();
      this.editor.setCursor({ line: lines.length, ch: lines.pop().length });

      if (state)
        this.dirty = !state.saved;

      this.initialized = true;
      this._triggerObservers("Ready");
      this.populateRecentFilesMenu();
      PreferenceObserver.init();
    }).then(null, (err) => console.log(err.message));

Also seems like this isn't Eclipse Orion anymore: resource:///modules/devtools/sourceeditor/editor.js

/**
 * A very thin wrapper around CodeMirror. [...]
 * CodeMirror docs: http://codemirror.net/doc/manual.html
 */