mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Added ctrl/cmd+s save on design settings screen
refs https://github.com/TryGhost/Team/issues/1149 - use ember-keyboard's `{{on-key}}` modifier to attach keyboard event listener when the design settings index screen is shown - ensures that ctrl/cmd+s on the change-theme screen won't trigger an unexpected save - blur active element when saving so the preview is updated and reflects what has just been saved (text fields only update preview on blur)
This commit is contained in:
parent
21847b822c
commit
e9911d5e20
2 changed files with 8 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
import Controller from '@ember/controller';
|
||||
import {action} from '@ember/object';
|
||||
import {next} from '@ember/runloop';
|
||||
import {inject as service} from '@ember/service';
|
||||
import {task} from 'ember-concurrency-decorators';
|
||||
import {tracked} from '@glimmer/tracking';
|
||||
|
@ -26,6 +27,12 @@ export default class SettingsDesignIndexController extends Controller {
|
|||
this.previewSize = size;
|
||||
}
|
||||
|
||||
@action
|
||||
saveFromKeyboard() {
|
||||
document.activeElement.blur?.();
|
||||
return this.saveTask.perform();
|
||||
}
|
||||
|
||||
@task
|
||||
*saveTask() {
|
||||
try {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<section class="gh-canvas gh-design">
|
||||
<section class="gh-canvas gh-design" {{on-key "cmd+s" this.saveFromKeyboard}}>
|
||||
<GhCanvasHeader class="gh-canvas-header">
|
||||
<h2 class="gh-canvas-title">Site design</h2>
|
||||
<section class="view-actions">
|
||||
|
|
Loading…
Add table
Reference in a new issue