chore(editor): view, selection-bridge, and type fixes
This commit is contained in:
Vendored
+1
-3
@@ -5,7 +5,5 @@ declare global {
|
||||
}
|
||||
|
||||
declare module 'vue' {
|
||||
interface HTMLAttributes {
|
||||
[key: `data-${string}`]: unknown;
|
||||
}
|
||||
type HTMLAttributes = Record<`data-${string}`, unknown>;
|
||||
}
|
||||
|
||||
Vendored
+2
-6
@@ -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>;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user