Skip to content

Commit

Permalink
reinit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Katochimoto committed Jul 19, 2015
1 parent 889c349 commit abdacfc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ckeditor-imgresize",
"version": "1.0.5",
"version": "1.0.6",
"main": [
"plugin.js"
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
19 changes: 11 additions & 8 deletions plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},
Expand Down Expand Up @@ -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,
Expand All @@ -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);
Expand Down

0 comments on commit abdacfc

Please sign in to comment.