fix(frontend): Attempt to resolve TypeError in RichTextInput.svelte
Fixes an issue where `ue.getWordAtDocPos is not a function` would be thrown in `MessageInput.svelte`. The error was caused by a timing issue where the `getWordAtDocPos` method on the `RichTextInput` component was not available when called from an event handler within the same component. This change refactors the code to pass the `getWordAtDocPos` function as a callback prop from `RichTextInput` to `MessageInput`, ensuring it's available when needed.
This commit is contained in:
@@ -38,10 +38,10 @@ const createIsLoadingStore = (i18n: i18nType) => {
|
||||
};
|
||||
|
||||
export const initI18n = (defaultLocale?: string | undefined) => {
|
||||
let detectionOrder = defaultLocale
|
||||
const detectionOrder = defaultLocale
|
||||
? ['querystring', 'localStorage']
|
||||
: ['querystring', 'localStorage', 'navigator'];
|
||||
let fallbackDefaultLocale = defaultLocale ? [defaultLocale] : ['en-US'];
|
||||
const fallbackDefaultLocale = defaultLocale ? [defaultLocale] : ['en-US'];
|
||||
|
||||
const loadResource = (language: string, namespace: string) =>
|
||||
import(`./locales/${language}/${namespace}.json`);
|
||||
|
||||
Reference in New Issue
Block a user