mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
This commit is contained in:
parent
732c0805ca
commit
f2d015267d
6 changed files with 49 additions and 34 deletions
|
|
@ -259,25 +259,20 @@ export const initWindow = (app: App) => {
|
|||
// siyuan://plugins/plugin-name/foo?bar=baz
|
||||
plugin.eventBus.emit("open-siyuan-url-plugin", {url});
|
||||
// siyuan://plugins/plugin-samplecustom_tab?title=自定义页签&icon=iconFace&data={"text": "This is the custom plugin tab I opened via protocol."}
|
||||
Object.keys(plugin.models).find(key => {
|
||||
if (key === pluginId) {
|
||||
let data = getSearch("data", url);
|
||||
try {
|
||||
data = JSON.parse(data || "{}");
|
||||
} catch (e) {
|
||||
console.log("Error open plugin tab with protocol:", e);
|
||||
}
|
||||
openFile({
|
||||
app,
|
||||
custom: {
|
||||
title: getSearch("title", url),
|
||||
icon: getSearch("icon", url),
|
||||
data,
|
||||
fn: plugin.models[key]
|
||||
},
|
||||
});
|
||||
return true;
|
||||
}
|
||||
let data = getSearch("data", url);
|
||||
try {
|
||||
data = JSON.parse(data || "{}");
|
||||
} catch (e) {
|
||||
console.log("Error open plugin tab with protocol:", e);
|
||||
}
|
||||
openFile({
|
||||
app,
|
||||
custom: {
|
||||
title: getSearch("title", url),
|
||||
icon: getSearch("icon", url),
|
||||
data,
|
||||
id: pluginId
|
||||
},
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue