[MGNLUI-2727] Rich-text field - when using custom config.js file, the magnolialink plugin is not available Created: 03/Mar/14 Updated: 11/Aug/15 Resolved: 16/Sep/14 |
|
| Status: | Closed |
| Project: | Magnolia UI |
| Component/s: | None |
| Affects Version/s: | 5.2.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Bence Vass | Assignee: | Mikaël Geljić |
| Resolution: | Duplicate | Votes: | 4 |
| Labels: | support | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||
| Issue Links: |
|
||||||||||||
| Template: |
|
||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||||||
| Date of First Response: | |||||||||||||
| Description |
|
When using a custom config.js file for the Rich-text field (CKEditor), the magnolialink plugin is not loaded (and thus DamLink and InternalLink are not available for the CKEditor). Configuring the plugin in config.js is possible, but the necessary eventlistener will still be missing. Possible solution: |
| Comments |
| Comment by Bence Vass [ 04/Mar/14 ] |
|
Always loading the plugin is problematic too, because then you can't load plugins from the custom config.js. |
| Comment by Moritz Siuts [ 02/Jun/14 ] |
|
Is there a workaround to use a custom config and the magnolialink plugin? |
| Comment by Mikaël Geljić [ 16/Sep/14 ] |
|
Hi there, I linked this issue to superseding ticket Meanwhile would you mind confirming whether a 5.2.x fix is still required (SUPPORT-3976 hints at 5.3.2)? Cheers, |
| Comment by Moritz Siuts [ 16/Sep/14 ] |
|
A workaround to this issue is to extend info.magnolia.dam.asset.field.factory.AssetsEnabledRichTextFieldFactory and override the methods initializeToolbarConfig and initializeCKEditorConfig to configure the CKEditor and add some custom plugins. Then you use your own class as factory class for Textareas at config/modules/ui-framework/fieldTypes/textArea |
| Comment by Matteo Pelucco [ 10/Aug/15 ] |
|
Here a working class, HTH (It would have helped me package com.package.info; import info.magnolia.dam.api.AssetProviderRegistry; import info.magnolia.dam.app.ui.field.factory.AssetsEnabledRichTextFieldFactory; import info.magnolia.i18nsystem.SimpleTranslator; import info.magnolia.ui.api.app.AppController; import info.magnolia.ui.api.context.UiContext; import info.magnolia.ui.form.field.definition.RichTextFieldDefinition; import info.magnolia.ui.vaadin.integration.contentconnector.ContentConnector; import info.magnolia.ui.vaadin.richtext.MagnoliaRichTextFieldConfig; import com.vaadin.data.Item; import com.vaadin.server.VaadinService; /** * Custom RichTextFieldFactory, able to instantiate magnolialink controls to CKEditor even in case of custom * configJsFile property. More infos here: https://jira.magnolia-cms.com/browse/MGNLUI-2727 * * @author matteo * */ public class MyProjectAssetsEnabledRichTextFieldFactory extends AssetsEnabledRichTextFieldFactory { public static final String ASSET_CHOSEN_EVENT_ID = "assetChosen"; private static final String PLUGIN_NAME_MAGNOLIALINK = "magnolialink"; private static final String PLUGIN_PATH_MAGNOLIALINK = "/VAADIN/js/magnolialink/"; public MyProjectAssetsEnabledRichTextFieldFactory(RichTextFieldDefinition definition, Item relatedFieldItem, AppController appController, UiContext uiContext, SimpleTranslator i18n, AssetProviderRegistry assetProviderRegistry, ContentConnector contentConnector) { super(definition, relatedFieldItem, appController, uiContext, i18n, assetProviderRegistry, contentConnector); } protected MagnoliaRichTextFieldConfig initializeCKEditorConfig() { MagnoliaRichTextFieldConfig config = super.initializeCKEditorConfig(); String path = VaadinService.getCurrentRequest().getContextPath(); // add this in any case config.addPlugin(PLUGIN_NAME_MAGNOLIALINK, path + PLUGIN_PATH_MAGNOLIALINK); config.addListenedEvent(EVENT_GET_MAGNOLIA_LINK); return config; } } |
| Comment by Matteo Pelucco [ 10/Aug/15 ] |
|
..and this is the configuration under config workspace (ui-framework module) |
| Comment by Mikaël Geljić [ 11/Aug/15 ] |
|
Hi Matteo, This is exactly what's done inside the RichTextFieldFactory itself. This was resolved in 5.3.4, with superseding ticket
So my question is, are you stuck with an older version of Magnolia? Or is there still a scenario where this is not working as intended? Cheers, |
| Comment by Matteo Pelucco [ 11/Aug/15 ] |
|
Hi Mika, M. |
| Comment by Mikaël Geljić [ 11/Aug/15 ] |
|
Perfect then, thanks for sharing and glad if that works for you. |