ardas / stripo-plugin

stripo-plugin
19 stars 32 forks source link

Feature Request: Event API to listen for `change` events #1

Closed jbwyme closed 5 years ago

jbwyme commented 5 years ago

The Stripo Plugin already supports auto-save which makes calls to the server but I'd like to be notified in javascript when the content is changed. I don't see this feature documented anywhere if it exists, but it seems like it'd be a trivial thing to add. Is this something y'all could help me out with?

antongrinenko commented 5 years ago

Hi,

Stripo plugin already has configuration params that can fit your needs.

window.Stripo.init({ ..., draft: { showAutoSaveLoader: function() {console.log('Auto save in process')}, hideAutoSaveLoader: function(error) {console.log('Auto save completed')} }, ... });

jbwyme commented 5 years ago

Cool, is this documented anywhere? I don't see it in the docs here: https://stripo.email/plugin-api/#plugin-configuration

I'm also trying to figure out how to be notified when initialization is complete. Is there a way to do that?

antongrinenko commented 5 years ago

You can use "onTemplateLoaded" param for this. Example: window.Stripo.init({ ..., onTemplateLoaded: function() {console.log('Loaded')} }

See updated documentation: https://stripo.email/plugin-api/#plugin-configuration