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

on(event.CREATE)的回调函数获取被划词的元素的id #92

Open
youyunzhi opened this issue Dec 28, 2021 · 1 comment
Open

on(event.CREATE)的回调函数获取被划词的元素的id #92

youyunzhi opened this issue Dec 28, 2021 · 1 comment

Comments

@youyunzhi
Copy link

youyunzhi commented Dec 28, 2021

,我的场景是对有id的段落进行划词,想要在create的时候,获取段落的id,请问这个有办法实现吗?

@youyunzhi youyunzhi changed the title on(event.CREATE)的回调函数的第三个参数event,在类型定义里面没有定义 on(event.CREATE)的回调函数获取被划词的元素的id Dec 28, 2021
@KonghaYao
Copy link

我看源代码知道 sources 是有 id 值的,可以直接从 sources 中读取
详细看这里吧

save(source: HighlightSource | HighlightSource[]): void {
if (!Array.isArray(source)) {
this._data.set(source.id, source);
return;
}
source.forEach(s => this._data.set(s.id, s));
}

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