Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/10789

Vanessa8853b9a19234
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index c444bc3897..16ebcdd2be 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -18,10 +18,12 @@ const renderCellURL = (urlContent: string) => {
let suffix = "";
try {
const urlObj = new URL(urlContent);
- host = urlObj.host;
- suffix = urlObj.href.replace(urlObj.origin, "");
- if (suffix.length > 12) {
- suffix = suffix.substring(0, 4) + "..." + suffix.substring(suffix.length - 6);
+ if (urlObj.protocol.startsWith("http")) {
+ host = urlObj.host;
+ suffix = urlObj.href.replace(urlObj.origin, "");
+ if (suffix.length > 12) {
+ suffix = suffix.substring(0, 4) + "..." + suffix.substring(suffix.length - 6);
+ }
}
} catch (e) {
// 不是 url 地址
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 831f7dac02..2219bd3121 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -1983,14 +1983,7 @@ export class WYSIWYG {
// 需放在嵌入块之前,否则嵌入块内的引用、链接、pdf 双链无法点击打开 https://ld246.com/article/1630479789513
const blockRefElement = hasClosestByAttribute(event.target, "data-type", "block-ref");
const aElement = hasClosestByAttribute(event.target, "data-type", "a") || hasClosestByAttribute(event.target, "data-type", "url");
- let aLink = "";
- if (aElement) {
- if (aElement.classList.contains("av__celltext")) {
- aLink = aElement.textContent.trim();
- } else {
- aLink = aElement.getAttribute("data-href");
- }
- }
+ const aLink = aElement ? aElement.getAttribute("data-href") : "";
if (blockRefElement || aLink.startsWith("siyuan://blocks/")) {
event.stopPropagation();
event.preventDefault();