FIX: Post height issues (#34)

This commit is contained in:
Keegan George 2023-03-24 12:25:46 -07:00 committed by GitHub
parent 850e31c83d
commit 5d7a126403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

1
.discourse-compatibility Normal file
View File

@ -0,0 +1 @@
3.1.0.beta2: 850e31c83d310a1b52e6105fe201eb96f9e33deb

View File

@ -59,13 +59,21 @@ export default apiInitializer("0.11.1", (api) => {
if (table.parentNode.contains(expandBtn)) { if (table.parentNode.contains(expandBtn)) {
expandBtn.parentNode.insertBefore(popupBtn, expandBtn); expandBtn.parentNode.insertBefore(popupBtn, expandBtn);
} else { } else {
table.parentNode.insertBefore(popupBtn, table); const buttonWrapper = document.createElement("div");
buttonWrapper.classList.add("fullscreen-table-wrapper--buttons");
buttonWrapper.append(popupBtn);
table.parentNode.insertBefore(buttonWrapper, table);
} }
popupBtn.addEventListener("click", generateModal.bind(attrs), false); popupBtn.addEventListener("click", generateModal.bind(attrs), false);
}); });
} }
function cleanupPopupBtns() {
const popupBtns = document.querySelectorAll("button.open-popup-link");
popupBtns.forEach((btn) => btn.removeEventListener("click", generateModal));
}
api.decorateCookedElement( api.decorateCookedElement(
(post, helper) => { (post, helper) => {
const canEdit = helper.widget.attrs.canEdit; const canEdit = helper.widget.attrs.canEdit;
@ -84,4 +92,6 @@ export default apiInitializer("0.11.1", (api) => {
id: "edit-table", id: "edit-table",
} }
); );
api.cleanupStream(cleanupPopupBtns);
}); });

View File

@ -31,8 +31,10 @@
table { table {
opacity: 0.5; opacity: 0.5;
} }
.btn-edit-table { .btn-edit-table {
display: block; display: block;
z-index: 2;
} }
} }
} }