Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b00d759

Browse files
Merge pull request #208 from jahn96/downloadSnippet
Rename downloadSnippet to exportSnippet
2 parents 42a8bad + c95cc1b commit b00d759

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

‎src/CodeSnippetDisplay.tsx

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ const CODE_SNIPPET_MORE_OTPIONS_COPY = 'jp-codeSnippet-more-options-copy';
118118
const CODE_SNIPPET_MORE_OTPIONS_INSERT = 'jp-codeSnippet-more-options-insert';
119119
const CODE_SNIPPET_MORE_OTPIONS_EDIT = 'jp-codeSnippet-more-options-edit';
120120
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';
123122
const CODE_SNIPPET_CREATE_NEW_BTN = 'jp-createSnippetBtn';
124123
const CODE_SNIPPET_NAME = 'jp-codeSnippet-name';
125124
const 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;

‎src/CodeSnippetMessage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ namespace Private {
103103
message.textContent = 'Saved as Snippet!';
104104
} else if (type === 'copy') {
105105
message.textContent = 'Saved to Clipboard!';
106-
} else if (type === 'download') {
107-
message.textContent = 'Downloaded the Snippet!';
106+
} else if (type === 'export') {
107+
message.textContent = 'Exported the Snippet!';
108108
}
109109
messageContainer.appendChild(message);
110110
body.append(messageContainer);

‎style/base.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,13 +677,13 @@ mark.jp-codeSnippet-search-bolding {
677677
cursor: pointer;
678678
}
679679

680-
.jp-codeSnippet-more-options-download {
680+
.jp-codeSnippet-more-options-export {
681681
color: var(--jp-brand-color0);
682682
padding-bottom: 5px;
683683
cursor: pointer;
684684
}
685685

686-
.jp-codeSnippet-more-options-download:hover {
686+
.jp-codeSnippet-more-options-export:hover {
687687
background-color: var(--jp-layout-color2);
688688
cursor: pointer;
689689
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /