From abdacfc575cffb083922ba63040e1b3244a3b1d9 Mon Sep 17 00:00:00 2001 From: Katochimoto Date: Sun, 19 Jul 2015 23:08:39 +0300 Subject: [PATCH] reinit fix --- bower.json | 2 +- package.json | 2 +- plugin.js | 19 +++++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/bower.json b/bower.json index 51493ae..c82e9da 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "ckeditor-imgresize", - "version": "1.0.5", + "version": "1.0.6", "main": [ "plugin.js" ], diff --git a/package.json b/package.json index 4b3d8b3..33e5383 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ckeditor-imgresize", - "version": "1.0.5", + "version": "1.0.6", "description": "CKEditor dragable image resizing with support divarea", "keywords": [ "ckeditor", diff --git a/plugin.js b/plugin.js index 3086e94..f879e93 100644 --- a/plugin.js +++ b/plugin.js @@ -87,18 +87,13 @@ _updateEvents: function() { var plugin = this.plugins.imgresize; + var editable = this.editable(); - if (this.document) { - this.document.removeListener('click', plugin._onClick); - } - + editable.removeListener('click', plugin._onClick); this.removeListener('loadSnapshot', plugin._onLoadSnapshot); if (!this.readOnly && this.mode === 'wysiwyg') { - if (this.document) { - this.document.on('click', plugin._onClick, this); - } - + editable.on('click', plugin._onClick, this); this.on('loadSnapshot', plugin._onLoadSnapshot, this, null, 5); } }, @@ -386,6 +381,10 @@ }; DragEvent.prototype._onMousemove = function(event) { + var nativeEvent = event.data.$; + nativeEvent.stopImmediatePropagation(); + nativeEvent.preventDefault(); + this._update(event); this._wrapper.fire('drag:drag', { 'attr': this._attr, @@ -399,6 +398,10 @@ }; DragEvent.prototype._onMouseup = function(event) { + var nativeEvent = event.data.$; + nativeEvent.stopImmediatePropagation(); + nativeEvent.preventDefault(); + this._update(event); this._editor.document.removeListener('mousemove', this._onMousemove); this._editor.document.removeListener('mouseup', this._onMouseup);