Skip to content

Commit cc99fcb

Browse files
committed
feat: add cancel button in add snippet panel
1 parent f336219 commit cc99fcb

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/extensionsIntegrated/CustomSnippets/htmlContent/snippets-panel.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@
111111
</div>
112112
</div>
113113

114-
<div id="save-custom-snippet-btn">
115-
<button class="dialog-button btn primary" disabled>Save</button>
114+
<div id="add-custom-snippet-panel-buttons">
115+
<button id="cancel-custom-snippet-btn" class="dialog-button btn">Cancel</button>
116+
<button id="save-custom-snippet-btn" class="dialog-button btn primary" disabled>Save</button>
116117
</div>
117118
</div>
118119

src/extensionsIntegrated/CustomSnippets/main.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ define(function (require, exports, module) {
122122
function _registerHandlers() {
123123
const $closePanelBtn = $("#close-custom-snippets-panel-btn");
124124
const $saveCustomSnippetBtn = $("#save-custom-snippet-btn");
125+
const $cancelCustomSnippetBtn = $("#cancel-custom-snippet-btn");
125126
const $abbrInput = $("#abbr-box");
126127
const $descInput = $("#desc-box");
127128
const $templateInput = $("#template-text-box");
@@ -159,6 +160,11 @@ define(function (require, exports, module) {
159160
Driver.handleSaveBtnClick();
160161
});
161162

163+
$cancelCustomSnippetBtn.on("click", function () {
164+
UIHelper.showSnippetListMenu();
165+
SnippetsList.showSnippetsList();
166+
});
167+
162168
$abbrInput.on("input", Helper.toggleSaveButtonDisability);
163169
$templateInput.on("input", Helper.toggleSaveButtonDisability);
164170

src/styles/Extn-CustomSnippets.less

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,14 @@
534534
}
535535
}
536536

537-
#save-custom-snippet-btn {
537+
#add-custom-snippet-panel-buttons {
538538
margin-top: 8px;
539539
padding-top: 8px;
540540
border-top: 1px solid @bc-panel-separator;
541541
text-align: right;
542+
display: flex;
543+
gap: 10px;
544+
justify-content: flex-end;
542545

543546
.dark & {
544547
border-top: 1px solid @dark-bc-panel-separator;

0 commit comments

Comments
 (0)