プロジェクト

全般

プロフィール

Vote #77756

完了

User preference for monospaced / variable-width font in textareas

Admin Redmine さんが4年以上前に追加. 4年以上前に更新.

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

0%

予定工数:
category_id:
10
version_id:
119
issue_org_id:
23653
author_id:
347
assigned_to_id:
1
comments:
7
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Currently, Redmine's stylesheets do not define a @font-family@ for text areas which leaves this up to the browser and results in e.g. monspaced fonts in Firefox and variable-width fonts in Webkit (Chrome, Safari, ...).

Generally, our experience at Planio has shown that there are users who will write more code in text areas and users who will write more prose text.

Therefore, this patch makes the behaviour more deterministic across browsers and lets users choose their preference in My Account. It includes a few tests and applies cleanly against current trunk.

h2. Implementation choices:

h3. Why are you using JavaScript to add an extra CSS class?

Textareas in Redmine are rendered using the regular @text_area@ helper in Rails. There is no way to render an extra css class for all textareas without touching every view file in Redmine that has a textarea. This would have made this patch much bigger.

The setting would not work in plugins out of the box since plugin developers would have to change their code as well.

h3. Why aren't you rendering an inline style definition in the HTML @HEAD@?

In theory, we could have defined an inline style in the HTML @HEAD@ on every page, depending on the value of @User.current.pref.monospace_textareas@ and thus eliminated the need for JavaScript here. Adding a class using JS however, will make it easier for theme developers to define their own styles for monospaced and variable-width textareas, such as custom font families, etc.


journals

Here's what it looks like:

!http://www.redmine.org/attachments/download/16576/My%20account%20-%20Redmine%202016-08-24%2013-26-56.png!
--------------------------------------------------------------------------------
quick fix
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
third time's a charm :)
--------------------------------------------------------------------------------
I found a simple use case of this feature in "Planio's site":https://support.plan.io/news/112 . I think this feature is useful for developers.

The patch passed all tests. Setting target version to 3.4.0.

!https://support.plan.io/attachments/download/196240/switch_between_monospaced_and_variable_width_font_for_text_areas.png!

--------------------------------------------------------------------------------
Feature added in r15753. I used a different solution that does not require javascript and lets the styles to be defined in stylesheets. Please let me know if there's anything wrong with this.
I've also changed the preference to a drop down instead of a checkbox in order to offer 3 options (monospaced, proportional and browser defaut).
--------------------------------------------------------------------------------

Admin Redmine さんが4年以上前に更新

  • カテゴリUI_10 にセット
  • 対象バージョン3.4.0_119 にセット

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

いいね!0
いいね!0