diff -r 24754fe4baaf -r e457ec945e50 client/js/renderer/nodeeditor.js --- a/client/js/renderer/nodeeditor.js Fri Apr 24 18:02:09 2015 +0200 +++ b/client/js/renderer/nodeeditor.js Sat Apr 25 04:13:53 2015 +0200 @@ -58,41 +58,41 @@ if (this.renderer.isEditable()) { - var onFieldChange = _(function() { - _(function() { - if (_this.renderer.isEditable()) { - var _data = { - title: _this.editor_$.find(".Rk-Edit-Title").val() - }; - if (_this.options.show_node_editor_uri) { - _data.uri = _this.editor_$.find(".Rk-Edit-URI").val(); - _this.editor_$.find(".Rk-Edit-Goto").attr("href",_data.uri || "#"); - } - if (_this.options.show_node_editor_image) { - _data.image = _this.editor_$.find(".Rk-Edit-Image").val(); - _this.editor_$.find(".Rk-Edit-ImgPreview").attr("src", _data.image || _image_placeholder); - } - if (_this.options.show_node_editor_description) { - _data.description = _this.editor_$.find(".Rk-Edit-Description").val(); + var onFieldChange = _.throttle(function() { + _.defer(function() { + if (_this.renderer.isEditable()) { + var _data = { + title: _this.editor_$.find(".Rk-Edit-Title").val() + }; + if (_this.options.show_node_editor_uri) { + _data.uri = _this.editor_$.find(".Rk-Edit-URI").val(); + _this.editor_$.find(".Rk-Edit-Goto").attr("href",_data.uri || "#"); + } + if (_this.options.show_node_editor_image) { + _data.image = _this.editor_$.find(".Rk-Edit-Image").val(); + _this.editor_$.find(".Rk-Edit-ImgPreview").attr("src", _data.image || _image_placeholder); + } + if (_this.options.show_node_editor_description) { + _data.description = _this.editor_$.find(".Rk-Edit-Description").val(); + } + if (_this.options.change_shapes) { + if(_model.get("shape")!==_this.editor_$.find(".Rk-Edit-Shape").val()){ + _data.shape = _this.editor_$.find(".Rk-Edit-Shape").val(); + _data.shape_changed = true; } - if (_this.options.change_shapes) { - if(_model.get("shape")!==_this.editor_$.find(".Rk-Edit-Shape").val()){ - _data.shape = _this.editor_$.find(".Rk-Edit-Shape").val(); - _data.shape_changed = true; - } - } + } + _model.set(_data); + _this.redraw(); + // For an unknown reason, we have to set data twice when we change shape, otherwise the image disappears. + if(_data.shape_changed===true){ _model.set(_data); - _this.redraw(); - // For an unknown reason, we have to set data twice when we change shape, otherwise the image disappears. - if(_data.shape_changed===true){ - _model.set(_data); - } - } else { - closeEditor(); } - }).defer(); - }).throttle(500); - + } else { + closeEditor(); + } + }); + }, 500); + this.editor_$.on("keyup", function(_e) { if (_e.keyCode === 27) { closeEditor(); @@ -176,7 +176,7 @@ shiftSize(1); return false; }); - + this.editor_$.find(".Rk-Edit-Image-Del").click(function() { _this.editor_$.find(".Rk-Edit-Image").val(''); onFieldChange(); @@ -201,8 +201,8 @@ this.editor_$.show(); paper.view.draw(); } - }); - + }).value(); +// }); /* NodeEditor End */ return NodeEditor;