From c046d4a221e32a3739779ddcdb2e279f8ba9b1e4 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Mon, 16 Jan 2023 16:59:45 +0100 Subject: [PATCH] Don't translate cloud links to cloud links --- plugs/core/cloud.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugs/core/cloud.ts b/plugs/core/cloud.ts index a2b407a..e2d6742 100644 --- a/plugs/core/cloud.ts +++ b/plugs/core/cloud.ts @@ -6,8 +6,6 @@ import { renderToText, replaceNodesMatching } from "$sb/lib/tree.ts"; import type { FileMeta } from "../../common/types.ts"; import { parseMarkdown } from "$sb/silverbullet-syscall/markdown.ts"; import { base64EncodedDataUrl } from "../../plugos/asset_bundle/base64.ts"; -import { CapacitorHttp } from "@capacitor/core"; -import { sandboxFetch } from "../../plug-api/plugos-syscall/fetch.ts"; const pagePrefix = "💭 "; @@ -67,7 +65,10 @@ async function translateLinksWithPrefix( replaceNodesMatching(tree, (tree) => { if (tree.type === "WikiLinkPage") { // Add the prefix in the link text - tree.children![0].text = prefix + tree.children![0].text; + if (!tree.children![0].text!.startsWith(pagePrefix)) { + // Only for links that aren't already cloud links + tree.children![0].text = prefix + tree.children![0].text; + } } return undefined; });