mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-19 14:21:46 +03:00
fix: add moveCursor function
This commit is contained in:
parent
e795655bd9
commit
9b0f608b6b
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user