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

Plugin API custom.fn => custom.id in openTab #8944

Closed
3 tasks done
zuoez02 opened this issue Aug 9, 2023 · 5 comments
Closed
3 tasks done

Plugin API custom.fn => custom.id in openTab #8944

zuoez02 opened this issue Aug 9, 2023 · 5 comments
Assignees
Milestone

Comments

@zuoez02
Copy link
Contributor

zuoez02 commented Aug 9, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

openTab时指定data为{}时,很容易与其他插件冲突,导致tab打不开。

源码调试时发现:

if (objEquals(item.data, options.custom.data)) {

用的是data作为判断依据,而没有进行插件名称的判断。按理说只有相同插件的相同data才考虑复用问题。

Expected result

不同类型tab的data相同时,不冲突导致无法打开

Screenshot or screen recording presentation

No response

Version environment

- Version: 2.9.9
- Operating System: MacOS
- Browser (if used):

Log file

More information

No response

@suka233
Copy link

suka233 commented Aug 11, 2023

萌佬的pr似乎可以搞定这个问题:#8927

@Vanessa219
Copy link
Member

目前没有办法识别,唯一标识需在初始化页签后才能获取的。再加一个 title 和 icon 的判断够用么?

@zuoez02
Copy link
Contributor Author

zuoez02 commented Aug 15, 2023

目前没有办法识别,唯一标识需在初始化页签后才能获取的。再加一个 title 和 icon 的判断够用么?

@Vanessa219 或者在data里默认就放个__plugin_name__: siyuan-plugin-xxx,类似这样呗。简单有效也算。一般人也用不到它,真有需要的也能用

@Vanessa219
Copy link
Member

openTab 是个方法,参数好像没法加上去。

@zuoez02
Copy link
Contributor Author

zuoez02 commented Aug 16, 2023

openTab 是个方法,参数好像没法加上去。

或者考虑弄个新的api替换掉这个。对于标签页希望不仅能够插件openTab,同时也希望比如刷新之后插件能获取到自己有哪些tab实例之类的,让插件可以完全掌握它所掌控的tab。

另外openTab不是有fn嘛,可以在上面做做文章,看看能不能拿到想要的上下文

@Vanessa219 Vanessa219 added this to the 2.10.1 milestone Aug 18, 2023
Vanessa219 added a commit to siyuan-note/plugin-sample that referenced this issue Aug 18, 2023
@Vanessa219 Vanessa219 changed the title 插件Tab的data相同时,识别错误无法打开对应插件的tab Plugin API custom.fn => custom.id in openTab Aug 18, 2023
Vanessa219 added a commit to siyuan-note/petal that referenced this issue Aug 18, 2023
Vanessa219 added a commit to siyuan-note/plugin-sample that referenced this issue Aug 18, 2023
Vanessa219 added a commit that referenced this issue Aug 18, 2023
@88250 88250 changed the title Plugin API custom.fn => custom.id in openTab Plugin API custom.fn => custom.id in openTab Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants