froala / angular-froala-wysiwyg

Angular 4, 5, 6, 7, 8 and 9 plugin for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
736 stars 202 forks source link

FroalaEditorDirective should use the host's FloaraEditor #504

Open bence-balogh-intland opened 2 years ago

bence-balogh-intland commented 2 years ago

Hi Guys,

We are using froala-editor package, together with angular-froala-wysiwyg. We recognized the following behaviors with the new version of these packages:

These issues have been traced back to the following root cause:

I have created a test repo for demonstration with both Angular and Non-Angular version of the editor: https://github.com/bence-balogh-intland/angular-froala-test/compare/master...add-froala With the following result: image

Please consider the following differences between the 2 editors:

For curiosity I checked what happens if I remove the line of the following import from node_modules\...\angular-froala-wysiwyg.js: import FroalaEditor from 'froala-editor';

And as you can see, it solved all of the points above: image

So my suggestion would be to remove the import of FroalaEditor from angular-froala-wysiwyg, and leave this resolution for the host applications, since froala-editor appends FroalaEditor to the window object on initialization. E.g. one possible way to do that: https://github.com/bence-balogh-intland/angular-froala-test/compare/master...add-froala#diff-2d2675bb4687601a5c7ccf707455132f90f3516a33716185687e5c41df59ac7dR36

Checked with: angular-froala-wysiwyg: 4.0.14 froala-editor: 4.0.14 Node: 14.18.0 Angular: 14.2.0

Thanks in advance!

bence-balogh-intland commented 2 years ago

I found a workaround, although it is more likely a temporary solution: https://github.com/bence-balogh-intland/angular-froala-test/compare/add-froala...fix-froala

  1. Import froala-editor/js/plugins.pkgd.min.js into somewhere, e.g. app.module.ts - solves missing features
  2. Explicitly define window.FroalaEditor on init - solves customization