33 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
44
55import { PureComponent } from "react" ;
6- import { showMenu } from "devtools-contextmenu " ;
7- import { isOriginalId , isGeneratedId } from "devtools-source-map" ;
6+ import { showMenu } from "devtools-launchpad " ;
7+ import { isOriginalId } from "devtools-source-map" ;
88import { copyToTheClipboard } from "../../utils/clipboard" ;
99import { isPretty } from "../../utils/source" ;
1010import { getSourceLocationFromMouseEvent } from "../../utils/editor" ;
@@ -16,7 +16,8 @@ import {
1616 getContextMenu ,
1717 getSelectedLocation ,
1818 getSelectedSource ,
19- getSymbols
19+ getSymbols ,
20+ getPrettySource
2021} from "../../selectors" ;
2122
2223import actions from "../../actions" ;
@@ -38,7 +39,8 @@ function getMenuItems(
3839 addExpression,
3940 getFunctionText,
4041 getFunctionLocation,
41- flashLineRange
42+ flashLineRange,
43+ hasPrettyPrint
4244 }
4345) {
4446 const copySourceLabel = L10N . getStr ( "copySource" ) ;
@@ -85,13 +87,16 @@ function getMenuItems(
8587 ) ;
8688
8789 const isOriginal = isOriginalId ( selectedLocation . sourceId ) ;
88- const hasSourceMap = selectedSource . get ( "sourceMapURL" ) ;
90+ const hasSourceMap = ! ! selectedSource . get ( "sourceMapURL" ) ;
8991 const isPrettyPrinted = isPretty ( selectedSource . toJS ( ) ) ;
9092
93+ const isPrettified = isPrettyPrinted || hasPrettyPrint ;
94+ const isMapped = isOriginal || hasSourceMap ;
95+
9196 const jumpLabel = {
9297 id : "node-menu-jump" ,
9398 accesskey : L10N . getStr ( "editor.jumpToMappedLocation1.accesskey" ) ,
94- disabled : isGeneratedId && ! hasSourceMap ,
99+ disabled : ! isMapped && ! isPrettified ,
95100 label : L10N . getFormatStr (
96101 "editor.jumpToMappedLocation1" ,
97102 isOriginal ? L10N . getStr ( "generated" ) : L10N . getStr ( "original" )
@@ -193,6 +198,7 @@ export default connect(
193198 return {
194199 selectedLocation : getSelectedLocation ( state ) ,
195200 selectedSource,
201+ hasPrettyPrint : ! ! getPrettySource ( state , selectedSource . get ( "id" ) ) ,
196202 contextMenu : getContextMenu ( state ) ,
197203 getFunctionText : line =>
198204 findFunctionText (
0 commit comments