fix: add moveCursor function

This commit is contained in:
DiamondThree 2022-08-11 15:15:47 +08:00
parent e795655bd9
commit 9b0f608b6b

View File

@ -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,