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

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.

問題

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

Environment

  • Liferay DXP 7.2, 7.3

解決策

  • 追加ツールバーへのボタンの追加 とスタイルツールバーへのボタンの追加 では、追加ツールバーとスタイルツールバーに特定のボタンを追加する方法について説明します。
  • ドキュメントの記事 エディターの設定の変更 では、特定のポートレットやエディターを対象にする方法を説明しています。
  • テキストを含むフラグメントに確実に変更を反映させるには、 editor.config.key と javax.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