@@ -118,8 +118,7 @@ const CODE_SNIPPET_MORE_OTPIONS_COPY = 'jp-codeSnippet-more-options-copy';
118118const CODE_SNIPPET_MORE_OTPIONS_INSERT = 'jp-codeSnippet-more-options-insert' ;
119119const CODE_SNIPPET_MORE_OTPIONS_EDIT = 'jp-codeSnippet-more-options-edit' ;
120120const 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' ;
123122const CODE_SNIPPET_CREATE_NEW_BTN = 'jp-createSnippetBtn' ;
124123const CODE_SNIPPET_NAME = 'jp-codeSnippet-name' ;
125124const OPTIONS_BODY = 'jp-codeSnippet-options-body' ;
@@ -1488,35 +1487,37 @@ export class CodeSnippetDisplay extends React.Component<
14881487 } ) ;
14891488 }
14901489
1491- private downloadCommand ( codeSnippet : ICodeSnippet ) : void {
1490+ private exportCommand ( codeSnippet : ICodeSnippet ) : void {
14921491 // Request a text
14931492 InputDialog . getText ( {
1494- title : 'Download Snippet?' ,
1495- label : 'Directory to Download : ' ,
1493+ title : 'Export Snippet?' ,
1494+ label : 'Directory to Export : ' ,
14961495 placeholder : 'share/snippet' ,
1497- okLabel : 'Download ' ,
1496+ okLabel : 'Export ' ,
14981497 } ) . then ( ( value : Dialog . IResult < string > ) => {
14991498 if ( value . button . accept ) {
15001499 const dirs = value . value . split ( '/' ) ;
15011500
1502- const codeSnippetDownloader = CodeSnippetContentsService . getInstance ( ) ;
1501+ const codeSnippetContentsManager = CodeSnippetContentsService . getInstance ( ) ;
15031502
15041503 let path = '' ;
15051504 for ( let i = 0 ; i < dirs . length ; i ++ ) {
15061505 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+ } ) ;
15101511 }
15111512
15121513 path += codeSnippet . name + '.json' ;
15131514
1514- codeSnippetDownloader . save ( path , {
1515+ codeSnippetContentsManager . save ( path , {
15151516 type : 'file' ,
15161517 format : 'text' ,
15171518 content : JSON . stringify ( codeSnippet ) ,
15181519 } ) ;
1519- showMessage ( 'download ' ) ;
1520+ showMessage ( 'export ' ) ;
15201521 }
15211522 } ) ;
15221523 }
@@ -1578,18 +1579,18 @@ export class CodeSnippetDisplay extends React.Component<
15781579 this . removeOptionsNode ( ) ;
15791580 } ;
15801581
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 ) ;
15861587 this . removeOptionsNode ( ) ;
15871588 } ;
15881589
15891590 optionsContainer . appendChild ( insertSnip ) ;
15901591 optionsContainer . appendChild ( copySnip ) ;
15911592 optionsContainer . appendChild ( editSnip ) ;
1592- optionsContainer . appendChild ( downloadSnip ) ;
1593+ optionsContainer . appendChild ( exportSnip ) ;
15931594 optionsContainer . appendChild ( deleteSnip ) ;
15941595 body . append ( optionsContainer ) ;
15951596 return body ;
0 commit comments