diff --git a/vue/editor/playground/src/env.d.ts b/vue/editor/playground/src/env.d.ts index f275bb2..71bd41b 100644 --- a/vue/editor/playground/src/env.d.ts +++ b/vue/editor/playground/src/env.d.ts @@ -5,7 +5,5 @@ declare global { } declare module 'vue' { - interface HTMLAttributes { - [key: `data-${string}`]: unknown; - } + type HTMLAttributes = Record<`data-${string}`, unknown>; } diff --git a/vue/editor/src/env.d.ts b/vue/editor/src/env.d.ts index b9d14ca..71a152f 100644 --- a/vue/editor/src/env.d.ts +++ b/vue/editor/src/env.d.ts @@ -5,13 +5,9 @@ declare global { } declare module 'vue' { - interface ComponentCustomProps { - [key: `data${string}`]: unknown; - } + type ComponentCustomProps = Record<`data${string}`, unknown>; } declare module 'vue' { - interface HTMLAttributes { - [key: `data-${string}`]: unknown; - } + type HTMLAttributes = Record<`data-${string}`, unknown>; } diff --git a/vue/editor/src/view/inline-content/parse.ts b/vue/editor/src/view/inline-content/parse.ts index 541cebd..8d3a9b1 100644 --- a/vue/editor/src/view/inline-content/parse.ts +++ b/vue/editor/src/view/inline-content/parse.ts @@ -35,7 +35,7 @@ function marksForElement(el: HTMLElement, registry: Registry): Mark[] { function walk(node: Node, marks: readonly Mark[], out: InlineNode[], registry: Registry): void { for (const child of Array.from(node.childNodes)) { if (child.nodeType === Node.TEXT_NODE) { - const text = (child.nodeValue ?? '').replace(ZWSP, ''); + const text = (child.nodeValue ?? '').replaceAll(ZWSP, ''); if (text) out.push({ text, marks }); continue; diff --git a/vue/editor/src/view/selection/selection-bridge.ts b/vue/editor/src/view/selection/selection-bridge.ts index 44247ca..5349543 100644 --- a/vue/editor/src/view/selection/selection-bridge.ts +++ b/vue/editor/src/view/selection/selection-bridge.ts @@ -48,7 +48,7 @@ function indexInParent(el: Node): number { } function getWindow(): Window | null { - return typeof globalThis.window === 'undefined' ? null : globalThis.window; + return globalThis.window === undefined ? null : globalThis.window; } export function createSelectionBridge( diff --git a/vue/editor/src/view/ui/EditorBubbleMenu.vue b/vue/editor/src/view/ui/EditorBubbleMenu.vue index 57d777b..3fc8eb7 100644 --- a/vue/editor/src/view/ui/EditorBubbleMenu.vue +++ b/vue/editor/src/view/ui/EditorBubbleMenu.vue @@ -26,7 +26,7 @@ const { floatingStyles, update } = useFloating(reference, floatingEl, { }); function selectionRect(): DOMRect | null { - const selection = typeof globalThis.window === 'undefined' ? null : globalThis.getSelection(); + const selection = globalThis.window === undefined ? null : globalThis.getSelection(); if (!selection || selection.rangeCount === 0) return null; diff --git a/vue/editor/src/view/ui/EditorSlashMenu.vue b/vue/editor/src/view/ui/EditorSlashMenu.vue index c6d4ebd..65e2153 100644 --- a/vue/editor/src/view/ui/EditorSlashMenu.vue +++ b/vue/editor/src/view/ui/EditorSlashMenu.vue @@ -33,11 +33,11 @@ const { floatingStyles, update } = useFloating(reference, floatingEl, { }); function escapeRegExp(value: string): string { - return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + return value.replaceAll(/[.*+?^${}()|[\]\\]/g, '\\$&'); } function caretRect(): DOMRect | null { - const selection = typeof globalThis.window === 'undefined' ? null : globalThis.getSelection(); + const selection = globalThis.window === undefined ? null : globalThis.getSelection(); if (!selection || selection.rangeCount === 0) return null;