Add "Copy web URL" command to the Copy context menu. (#16415)

This command copies a web deeplink url onto clipboard, which is useful
when SiYuan is running in browser and the link will use the format
of "https://app.com/?id={id}". This link can be then easily shared
to other users who have access to the same instance.

The item is only visible in browsers.
This commit is contained in:
Juho Mäkinen 2025-11-21 17:00:23 +02:00 committed by GitHub
parent 576f60d693
commit 6d5d17ce86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 32 additions and 2 deletions

View file

@ -216,7 +216,7 @@ export const toolbarKeyToMenu = (toolbar: Array<string | IMenuItem>) => {
};
export const copyTextByType = async (ids: string[],
type: "ref" | "blockEmbed" | "protocol" | "protocolMd" | "hPath" | "id") => {
type: "ref" | "blockEmbed" | "protocol" | "protocolMd" | "hPath" | "id" | "webURL") => {
let text = "";
for (let i = 0; i < ids.length; i++) {
const id = ids[i];
@ -236,6 +236,9 @@ export const copyTextByType = async (ids: string[],
} else if (type === "hPath") {
const response = await fetchSyncPost("/api/filetree/getHPathByID", {id});
text += response.data;
} else if (type === "webURL") {
const origin = window.location.origin;
text += `${origin}/?id=${id}`;
} else if (type === "id") {
text += id;
}