Skip to content

Commit a1e16b2

Browse files
committed
🎨 #17843
1 parent 5aef840 commit a1e16b2

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

app/src/editor/openLink.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {isLocalPath, isSiYuanUriProtocol, parseSiYuanUriBlockInfo, pathPosix} from "../util/pathName";
1+
import {isLocalPath, isSiYuanUriProtocol, parseSiYuanUriInfo, pathPosix} from "../util/pathName";
22
/// #if !BROWSER
33
import {shell, ipcRenderer} from "electron";
44
/// #endif
@@ -15,8 +15,8 @@ import {openMobileFileById} from "../mobile/editor";
1515

1616
import type {App} from "../index";
1717

18-
export const processSiYuanUriBlocks = (app: App, uriObj: URL): boolean => {
19-
const blockInfo = parseSiYuanUriBlockInfo(uriObj);
18+
const processSiYuanUriBlocks = (app: App, uriObj: URL): boolean => {
19+
const blockInfo = parseSiYuanUriInfo(uriObj);
2020
if (blockInfo != null) {
2121
const {id, focus} = blockInfo;
2222
window.siyuan.editorIsFullscreen = blockInfo.fullscreen;
@@ -52,7 +52,7 @@ export const processSiYuanUriBlocks = (app: App, uriObj: URL): boolean => {
5252
return false;
5353
};
5454

55-
export const processSiYuanUriPlugins = (app: App, uriObj: URL): boolean => {
55+
const processSiYuanUriPlugins = (app: App, uriObj: URL): boolean => {
5656
const pluginNameOrTabType: string | null = (() => {
5757
const name = uriObj.pathname.split("/")[1];
5858
if (!name) {

app/src/util/pathName.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const isSiYuanUriProtocol = (uri: URL | string | null | undefined): boole
4949
* @param uri - the siyuan block uri to parse
5050
* @returns the block id and other info, or null if the uri is not a valid siyuan block uri
5151
*/
52-
export const parseSiYuanUriBlockInfo = (uri: URL | string | null | undefined): ISiYuanUriBlockInfo | null => {
52+
export const parseSiYuanUriInfo = (uri: URL | string | null | undefined): ISiYuanUriBlockInfo | null => {
5353
try {
5454
if (uri == null) return null;
5555

@@ -76,9 +76,9 @@ export const getIdZoomInByPath = () => {
7676
id: "",
7777
isZoomIn: false,
7878
};
79-
80-
if (searchParams.has("url")) {
81-
const dataInfo = parseSiYuanUriBlockInfo(searchParams.get("url"));
79+
const PWAURL = searchParams.get("url");
80+
if (/^web\+siyuan:\/\/blocks\/\d{14}-\w{7}/.test(PWAURL)) {
81+
const dataInfo = parseSiYuanUriInfo(PWAURL);
8282
if (dataInfo != null) {
8383
data.id = dataInfo.id;
8484
data.isZoomIn = dataInfo.focus;
@@ -88,7 +88,7 @@ export const getIdZoomInByPath = () => {
8888
}
8989

9090
if (window.JSAndroid) {
91-
const dataInfo = parseSiYuanUriBlockInfo(window.JSAndroid.getBlockURL());
91+
const dataInfo = parseSiYuanUriInfo(window.JSAndroid.getBlockURL());
9292
if (dataInfo != null) {
9393
data.id = dataInfo.id;
9494
data.isZoomIn = dataInfo.focus;

0 commit comments

Comments
 (0)