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;