Added debounce for announcement content editor

refs TryGhost/Team#3009
This commit is contained in:
Elena Baidakova 2023-04-20 10:35:04 +04:00 committed by Elena Baidakova
parent 65ba464548
commit e39c79a811

View File

@ -1,5 +1,6 @@
import Component from '@glimmer/component'; import Component from '@glimmer/component';
import {action} from '@ember/object'; import {action} from '@ember/object';
import {debounce} from '@ember/runloop';
import {inject as service} from '@ember/service'; import {inject as service} from '@ember/service';
export default class AnnouncementSettingsContentComponent extends Component { export default class AnnouncementSettingsContentComponent extends Component {
@ -9,10 +10,14 @@ export default class AnnouncementSettingsContentComponent extends Component {
return this.settings.announcementContent; return this.settings.announcementContent;
} }
updatePreview() {
debounce(this, this.args.onChange, 300);
}
@action @action
setContent(html) { setContent(html) {
this.settings.announcementContent = html; this.settings.announcementContent = html;
this.settings.save(); this.settings.save();
this.args.onChange?.(); this.updatePreview();
} }
} }