diff --git a/devtools/client/debugger/src/components/Editor/Tab.js b/devtools/client/debugger/src/components/Editor/Tab.js index 5770ac3db520..ec1c83773ac0 100644 --- a/devtools/client/debugger/src/components/Editor/Tab.js +++ b/devtools/client/debugger/src/components/Editor/Tab.js @@ -137,7 +137,7 @@ class Tab extends PureComponent { { item: { type: "separator" } }, { item: { - ...tabMenuItems.copyToClipboard, + ...tabMenuItems.copySource, disabled: selectedSource.id !== tab, click: () => copyToClipboard(sourceTab), }, diff --git a/devtools/client/debugger/src/components/Editor/menus/editor.js b/devtools/client/debugger/src/components/Editor/menus/editor.js index 7b65e11a951b..471257884551 100644 --- a/devtools/client/debugger/src/components/Editor/menus/editor.js +++ b/devtools/client/debugger/src/components/Editor/menus/editor.js @@ -28,6 +28,7 @@ import type { ThreadContext, } from "../../../types"; +// Menu Items export const continueToHereItem = ( cx: ThreadContext, location: SourceLocation, @@ -41,31 +42,28 @@ export const continueToHereItem = ( label: L10N.getStr("editor.continueToHere.label"), }); -// menu items - const copyToClipboardItem = ( - selectedContent: SourceContent, + selectionText: string, editorActions: EditorItemActions ) => ({ id: "node-menu-copy-to-clipboard", label: L10N.getStr("copyToClipboard.label"), accesskey: L10N.getStr("copyToClipboard.accesskey"), - disabled: false, - click: () => - selectedContent.type === "text" && - copyToTheClipboard(selectedContent.value), + disabled: selectionText.length === 0, + click: () => copyToTheClipboard(selectionText), }); const copySourceItem = ( - selectedSource: Source, - selectionText: string, + selectedContent: SourceContent, editorActions: EditorItemActions ) => ({ id: "node-menu-copy-source", label: L10N.getStr("copySource.label"), accesskey: L10N.getStr("copySource.accesskey"), - disabled: selectionText.length === 0, - click: () => copyToTheClipboard(selectionText), + disabled: false, + click: () => + selectedContent.type === "text" && + copyToTheClipboard(selectedContent.value), }); const copySourceUri2Item = ( @@ -203,10 +201,10 @@ export function editorMenuItems({ ), continueToHereItem(cx, location, isPaused, editorActions), { type: "separator" }, - ...(content ? [copyToClipboardItem(content, editorActions)] : []), + copyToClipboardItem(selectionText, editorActions), ...(!selectedSource.isWasm ? [ - copySourceItem(selectedSource, selectionText, editorActions), + ...(content ? [copySourceItem(content, editorActions)] : []), copySourceUri2Item(selectedSource, editorActions), ] : []), diff --git a/devtools/client/debugger/src/utils/tabs.js b/devtools/client/debugger/src/utils/tabs.js index 42e246af31b5..12349c2faa93 100644 --- a/devtools/client/debugger/src/utils/tabs.js +++ b/devtools/client/debugger/src/utils/tabs.js @@ -78,10 +78,10 @@ export function getTabMenuItems(): Object { accesskey: L10N.getStr("sourceTabs.revealInTree.accesskey"), disabled: false, }, - copyToClipboard: { - id: "node-menu-copy-to-clipboard", - label: L10N.getStr("copyToClipboard.label"), - accesskey: L10N.getStr("copyToClipboard.accesskey"), + copySource: { + id: "node-menu-copy-source", + label: L10N.getStr("copySource.label"), + accesskey: L10N.getStr("copySource.accesskey"), disabled: false, }, copySourceUri2: { diff --git a/devtools/client/locales/en-US/debugger.properties b/devtools/client/locales/en-US/debugger.properties index ff109b96194c..4e0f1664c429 100644 --- a/devtools/client/locales/en-US/debugger.properties +++ b/devtools/client/locales/en-US/debugger.properties @@ -19,12 +19,12 @@ collapseSources=Collapse Sources and Outline panes collapseBreakpoints=Collapse Breakpoints pane # LOCALIZATION NOTE (copyToClipboard.label): This is the text that appears in the -# context menu to copy the complete source of the open file. +# context menu to copy the text that the user selected. copyToClipboard.label=Copy to clipboard copyToClipboard.accesskey=C # LOCALIZATION NOTE (copySource.label): This is the text that appears in the -# context menu to copy the selected source of file open. +# context menu to copy all of the text in the open file. copySource.label=Copy source text copySource.accesskey=y