- if (preview.contents().length === 0) {
- preview.oneTime(500, "loading", function () {
- preview.addClass("loading");
- });
+ preview.css("min-height", minHeight + "px");
+ });
+
+ /*
+ * Install a handler to switch to preview mode
+ */
+ $(document).on("show.bs.tab", ".richtext_container button[data-bs-target$='_preview']", function () {
+ var container = $(this).closest(".richtext_container");
+ var editor = container.find("textarea");
+ var preview = container.find(".tab-pane[id$='_preview']");
+
+ if (preview.children(".richtext").contents().length === 0) {
+ preview.children(".richtext_placeholder").removeAttr("hidden").addClass("delayed-fade-in");