Add data-text-formatting attribute for selected markup language to body tag
(I looked in trunk for a solution and in the issues for a request but couldn't find anything, I'm sorry if this is a duplicate or already solved)
Knowing the markup used in the js would allow setting the correct markup/function for the added buttons directly in the js.
While there are a few other possibilities to achieve this (load different js files from the plugins depending on the selected markup, this adds complexity on the js side either because of duplication, loading 2 files for the markup-specific and common code, and so on).
The simplest change we could come up with would be to add a line similar to:
to source:/tags/3.1.0/lib/redmine/wiki_formatting/textile/helper.rb#L35, the same for markdown.
Since the text formatting is set at the application level, not per textarea, I think adding a new attribute to 'body' is enough.
diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index bcd6622a7..16a640267 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -17,7 +17,7 @@ <!-- page specific tags --> <%= yield :header_tags -%> </head> -<body class="<%= body_css_classes %>"> +<body class="<%= body_css_classes %>" data-text-formatting="<%= Setting.text_formatting %>"> <%= call_hook :view_layouts_base_body_top %> <div id="wrapper">