AEM 6.1 - настройка подключаемых модулей текстового редактора в поле RTE в диалоговом окне Touch UI
У меня есть диалоговое окно Touch UI, содержащее несколько полей Rich Text. Некоторые из них расположены на нескольких вкладках. Я хотел бы добавить несколько плагинов, таких как плагин misctools, на панель инструментов RTE. Как это достигается?
Я попытался настроить их, используя узел rtePlugins как дочерний узел узла в диалоговом окне, а также добавив узел rtePlugins под узлом cq:editConfig->cq:inplaceEditing, но ни один из этих подходов не изменяет панель инструментов RTE внутри сам диалог (я не хочу редактировать на месте).
Возможно ли то, что я хочу сделать?
3 ответа
ОБНОВЛЕНИЕ К МОЕМУ ПРЕДЫДУЩЕМУ ОТВЕТУ:
ПОСМОТРИТЕ НА ЭТОМ https://docs.adobe.com/docs/en/aem/6-3/administer/operations/page-authoring/rich-text-editor.html #RTE - на месте и в диалоге
Казалось бы, RTE внутри диалога на самом деле возможно, но у него есть свои проблемы, как описано в ссылке выше. Кроме того, 6.3 теперь использует CoralUI2, поэтому приведенное выше решение работает, но настройка useFixedInlineToolbar="{Boolean}true" не влияет на диалог, меню RTE не отображается, пока вы не нажмете внутри текстовой области RTE. Я еще не решил это.
Вот пример, который я только что создал для RTE в диалоге touchUI в AEM6.3
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="Properties"
sling:resourceType="cq/gui/components/authoring/dialog">
<content
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<layout
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/container">
<items jcr:primaryType="nt:unstructured">
<regulartext
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/foundation/form/textfield"
fieldLabel="Text"
name="./regulartext"/>
<text jcr:primaryType="nt:unstructured"
sling:resourceType="cq/gui/components/authoring/dialog/richtext"
fieldLabel="RICH As Text"
name="./text"
useFixedInlineToolbar="{Boolean}true">
<rtePlugins jcr:primaryType="nt:unstructured">
<edit
jcr:primaryType="nt:unstructured"
defaultPasteMode="wordhtml"
features="[cut,copy,paste-plaintext,paste-wordhtml]"
stripHtmlTags="{Boolean}true"/>
<findreplace
jcr:primaryType="nt:unstructured"
features="*"/>
<format
jcr:primaryType="nt:unstructured"
features="*"/>
<image
jcr:primaryType="nt:unstructured"
features="*"/>
<justify
jcr:primaryType="nt:unstructured"
features="*"/>
<links jcr:primaryType="nt:unstructured">
<linkDialogConfig
jcr:primaryType="nt:unstructured"
height="{Long}316">
<linkAttributes jcr:primaryType="cq:WidgetCollection">
<linkAdvanced
jcr:primaryType="cq:Widget"
collapsed="{Boolean}true"
collapsible="{Boolean}true"
inputValue="advanced"
name="./linkdialog/cq:adhocLinkTrackingTab"
title="Link tracking"
xtype="dialogfieldset">
<items jcr:primaryType="cq:WidgetCollection">
<enable
jcr:primaryType="nt:unstructured"
attribute="enabletracking"
fieldDescription="override analytics framework settings"
fieldLabel="Custom link tracking"
name="./linkdialog/cq:adhocLinkTrackingEnableTracking"
xtype="checkbox">
<listeners
jcr:primaryType="nt:unstructured"
check="function(component){var dlg=component.findParentByType('rtelinkdialog');dlg.enableSCFields(component.checked);}"/>
</enable>
<events
jcr:primaryType="nt:unstructured"
attribute="adhocevents"
fieldDescription="e.g.: event2, event7"
fieldLabel="Include SiteCatalyst events"
name="./linkdialog/cq:adhocLinkTrackingEvents"
xtype="textfield"/>
<evars
jcr:primaryType="nt:unstructured"
attribute="adhocevars"
fieldDescription="e.g.: eVar1: pagedata.url, prop4: 'const'"
fieldLabel="Include SiteCatalyst variables"
name="./linkdialog/cq:adhocLinkTrackingEvars"
xtype="textfield"/>
</items>
</linkAdvanced>
</linkAttributes>
</linkDialogConfig>
</links>
<lists
jcr:primaryType="nt:unstructured"
features="*"/>
<misctools
jcr:primaryType="nt:unstructured"
features="*">
<specialCharsConfig jcr:primaryType="nt:unstructured">
<chars jcr:primaryType="nt:unstructured">
<copyright
jcr:primaryType="nt:unstructured"
entity="©"/>
<trademark
jcr:primaryType="nt:unstructured"
entity="™"/>
<registered
jcr:primaryType="nt:unstructured"
entity="®"/>
<emDash
jcr:primaryType="nt:unstructured"
entity="—"/>
<dagger
jcr:primaryType="nt:unstructured"
entity="†"/>
<doubleDagger
jcr:primaryType="nt:unstructured"
entity="‡"/>
</chars>
</specialCharsConfig>
</misctools>
<paraformat
jcr:primaryType="nt:unstructured"
features="*">
<formats jcr:primaryType="cq:WidgetCollection">
<p
jcr:primaryType="nt:unstructured"
description="Paragraph"
tag="p"/>
<h1
jcr:primaryType="nt:unstructured"
description="Heading 1"
tag="h1"/>
<h2
jcr:primaryType="nt:unstructured"
description="Heading 2"
tag="h2"/>
<h3
jcr:primaryType="nt:unstructured"
description="Heading 3"
tag="h3"/>
<h4
jcr:primaryType="nt:unstructured"
description="Heading 4"
tag="h4"/>
<h5
jcr:primaryType="nt:unstructured"
description="Heading 5"
tag="h5"/>
<h6
jcr:primaryType="nt:unstructured"
description="Heading 6"
tag="h6"/>
</formats>
</paraformat>
<spellcheck
jcr:primaryType="nt:unstructured"
features="*"
invalidStyle="background-color: #ffdddd;"/>
<styles
jcr:primaryType="nt:unstructured"
features="*">
<styles jcr:primaryType="cq:WidgetCollection">
<disclaimer
jcr:primaryType="nt:unstructured"
cssName="small"
text="Disclaimer"/>
</styles>
</styles>
<subsuperscript
jcr:primaryType="nt:unstructured"
features="*"/>
<table
jcr:primaryType="nt:unstructured"
features="*"/>
<undo
jcr:primaryType="nt:unstructured"
features="*"/>
</rtePlugins>
<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured">
<typeConfig
jcr:primaryType="nt:unstructured"
useSemanticMarkup="{Boolean}true"/>
</docType>
</htmlRules>
<uiSettings jcr:primaryType="nt:unstructured">
<cui jcr:primaryType="nt:unstructured">
<inline
jcr:primaryType="nt:unstructured"
toolbar="[#format,-,#justify,-,#lists,-,links#modifylink,links#unlink,links#anchor,-,#styles,#paraformat,-,subsuperscript#subscript,subsuperscript#superscript,-,edit#cut,edit#copy,edit#paste-plaintext,edit#paste-wordhtml,-,findreplace#find,findreplace#replace,-,undo#undo,undo#redo,-,spellcheck#checktext,-,misctools#specialchars,-,#styles,#paraformat,-,table#table]">
<popovers jcr:primaryType="nt:unstructured">
<format
jcr:primaryType="nt:unstructured"
items="[format#bold,format#italic,format#underline]"
ref="format"/>
<justify
jcr:primaryType="nt:unstructured"
items="[justify#justifyleft,justify#justifycenter,justify#justifyright]"
ref="justify"/>
<lists
jcr:primaryType="nt:unstructured"
items="[lists#unordered,lists#ordered,lists#outdent,lists#indent]"
ref="lists"/>
<styles
jcr:primaryType="nt:unstructured"
items="styles:getStyles:styles-pulldown"
ref="styles"/>
<paraformat
jcr:primaryType="nt:unstructured"
items="paraformat:getFormats:paraformat-pulldown"
ref="paraformat"/>
</popovers>
</inline>
<!--<fullscreen-->
<!--jcr:primaryType="nt:unstructured"-->
<!--toolbar="[#format,-,subsuperscript#subscript,subsuperscript#superscript,-,edit#cut,edit#copy,edit#paste-plaintext,edit#paste-wordhtml,-,findreplace#find,findreplace#replace,-,undo#undo,undo#redo,-#justify,-,links#modifylink,links#unlink,links#anchor,-,#lists,-,spellcheck#checktext,-,misctools#specialchars,-,#styles,#paraformat,-,table#table,-,fullscreen#finish,-,control#close,control#save]">-->
<!--<popovers jcr:primaryType="nt:unstructured">-->
<!--<format-->
<!--jcr:primaryType="nt:unstructured"-->
<!--items="[format#bold,format#italic,format#underline]"-->
<!--ref="format"/>-->
<!--<justify-->
<!--jcr:primaryType="nt:unstructured"-->
<!--items="[justify#justifyleft,justify#justifycenter,justify#justifyright]"-->
<!--ref="justify"/>-->
<!--<lists-->
<!--jcr:primaryType="nt:unstructured"-->
<!--items="[lists#unordered,lists#ordered,lists#outdent,lists#indent]"-->
<!--ref="lists"/>-->
<!--<styles-->
<!--jcr:primaryType="nt:unstructured"-->
<!--items="styles:getStyles:styles-pulldown"-->
<!--ref="styles"/>-->
<!--<paraformat-->
<!--jcr:primaryType="nt:unstructured"-->
<!--items="paraformat:getFormats:paraformat-pulldown"-->
<!--ref="paraformat"/>-->
<!--</popovers>-->
<!--</fullscreen>-->
<tableEditOptions
jcr:primaryType="nt:unstructured"
toolbar="[table#insertcolumn-before,table#insertcolumn-after,table#removecolumn,-,table#insertrow-before,table#insertrow-after,table#removerow,-,table#mergecells-right,table#mergecells-down,table#mergecells,table#splitcell-horizontal,table#splitcell-vertical,-,table#selectrow,table#selectcolumn,-,table#ensureparagraph,-,table#modifytableandcell,table#removetable,-,undo#undo,undo#redo,-,table#exitTableEditing,-]"/>
</cui>
</uiSettings>
</text>
</items>
</column>
</items>
</content>
</jcr:root>
Вы упомянули, что используете TouchUI. Таким образом, в диалоге отсутствует концепция TouchEI RTEeditor. RTE "по замыслу", встроен в TouchUI. Тем не менее, если дважды щелкнуть встроенный RTE или щелкнуть по гаечному ключу в меню инструментов, вы увидите классический RTE в диалоговом окне TouchUI.
Таким образом, отвечая на ваш вопрос, концепция наличия нескольких RTE внутри диалога больше не существует, вам, вероятно, нужно переосмыслить дизайн вашего компонента.
Что касается расширения панелей инструментов в RTE, вам нужно добавить uiSettings, как встроенные, так и полноэкранные, как требуется для нужных вам опций меню.
Вот пример файла RTE dialog.xml с почти всеми включенными плагинами:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="cq:Dialog"
helpPath="en/cq/current/wcm/default_components.html#Text"
title="Text"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<tab1
jcr:primaryType="cq:Widget"
anchor="100%"
title="Text"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<text
jcr:primaryType="cq:Widget"
hideLabel="{Boolean}true"
name="./text"
useFixedInlineToolbar="{Boolean}true"
xtype="richtext">
<rtePlugins jcr:primaryType="nt:unstructured">
<edit
jcr:primaryType="nt:unstructured"
defaultPasteMode="wordhtml"
features="[cut,copy,paste-plaintext,paste-wordhtml]"
stripHtmlTags="{Boolean}true"/>
<findreplace
jcr:primaryType="nt:unstructured"
features="*"/>
<format
jcr:primaryType="nt:unstructured"
features="*"/>
<image
jcr:primaryType="nt:unstructured"
features="*"/>
<justify
jcr:primaryType="nt:unstructured"
features="*"/>
<links jcr:primaryType="nt:unstructured">
<linkDialogConfig
jcr:primaryType="nt:unstructured"
height="{Long}316">
<linkAttributes jcr:primaryType="cq:WidgetCollection">
<linkAdvanced
jcr:primaryType="cq:Widget"
collapsed="{Boolean}true"
collapsible="{Boolean}true"
inputValue="advanced"
name="./linkdialog/cq:adhocLinkTrackingTab"
title="Link tracking"
xtype="dialogfieldset">
<items jcr:primaryType="cq:WidgetCollection">
<enable
jcr:primaryType="nt:unstructured"
attribute="enabletracking"
fieldDescription="override analytics framework settings"
fieldLabel="Custom link tracking"
name="./linkdialog/cq:adhocLinkTrackingEnableTracking"
xtype="checkbox">
<listeners
jcr:primaryType="nt:unstructured"
check="function(component){var dlg=component.findParentByType('rtelinkdialog');dlg.enableSCFields(component.checked);}"/>
</enable>
<events
jcr:primaryType="nt:unstructured"
attribute="adhocevents"
fieldDescription="e.g.: event2, event7"
fieldLabel="Include SiteCatalyst events"
name="./linkdialog/cq:adhocLinkTrackingEvents"
xtype="textfield"/>
<evars
jcr:primaryType="nt:unstructured"
attribute="adhocevars"
fieldDescription="e.g.: eVar1: pagedata.url, prop4: 'const'"
fieldLabel="Include SiteCatalyst variables"
name="./linkdialog/cq:adhocLinkTrackingEvars"
xtype="textfield"/>
</items>
</linkAdvanced>
</linkAttributes>
</linkDialogConfig>
</links>
<lists
jcr:primaryType="nt:unstructured"
features="*"/>
<misctools
jcr:primaryType="nt:unstructured"
features="*">
<specialCharsConfig jcr:primaryType="nt:unstructured">
<chars jcr:primaryType="nt:unstructured">
<copyright
jcr:primaryType="nt:unstructured"
entity="©"/>
<trademark
jcr:primaryType="nt:unstructured"
entity="™"/>
<registered
jcr:primaryType="nt:unstructured"
entity="®"/>
<emDash
jcr:primaryType="nt:unstructured"
entity="—"/>
<dagger
jcr:primaryType="nt:unstructured"
entity="†"/>
<doubleDagger
jcr:primaryType="nt:unstructured"
entity="‡"/>
</chars>
</specialCharsConfig>
</misctools>
<paraformat
jcr:primaryType="nt:unstructured"
features="*">
<formats jcr:primaryType="cq:WidgetCollection">
<p
jcr:primaryType="nt:unstructured"
description="Paragraph"
tag="p"/>
<h1
jcr:primaryType="nt:unstructured"
description="Heading 1"
tag="h1"/>
<h2
jcr:primaryType="nt:unstructured"
description="Heading 2"
tag="h2"/>
<h3
jcr:primaryType="nt:unstructured"
description="Heading 3"
tag="h3"/>
<h4
jcr:primaryType="nt:unstructured"
description="Heading 4"
tag="h4"/>
<h5
jcr:primaryType="nt:unstructured"
description="Heading 5"
tag="h5"/>
<h6
jcr:primaryType="nt:unstructured"
description="Heading 6"
tag="h6"/>
</formats>
</paraformat>
<spellcheck
jcr:primaryType="nt:unstructured"
features="*"
invalidStyle="background-color: #ffdddd;"/>
<styles
jcr:primaryType="nt:unstructured"
features="*">
<styles jcr:primaryType="cq:WidgetCollection">
<disclaimer
jcr:primaryType="nt:unstructured"
cssName="small"
text="Disclaimer"/>
</styles>
</styles>
<subsuperscript
jcr:primaryType="nt:unstructured"
features="*"/>
<table
jcr:primaryType="nt:unstructured"
features="*"/>
<undo
jcr:primaryType="nt:unstructured"
features="*"/>
</rtePlugins>
<htmlRules jcr:primaryType="nt:unstructured">
<docType jcr:primaryType="nt:unstructured">
<typeConfig
jcr:primaryType="nt:unstructured"
useSemanticMarkup="{Boolean}true"/>
</docType>
</htmlRules>
<uiSettings jcr:primaryType="nt:unstructured">
<cui jcr:primaryType="nt:unstructured">
<inline
jcr:primaryType="nt:unstructured"
toolbar="[#format,-,#justify,-,#lists,-,links#modifylink,links#unlink,links#anchor,-,#styles,#paraformat,-,fullscreen#start,-,control#close,control#save]">
<popovers jcr:primaryType="nt:unstructured">
<format
jcr:primaryType="nt:unstructured"
items="[format#bold,format#italic,format#underline]"
ref="format"/>
<justify
jcr:primaryType="nt:unstructured"
items="[justify#justifyleft,justify#justifycenter,justify#justifyright]"
ref="justify"/>
<lists
jcr:primaryType="nt:unstructured"
items="[lists#unordered,lists#ordered,lists#outdent,lists#indent]"
ref="lists"/>
<styles
jcr:primaryType="nt:unstructured"
items="styles:getStyles:styles-pulldown"
ref="styles"/>
<paraformat
jcr:primaryType="nt:unstructured"
items="paraformat:getFormats:paraformat-pulldown"
ref="paraformat"/>
</popovers>
</inline>
<fullscreen
jcr:primaryType="nt:unstructured"
toolbar="[#format,-,subsuperscript#subscript,subsuperscript#superscript,-,edit#cut,edit#copy,edit#paste-plaintext,edit#paste-wordhtml,-,findreplace#find,findreplace#replace,-,undo#undo,undo#redo,-#justify,-,links#modifylink,links#unlink,links#anchor,-,#lists,-,spellcheck#checktext,-,misctools#specialchars,-,#styles,#paraformat,-,table#table,-,fullscreen#finish,-,control#close,control#save]">
<popovers jcr:primaryType="nt:unstructured">
<format
jcr:primaryType="nt:unstructured"
items="[format#bold,format#italic,format#underline]"
ref="format"/>
<justify
jcr:primaryType="nt:unstructured"
items="[justify#justifyleft,justify#justifycenter,justify#justifyright]"
ref="justify"/>
<lists
jcr:primaryType="nt:unstructured"
items="[lists#unordered,lists#ordered,lists#outdent,lists#indent]"
ref="lists"/>
<styles
jcr:primaryType="nt:unstructured"
items="styles:getStyles:styles-pulldown"
ref="styles"/>
<paraformat
jcr:primaryType="nt:unstructured"
items="paraformat:getFormats:paraformat-pulldown"
ref="paraformat"/>
</popovers>
</fullscreen>
<tableEditOptions
jcr:primaryType="nt:unstructured"
toolbar="[table#insertcolumn-before,table#insertcolumn-after,table#removecolumn,-,table#insertrow-before,table#insertrow-after,table#removerow,-,table#mergecells-right,table#mergecells-down,table#mergecells,table#splitcell-horizontal,table#splitcell-vertical,-,table#selectrow,table#selectcolumn,-,table#ensureparagraph,-,table#modifytableandcell,table#removetable,-,undo#undo,undo#redo,-,table#exitTableEditing,-]"/>
</cui>
</uiSettings>
</text>
<isRichTextFlag
jcr:primaryType="cq:Widget"
ignoreData="{Boolean}true"
name="./textIsRich"
value="true"
xtype="hidden"/>
</items>
</tab1>
<tab2
jcr:primaryType="cq:Widget"
anchor="100%"
title="Configurations"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<noStackFlag
jcr:primaryType="cq:Widget"
fieldLabel="Enable No Stack"
name="./noStack"
type="select"
xtype="selection">
<options jcr:primaryType="cq:WidgetCollection">
<yes
jcr:primaryType="nt:unstructured"
text="Yes"
value="yes"/>
<no
jcr:primaryType="nt:unstructured"
text="No"
value="no"/>
</options>
</noStackFlag>
</items>
</tab2>
</items>
</jcr:root>
и соответствующий _cq_eeditConfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:EditConfig">
<cq:inplaceEditing
jcr:primaryType="cq:InplaceEditingConfig"
active="{Boolean}true"
configPath="../../dialog/items/tab1/items/text"
editorType="text"/>
<cq:listeners
jcr:primaryType="cq:EditListenersConfig"
afteredit="REFRESH_SELF"/>
</jcr:root>
Существует проблема с основным jar AEM 6.1, когда панель инструментов показывает только 3-5 кнопок для диалогового поля Richtext, даже после создания правильного узла rtePlugins в поле richtext или использования метода cq:inplaceEditing. Попробуйте установить пакет AEM 6.1 с пакетом обновления и пакеты исправления ошибок. Вы можете найти его на сайте Adobe: https://www.adobeaemcloud.com/content/marketplace/marketplaceProxy.html?packagePath=/content/companies/public/adobe/packages/cq610/servicepack/AEM-6.1-Service-Pack-1. Я указал путь к SP1, которого должно быть достаточно для вашей проблемы. Вы также можете выбрать пакет исправлений кумулятивных ошибок SP2 плюс (заботится о других проблемах). После этого вы сможете увидеть кнопки, соответствующие всем настроенным вами плагинам в узле rtePlugins.