mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Removed deprecated usage of this.$()
in components
no issue - converted remaining uses of `this.$()` that I could find over to native DOM - deprecation is still silenced for now because both `liquid-fire` and `liquid-wormhole` trigger it
This commit is contained in:
parent
3ac4de6747
commit
4d5c43305b
8 changed files with 26 additions and 25 deletions
|
@ -16,6 +16,6 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
click() {
|
||||
this.$('a').blur();
|
||||
this.element.querySelector('a').blur();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -25,21 +25,30 @@ export default Component.extend(DropdownMixin, {
|
|||
}),
|
||||
|
||||
didInsertElement() {
|
||||
let dropdownService = this.dropdown;
|
||||
|
||||
this._super(...arguments);
|
||||
|
||||
let dropdownService = this.dropdown;
|
||||
dropdownService.on('close', this, this.close);
|
||||
dropdownService.on('toggle', this, this.toggle);
|
||||
|
||||
this._animationEndHandler = run.bind(this, function (event) {
|
||||
if (event.animationName === 'fade-out' && this.closing) {
|
||||
this.set('isOpen', false);
|
||||
this.set('closing', false);
|
||||
}
|
||||
});
|
||||
|
||||
this.element.addEventListener('animationend', this._animationEndHandler);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
let dropdownService = this.dropdown;
|
||||
|
||||
this._super(...arguments);
|
||||
|
||||
let dropdownService = this.dropdown;
|
||||
dropdownService.off('close', this, this.close);
|
||||
dropdownService.off('toggle', this, this.toggle);
|
||||
|
||||
this.element.removeEventListener('animationend', this._animationEndHandler);
|
||||
},
|
||||
|
||||
open() {
|
||||
|
@ -54,17 +63,6 @@ export default Component.extend(DropdownMixin, {
|
|||
if (this.button) {
|
||||
this.set('button.isOpen', false);
|
||||
}
|
||||
|
||||
this.$().on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', (event) => {
|
||||
if (event.originalEvent.animationName === 'fade-out') {
|
||||
run(this, function () {
|
||||
if (this.closing) {
|
||||
this.set('isOpen', false);
|
||||
this.set('closing', false);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// Called by the dropdown service when any dropdown button is clicked.
|
||||
|
|
|
@ -24,7 +24,7 @@ export default Component.extend({
|
|||
|
||||
// Reset form
|
||||
if (this.shouldResetForm) {
|
||||
this.$().closest('form')[0].reset();
|
||||
this.element.closest('form').reset();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -613,7 +613,7 @@ export default Component.extend(ShortcutsMixin, {
|
|||
|
||||
// trigger the dialog via gh-file-input, when a file is selected it will
|
||||
// trigger the onImageFilesSelected closure action
|
||||
this.$('input[type="file"]').click();
|
||||
this.element.querySelector('input[type="file"]').click();
|
||||
},
|
||||
|
||||
// wrap SimpleMDE's built-in preview toggle so that we can trigger a closure
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import Component from '@ember/component';
|
||||
import {computed} from '@ember/object';
|
||||
import {run} from '@ember/runloop';
|
||||
import {inject as service} from '@ember/service';
|
||||
|
||||
export default Component.extend({
|
||||
|
@ -32,16 +33,18 @@ export default Component.extend({
|
|||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.$().on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', (event) => {
|
||||
this._animationEndHandler = run.bind(this, function () {
|
||||
if (event.originalEvent.animationName === 'fade-out') {
|
||||
this.notifications.closeNotification(this.message);
|
||||
}
|
||||
});
|
||||
|
||||
this.element.addEventListener('animationend', this._animationEndHandler);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
this.$().off('animationend webkitAnimationEnd oanimationend MSAnimationEnd');
|
||||
this.element.removeEventListener('animationend', this._animationEndHandler);
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -150,9 +150,8 @@ const GhTaskButton = Component.extend({
|
|||
// so we want to restart the retry spinner animation to show something
|
||||
// has happened when the button is clicked
|
||||
_restartAnimation: task(function* () {
|
||||
if (this.$('.retry-animated').length) {
|
||||
// eslint-disable-next-line
|
||||
let elem = this.$('.retry-animated')[0];
|
||||
let elem = this.element.querySelector('.retry-animated');
|
||||
if (elem) {
|
||||
elem.classList.remove('retry-animated');
|
||||
yield timeout(10);
|
||||
elem.classList.add('retry-animated');
|
||||
|
|
|
@ -70,9 +70,9 @@ export default ModalComponent.extend({
|
|||
|
||||
_setErrorState(state) {
|
||||
if (state) {
|
||||
this.$('.url').addClass('error');
|
||||
this.element.querySelector('.url').classList.add('error');
|
||||
} else {
|
||||
this.$('.url').removeClass('error');
|
||||
this.element.querySelector('.url').classList.remove('error');
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
self.deprecationWorkflow = self.deprecationWorkflow || {};
|
||||
self.deprecationWorkflow.config = {
|
||||
workflow: [
|
||||
// revert one liquid-fire and liquid-wormhole remove uses of `this.$()`
|
||||
{handler: 'silence', matchId: 'ember-views.curly-components.jquery-element'},
|
||||
// revert once ember-infinity removes usage of `isVisible`
|
||||
// https://github.com/ember-infinity/ember-infinity/pull/399
|
||||
|
|
Loading…
Add table
Reference in a new issue