adobe / aem-core-forms-components

Apache License 2.0
26 stars 50 forks source link

Inplace editing of core text component broken after upgrading forms components to 3.0.x #1371

Closed samueljdel closed 1 week ago

samueljdel commented 1 week ago

We recently upgraded forms components from 2.0.90 to 3.0.50. After upgrade we noticed that upgrading forms components broke the inplace editing functionality of the core Text component. The post call also has the formatting stripped. This works fine on 2.0.90

Expected Behaviour

Inplace editing of Text component shows toolbar and doesn't remove formatting when inplace editing is active and the cursor is clicked outside the component.

Actual Behaviour

Inplace editing of Text component doesn't show toolbar and removes formatting when inplace editing is active and the cursor is clicked outside the component.

Reproduce Scenario (including but not limited to)

This can be observed on a new repo or any existing repo with forms by upgrading forms to 3.0.44 - 3.0.52 with core components 2.24.6 or above

Steps to Reproduce

Add core Text component to any page and author it using dialog normally with some formatting. Select the component and click on the edit icon for inplace editing. Click outside the component and all formatting present in the component is removed

Platform and Version

AEM cloud environments and AEM cloud SDK

AEM Version (mention the exact version in case of cloud SDK)

AEM Cloud SDK(tested on AEM SDK v2024.5.16461.20240524T172309Z-240400 and above) with core components 2.24.6 or above

AEM Forms Version

AEM Forms 3.0.48 and above(could occur in previous 3.0.x versions)

Sample Code that illustrates the problem

Happens on default generated core Text component

Logs taken while reproducing problem

No logs available attached HAR file of the post request text component inplace editing issue.json

rismehta commented 1 week ago

@samueljdel I attempted to reproduce the issue on my end but was unsuccessful. @im-shiv, could you please verify if the issue can be reproduced?

rismehta commented 1 week ago

@samueljdel Could you please provide a video demonstrating the issue?

NiranjanPalani90 commented 1 week ago

@rismehta Attached video for your reference.

https://github.com/user-attachments/assets/8e2470c5-c2dd-4b7f-9e85-bf2845d2bd1a

samueljdel commented 1 week ago

@rismehta Looks like the root cause for this is the same as https://github.com/adobe/aem-core-forms-components/issues/1374 Commenting out the below code in /apps/core/fd/components/form/container/v2/container/clientlibs/editorhook/js/toolbaractionhook.js makes the toolbar load and the formatting issues are not present.

if(!(hasRichTextLabel || hasRichTextAttribute)){
                editable.config.editConfig.inplaceEditingConfig.editorType="plaintext";
            }
rismehta commented 1 week ago

@samueljdel Thanks for identifying the issue. This should be resolved with the changes in this, https://github.com/adobe/aem-core-forms-components/pull/1376

rismehta commented 1 week ago

@samueljdel This issue has been resolved in the release available here: https://github.com/adobe/aem-core-forms-components/releases/tag/core-forms-components-reactor-3.0.54