@@ -118,8 +118,7 @@ const CODE_SNIPPET_MORE_OTPIONS_COPY = 'jp-codeSnippet-more-options-copy';
118
118
const CODE_SNIPPET_MORE_OTPIONS_INSERT = 'jp-codeSnippet-more-options-insert' ;
119
119
const CODE_SNIPPET_MORE_OTPIONS_EDIT = 'jp-codeSnippet-more-options-edit' ;
120
120
const CODE_SNIPPET_MORE_OTPIONS_DELETE = 'jp-codeSnippet-more-options-delete' ;
121
- const CODE_SNIPPET_MORE_OTPIONS_DOWNLOAD =
122
- 'jp-codeSnippet-more-options-download' ;
121
+ const CODE_SNIPPET_MORE_OTPIONS_EXPORT = 'jp-codeSnippet-more-options-export' ;
123
122
const CODE_SNIPPET_CREATE_NEW_BTN = 'jp-createSnippetBtn' ;
124
123
const CODE_SNIPPET_NAME = 'jp-codeSnippet-name' ;
125
124
const OPTIONS_BODY = 'jp-codeSnippet-options-body' ;
@@ -1488,35 +1487,37 @@ export class CodeSnippetDisplay extends React.Component<
1488
1487
} ) ;
1489
1488
}
1490
1489
1491
- private downloadCommand ( codeSnippet : ICodeSnippet ) : void {
1490
+ private exportCommand ( codeSnippet : ICodeSnippet ) : void {
1492
1491
// Request a text
1493
1492
InputDialog . getText ( {
1494
- title : 'Download Snippet?' ,
1495
- label : 'Directory to Download : ' ,
1493
+ title : 'Export Snippet?' ,
1494
+ label : 'Directory to Export : ' ,
1496
1495
placeholder : 'share/snippet' ,
1497
- okLabel : 'Download ' ,
1496
+ okLabel : 'Export ' ,
1498
1497
} ) . then ( ( value : Dialog . IResult < string > ) => {
1499
1498
if ( value . button . accept ) {
1500
1499
const dirs = value . value . split ( '/' ) ;
1501
1500
1502
- const codeSnippetDownloader = CodeSnippetContentsService . getInstance ( ) ;
1501
+ const codeSnippetContentsManager = CodeSnippetContentsService . getInstance ( ) ;
1503
1502
1504
1503
let path = '' ;
1505
1504
for ( let i = 0 ; i < dirs . length ; i ++ ) {
1506
1505
path += dirs [ i ] + '/' ;
1507
- codeSnippetDownloader . save ( path , { type : 'directory' } ) . catch ( ( _ ) => {
1508
- alert ( 'Path should be a relative path' ) ;
1509
- } ) ;
1506
+ codeSnippetContentsManager
1507
+ . save ( path , { type : 'directory' } )
1508
+ . catch ( ( _ ) => {
1509
+ alert ( 'Path should be a relative path' ) ;
1510
+ } ) ;
1510
1511
}
1511
1512
1512
1513
path += codeSnippet . name + '.json' ;
1513
1514
1514
- codeSnippetDownloader . save ( path , {
1515
+ codeSnippetContentsManager . save ( path , {
1515
1516
type : 'file' ,
1516
1517
format : 'text' ,
1517
1518
content : JSON . stringify ( codeSnippet ) ,
1518
1519
} ) ;
1519
- showMessage ( 'download ' ) ;
1520
+ showMessage ( 'export ' ) ;
1520
1521
}
1521
1522
} ) ;
1522
1523
}
@@ -1578,18 +1579,18 @@ export class CodeSnippetDisplay extends React.Component<
1578
1579
this . removeOptionsNode ( ) ;
1579
1580
} ;
1580
1581
1581
- const downloadSnip = document . createElement ( 'div' ) ;
1582
- downloadSnip . className = CODE_SNIPPET_MORE_OTPIONS_DOWNLOAD ;
1583
- downloadSnip . textContent = 'Download snippet' ;
1584
- downloadSnip . onclick = ( ) : void => {
1585
- this . downloadCommand ( codeSnippet ) ;
1582
+ const exportSnip = document . createElement ( 'div' ) ;
1583
+ exportSnip . className = CODE_SNIPPET_MORE_OTPIONS_EXPORT ;
1584
+ exportSnip . textContent = 'Export snippet' ;
1585
+ exportSnip . onclick = ( ) : void => {
1586
+ this . exportCommand ( codeSnippet ) ;
1586
1587
this . removeOptionsNode ( ) ;
1587
1588
} ;
1588
1589
1589
1590
optionsContainer . appendChild ( insertSnip ) ;
1590
1591
optionsContainer . appendChild ( copySnip ) ;
1591
1592
optionsContainer . appendChild ( editSnip ) ;
1592
- optionsContainer . appendChild ( downloadSnip ) ;
1593
+ optionsContainer . appendChild ( exportSnip ) ;
1593
1594
optionsContainer . appendChild ( deleteSnip ) ;
1594
1595
body . append ( optionsContainer ) ;
1595
1596
return body ;
0 commit comments