fix: add moveCursor function
This commit is contained in:
@@ -1056,11 +1056,14 @@ export class SelectionManager implements VirgoSelection {
|
|||||||
* @param {string} blockId
|
* @param {string} blockId
|
||||||
* @memberof SelectionManager
|
* @memberof SelectionManager
|
||||||
*/
|
*/
|
||||||
public moveCursor(index: number, blockId: string): void {
|
public async moveCursor(
|
||||||
const nowRange = window.getSelection().getRangeAt(0);
|
nowRange: any,
|
||||||
|
index: number,
|
||||||
|
blockId: string
|
||||||
|
): Promise<void> {
|
||||||
let preRang = document.createRange();
|
let preRang = document.createRange();
|
||||||
preRang.setStart(nowRange.startContainer, nowRange.startOffset + index);
|
preRang.setStart(nowRange.startContainer, index);
|
||||||
preRang.setEnd(nowRange.endContainer, nowRange.endOffset + index);
|
preRang.setEnd(nowRange.endContainer, index);
|
||||||
let prePosition = preRang.getClientRects().item(0);
|
let prePosition = preRang.getClientRects().item(0);
|
||||||
this.activeNodeByNodeId(
|
this.activeNodeByNodeId(
|
||||||
blockId,
|
blockId,
|
||||||
|
|||||||
Reference in New Issue
Block a user