There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix: add moveCursor function
DiamondThree9b0f608b6b2e
diff --git a/libs/components/editor-core/src/editor/selection/selection.ts b/libs/components/editor-core/src/editor/selection/selection.tsindex 4b2da05cb6..99f648a930 100644--- a/libs/components/editor-core/src/editor/selection/selection.ts+++ b/libs/components/editor-core/src/editor/selection/selection.ts@@ -1056,11 +1056,14 @@ export class SelectionManager implements VirgoSelection {* @param {string} blockId* @memberof SelectionManager*/- public moveCursor(index: number, blockId: string): void {- const nowRange = window.getSelection().getRangeAt(0);+ public async moveCursor(+ nowRange: any,+ index: number,+ blockId: string+ ): Promise<void> {let preRang = document.createRange();- preRang.setStart(nowRange.startContainer, nowRange.startOffset + index);- preRang.setEnd(nowRange.endContainer, nowRange.endOffset + index);+ preRang.setStart(nowRange.startContainer, index);+ preRang.setEnd(nowRange.endContainer, index);let prePosition = preRang.getClientRects().item(0);this.activeNodeByNodeId(blockId,