A Slate plugin to handle onChange event on silence without event stack. Useful for implementing auto save Editor.
npm install slate-auto-save
import autoSavePlugin, { delay } from 'slate-auto-save';
const doSomeThing = (state) => {
console.log(state);
}
const autoSaveDelay = delay(3000); //milliseconds
const plugins = [
autoSavePlugin(doSomeThing, autoSaveDelay)
// can use autoSavePlugin(doSomeThing) if you want delay 2000ms by default
];
// And later pass it into the Slate editor...
<Editor
...
plugins={plugins}
/>
Pull requests are welcome.
MIT © komcal