From cb915eb4d04e1bec38e82f0fb8f21c952031f753 Mon Sep 17 00:00:00 2001 From: kim365my Date: Thu, 4 Apr 2024 23:01:56 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=EB=B2=A4=ED=8A=B8=20=EC=A0=84?= =?UTF-8?q?=ED=8C=8C=EB=90=98=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ src/EnbedDecoratiion.ts | 2 ++ src/PostProcessor.ts | 3 ++- styles.css | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 184d973..8528364 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,7 @@ ## view source mode ![image](https://github.com/kim365my/obsidian-sample-plugin/assets/102598905/f71fe9d7-4346-4cd9-a6b3-7b02d905a1e6) + + +## 앞으로 할일 +- 이미 라이브에서 랜더링된 요소(테이블, 콜아웃 등)에서 해당 링크에 커서가 갔을 경우 편집가능할 수 있게 랜더링 취소하기 \ No newline at end of file diff --git a/src/EnbedDecoratiion.ts b/src/EnbedDecoratiion.ts index 2037810..a11a6a1 100644 --- a/src/EnbedDecoratiion.ts +++ b/src/EnbedDecoratiion.ts @@ -47,6 +47,7 @@ class StatefulDecorationSet { const params = await LinkThumbnailWidgetParams(token.value); if (params != null) { linkEl.innerHTML = params; + linkEl.addEventListener("click", (e) => e.stopPropagation()); } else { return Decoration.none; } @@ -94,6 +95,7 @@ function buildViewPlugin(plugin: LinkThumbnailPlugin) { const tokenProps = node.type.prop(tokenClassNodeProp); if (tokenProps && node.name === "url") { const value = view.state.doc.sliceString(from, to); + console.log(tokenProps, node, value, view.state); if (value) { targetElements.push({from: from, to: to, value: value}); } diff --git a/src/PostProcessor.ts b/src/PostProcessor.ts index f459441..855cb64 100644 --- a/src/PostProcessor.ts +++ b/src/PostProcessor.ts @@ -14,7 +14,7 @@ export class PostProcessor { context: MarkdownPostProcessorContext ) => { // 링크 변환 - const linkEls = element.findAll("a.external-link:not(.cm-formatting)"); + const linkEls:Element[] = element.findAll("a.external-link:not(.cm-formatting)"); for (const linkEl of linkEls) { // dataview 클래스를 가진 부모 요소를 확인합니다. if (linkEl.closest(".dataview") !== null) { @@ -26,6 +26,7 @@ export class PostProcessor { linkEl.innerHTML = params; linkEl.removeClass("external-link"); linkEl.addClass("markdown-rendered"); + linkEl.addEventListener("click", (e) => e.stopPropagation()); } } }; diff --git a/styles.css b/styles.css index dc18d81..f06395e 100644 --- a/styles.css +++ b/styles.css @@ -49,7 +49,7 @@ a:has(.openGraphPreview):hover { justify-content: center; gap: 8px; overflow: auto; - padding: var(--size-4-4) var(--size-4-2); + padding: var(--size-4-3) var(--size-4-2); } .openGraphPreview .se-oglink-info { display: block;