mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 03:12:54 +03:00
8cc4c6c4a1
no issue - since `ember-concurrency@2.0` it's possible to use the standard imports as decorators removing the need for the extra `ember-concurrency-decorators` dependency and imports
35 lines
811 B
JavaScript
35 lines
811 B
JavaScript
import Component from '@glimmer/component';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
import {task} from 'ember-concurrency';
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
export default class ModalPostPreviewComponent extends Component {
|
|
@tracked tab = 'browser';
|
|
@service settings;
|
|
@service session;
|
|
|
|
constructor() {
|
|
super(...arguments);
|
|
this.saveFirstTask.perform();
|
|
}
|
|
|
|
@action
|
|
changeTab(tab) {
|
|
this.tab = tab;
|
|
}
|
|
|
|
@task
|
|
*saveFirstTask() {
|
|
const {saveTask, post, hasDirtyAttributes} = this.args.data;
|
|
|
|
if (saveTask.isRunning) {
|
|
return yield saveTask.last;
|
|
}
|
|
|
|
if (post.isDraft && hasDirtyAttributes) {
|
|
yield saveTask.perform();
|
|
}
|
|
}
|
|
}
|