[Feature request] Vertical spacing (margins) for headings and lists in htmlStyle
メンテナーはふだん 3 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 20/100
調査の方向性
The request covers htmlStyle rendering in EnrichedTextInput and EnrichedText on iOS, Android, and web; an open linked pull request (#838) is already addressing it. For context, compare the sibling library's ParagraphStyleUtils.m and MarginBottomSpan.kt, linked in the issue, and review the proposed examples and platform behaviors. Done means block margins work across platforms while leaving HTML, plain text, and selection offsets unchanged.
索引モデルが issue の本文から書いたものです。
説明
Is your feature request related to a problem? Please describe.
This is the separate request @kacperzolkiewski asked for in #259: a way to add vertical space around block elements.
We render the same HTML with EnrichedTextInput on web and on native. On web we style it with CSS: margin: 18px 0 8px on h1–h3, margin: 6px 0 on ul/ol, and line-height: 1.55. On native we can match the line height with the lineHeight style, and soon on EnrichedText too (#724). But we can't add space above or below headings or lists. HeadingStyle only has fontSize and bold, on main as well.
As a result, headings sit flush against the paragraph before and after them. Long documents read as one dense block on phones, while the same document looks well spaced on web. Our users reported exactly this.
Describe the solution you'd like
Per-block vertical spacing in htmlStyle, for both EnrichedTextInput and EnrichedText:
htmlStyle={{
h2: { fontSize: 20, bold: true, marginTop: 18, marginBottom: 8 },
ul: { gapWidth: 8, marginLeft: 20, marginTop: 6, marginBottom: 6 },
}}
- iOS:
paragraphSpacingBeforeon a block's first paragraph andparagraphSpacingon its last. - Android: a span that adds top and bottom space.
- Web: CSS margins.
The spacing should be visual only, with no change to the HTML, the plain text or selection offsets. #470 (paragraphSpacing for checkbox lists) is a similar idea for one block type.
The sibling library react-native-enriched-markdown already ships this API in its renderer: markdownStyle.h1–h6 take marginTop and marginBottom (docs).
- iOS:
paragraphSpacing(ParagraphStyleUtils.m). - Android: a
LineHeightSpan(MarginBottomSpan.kt). - Edges: it collapses adjacent margins and drops the last block's bottom margin (
allowTrailingMargin).
Matching those prop names and behaviours here would keep the two libraries consistent. One difference for an editor: the space above a block should come from paragraphSpacingBefore rather than an inserted spacer character, so the text and offsets stay unchanged.
Describe alternatives you've considered
- Inserting
<br>around headings before rendering: the editor then saves those<br>s back into the document. - A large
lineHeight: it spreads out every line, not just the gaps between blocks (as noted in #259).
Additional context
react-native-enriched-html 1.1.1, React Native 0.86.3, Expo SDK 57, tested on the iOS 18.6 simulator.
- 主要言語
- C
- スター
- 1.4k
- フォーク
- 74
- 平均マージ
- 3日 4時間
- マージ済み PR(30日)
- 18
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
software-mansion/react-native-enriched-html のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
software-mansion/react-native-enriched-html#848 ·
メンテナーはふだん 3 日以内に返信
-
[iOS] Named entity rendered literally, then saved as &nbsp;対応中かも @exploIF が 4 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
software-mansion/react-native-enriched-html#818 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
[iOS] Tags not parsed on iOS below a certain string length対応中かも @hejsztynx が 18 日前に担当しました。 オープンbug
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
software-mansion/react-native-enriched-html#811 · コメント 3 件 ·
メンテナーはふだん 3 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 50/100
software-mansion/react-native-enriched-html#810 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
software-mansion/react-native-enriched-html#803 ·
メンテナーはふだん 3 日以内に返信
software-mansion/react-native-enriched-html の issue をすべて見る
似ている issue
-
documentation severity: low
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
luainkernel/lunatik#2231 ·
メンテナーはふだん 1 日以内に返信
-
aspect ratio 16:10オープンenhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Revivedx/SavageWindRecomp#402 ·
メンテナーはふだん 1 日以内に返信
-
cleanup help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ESPresense/ESPresense#2602 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
apache/arrow-swift#209 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
libretiny-eu/libretiny#435 ·
メンテナーはふだん 4 日以内に返信