Add attribute "data-key" for Dialog (#10138)

This commit is contained in:
归去来兮 2024-01-10 22:31:28 +08:00 committed by GitHub
parent b669d1a19c
commit 291211bd00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 103 additions and 0 deletions

View file

@ -261,6 +261,7 @@ export class Background {
width: isMobile() ? "92vw" : "912px",
height: isMobile() ? "80vh" : "70vh",
});
dialog.element.setAttribute("data-key", Constants.DIALOG_BACKGROUNDRANDOM);
dialog.element.addEventListener("click", (event) => {
const target = event.target as HTMLElement;
if (target.classList.contains("b3-card")) {
@ -349,6 +350,7 @@ export class Background {
<button class="b3-button b3-button--text">${window.siyuan.languages.confirm}</button>
</div>`,
});
dialog.element.setAttribute("data-key", Constants.DIALOG_BACKGROUNDLINK);
const btnsElement = dialog.element.querySelectorAll(".b3-button");
btnsElement[0].addEventListener("click", () => {
dialog.destroy();