Skip to content

Commit

Permalink
Store default name of custom formats
Browse files Browse the repository at this point in the history
so that we don't need to do empty check in popup ui
  • Loading branch information
yorkxin committed Aug 25, 2024
1 parent aecb136 commit 2c6ef8a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/ui/custom-format.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ <h2 class="title is-3" data-placeholder="default-name">Custom Format</h2>
<div class="field">
<label class="label" for="input-name">Display Name on Menu</label>
<div class="control">
<input id="input-name" class="input" type="text" placeholder="Custom Format">
<input id="input-name" class="input" type="text">
</div>
<p class="help">Leave blank to use &ldquo;<span data-placeholder="default-name">Custom Format</span>.&rdquo;</p>
</div>
<div class="field">
<label class="label" for="input-template">Template</label>
Expand Down
6 changes: 3 additions & 3 deletions src/ui/custom-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class UI {
* @param customFormat {CustomFormat}
*/
load(customFormat) {
this.elInputName.value = customFormat.name;
this.elInputName.value = customFormat.name === '' ? this.defaultName() : customFormat.name;
this.elInputTemplate.value = customFormat.template;
this.elShowInPopupMenu.checked = customFormat.showInPopupMenu;
this.renderPreview();
Expand Down Expand Up @@ -119,8 +119,8 @@ class UI {
links: [
{
title: 'Example 3', url: 'https://example.com/3', number: 1,
},
{
},
{
title: 'Example 4', url: 'https://example.com/4', number: 2,
},
],
Expand Down

0 comments on commit 2c6ef8a

Please sign in to comment.