Provides Undo.init() to initialise Undo just after editor isready.
The sample will add the Undo button, the position in History and Redo button on SoSIe Menubar so you will be able to undo and redo changes.
Update your html page following these steps:
- This plugin is dependant from editorjs-undo so you will have to load it loadEditor section
/**
* Editor core
*/
mode='prod'
source='local';//Works only with local stored dists as we decided not to publish on npm
target=source+':'+editorDir;
await loadEditor([
/* SOSIE Editor */
{'#sosie-js/editor.js@0.7.0':['[.](https://github.com/sosie-js/editor.js)','dist/sosie.js']},
{'sos-productions/editor.js@next':['[src/editor.js](https://github.com/sos-productions/editor.js)','../../dist/editor.js']},
/* We need this for the icon butons */
{'font-awesome@latest':['[src/font-awesome](https://github.com/FortAwesome/Font-Awesome/tree/fa-4)','../../dist/css/font-awesome.min.css']},
/* Here comes the undo core (big thanks to komiitters!)*/
{'#editorjs-undo@latest': ['[src/editorjs-undo](https://github.com/kommitters/editorjs-undo)','../../dist/editorjs-undo.js']}
],nocache,mode,target);this will generate an equivalent of
<script src="dist/sosie.js"></script>
<script src="dist/editor.js"></script>
<script src="dist/css/font-awesome.min.css"></script>
<script src="dist/editorjs-undo.js"></script>- Add a line in your html page in the section loadPlugins and the script-loader will do the remaining part
/**
* Plugins
*/
await loadPlugins([
{'sosie-js/script-loader@3.0.0': '[example/plugins/script-loader](https://github.com/sosie-js/script-loader)'}, //virtual , already loaded we keep a version trace here
{'sosie-js/undo-plugin@1.0.0': ['[example/plugins/undo-plugin](https://github.com/sosie-js/undo-plugin)',['dist/bundle.js','dist/sample.js']]},
],nocache,mode,target);this will generate an equivalent of
<script src="example/plugins/undo-plugin/dist/bundle.js"></script>
<script src="example/plugins/undo-plugin/dist/sample.js"></script>To produce the dist/bundle.js for production use the command:
yarn build:minify- For now I failed to make it work with webpack babel so yarn build will break the build
- Cache issues on updates
