Skip to content

Commit 9cfe206

Browse files
committed
feat: make all the input fields mandatory
1 parent c45adde commit 9cfe206

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@
5656
<!--this view will open up when user clicks on add a new snippet button-->
5757
<div id="custom-snippets-add-new" class="custom-snippets-add-new hidden">
5858
<div id="abbr-box-wrapper">
59-
<label for="abbr-box">Abbreviation*: </label>
59+
<label for="abbr-box">Abbreviation: </label>
6060
<input id="abbr-box" type="text" placeholder="clg" autocomplete="off" />
6161
</div>
6262

6363
<div id="desc-box-wrapper">
64-
<label for="desc-box">Description*: </label>
64+
<label for="desc-box">Description: </label>
6565
<input id="desc-box" type="text" placeholder="console log shortcut" autocomplete="off" />
6666
</div>
6767

6868
<div id="template-text-box-wrapper">
69-
<label for="template-text-box">Template Text*: </label>
69+
<label for="template-text-box">Template Text: </label>
7070
<input id="template-text-box" type="text" placeholder="console.log()" autocomplete="off" />
7171
</div>
7272

src/extensionsIntegrated/CustomSnippets/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ define(function (require, exports, module) {
9797
const $abbrInput = $("#abbr-box");
9898
const $descInput = $("#desc-box");
9999
const $templateInput = $("#template-text-box");
100+
const $fileExtnInput = $("#file-extn-box");
100101
const $addSnippetBtn = $("#add-snippet-btn");
101102
const $addNewSnippetBtn = $("#add-new-snippet-btn");
102103
const $backToListMenuBtn = $("#back-to-list-menu-btn");
@@ -125,6 +126,7 @@ define(function (require, exports, module) {
125126
$abbrInput.on("input", Helper.toggleSaveButtonDisability);
126127
$descInput.on("input", Helper.toggleSaveButtonDisability);
127128
$templateInput.on("input", Helper.toggleSaveButtonDisability);
129+
$fileExtnInput.on("input", Helper.toggleSaveButtonDisability);
128130
}
129131

130132
AppInit.appReady(function () {

src/extensionsIntegrated/CustomSnippets/src/helper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ define(function (require, exports, module) {
1313
const abbreviation = $("#abbr-box").val().trim();
1414
const description = $("#desc-box").val().trim();
1515
const templateText = $("#template-text-box").val().trim();
16-
const fileExtension = $("#file-extn-box").val().trim() || "all";
16+
const fileExtension = $("#file-extn-box").val().trim();
1717

1818
return {
1919
abbreviation: abbreviation,
@@ -34,14 +34,16 @@ define(function (require, exports, module) {
3434
const $abbrInput = $("#abbr-box");
3535
const $descInput = $("#desc-box");
3636
const $templateInput = $("#template-text-box");
37+
const $fileExtnInput = $("#file-extn-box");
3738

3839
const $saveBtn = $("#save-custom-snippet-btn").find("button");
3940

4041
// make sure that the required fields has some value
4142
const hasAbbr = $abbrInput.val().trim().length > 0;
4243
const hasDesc = $descInput.val().trim().length > 0;
4344
const hasTemplate = $templateInput.val().trim().length > 0;
44-
$saveBtn.prop("disabled", !(hasAbbr && hasDesc && hasTemplate));
45+
const hasFileExtn = $fileExtnInput.val().trim().length > 0;
46+
$saveBtn.prop("disabled", !(hasAbbr && hasDesc && hasTemplate && hasFileExtn));
4547
}
4648

4749
/**

0 commit comments

Comments
 (0)