From 4ab86115fc1544f0b46cd7eb415a9f64cbc380cd Mon Sep 17 00:00:00 2001 From: Matthias Portzel Date: Sat, 3 Sep 2022 08:39:36 -0400 Subject: [PATCH] Fix bug editing in firefox --- thoughts/templates/thoughts/index.html | 2 +- thoughts/templates/thoughts/post.html | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/thoughts/templates/thoughts/index.html b/thoughts/templates/thoughts/index.html index 2d9997f..e146aaa 100644 --- a/thoughts/templates/thoughts/index.html +++ b/thoughts/templates/thoughts/index.html @@ -151,7 +151,7 @@ showMoreButton.parentNode.removeChild(showMoreButton); // Show the extended text extended.classList.remove("hidden"); - }) + }); main.appendChild(showMoreButton); } diff --git a/thoughts/templates/thoughts/post.html b/thoughts/templates/thoughts/post.html index ed4fb5c..a0d417f 100644 --- a/thoughts/templates/thoughts/post.html +++ b/thoughts/templates/thoughts/post.html @@ -113,6 +113,13 @@ for (const box of textboxes) { // Set the initial heights of the boxes updateBoxHeight(box); + // This works fine in Blink, but in Firefox this fails, + // more often on a complex page (pretty much every time on this page; + // less often if I start commenting stuff out, but it still happens) + // So after the first render this re-runs the updateBoxHeight to make sure. + // This does lead to a flash of short-boxes, but it's better than nothing. + setTimeout(updateBoxHeight.bind(null, box), 0); + // Add an event listener to update the box height on key press box.addEventListener("input", evt => updateBoxHeight(box)); // Allow pasting images into either text box