[Web] Manual <a href="URL">URL</a> links adjacent to non-whitespace characters are stripped on initial mount / setValue
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 74/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- react, typescript
- 領域
- frontend
調査の方向性
Start with src/web/formats/EnrichedLink.ts and src/web/pmPlugins/AutolinkPlugin/index.ts, then trace how setContent triggers the plugin on initial mount. Check the link parsing and autolink transaction behavior for URL links adjacent to other text. Done means the manual link remains in the editor HTML after remount or setValue, including the punctuation and adjacent word cases in the issue.
索引モデルが issue の本文から書いたものです。
説明
Description
On web, when <EnrichedTextInput> loads HTML containing a link whose text matches its href (for example inserted manually via ref.current.setLink(...) without surrounding spaces, or wrapped in punctuation like (https://example.com)), the <a> mark is silently stripped on initial mount / setContent.
Minimal Reproduction
<EnrichedTextInput
defaultValue='<html><p>foo<a href="https://example.com">https://example.com</a>bar</p></html>'
/>
Or programmatically / via toolbar:
- Place cursor inside existing word
foobar(betweenfooandbar). - Insert link via
editor.setLink(start, end, "https://example.com", "https://example.com").- Before reload,
getHTML()preserves<p>foo<a href="https://example.com">https://example.com</a>bar</p>.
- Before reload,
- Remount
<EnrichedTextInput>with that saved HTML indefaultValue(or callsetValue(...)).
Expected:
The <a href="https://example.com">https://example.com</a> link is preserved.
Actual:
The link mark is stripped and only plain text foohttps://example.combar remains in the editor DOM.
Root Cause (in [email protected])
EnrichedLink(src/web/formats/EnrichedLink.ts,addAttributes().auto.parseHTML) classifies any parsed<a href="X">X</a>asauto: truewheneverhref === el.textContentandisFullLinkMatch(href, linkRegex)is true (unlesslinkRegex === null). BecauserenderHTMLdoes not persist whether a link was manual or auto, manually created URL links come back asauto: trueon reload.- Immediately on
onCreate→editor.commands.setContent(...)(src/web/EnrichedTextInput.tsx),AutolinkPlugin(src/web/pmPlugins/AutolinkPlugin/index.ts) runsappendTransaction:- It splits block runs by whitespace (
/\S+/g), yielding the full token"foohttps://example.combar". - It requires a full-word match (
r.start === 0 && r.endExclusive === word.length), which isfalse. removeAutoLinksInRangethen removes everylinkmark withattrs.auto === true.
- It splits block runs by whitespace (
The same happens for cases like (<a href="https://example.com">https://example.com</a>) or any URL-labeled link touching non-whitespace characters on either side.
Environment
react-native-enriched-html:1.2.0- Platform: Web (
Chrome, Tiptap3.31.3)
- 主要言語
- C
- スター
- 1.4k
- フォーク
- 80
- 平均マージ
- 4日 19時間
- マージ済み PR(30日)
- 21
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
software-mansion/react-native-enriched-html のほかの issue
-
[Web] Leading, trailing, and consecutive spaces in <p> and <codeblock> are stripped by setContent on mount / setValue対応中かも @pcbeingused333 が 2 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
software-mansion/react-native-enriched-html#886 ·
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
software-mansion/react-native-enriched-html#881 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
software-mansion/react-native-enriched-html#880 ·
メンテナーはふだん 2 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
software-mansion/react-native-enriched-html#878 ·
メンテナーはふだん 2 日以内に返信
-
[Android] Leading and consecutive spaces are lost when HTML is parsed (iOS keeps them)対応中かも @szydlovsky が 1 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
software-mansion/react-native-enriched-html#877 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
software-mansion/react-native-enriched-html の issue をすべて見る
似ている issue
-
[Android Auto] MU1017 (MHI2Q_JP_AUG22_P1017) cluster map works with a pinned profile — values insideオープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
kamgurgul/mib2q-carplay#74 ·
-
Claude:NotNeeded GPT:NotABug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
open5gs/open5gs#5195 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
FriendsofECCE/ECCE#1358 ·
-
documentation needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
X11Libre/xserver#4255 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
antoxa2584x/nfsu2-sw#52 ·