改进 getSearch 函数实现 (#7089)

* 🎨 改进 `getSearch` 方法

兼容 key 为空字符串与 value 为空字符串的 URL search params

* 🎨 改进 `getSearch` 方法

* 🎨 style
This commit is contained in:
颖逸 2023-01-16 23:54:47 +08:00 committed by GitHub
parent 4f2bca7e05
commit 67743b50ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 19 deletions

View file

@ -129,8 +129,8 @@ export const initFramework = () => {
initEditorName();
if (getOpenNotebookCount() > 0) {
const openId = getSearch("id", window.location.href);
if (openId) {
openMobileFileById(getSearch("id", window.location.href),
if (openId !== null) {
openMobileFileById(openId,
getSearch("focus", window.location.href) === "1" ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT]);
} else {
const localDoc = window.siyuan.storage[Constants.LOCAL_DOCINFO];