diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /browser/components/storybook/.storybook/addon-fluent/withPseudoLocalization.mjs | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/storybook/.storybook/addon-fluent/withPseudoLocalization.mjs')
-rw-r--r-- | browser/components/storybook/.storybook/addon-fluent/withPseudoLocalization.mjs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/browser/components/storybook/.storybook/addon-fluent/withPseudoLocalization.mjs b/browser/components/storybook/.storybook/addon-fluent/withPseudoLocalization.mjs index 9d6c62af38..74fd67a6cd 100644 --- a/browser/components/storybook/.storybook/addon-fluent/withPseudoLocalization.mjs +++ b/browser/components/storybook/.storybook/addon-fluent/withPseudoLocalization.mjs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -import { useEffect, useGlobals, addons } from "@storybook/addons"; +import { useEffect, useGlobals, useChannel } from "@storybook/preview-api"; import { DIRECTIONS, DIRECTION_BY_STRATEGY, @@ -25,11 +25,11 @@ export const withPseudoLocalization = (StoryFn, context) => { const [{ pseudoStrategy }] = useGlobals(); const direction = DIRECTION_BY_STRATEGY[pseudoStrategy] || DIRECTIONS.ltr; const isInDocs = context.viewMode === "docs"; - const channel = addons.getChannel(); + const emit = useChannel({}); useEffect(() => { if (pseudoStrategy) { - channel.emit(UPDATE_STRATEGY_EVENT, pseudoStrategy); + emit(UPDATE_STRATEGY_EVENT, pseudoStrategy); } }, [pseudoStrategy]); @@ -56,8 +56,7 @@ export const withPseudoLocalization = (StoryFn, context) => { */ export const withFluentStrings = (StoryFn, context) => { const [{ fluentStrings }, updateGlobals] = useGlobals(); - const channel = addons.getChannel(); - + const emit = useChannel({}); const fileName = context.component + ".ftl"; let strings = []; @@ -83,7 +82,7 @@ export const withFluentStrings = (StoryFn, context) => { } } - channel.emit(FLUENT_CHANGED, strings); + emit(FLUENT_CHANGED, strings, fileName); return StoryFn(); }; |