When using the Froala editor with selective plugin loading (pluginsEnabled), enabling only the "align" plugin causes a JavaScript error when attempting to apply text alignment (e.g., center, right, justify) to selected text.
Steps to Reproduce:
- Configure Froala editor with selective plugins:
- Add some text to the editor
- Select the text
- Click the alignment dropdown and select "Center" (or any alignment option)
Expected Behavior:
The selected text should be aligned to the center without errors.
Actual Behavior:
A JavaScript error is thrown:
The alignment is not applied, and the dropdown does not update.
Root Cause:
The align plugin in plugins.pkgd.min.js appears to call selectedCells() (a table plugin method) without checking if the table plugin is loaded or if the context is actually a table cell.
Workaround:
Adding the "table" plugin to pluginsEnabled alongside "align" resolves the issue:
Suggested Fix:
The align plugin should either:
- Check if selectedCells exists before calling it
- Document that the "table" plugin is a required dependency when using "align"
- Separate text alignment logic from table cell alignment logic
- Environment:
Browser: latest Chrome
Using: angular-froala-wysiwyg 4.6.2.