AEM 6.3 Communities:UGC工具栏配置ckrte.js能否存本地代码库?
Customizing UGC RTE Toolbar: Using Local
ckrte.js in AEM Communities Absolutely, you can store ckrte.js in your local project's clientlibs—you don't have to rely solely on CRXDE. The issue you're seeing is almost certainly related to misconfiguration of your clientlib or loading order, rather than a restriction on where the file can live. Let's walk through what's likely going wrong and how to fix it:
Common Reasons Your Local ckrte.js Isn't Taking Effect
- Incorrect Clientlib Categories: AEM loads clientlibs based on their assigned
categoriesproperty. For UGC RTE customization, your clientlib needs to include categories aligned with Communities UGC components (e.g.,cq.commities.ugcorcq.commities.rte—double-check the exact category for your AEM version). If the category doesn't match, AEM won't inject your script when the UGC RTE loads. - Loading Order Conflict: The default
ckrte.jsfrom AEM's out-of-the-box libraries might load after your custom script, overwriting your changes. Fix this by:- Adding a
dependenciesproperty to your clientlib that includes the OOTB RTE clientlib category. This ensures your script loads after the default one. - Setting a higher
rankingvalue (e.g.,100) on your clientlib folder—AEM loads clientlibs with higher ranking values later.
- Adding a
- Clientlib Deployment Issues: Ensure your clientlib folder has the correct JCR type (
cq:ClientLibraryFolder) and that yourckrte.jsis placed inside ajssubfolder. Also, verify your project deploys the clientlib correctly to your AEM instance (check CRXDE to confirm the file exists under your project's path). - Caching: AEM aggressively caches clientlibs. After making changes, clear the clientlib cache via
/system/console/cacheor enable development mode (disable clientlib minification/merging) to see updates immediately.
Step-by-Step Fix
- Configure Your Clientlib:
- In your project's
ui.appsmodule, create a new clientlib folder (e.g.,apps/your-project/clientlibs/ugc-rte-custom). - Set its
jcr:primaryTypetocq:ClientLibraryFolder. - Add a
categoriesproperty (string array) with the appropriate Communities RTE category. - Add a
dependenciesproperty (string array) with the OOTB RTE clientlib category to enforce load order. - Place your custom
ckrte.jsinside ajssubfolder of this clientlib.
- In your project's
- Adjust RTE Logic:
- In your
ckrte.js, modify the CKEditor config after OOTB initialization. For example:CKEDITOR.on('instanceReady', function(event) { var editor = event.editor; // Customize toolbar here editor.config.toolbar = [ ['Bold', 'Italic', 'Underline'], ['Link', 'Unlink'], ['BulletedList', 'NumberedList'] ]; });
- In your
- Verify and Test:
- Deploy your project to AEM, clear the cache, and load a UGC component (like a comment or forum post).
- Use your browser's dev tools Network tab to confirm your
ckrte.jsloads after the OOTB version.
With these adjustments, your local ckrte.js should successfully override the default UGC toolbar configuration.
内容的提问来源于stack exchange,提问作者Mark Handy
相关产品推荐
相关产品推荐

