Skip to content

Enhance compatibility and the plugin command cannot be set to empty #9231

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

Closed
3 tasks done
zxhd863943427 opened this issue Sep 20, 2023 · 7 comments
Closed
3 tasks done
Assignees
Milestone

Comments

@zxhd863943427
Copy link
Contributor

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

目前快捷键界面是使用HTML字符拼接生成的,并且没有容错机制 假如插件传递了一个错误的快捷键设置,就会导致快捷键界面空白,无法打开。

比如developer tool插件,由于快捷键功能是在未能自定义快捷键的时间节点增加的,所以缺乏html拼接时的部分字段,导致快捷键界面无法打开。

Expected result

增加容错机制,只忽略错误的快捷键。

Screenshot or screen recording presentation

No response

Version environment

- Version: 2.10.4
- Operating System: win10
- Browser (if used):

Log file

无需日志

More information

No response

@Vanessa219
Copy link
Member

这个插件安装了是正常可以打开的,可能是版本兼容的问题,看了下应该么什么问题。如果还有问题麻烦继续跟帖,我先关闭了。

@Vanessa219 Vanessa219 removed their assignment Sep 27, 2023
@zxhd863943427
Copy link
Contributor Author

这个插件安装了是正常可以打开的,可能是版本兼容的问题,看了下应该么什么问题。如果还有问题麻烦继续跟帖,我先关闭了。

v姐你试的太晚了……我已经提交给插件作者修正了。但是这个问题依然需要修复,因为不能控制插件的行为。

另外,我在本地测试插件的适合,偶尔会发生没有正确赋值给customHotKey,导致直接报错,快捷键界面也打不开。这证明哪怕插件不出错,也有概率出现这个问题,需要增加一个错误捕获机制。

增加的位点在这:

item.commands.forEach(command => {

@Vanessa219
Copy link
Member

是 commands 为空抛错还是 forEach 里面报错。这个需要根据错误信息进行容错处理。

@zxhd863943427
Copy link
Contributor Author

在foreach中会报错,根据测试,

 const keyValue = updateHotkeyTip(command.customHotkey);
 commandHTML += ...

都有概率出错。

@Vanessa219
Copy link
Member

跟了下代码, try catch 可能会存在数据不一致的问题,还麻烦把插件及对应的版本发我一下,我看看具体问题。

@zxhd863943427
Copy link
Contributor Author

https://github.com/zuoez02/siyuan-plugin-devtool/releases/tag/v0.1.7

这个版本应该是会出错的。

另外插件没问题的情况下,customHotkey有时候也会很奇怪的赋值失败,变为undefined,导致updateHotkeyTip运行报错

@Vanessa219 Vanessa219 changed the title 快捷键界面生成需要error捕获 Enhance compatibility and the plugin command cannot be set to empty Oct 23, 2023
@Vanessa219 Vanessa219 self-assigned this Oct 23, 2023
@Vanessa219 Vanessa219 added this to the 2.10.12 milestone Oct 23, 2023
Vanessa219 added a commit that referenced this issue Oct 23, 2023
@Vanessa219
Copy link
Member

感谢,已改进

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