mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: mouseEnter
is deprecated in newer Ember releases
This is the recommended fix via: https://deprecations.emberjs.com/v3.x/#toc_component-mouseenter-leave-move
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { computed } from "@ember/object";
|
import { computed, action } from "@ember/object";
|
||||||
import { makeArray } from "discourse-common/lib/helpers";
|
import { makeArray } from "discourse-common/lib/helpers";
|
||||||
import { guidFor } from "@ember/object/internals";
|
import { guidFor } from "@ember/object/internals";
|
||||||
import UtilsMixin from "select-kit/mixins/utils";
|
import UtilsMixin from "select-kit/mixins/utils";
|
||||||
@@ -27,6 +27,18 @@ export default Component.extend(UtilsMixin, {
|
|||||||
"item.classNames",
|
"item.classNames",
|
||||||
],
|
],
|
||||||
|
|
||||||
|
didInsertElement() {
|
||||||
|
this._super(...arguments);
|
||||||
|
this.element.addEventListener("mouseenter", this.handleMouseEnter);
|
||||||
|
},
|
||||||
|
|
||||||
|
willDestroyElement() {
|
||||||
|
this._super(...arguments);
|
||||||
|
if (this.element) {
|
||||||
|
this.element.removeEventListener("mouseenter", this.handleMouseEnter);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
isNone: computed("rowValue", function () {
|
isNone: computed("rowValue", function () {
|
||||||
return this.rowValue === this.getValue(this.selectKit.noneItem);
|
return this.rowValue === this.getValue(this.selectKit.noneItem);
|
||||||
}),
|
}),
|
||||||
@@ -91,7 +103,8 @@ export default Component.extend(UtilsMixin, {
|
|||||||
return this.rowValue === this.value;
|
return this.rowValue === this.value;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
mouseEnter() {
|
@action
|
||||||
|
handleMouseEnter() {
|
||||||
if (!this.isDestroying || !this.isDestroyed) {
|
if (!this.isDestroying || !this.isDestroyed) {
|
||||||
this.selectKit.onHover(this.rowValue, this.item);
|
this.selectKit.onHover(this.rowValue, this.item);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user