Ghost/ghost/admin/app/components/gh-navitem.hbs
Rish f8b2092f6c 🐛 Fixed nav item not saving updated value on keyboard save
no issue

- Fixes nav item values not saving on keyboard save shortcut
- Nav items value was only being updated in settings on focus out from text field.
- In case of keyboard save, focus out didn't happen so old value got saved and re-populated
- Change fixes to update setting value while typing
2020-07-07 14:47:10 +05:30

55 lines
1.9 KiB
Handlebars

{{#unless this.navItem.isNew}}
<span class="gh-blognav-grab">
{{svg-jar "grab"}}
<span class="sr-only">Reorder</span>
</span>
{{/unless}}
<div class="gh-blognav-line">
<GhValidationStatusContainer
@tagName="span"
@class="gh-blognav-label"
@errors={{this.navItem.errors}}
@property="label"
@hasValidated={{this.navItem.hasValidated}}
>
<GhTrimFocusInput
@shouldFocus={{this.navItem.last}}
@placeholder="Label"
@value={{readonly this.label}}
@input={{action "updateLabel" value="target.value"}}
@keyPress={{action "clearLabelErrors"}}
@focus-out={{action "updateLabel" this.label}} data-test-input="label" />
<GhErrorMessage
@errors={{this.navItem.errors}}
@property="label" data-test-error="label" />
</GhValidationStatusContainer>
<GhValidationStatusContainer
@tagName="span"
@class="gh-blognav-url"
@errors={{this.navItem.errors}}
@property="url"
@hasValidated={{this.navItem.hasValidated}}
>
<GhNavitemUrlInput
@baseUrl={{this.baseUrl}}
@isNew={{this.navItem.isNew}}
@url={{readonly this.url}}
@update={{action "updateUrl"}}
@clearErrors={{action "clearUrlErrors"}} data-test-input="url" />
<GhErrorMessage
@errors={{this.navItem.errors}}
@property="url" data-test-error="url" />
</GhValidationStatusContainer>
</div>
{{#if this.navItem.isNew}}
<button type="button" class="gh-blognav-add" {{action "addItem" this.navItem}}>
{{svg-jar "add"}}<span class="sr-only">Add</span>
</button>
{{else}}
<button type="button" class="gh-blognav-delete" {{action "deleteItem" this.navItem}}>
{{svg-jar "trash"}}<span class="sr-only">Delete</span>
</button>
{{/if}}