From: Anton Khorev Date: Thu, 8 Aug 2024 03:28:55 +0000 (+0300) Subject: Move help card between pane/sidebar depending on sidebar visibility X-Git-Tag: live~312^2~2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/8401cd0d140fd9bd0a2b12415745179e90c7e27a Move help card between pane/sidebar depending on sidebar visibility --- diff --git a/app/assets/javascripts/richtext.js b/app/assets/javascripts/richtext.js index cb0bd1f27..1383a34df 100644 --- a/app/assets/javascripts/richtext.js +++ b/app/assets/javascripts/richtext.js @@ -32,4 +32,18 @@ $(document).ready(function () { preview.css("min-height", minHeight + "px"); }); + + var updateHelp = function () { + $(".richtext_container .richtext_help_sidebar:not(:visible):not(:empty)").each(function () { + var container = $(this).closest(".richtext_container"); + $(this).children().appendTo(container.find(".tab-pane[id$='_help']")); + }); + $(".richtext_container .richtext_help_sidebar:visible:empty").each(function () { + var container = $(this).closest(".richtext_container"); + container.find(".tab-pane[id$='_help']").children().appendTo($(this)); + }); + }; + + updateHelp(); + $(window).on("resize", updateHelp); }); diff --git a/app/views/shared/_richtext_field.html.erb b/app/views/shared/_richtext_field.html.erb index c3ad9e3be..5b84fd6ed 100644 --- a/app/views/shared/_richtext_field.html.erb +++ b/app/views/shared/_richtext_field.html.erb @@ -6,7 +6,7 @@ - @@ -24,6 +24,6 @@ - +