summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/inspector.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-04 14:35:31 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-04 14:35:31 -0500
commit7edd685eee95759d66a457cf428f42e0dda94671 (patch)
treec4514958ea133084552be32d331c115afc509daa /devtools/client/inspector/inspector.js
parent0083d404eff36f873cde465d50cd34b112bd124f (diff)
parentfc7d9fade54dfbe275c4808dabe30a19415082e0 (diff)
downloadUXP-7edd685eee95759d66a457cf428f42e0dda94671.tar
UXP-7edd685eee95759d66a457cf428f42e0dda94671.tar.gz
UXP-7edd685eee95759d66a457cf428f42e0dda94671.tar.lz
UXP-7edd685eee95759d66a457cf428f42e0dda94671.tar.xz
UXP-7edd685eee95759d66a457cf428f42e0dda94671.zip
Merge branch 'master' into configurebuild-work
Diffstat (limited to 'devtools/client/inspector/inspector.js')
-rw-r--r--devtools/client/inspector/inspector.js32
1 files changed, 30 insertions, 2 deletions
diff --git a/devtools/client/inspector/inspector.js b/devtools/client/inspector/inspector.js
index c056c213f..d0458fc1f 100644
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -169,6 +169,10 @@ Inspector.prototype = {
return this._target.client.traits.getUniqueSelector;
},
+ get canGetCssPath() {
+ return this._target.client.traits.getCssPath;
+ },
+
get canGetUsedFontFaces() {
return this._target.client.traits.getUsedFontFaces;
},
@@ -1074,6 +1078,15 @@ Inspector.prototype = {
click: () => this.copyUniqueSelector(),
}));
copySubmenu.append(new MenuItem({
+ id: "node-menu-copycsspath",
+ label: INSPECTOR_L10N.getStr("inspectorCopyCSSPath.label"),
+ accesskey:
+ INSPECTOR_L10N.getStr("inspectorCopyCSSPath.accesskey"),
+ disabled: !isSelectionElement,
+ hidden: !this.canGetCssPath,
+ click: () => this.copyCssPath(),
+ }));
+ copySubmenu.append(new MenuItem({
id: "node-menu-copyimagedatauri",
label: INSPECTOR_L10N.getStr("inspectorImageDataUri.label"),
disabled: !isSelectionElement || !markupContainer ||
@@ -1677,9 +1690,24 @@ Inspector.prototype = {
return;
}
- this.selection.nodeFront.getUniqueSelector().then((selector) => {
+ this.telemetry.toolOpened("copyuniquecssselector");
+ this.selection.nodeFront.getUniqueSelector().then(selector => {
clipboardHelper.copyString(selector);
- }).then(null, console.error);
+ }).catch(e => console.error);
+ },
+
+ /**
+ * Copy the full CSS Path of the selected Node to the clipboard.
+ */
+ copyCssPath: function () {
+ if (!this.selection.isNode()) {
+ return;
+ }
+
+ this.telemetry.toolOpened("copyfullcssselector");
+ this.selection.nodeFront.getCssPath().then(path => {
+ clipboardHelper.copyString(path);
+ }).catch(e => console.error);
},
/**