이벤트 전파되는 버그 수정

This commit is contained in:
kim365my 2024-04-04 23:01:56 +09:00
parent d5e9fec034
commit cb915eb4d0
4 changed files with 9 additions and 2 deletions

View File

@ -5,3 +5,7 @@
## view source mode
![image](https://github.com/kim365my/obsidian-sample-plugin/assets/102598905/f71fe9d7-4346-4cd9-a6b3-7b02d905a1e6)
## 앞으로 할일
- 이미 라이브에서 랜더링된 요소(테이블, 콜아웃 등)에서 해당 링크에 커서가 갔을 경우 편집가능할 수 있게 랜더링 취소하기

View File

@ -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<string>(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});
}

View File

@ -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());
}
}
};

View File

@ -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;