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

AlloyEditor / CKEditorで、 <a> タグが他の見出しタグを囲むことができない。

Written By

Alfonso Crisci

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.

問題

AlloyEditor/CKEditorでは、アンカー (<a>) タグで、見出し(<h1>, <h2>, etc..)のような他のHTML要素を囲むことができません。 例えば、ソースタブにこのようなHTMLマークアップがあります:

<a class="test" href="web">
  <h1><span>This is a test header <img alt="test" scr="https://test.com"
  /></span></h1>
</a>

になるのでしょうか。

<h1>
<a class="test" href="web"><span>This is a test header <img alt="test" scr="https://test.com" /> </span></a>
</h1>

リッチテキストエディタのタブに切り替えたり、コンテンツを公開した後に

環境

  • Liferay DXP 7.0、7.1、7.2

解像度

このようなHTML構造を許可するように、エディタの設定を上書きしてください。

例えば、CKEditorをオーバーライドするモジュールでは、ファイル内に1行を追加する必要がある:/src/main/resources/META-INF/resources/ckeditor/dtd_definition.js

CKEDITOR.dtd.a.h1 = 1;

サンプルモジュールのソースコードを便宜上、ここに添付します。

追加情報

注: CKEditorとAlloy EditorはWYSIWYGコンテンツエディターとして提供されており、HTMLエディターとして意図されているものではありません。 これらのエディターのソースモードは、便宜上提供されているもので、ちょっとしたマークアップの調整程度を目的としています。 ソースモードに入力されたマークアップは、変更されずにそのまま残ることを保証するものではありません。

Did this article resolve your issue ?

Legacy Knowledge Base