Alex-D / Trumbowyg

A lightweight and amazing WYSIWYG JavaScript editor under 10kB
https://alex-d.github.io/Trumbowyg
MIT License
3.96k stars 606 forks source link

fix(table): cells unresizable after table changed and add cellHandles… #1473

Open zymbth opened 3 days ago

zymbth commented 3 days ago

The table plugin of v2.28.0 still has resize bugs: table cells are unresizable after table content is changed, and cellHandles is added repeatedly.

I created a codepen to show it. codepen

This bug happened when asynchronously creating a table (such as $("#editor").trumbowyg('html', string)), or table content has been changed. In addition, correct the CSS selector of cellhandle.

Reason: The rebuildResizeLayers is emitted via event tbwchange.tbwTable. And its variables (tableState, targetColumnIndex, $table) used in mouse events come from different closures (caused by hasResizeLayers).