TeselaGen / tg-oss

Teselagen Open Source modules
https://teselagen.github.io/tg-oss/
MIT License
40 stars 17 forks source link

ReadOnly mode callback #19

Closed wandji20 closed 1 year ago

wandji20 commented 1 year ago

@tnrich, I have an OVE integration that runs smoothly so far. However, I would like to react to changes in our application when the readOnly mode is toggled. Just wondering if this feature already exists, or would be a nice first issue for me? Thanks

tnrich commented 1 year ago

Hi @wandji20 I don't believe I have an onReadOnlyChanged handler set up yet, I'll look into this and get back to you.

tnrich commented 1 year ago

Hi @wandji20 I've added a new handler called beforeReadOnlyChange that should allow you to react to changes to readOnly as well as prevent those changes (if necessary) by returning false from the handler (can be async if necessary).

These changes landed in @teselagen/ove v0.3.13

tnrich commented 1 year ago

Lemme know if you need anything else!

wandji20 commented 1 year ago

Hi @tnrich Thank you so much for making this change! So we are integrating OVE into our product via CDN and I can't find the beforeReadOnlyChange handler in the CDN yet. I am not sure if I am checking correctly, but I would love to confirm if it is already available via the CDN. Thanks

tnrich commented 1 year ago

Can you be a bit more specific about which CDN you're using @wandji20 ?

wandji20 commented 1 year ago

Sure @tnrich I did check with this CDN https://unpkg.com/open-vector-editor/umd/open-vector-editor.js Also, checked my node-modules/open-vector-editor/umd/open-vector-editor.js after installing via npm.

wandji20 commented 1 year ago

Hi @tnrich Found the change here https://www.npmjs.com/package/@teselagen/ove. Probably, I was not checking in the right place. Thank you so much