Skip to content

Commit b1e7624

Browse files
committed
1 parent b24641c commit b1e7624

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

app/src/card/openCard.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ export const openCardByData = (cardsData: ICard[], html = "") => {
4444
<div class="card__header">
4545
<span class="fn__flex-1 fn__flex-center">${window.siyuan.languages.riffCard}</span>
4646
${html}
47-
${isMobile() ? "" : `<div class="fn__space"></div>
48-
<div data-type="fullscreen" class="b3-tooltips b3-tooltips__sw block__icon block__icon--show" aria-label="${window.siyuan.languages.fullscreen}">
47+
<div class="fn__space"></div>
48+
${isMobile() ? `<div data-type="close" class="block__icon block__icon--show">
49+
<svg><use xlink:href="#iconCloseRound"></use></svg>
50+
</div>` : `<div data-type="fullscreen" class="b3-tooltips b3-tooltips__sw block__icon block__icon--show" aria-label="${window.siyuan.languages.fullscreen}">
4951
<svg><use xlink:href="#iconFullscreen"></use></svg>
5052
</div>`}
5153
</div>
@@ -100,8 +102,8 @@ export const openCardByData = (cardsData: ICard[], html = "") => {
100102
</div>
101103
</div>
102104
</div>`,
103-
width: isMobile() ? "98vw" : "80vw",
104-
height: isMobile() ? "80vh" : "70vh",
105+
width: isMobile() ? "100vw" : "80vw",
106+
height: isMobile() ? "100vh" : "70vh",
105107
});
106108
(dialog.element.querySelector(".b3-dialog__scrim") as HTMLElement).style.backgroundColor = "var(--b3-theme-background)";
107109
(dialog.element.querySelector(".b3-dialog__container") as HTMLElement).style.maxWidth = "1024px";
@@ -142,6 +144,13 @@ export const openCardByData = (cardsData: ICard[], html = "") => {
142144
event.preventDefault();
143145
return;
144146
}
147+
const closeElement = hasClosestByAttribute(event.target as HTMLElement, "data-type", "close");
148+
if (closeElement) {
149+
dialog.destroy();
150+
event.stopPropagation();
151+
event.preventDefault();
152+
return;
153+
}
145154
let type = "";
146155
if (typeof event.detail === "string") {
147156
if (event.detail === "1" || event.detail === "j") {

0 commit comments

Comments
 (0)