tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit f25e9425a3177181609cf7f55f00a770970c879f
parent aed9350343eb4b7d2888169aa0cf096ecb83f747
Author: Lorenz A <me@lorenzackermann.xyz>
Date:   Fri, 12 Dec 2025 13:01:51 +0000

Bug 2004278 - [devtools] Turn devtools/client/inspector/markup/views/text-editor.js into an ES class. r=devtools-reviewers,nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D276126

Diffstat:
Mdevtools/client/inspector/markup/views/text-editor.js | 52++++++++++++++++++++++++++--------------------------
1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/devtools/client/inspector/markup/views/text-editor.js b/devtools/client/inspector/markup/views/text-editor.js @@ -34,26 +34,26 @@ loader.lazyRequireGetter( /** * Creates a simple text editor node, used for TEXT and COMMENT * nodes. - * - * @param {MarkupContainer} container - * The container owning this editor. - * @param {DOMNode} node - * The node being edited. - * @param {string} type - * The type of editor to build. This can be either 'text' or 'comment'. */ -function TextEditor(container, node, type) { - this.container = container; - this.markup = this.container.markup; - this.node = node; - this._selected = false; +class TextEditor { + /** + * @param {MarkupContainer} container + * The container owning this editor. + * @param {DOMNode} node + * The node being edited. + * @param {string} type + * The type of editor to build. This can be either 'text' or 'comment'. + */ + constructor(container, node, type) { + this.container = container; + this.markup = this.container.markup; + this.node = node; + this._selected = false; - this.showTextEditor = this.showTextEditor.bind(this); + this.showTextEditor = this.showTextEditor.bind(this); - this.buildMarkup(type); -} - -TextEditor.prototype = { + this.buildMarkup(type); + } buildMarkup(type) { const doc = this.markup.doc; @@ -70,17 +70,17 @@ TextEditor.prototype = { this.elt ); }); - }, + } get ReactDOM() { // Reuse the toolbox's ReactDOM to avoid loading react-dom.js again in the // Inspector's BrowserLoader. return this.container.markup.inspector.ReactDOM; - }, + } get selected() { return this._selected; - }, + } set selected(value) { if (value === this._selected) { @@ -88,7 +88,7 @@ TextEditor.prototype = { } this._selected = value; this.update(); - }, + } showTextEditor(element) { new InplaceEditor({ @@ -114,7 +114,7 @@ TextEditor.prototype = { stopOnReturn: true, trimOutput: false, }); - }, + } async update() { try { @@ -126,18 +126,18 @@ TextEditor.prototype = { } catch (e) { console.error(e); } - }, + } destroy() { this.ReactDOM.unmountComponentAtNode(this.elt); - }, + } /** * Stub method for consistency with ElementEditor. */ getInfoAtNode() { return null; - }, -}; + } +} module.exports = TextEditor;