refactor(editor): remove assert functions (#10629)

This commit is contained in:
Saul-Mirone
2025-03-05 10:20:02 +00:00
parent 201c3438ba
commit 7e39893aac
17 changed files with 63 additions and 95 deletions

View File

@@ -1,4 +1,3 @@
import { assertInstanceOf } from '@blocksuite/global/utils';
import { effect } from '@preact/signals-core';
import * as Y from 'yjs';
@@ -47,7 +46,9 @@ export class RangeService<TextAttributes extends BaseTextAttributes> {
return null;
}
const textNode = text.childNodes[1];
assertInstanceOf(textNode, Text);
if (!(textNode instanceof Text)) {
return null;
}
range.setStart(textNode, 0);
range.setEnd(textNode, textNode.textContent?.length ?? 0);
const inlineRange = this.toInlineRange(range);