mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
75ad2a2986
commit
ab7c0ca8c6
2 changed files with 14 additions and 20 deletions
|
|
@ -249,21 +249,17 @@ export const initWindow = (app: App) => {
|
||||||
currentWindow.on("blur", winOnBlur);
|
currentWindow.on("blur", winOnBlur);
|
||||||
if (!isWindow()) {
|
if (!isWindow()) {
|
||||||
ipcRenderer.on(Constants.SIYUAN_OPENURL, (event, url) => {
|
ipcRenderer.on(Constants.SIYUAN_OPENURL, (event, url) => {
|
||||||
app.plugins.forEach(plugin => {
|
|
||||||
plugin.eventBus.emit("open-siyuan-url", { url });
|
|
||||||
});
|
|
||||||
if (url.startsWith("siyuan://plugins/")) {
|
if (url.startsWith("siyuan://plugins/")) {
|
||||||
const urlObj = new URL(url);
|
const pluginId = url.replace("siyuan://plugins/", "").split("?")[0];
|
||||||
const pluginId = urlObj.pathname.split("/")[3];
|
if (!pluginId) {
|
||||||
if (pluginId) {
|
return;
|
||||||
app.plugins.find(plugin => {
|
}
|
||||||
|
app.plugins.find(plugin => {
|
||||||
|
if (pluginId.startsWith(plugin.name)) {
|
||||||
// siyuan://plugins/plugin-name/foo?bar=baz
|
// siyuan://plugins/plugin-name/foo?bar=baz
|
||||||
if (pluginId.startsWith(plugin.name)) {
|
plugin.eventBus.emit("open-siyuan-url-plugin", {url});
|
||||||
plugin.eventBus.emit("open-siyuan-url-plugins", { url });
|
|
||||||
}
|
|
||||||
|
|
||||||
// siyuan://plugins/plugin-samplecustom_tab?title=自定义页签&icon=iconFace&data={"text": "This is the custom plugin tab I opened via protocol."}
|
// siyuan://plugins/plugin-samplecustom_tab?title=自定义页签&icon=iconFace&data={"text": "This is the custom plugin tab I opened via protocol."}
|
||||||
const match = Object.keys(plugin.models).find(key => {
|
Object.keys(plugin.models).find(key => {
|
||||||
if (key === pluginId) {
|
if (key === pluginId) {
|
||||||
let data = getSearch("data", url);
|
let data = getSearch("data", url);
|
||||||
try {
|
try {
|
||||||
|
|
@ -283,12 +279,10 @@ export const initWindow = (app: App) => {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (match) {
|
return true;
|
||||||
return true;
|
}
|
||||||
}
|
});
|
||||||
});
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (isSYProtocol(url)) {
|
if (isSYProtocol(url)) {
|
||||||
const id = getIdFromSYProtocol(url);
|
const id = getIdFromSYProtocol(url);
|
||||||
|
|
@ -304,7 +298,7 @@ export const initWindow = (app: App) => {
|
||||||
ipcRenderer.send(Constants.SIYUAN_SHOW, getCurrentWindow().id);
|
ipcRenderer.send(Constants.SIYUAN_SHOW, getCurrentWindow().id);
|
||||||
}
|
}
|
||||||
app.plugins.forEach(plugin => {
|
app.plugins.forEach(plugin => {
|
||||||
plugin.eventBus.emit("open-siyuan-url-blocks", {
|
plugin.eventBus.emit("open-siyuan-url-block", {
|
||||||
url,
|
url,
|
||||||
id,
|
id,
|
||||||
focus,
|
focus,
|
||||||
|
|
|
||||||
2
app/src/types/index.d.ts
vendored
2
app/src/types/index.d.ts
vendored
|
|
@ -44,7 +44,7 @@ type TEventBus = "ws-main" |
|
||||||
"open-noneditableblock" |
|
"open-noneditableblock" |
|
||||||
"open-menu-blockref" | "open-menu-fileannotationref" | "open-menu-tag" | "open-menu-link" | "open-menu-image" |
|
"open-menu-blockref" | "open-menu-fileannotationref" | "open-menu-tag" | "open-menu-link" | "open-menu-image" |
|
||||||
"open-menu-av" | "open-menu-content" | "open-menu-breadcrumbmore" |
|
"open-menu-av" | "open-menu-content" | "open-menu-breadcrumbmore" |
|
||||||
"open-siyuan-url" | "open-siyuan-url-blocks" | "open-siyuan-url-plugins" |
|
"open-siyuan-url-plugin" | "open-siyuan-url-block" |
|
||||||
"input-search" |
|
"input-search" |
|
||||||
"loaded-protyle"
|
"loaded-protyle"
|
||||||
type TAVCol =
|
type TAVCol =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue