VojtechLanka / grapesjs-blocks-table

Plugin for GrapesJS that adds table block.
BSD 3-Clause "New" or "Revised" License
8 stars 3 forks source link

When I drag and drop a table to editor, I see an error #7

Closed allenhwkim closed 5 months ago

allenhwkim commented 10 months ago

When I drag and drop a table to editor, I see an error image

image

image

https://codesandbox.io/p/sandbox/table-forked-94xdwf?file=%2Fsrc%2Findex.js%3A14%2C1

However, it seems working with the old version, 0.0.118 image

VojtechLanka commented 10 months ago

Hi, thanks for the report. It has been a while since I worked on this but if I remember correctly the plugin works under the assumption that editor is globaly defined variable that holds the result of grapesjs.init().

For some reason the codesandbox is not loading for me, and I have no idea why it would work with the older version but not with the new one.

VojtechLanka commented 8 months ago

Hello, sorry for the wait my full time job keeps me occupied. Looking at it in detail the problem is that several helper functions expect the editor to be globally available. In the example you provided the problem can be fixed by doing window.editor = editor;. This approach was fine when I original developed this plugin but I am no longer so sure of it.

I have created new version v1.2.0 that should address this issue.

Please let me know if it works as expected.

VojtechLanka commented 5 months ago

Closing due to no activity.