Skip to content

Improve openWindow parameter checking #9116

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
WingDr opened this issue Sep 5, 2023 · 3 comments
Closed
3 tasks done

Improve openWindow parameter checking #9116

WingDr opened this issue Sep 5, 2023 · 3 comments
Assignees
Milestone

Comments

@WingDr
Copy link

WingDr commented Sep 5, 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

因为直接传块id打开的话会加载很多东西,并且显示没必要显示的标题(直接取的文档id),然后看到openWindow里面有tab的参数所以想尝试一下。问题就在于这个要传进去的ITab从哪里获取,我试了一下用openTab的结果,这里我写的代码是这样的

image

然后就出现了下面的报错:

image

然后我试了下自己手搓ITab:

image

发现又报这个错

image

就真不懂这个咋用了

Expected result

不管是手搓还是openTab总得有个方法吧,但是感觉也不是不让用那种,是不是有哪里没做对?

Screenshot or screen recording presentation

No response

Version environment

- Version: 2.10.3
- Operating System: Windows
- Browser (if used):

Log file

More information

No response

@Vanessa219
Copy link
Member

tab 目前的使用场景如下,具体实现为:
https://github.com/siyuan-note/siyuan/blob/336eaef0000e2ef63b06f9b91a2b280b906210b3/app/src/window/openNewWindow.ts ,主要是将 json 传递给 Electron 的主线程,然后再根据 json 内容新建页签。

image

@WingDr
Copy link
Author

WingDr commented Sep 6, 2023

我知道了,这里确实是有个bug,还是这个错误提示

image

看到它错误的源码在这里

image

这里在ts里doc本身是可选参数,所以应该先判断n.doc是否存在。为了验证我在参数里加了这个

image

就可以正常传入openTab的结果打开了

Vanessa219 added a commit that referenced this issue Sep 6, 2023

Verified

This commit was signed with the committer’s verified signature.
@Vanessa219 Vanessa219 changed the title 不知道怎么用openWindow打开自定义的tab Enhance openWindow parameter judgment Sep 6, 2023
@Vanessa219 Vanessa219 self-assigned this Sep 6, 2023
@Vanessa219 Vanessa219 modified the milestones: backlog, 2.10.4 Sep 6, 2023
@Vanessa219
Copy link
Member

好的,多谢。已修改。

@88250 88250 changed the title Enhance openWindow parameter judgment Improve openWindow parameter checking Sep 8, 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