问题
I have a Touch UI dialog containing multiple Rich Text fields. Some are spread out over several tabs. I would like to add several plugins, such as the misctools plugin, to the RTE toolbar. How is this accomplished?
I have tried configuring them using the an rtePlugins node as a child of the field node in the dialog, as well as adding an rtePlugins node under the cq:editConfig->cq:inplaceEditing node, but none of these approaches change the RTE toolbar inside the dialog itself (I don't want in-place editing).
Is what I want to do even possible?
回答1:
UPDATE TO MY PREVIOUS ANSWER:
HAVE A LOOK AT THIS https://docs.adobe.com/docs/en/aem/6-3/administer/operations/page-authoring/rich-text-editor.html #RTE - In-place and In a Dialog
It would appear RTE inside a dialog is actually possible, but it does have it's issues, as documented in the link above. Additionally, 6.3 now uses CoralUI2, so this solution above does work, but the setting of useFixedInlineToolbar="{Boolean}true" has no affect inside a dialog, the RTE menu is not visible until you click inside the RTE textarea. I'm yet to resolve this.
Here's an example I've just created for RTE inside a touchUI dialog in 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>
回答2:
There is an issue with the basic AEM 6.1 jar where the toolbar shows only 3-5 buttons for Richtext dialog field even after creating proper rtePlugins node under the richtext field or using cq:inplaceEditing method. Try installing the AEM 6.1 Service Pack package and bug fix packages.You can find it on Adobe's site : https://www.adobeaemcloud.com/content/marketplace/marketplaceProxy.html?packagePath=/content/companies/public/adobe/packages/cq610/servicepack/AEM-6.1-Service-Pack-1. I have provided the path for SP1 which should be enough for your issue. You can also opt for SP2 plus Cumulative Bug fixes package(takes care of other issues). After that you will be able to see buttons corresponding to all the plugins configured by you under rtePlugins node.
回答3:
You mentioned that you are using TouchUI. As such, there is no touchUI concept of an RTEeditor inside a dialog. RTE "by design", are inline in TouchUI. That said, if you double-click your inline RTE or click the spanner from the toolmenu, you are presented with a classicUI RTE inside a TouchUI dialog.
So in answering your question, the concept of having multiple RTE inside a dialog no longer exists, you probably need to rethink the design your component.
With reference to extending the toolbars on RTE you need to add uiSettings, both inline and fullscreen as required for the menu options you desire.
Here's a sample RTE dialog.xml with pretty much all plugins enabled:
<?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>
and the corresponding _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>
来源:https://stackoverflow.com/questions/44182298/aem-6-1-configure-rich-text-editor-plugins-on-an-rte-field-inside-a-touch-ui-d