mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
parent
2d167f91a8
commit
c3a7fd56e7
11 changed files with 241 additions and 3 deletions
|
|
@ -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;
|
||||
},
|
||||
|
|
@ -1073,6 +1077,15 @@ Inspector.prototype = {
|
|||
hidden: !this.canGetUniqueSelector,
|
||||
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"),
|
||||
|
|
@ -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);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ const ALL_MENU_ITEMS = [
|
|||
"node-menu-copyinner",
|
||||
"node-menu-copyouter",
|
||||
"node-menu-copyuniqueselector",
|
||||
"node-menu-copycsspath",
|
||||
"node-menu-copyimagedatauri",
|
||||
"node-menu-delete",
|
||||
"node-menu-pseudo-hover",
|
||||
|
|
|
|||
|
|
@ -25,6 +25,12 @@ const COPY_ITEMS_TEST_DATA = [
|
|||
selector: "[data-id=\"copy\"]",
|
||||
text: "body > div:nth-child(1) > p:nth-child(2)",
|
||||
},
|
||||
{
|
||||
desc: "copy css path",
|
||||
id: "node-menu-copycsspath",
|
||||
selector: "[data-id=\"copy\"]",
|
||||
text: "html body div p",
|
||||
},
|
||||
{
|
||||
desc: "copy image data uri",
|
||||
id: "node-menu-copyimagedatauri",
|
||||
|
|
|
|||
|
|
@ -154,6 +154,12 @@ inspectorCopyOuterHTML.accesskey=O
|
|||
inspectorCopyCSSSelector.label=CSS Selector
|
||||
inspectorCopyCSSSelector.accesskey=S
|
||||
|
||||
# LOCALIZATION NOTE (inspectorCopyCSSPath.label): This is the label
|
||||
# shown in the inspector contextual-menu for the item that lets users copy
|
||||
# the full CSS path of the current node
|
||||
inspectorCopyCSSPath.label=CSS Path
|
||||
inspectorCopyCSSPath.accesskey=P
|
||||
|
||||
# LOCALIZATION NOTE (inspectorPasteOuterHTML.label): This is the label shown
|
||||
# in the inspector contextual-menu for the item that lets users paste outer
|
||||
# HTML in the current node
|
||||
|
|
|
|||
|
|
@ -163,6 +163,12 @@ Telemetry.prototype = {
|
|||
toolbareyedropper: {
|
||||
histogram: "DEVTOOLS_TOOLBAR_EYEDROPPER_OPENED_COUNT",
|
||||
},
|
||||
copyuniquecssselector: {
|
||||
histogram: "DEVTOOLS_COPY_UNIQUE_CSS_SELECTOR_OPENED_COUNT",
|
||||
},
|
||||
copyfullcssselector: {
|
||||
histogram: "DEVTOOLS_COPY_FULL_CSS_SELECTOR_OPENED_COUNT",
|
||||
},
|
||||
developertoolbar: {
|
||||
histogram: "DEVTOOLS_DEVELOPERTOOLBAR_OPENED_COUNT",
|
||||
timerHistogram: "DEVTOOLS_DEVELOPERTOOLBAR_TIME_ACTIVE_SECONDS"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue