/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EventEmitter = require("resource://devtools/shared/event-emitter.js");
var { StyleEditorUI } = ChromeUtils.importESModule( "resource://devtools/client/styleeditor/StyleEditorUI.sys.mjs"
); var { getString } = ChromeUtils.importESModule( "resource://devtools/client/styleeditor/StyleEditorUtil.sys.mjs"
);
var StyleEditorPanel = function StyleEditorPanel(panelWin, toolbox, commands) {
EventEmitter.decorate(this);
/** * Show an error message from the style editor in the toolbox * notification box. * * @param {string} data * The parameters to customize the error message
*/
_showError(data) { if (!this._toolbox) { // could get an async error after we've been destroyed return;
}
let errorMessage = getString(data.key); if (data.append) {
errorMessage += " " + data.append;
}
/** * Select a stylesheet. * * @param {StyleSheetResource} stylesheet * The resource for the stylesheet to find and select in editor. * @param {number} line * Line number to jump to after selecting. One-indexed * @param {number} col * Column number to jump to after selecting. One-indexed * @return {Promise} * Promise that will resolve when the editor is selected and ready * to be used.
*/
selectStyleSheet(stylesheet, line, col) { if (!this.UI) { returnnull;
}
returnthis.UI.selectStyleSheet(stylesheet, line - 1, col ? col - 1 : 0);
},
/** * Given a location in an original file, open that file in the editor. * * @param {string} originalId * The original "sourceId" returned from the sourcemap worker. * @param {number} line * Line number to jump to after selecting. One-indexed * @param {number} col * Column number to jump to after selecting. One-indexed * @return {Promise} * Promise that will resolve when the editor is selected and ready * to be used.
*/
selectOriginalSheet(originalId, line, col) { if (!this.UI) { returnnull;
}
const originalSheet = this.UI.getOriginalSourceSheet(originalId); returnthis.UI.selectStyleSheet(originalSheet, line - 1, col ? col - 1 : 0);
},
getStylesheetResourceForGeneratedURL(url) { if (!this.UI) { returnnull;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.