legacy-knowledge-base
公開されました Jul. 2, 2025

テキストを含むフラグメントのためのAlloy Editorボタンを追加する

written-by

Ricardo Couso

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

learn-legacy-article-disclaimer-text

問題

  • Alloy Editorにテキストを含むフラグメントでボタンを新規作成しようとすると、うまくいきません。
  • 適切なエディターの構成はどうあるべきか?

Environment

  • Liferay DXP 7.2, 7.3

解決策

  • 追加ツールバーへのボタンの追加 とスタイルツールバーへのボタンの追加 では、追加ツールバーとスタイルツールバーに特定のボタンを追加する方法について説明します。
  • ドキュメントの記事 エディターの設定の変更 では、特定のポートレットやエディターを対象にする方法を説明しています。
  • テキストを含むフラグメントに確実に変更を反映させるには、 editor.config.keyjavax.portlet.nameを適切に指定する必要があります:
    @Component(
    immediate = true,
    property = {
    "editor.config.key=fragmenEntryLinkRichTextEditor",
    "javax.portlet.name=" + ContentPageEditorPortletKeys.CONTENT_PAGE_EDITOR_PORTLET,
    "service.ranking:Integer=100"
    },
    service = EditorConfigContributor.class
    )
  • なお、ツールバーの「+」ボタンは、デフォルトではテキストボックスの左側に表示されるため、フラグメントが左側まで伸びている場合は隠れてしまうことがあります。 で、ボタンの位置を右などに変更することが可能です:
    JSONObject toolbarsJSONObject = jsonObject.getJSONObject("toolbars");
    
    JSONObject addToolbar = toolbarsJSONObject.getJSONObject("add");
    
    addToolbar.put("position", "right");
did-this-article-resolve-your-issue

legacy-knowledge-base