Legacy Knowledge Base
公開されました Jul. 2, 2025

フラグメントのコンテンツが複製される

Written By

Anishq Sharma

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

問題

  • 以下のような HTML 構造のページ フラグメントを追加しようとすると、保存後にフラグメントのデータが複製されます。 また、データは編集できなくなります。
<p>
<lfr-editable id="heading" type="rich-text">
Hii All!!
</lfr-editable>
</p>

Environment

  • Liferay DXP 7.0
  • Liferay DXP 7.1
  • Liferay DXP 7.2
  • Liferay DXP 7.3

解決策

  • 実際、これは Liferay の問題ではなく、フラグメントの HTML 構造。
  • その性質上、編集可能な要素はレンダリング時にブロック要素 (div) に変換されます。この問題で言及されている <p> と <h1> 要素はインライン要素です。
  • HTML 標準では、インライン内にブロック要素を含めることは許可されていません。
  • ユーザーが編集可能ファイル内に段落またはヘッダーを配置したい場合は、「html」編集可能タイプを使用します。
  • 回避策として、 <div> 使用してリッチテキストの lfr 編集可能フィールドを囲み、 <p> タグの使用を避けます。
<div>
<lfr-editable id="heading" type="rich-text">
Hi All!!
</lfr-editable>
</div>

追加情報

Did this article resolve your issue ?

Legacy Knowledge Base