mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:25:35 +08:00
DEV: Rename modifier
import to avoid overwriting template keyword
This commit is contained in:
parent
9f9b09536d
commit
e9e3456f18
|
@ -1,9 +1,9 @@
|
|||
import { on } from "@ember/modifier";
|
||||
import autosize from "autosize";
|
||||
import { modifier } from "ember-modifier";
|
||||
import { modifier as modifierFn } from "ember-modifier";
|
||||
import autoFocus from "discourse/modifiers/auto-focus";
|
||||
|
||||
const resize = modifier((element) => {
|
||||
const resize = modifierFn((element) => {
|
||||
autosize(element);
|
||||
return () => autosize.destroy(element);
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Component from "@glimmer/component";
|
||||
import { concat } from "@ember/helper";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
import { modifier } from "ember-modifier";
|
||||
import { modifier as modifierFn } from "ember-modifier";
|
||||
import concatClass from "discourse/helpers/concat-class";
|
||||
import TrapTab from "discourse/modifiers/trap-tab";
|
||||
import DFloatPortal from "float-kit/components/d-float-portal";
|
||||
|
@ -11,7 +11,7 @@ import FloatKitCloseOnClickOutside from "float-kit/modifiers/close-on-click-outs
|
|||
import FloatKitCloseOnEscape from "float-kit/modifiers/close-on-escape";
|
||||
|
||||
export default class DFloatBody extends Component {
|
||||
closeOnScroll = modifier(() => {
|
||||
closeOnScroll = modifierFn(() => {
|
||||
const firstScrollParent = getScrollParent(this.trigger);
|
||||
|
||||
const handler = () => {
|
||||
|
|
|
@ -7,7 +7,7 @@ import willDestroy from "@ember/render-modifiers/modifiers/will-destroy";
|
|||
import { LinkTo } from "@ember/routing";
|
||||
import { service } from "@ember/service";
|
||||
import { htmlSafe } from "@ember/template";
|
||||
import { modifier } from "ember-modifier";
|
||||
import { modifier as modifierFn } from "ember-modifier";
|
||||
import { and, eq } from "truth-helpers";
|
||||
import concatClass from "discourse/helpers/concat-class";
|
||||
import replaceEmoji from "discourse/helpers/replace-emoji";
|
||||
|
@ -39,11 +39,11 @@ export default class ChatChannelRow extends Component {
|
|||
@tracked rowStyle = null;
|
||||
@tracked canSwipe = true;
|
||||
|
||||
registerSwipableRow = modifier((element) => {
|
||||
registerSwipableRow = modifierFn((element) => {
|
||||
this.swipableRow = element;
|
||||
});
|
||||
|
||||
onReset = modifier((element) => {
|
||||
onReset = modifierFn((element) => {
|
||||
const handler = () => {
|
||||
this.rowStyle = htmlSafe("margin-right: 0px;");
|
||||
this.showRemoveButton = false;
|
||||
|
@ -60,7 +60,7 @@ export default class ChatChannelRow extends Component {
|
|||
};
|
||||
});
|
||||
|
||||
onRemoveChannel = modifier((element) => {
|
||||
onRemoveChannel = modifierFn((element) => {
|
||||
element.addEventListener(
|
||||
"transitionend",
|
||||
() => {
|
||||
|
@ -72,7 +72,7 @@ export default class ChatChannelRow extends Component {
|
|||
element.classList.add(FADEOUT_CLASS);
|
||||
});
|
||||
|
||||
handleSwipe = modifier((element) => {
|
||||
handleSwipe = modifierFn((element) => {
|
||||
element.addEventListener("touchstart", this.onSwipeStart, {
|
||||
passive: true,
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Component from "@glimmer/component";
|
||||
import { cached } from "@glimmer/tracking";
|
||||
import { service } from "@ember/service";
|
||||
import { modifier } from "ember-modifier";
|
||||
import { modifier as modifierFn } from "ember-modifier";
|
||||
import { eq } from "truth-helpers";
|
||||
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
|
||||
import isElementInViewport from "discourse/lib/is-element-in-viewport";
|
||||
|
@ -18,7 +18,7 @@ export default class ChatThreadList extends Component {
|
|||
|
||||
noThreadsLabel = I18n.t("chat.threads.none");
|
||||
|
||||
subscribe = modifier((element, [channel]) => {
|
||||
subscribe = modifierFn((element, [channel]) => {
|
||||
this.messageBus.subscribe(
|
||||
`/chat/${channel.id}`,
|
||||
this.onMessageBus,
|
||||
|
@ -35,7 +35,7 @@ export default class ChatThreadList extends Component {
|
|||
};
|
||||
});
|
||||
|
||||
fill = modifier((element) => {
|
||||
fill = modifierFn((element) => {
|
||||
this.resizeObserver = new ResizeObserver(() => {
|
||||
if (isElementInViewport(element)) {
|
||||
this.loadThreads();
|
||||
|
@ -49,7 +49,7 @@ export default class ChatThreadList extends Component {
|
|||
};
|
||||
});
|
||||
|
||||
loadMore = modifier((element) => {
|
||||
loadMore = modifierFn((element) => {
|
||||
this.intersectionObserver = new IntersectionObserver(this.loadThreads);
|
||||
this.intersectionObserver.observe(element);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user