wiris / html-integrations

The official JavaScript library for MathType, the leading formula editor and equation writer for the web by Wiris
https://wiris.com/solutions/integrations/html-editors/
MIT License
76 stars 53 forks source link

fix: infite loop in some demo when deploy #961

Closed xjiang-at-wiris closed 5 months ago

xjiang-at-wiris commented 5 months ago

Description

With the current webpack configuration, when deploying demos, the entire editor gets copied over, including some unnecessary files. Due to caching mechanisms, webpack continuously detects changes in the source files of the TinyMCE editor, triggering continuous hot reloads.

This change will exclude those mentioned files during deployment, retaining only the minified or required files as they are the ones actually needed.

Steps to reproduce

Changes.md

fix: Exclude certain unnecessary files that are copied over during the deployment of TinyMCE 5 & TinyMCE 6 & CKEditor 4 demos to prevent an infinite loop. #KB-44423


#taskid 44423

xjiang-at-wiris commented 5 months ago

TinyMCE 5 & 6 work perfect!

The block still happens on CKEditor4, not on the 5 though.

thanks, fixed!

jgonzalez-at-wiris commented 5 months ago

Would be interesting to complement your changes with a removal of the dists folders so we make sure that directories are empty every time we start the project: https://github.com/johnagan/clean-webpack-plugin. CC @carla-at-wiris

xjiang-at-wiris commented 5 months ago

Tested all HTML demos, and didn't find any issues! Do we know why these 3 and not the other editors ? It makes sense to change froala, generic, ck5, and the viewer to this new config ? Great job!

Good question!

The core error in the problem was that the dist folder was repeatedly written and mixed in when building and packaging the project, including some problematic files (For example, we need some code from Tiny to run Tiny editor in our demo).

So, the generic and viewer components didn't need any changes. They shouldn't have used any third-party assets from the beginning.

The architecture of CKEditor 5 and CKEditor 4 is completely different. So, for some unknown reason, we didn't need to include CK5 files in the dist folder to run the editor.

Froala is most likely to encounter a similar problem because it also packages the entire editor. However, fortunately, it didn't cause any errors. Of course, if the goal is to maintain cleanliness, Froala should be cleanable as well.