mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-22 16:26:09 +01:00
This commit is contained in:
parent
487e2f980b
commit
8853b9a192
2 changed files with 7 additions and 12 deletions
|
|
@ -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 地址
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue