Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Uncaught TypeError - Handlebars.compile is not a function - AEM 6.5

id-genz
Level 1
Level 1

We are using a custom color picker from Experiencing Adobe Experience Manager - Day CQ: AEM 65 - Touch UI RTE (Rich Text Editor) Dialog Colo... - the color picker works fine, but color-picker.js throws this Uncaught TypeError, and that causes an issue with other plugins which load after it. My understanding is that Handlebars is included OOTB in AEM, based on the docs - SCF Handlebars Helpers (although, the 6.5 version of this documentation appears incorrect - helpers.js has moved to /libs/clientlibs/social/commons/scf/helpers.js in 6.5) which makes me think that the issue is due to helpers.js moving. Is there a step that is missing somewhere that I need to make sure Handlebars is included and accessible by this JS file?

1 Accepted Solution
Arun_Patidar
Correct answer by
Community Advisor
Community Advisor

The error is because the plugin is loading twice with page and in a popover dialog, and in the popover dialog the Handlebar js is not being loaded that causing the issue, in case if you are using custom plugins then add below condition in plugin js to load plugins only once.

if (document.location.pathname.indexOf("/editor.html/") > -1)

        addDialogTemplate();

I've updated the color picker and created new custom style plugin and both are working fine in 6.3,6.4 and 6.5

View solution in original post

10 Replies
antoniom5495929
Level 7
Level 7

Hi,

the handlebars library is deployed by default if you include the cq.authoring.dialog clientlib into your project (as you can see from the image).

Screen Shot 2019-06-28 at 18.35.01.png

Thanks,

Antonio

Arun_Patidar
Correct answer by
Community Advisor
Community Advisor

The error is because the plugin is loading twice with page and in a popover dialog, and in the popover dialog the Handlebar js is not being loaded that causing the issue, in case if you are using custom plugins then add below condition in plugin js to load plugins only once.

if (document.location.pathname.indexOf("/editor.html/") > -1)

        addDialogTemplate();

I've updated the color picker and created new custom style plugin and both are working fine in 6.3,6.4 and 6.5

View solution in original post

narayana_chirra
Level 3
Level 3

if (document.location.pathname.indexOf("/editor.html/") > -1) {

        addDialogTemplate();

}

 

yes, it is working for us, we are having a similar issue with RTE Image Picker Plugin.

Thanks 

 
 
shivamurthym775
Level 2
Level 2

Hi Arun,

I was not able to fix the same issue by adding the

if (document.location.pathname.indexOf("/editor.html/") > -1)

        addDialogTemplate();

Do we need to do something else?@

narayana_chirra
Level 3
Level 3

if (document.location.pathname.indexOf("/editor.html/") > -1) {

        addDialogTemplate();

}

 

yes, it is working for us, we are having a similar issue with RTE Image Picker Plugin.