umodoc / editor

Umo Editor is an open-source document editor, based on Vue3 and Tiptap. Umo Editor 是一个基于 Vue3 和 Tiptap 的适合于国人使用的本土化开源文档编辑器。
https://editor.umodoc.com/en/docs
MIT License
171 stars 30 forks source link

[功能建议]: 请教下有事件可以获取上一次光标的位置吗? #19

Closed qtch closed 1 month ago

qtch commented 1 month ago

你的功能建议是否和某个问题相关?

想实现以下视频类似的功能,光标先是focus在内容区域,后来再进行某些操作时,光标是否可以重新focus到原来的位置

你希望看到什么解决方案?

光标是否可以focus到原来的位置

你考虑过哪些替代方案?

No response

你有其他上下文或截图吗?

https://github.com/user-attachments/assets/f94076bd-760d-49fc-a324-7fca03ff3432

其他说明

No response

意向参与贡献

umodoc commented 1 month ago

可使用foucs(undefined),或者使用getEditor()获取编辑器实例后,从获取的实例中取当前选中的内容和状态。

shenghui-shan commented 1 month ago

editor.state.selection.anchor