Skip to content

Conversation

@hqweay
Copy link

@hqweay hqweay commented Nov 29, 2025

✨移动端支持触发open-siyuan-url-plugin

#15892

在 iOS 测试通过。

参考

ipcRenderer.on(Constants.SIYUAN_OPEN_URL, (event, url) => {
的实现。

没有实现对 siyuan://plugins/plugin-samplecustom_tab... 链接的处理,我理解以这种形式的链接打开 Tab 应该是历史原因。这种效果插件监听 open-siyuan-url-plugin 已经可以自己实现了。

@88250 88250 requested a review from Vanessa219 November 29, 2025 09:45
@88250 88250 added this to the 3.4.2 milestone Nov 29, 2025
@88250 88250 changed the title ✨移动端支持触发open-siyuan-url-plugin #15892 Support triggering the open-siyuan-url-plugin on mobile Nov 29, 2025
@TCOTC
Copy link
Contributor

TCOTC commented Nov 29, 2025

app.plugins.find(plugin => {
if (pluginNameType.startsWith(plugin.name)) {
// siyuan://plugins/plugin-name/foo?bar=baz
plugin.eventBus.emit("open-siyuan-url-plugin", {url});
// https://github.com/siyuan-note/siyuan/pull/9256
if (pluginNameType.split("/")[0] !== plugin.name) {
// siyuan://plugins/plugin-samplecustom_tab?title=自定义页签&icon=iconFace&data={"text": "This is the custom plugin tab I opened via protocol."}
let data = urlObj.searchParams.get("data");
try {
data = JSON.parse(data || "{}");
} catch (e) {
console.log("Error open plugin tab with protocol:", e);
}
openFile({
app,
custom: {
title: urlObj.searchParams.get("title"),
icon: urlObj.searchParams.get("icon"),
data,
id: pluginNameType
},
});
}
return true;
}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants