プロジェクト

全般

プロフィール

Vote #76685

未完了

Add javascript variable for selected markup language

Admin Redmine さんが約2年前に追加. 約2年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
Text formatting_26
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
26
version_id:
0
issue_org_id:
20620
author_id:
3866
assigned_to_id:
0
comments:
4
status_id:
1
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

(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)

We (plan.io) currently add 2 buttons to the wiki toolbar, one as described in #14937 and another from a plugin, which insert markup-sensitive content to the edited text. Those buttons are added from included javascript files, there currently is no easy way to find out which markup is selected from the js.

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:


javascript_tag("var wikiMarkup = 'textile';") +

to source:/tags/3.1.0/lib/redmine/wiki_formatting/textile/helper.rb#L35, the same for markdown.

Is this something that could be added to Redmine, or how should markup-dependent javascript be handled? Thanks.


journals

Whoops, seems I used opening instead of closing tags at the end of the code line, sorry (which also shows how the code button proposed in #14937 could be helpful :-) )
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
This should not be done in a specific markup helper.

This should not be a "global variable":http://c2.com/cgi/wiki?GlobalVariablesAreBad, could be stored e.g. as a @data-markup-language@ attribute on @textarea@ component.
--------------------------------------------------------------------------------
Thanks for correcting the description.

A data attribute on text areas would probably work too.
--------------------------------------------------------------------------------

Admin Redmine さんが約2年前に更新

  • カテゴリText formatting_26 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0