Text-run paragraphs miss the synthetic paragraph carrier reset

クローズ 初心者向け
#2,803 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #2810 @chubes4 による — マージ済み

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php, wordpress
領域
backend

調査の方向性

HtmlCompilation::convertText() から始めてください。ここでソーステキストノード用の有効性キャリアである core/paragraph が作られています。次に createBlock() を確認してください。このメソッドは、コンテンツに class= が含まれる場合にのみ SYNTHETIC_PARAGRAPH_CLASS を追加します。EngineSupportCss が詳細度ゼロのキャリアリセットをどのように適用しているかも確認してください。Issue の再現手順を実行し、.author の行の高さが 28px であることを確かめてください。プレーンテキストのランに合成段落クラスが付与され、再現結果がソースの高さと一致すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Problem

Bare text inside a lowered container (<div class="author">Anonyme</div>) becomes a plain <p> with no blocks-engine-synthetic-paragraph class. That paragraph has no source box, but it renders with the UA paragraph margins of 1em top and bottom.

Reproduction (neutral)

<style>.review{display:flex;flex-direction:column}.author{font-weight:600;margin-top:16px}</style>
<main><div class="review"><p class="body">Quote text here.</p><div class="author primary">Anonyme</div></div></main>

Output: <div class="wp-block-group author primary …"><p>Anonyme</p></div>. In the source, .author is 28px tall; in the import it is 60px tall, because of the 16px UA margin above and below the paragraph.

On a real capture (nostar2.com reviews carousel), every slide's author line grows 32px. The section and everything below it drift 32px.

Root cause

HtmlCompilation::convertText() builds the validity-carrier core/paragraph for a source text node. createBlock() adds SYNTHETIC_PARAGRAPH_CLASS to source-less paragraphs only when their content contains class= (styled inline leaves). Plain text runs never get the class, so EngineSupportCss's zero-specificity carrier reset (margin:0, display:contents) doesn't apply to them.

Expected

Every paragraph convertText() synthesizes for a source text run is marked as a synthetic paragraph. The text then renders in its parent's box, exactly as in the source.


AI disclosure: found and reduced with Claude (Anthropic) in the Pi coding agent during the nostar2.com import parity loop.

主要言語
PHP
スター
25
フォーク
3
平均マージ
2時間 29分
マージ済み PR(30日)
931

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Automattic/blocks-engine のほかの issue

Automattic/blocks-engine の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。