May 10, 2020
Estimated Post Reading Time ~

Issues with RTE In AEM And their Fixes

Edit rte and click ‘done’ in the dialog without clicking outside the rte field, the value will not get stored.
Solution:
1.Override /libs/cq/gui/components/authoring/dialog/richtext/clientlibs/richtext/js/richtext.js
2. Add this line of code:
$container.focusout(function() {
var el = $(this).closest(“.richtext-container”);el.find(“input[type=hidden].coral-Textfield”).val(el.find(“.coral-RichText-editable”).html());
});
Want to change the ‘height of RTE’ for different component:
Solution:
a. Override /libs/cq/gui/components/authoring/dialog/richtext/render.jsp
b. Add a height string property in the rte field of the component and add the value, you want in px.
c. Edit the last line to :

.infinity.json”
data-use-fixed-inline-toolbar=”” style=”height:px”>

</div>
Want to define a common RTE with all the plugin configuration done and refer it in all the components:
Solution:
a. Create a common RTE by defining all rtePlugins and uiSettings.
b. Refer them in your component using the concept of ‘Sling Resource Merger’
c. Create the new RTE field and create its rtePlugins,uiSettings with property sling:resourceSuperType pointing to common rtePlugins and uiSettings
Want to remove the <p> tag from RTE which gets added:
Solution:
Add a Boolean property
removeSingleParagraphContainer=true
Link is not getting saved in RTE
Solution:
Add a Boolean property
useFixedInlineToolbar=true
This property does not work with multifield, so it should be removed in case of multifield.
RTE in multifield and nested multifield, values do not appear though its saved
Solution:
$(document).on(“touchui-composite-multifield-nodestore-ready”,function(){
var $container = $(“.richtext-container”);
if($container.length){
$container.each(function() {
var html = $(this).find(“input[type=hidden].coral-Textfield”).val();
$(this).find(“.coral-RichText-editable”).empty().append(html);
});
}
});


By aem4beginner

1 comment:

  1. If my RTE is mandatory, then I'm getting error icon at tab level along with RTE container. After filling the value and clicking on outside the container, the error icon is going away from container but not from tab. Can I expect a solution here?

    ReplyDelete

If you have any doubts or questions, please let us know.