- $(".richtext_content textarea").change(function () {
- $(this).parents(".richtext_container").find(".richtext_preview").empty();
+ $(document).on("change", ".richtext_container textarea", function () {
+ const container = $(this).closest(".richtext_container");
+ const preview = container.find(".tab-pane[id$='_preview']");
+
+ preview.children(".richtext_placeholder").attr("hidden", true).removeClass("delayed-fade-in");
+ preview.children(".richtext").empty();
+ });
+
+ /*
+ * Install a handler to set the minimum preview pane height
+ * when switching away from an edit pane
+ */
+ $(document).on("hide.bs.tab", ".richtext_container button[data-bs-target$='_edit']", function () {
+ const container = $(this).closest(".richtext_container");
+ const editor = container.find("textarea");
+ const preview = container.find(".tab-pane[id$='_preview']");
+ const minHeight = editor.outerHeight() - preview.outerHeight() + preview.height();
+
+ preview.css("min-height", minHeight + "px");