mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
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:
parent
576f60d693
commit
6d5d17ce86
15 changed files with 32 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue