diff options
Diffstat (limited to 'utils/util.ts')
| -rw-r--r-- | utils/util.ts | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/utils/util.ts b/utils/util.ts index 273191a..f5f7247 100644 --- a/utils/util.ts +++ b/utils/util.ts @@ -1,31 +1,34 @@ -const COLOR_CODE_REGEX = /&([0-9a-fk-or]|#[0-9A-F]{6})/ig; +const COLOR_CODE_REGEX = /&([0-9a-fk-or]|#[0-9A-F]{6})/gi; export function stripColorCodes(str: string): string { return str.replace(COLOR_CODE_REGEX, ''); } -export function navigateToEditorPane(type: 'quest' | 'category' | 'item' | 'config' | null, id?: string) { +export function navigateToEditorPane( + type: 'quest' | 'category' | 'item' | 'config' | null, + id?: string +) { if (id) { if (type === 'category') { - navigateTo({ path: '/editor/category/' + id }) + navigateTo({ path: '/editor/category/' + id }); } else if (type === 'quest') { - navigateTo({ path: '/editor/quest/' + id }) + navigateTo({ path: '/editor/quest/' + id }); } else if (type === 'item') { - navigateTo({ path: '/editor/item/' + id }) + navigateTo({ path: '/editor/item/' + id }); } } else if (type === 'config') { - navigateTo({ path: '/editor/config' }) + navigateTo({ path: '/editor/config' }); } else if (!id && !type) { - navigateTo({ path: '/editor' }) + navigateTo({ path: '/editor' }); } } export type BrowserCapabilities = { - canUseFsApi: boolean -} + canUseFsApi: boolean; +}; export function getBrowserCapabilities(): BrowserCapabilities { return { - canUseFsApi: typeof (window as any)?.showDirectoryPicker === 'function' - } -}
\ No newline at end of file + canUseFsApi: typeof (window as any)?.showDirectoryPicker === 'function', + }; +} |
