Hook MementoCanvas to bound data

This commit is contained in:
Luis Leiva 2019-07-18 11:38:45 +03:00
parent 2a2d26cf0e
commit 892d51e457
2 changed files with 6 additions and 10 deletions

View File

@ -175,9 +175,6 @@
* @namespace $.fn.sketchable.plugins.memento * @namespace $.fn.sketchable.plugins.memento
*/ */
$.fn.sketchable.plugins.memento = function($instance) { $.fn.sketchable.plugins.memento = function($instance) {
// Access the instance configuration.
var config = $instance.sketchable('config');
var callbacks = { var callbacks = {
clear: function(elem, data) { clear: function(elem, data) {
data.memento.reset(); data.memento.reset();
@ -263,8 +260,9 @@
}); });
// Initialize plugin here. // Initialize plugin here.
config.memento = new MementoCanvas($instance); var data = $instance.sketchable('data');
config.memento.init(); data.memento = new MementoCanvas($instance);
data.memento.init();
}; };
})(jQuery); })(jQuery);

View File

@ -177,9 +177,6 @@
* @namespace Sketchable.plugins.memento * @namespace Sketchable.plugins.memento
*/ */
Sketchable.prototype.plugins.memento = function(instance) { Sketchable.prototype.plugins.memento = function(instance) {
// Access the instance configuration.
var config = instance.config();
var callbacks = { var callbacks = {
clear: function(elem, data) { clear: function(elem, data) {
data.memento.reset(); data.memento.reset();
@ -267,8 +264,9 @@
}); });
// Initialize plugin here. // Initialize plugin here.
config.memento = new MementoCanvas(instance); var data = dataBind(instance.elem)[namespace];
config.memento.init(); data.memento = new MementoCanvas(instance);
data.memento.init();
}; };
})(this); })(this);