0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fixed error when interacting with tag accent color input

closes https://github.com/TryGhost/Team/issues/744

- we were using `{{on}}` with a function on the component that wasn't bound to `this` via the `action` decorator meaning errors were thrown every time the input lost focus
This commit is contained in:
Kevin Ansfield 2021-07-14 15:59:27 +01:00
parent 85f579b785
commit 7a3b171f7f

View file

@ -1,5 +1,6 @@
import Component from '@ember/component'; import Component from '@ember/component';
import Ember from 'ember'; import Ember from 'ember';
import {action} from '@ember/object';
import {computed} from '@ember/object'; import {computed} from '@ember/object';
import {htmlSafe} from '@ember/template'; import {htmlSafe} from '@ember/template';
import {or} from '@ember/object/computed'; import {or} from '@ember/object/computed';
@ -161,7 +162,7 @@ export default Component.extend({
} }
}, },
updateAccentColor: async function (event) { updateAccentColor: action(async function (event) {
let newColor = event.target.value; let newColor = event.target.value;
const oldColor = this.tag.get('accentColor'); const oldColor = this.tag.get('accentColor');
@ -199,7 +200,7 @@ export default Component.extend({
this.tag.errors.add('accentColor', 'The colour should be in valid hex format'); this.tag.errors.add('accentColor', 'The colour should be in valid hex format');
this.tag.hasValidated.pushObject('accentColor'); this.tag.hasValidated.pushObject('accentColor');
} }
}, }),
debounceUpdateAccentColor: task(function*(event) { debounceUpdateAccentColor: task(function*(event) {
yield timeout(10); yield timeout(10);