Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

这个选中选区的前提是知道path路径位置,如果我不知道呢? #5847

Open
ZaiQi-zq opened this issue Apr 28, 2024 · 2 comments

Comments

@ZaiQi-zq
Copy link

问题描述

const newSelection = {
anchor: { path: [1,0], offset:8 },
focus: { path: [1,0], offset:10 }
}
editor.select(newSelection)
这个选中选区的前提是知道path路径位置,如果我不知道呢?

wangEditor 版本

请输入内容……

是否查阅了文档 ?

(文档链接 www.wangeditor.com

是/否

最小成本的复现步骤

(请告诉我们,如何最快的复现该问题?)

  • 步骤一
  • 步骤二
  • 步骤三
@ZaiQi-zq
Copy link
Author

有没有好的办法去获取指定内容所在文档中的路径

@cycleccc
Copy link

有没有好的办法去获取指定内容所在文档中的路径

你的意思是指在代码层获取特定内容的路径吗,这个应该可以通过slate的API来筛选,wangEditor有暴露出slate相关的api。

你可以看下 wagneditor 和 slate 的文档来获取指定内容的路径,先获取 匹配的node,node有附带path或可以通过其它 api 获取 path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants