Add Alloy Editor buttons for fragments with text


  • Trying to new buttons to Alloy Editor in fragments with text is not working.
  • What should be the appropriate editor's configuration?


  • Liferay DXP 7.2, 7.3


  • The documentation articles Adding a Button to the Add Toolbar and Adding a Button to a Styles Toolbar explain how to add particular buttons for the Add and Styles Toolbars.
  • The documentation article Modifying an Editor's Configuration explains how to target particular portlets and editors.
  • To make sure that the changes affect fragments with text it's necessary to specify the appropriate editor.config.key and
    immediate = true,
    property = {
    "" + ContentPageEditorPortletKeys.CONTENT_PAGE_EDITOR_PORTLET,
    service = EditorConfigContributor.class
  • Note that the Add Toolbar "+" button will appear by default on the left of the text box, so it might be hidden if the fragment stretches all the way to the left. It's possible to change the button position, for example to the right, with:
    JSONObject toolbarsJSONObject = jsonObject.getJSONObject("toolbars");
    JSONObject addToolbar = toolbarsJSONObject.getJSONObject("add");
    addToolbar.put("position", "right");
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 0 de 0