equal
deleted
inserted
replaced
8 |
8 |
9 //var EdgeEditor = Renderer.EdgeEditor = Utils.inherit(Renderer._BaseEditor); |
9 //var EdgeEditor = Renderer.EdgeEditor = Utils.inherit(Renderer._BaseEditor); |
10 var EdgeEditor = Utils.inherit(BaseEditor); |
10 var EdgeEditor = Utils.inherit(BaseEditor); |
11 |
11 |
12 _(EdgeEditor.prototype).extend({ |
12 _(EdgeEditor.prototype).extend({ |
13 _init: function() { |
13 _init: function() { |
14 BaseEditor.prototype._init.apply(this); |
14 BaseEditor.prototype._init.apply(this); |
15 this.template = this.options.templates['templates/edgeeditor.html']; |
15 this.template = this.options.templates['templates/edgeeditor.html']; |
16 this.readOnlyTemplate = this.options.templates['templates/edgeeditor_readonly.html']; |
16 this.readOnlyTemplate = this.options.templates['templates/edgeeditor_readonly.html']; |
17 }, |
17 }, |
18 draw: function() { |
18 draw: function() { |
19 var _model = this.source_representation.model, |
19 var _model = this.source_representation.model, |
20 _from_model = _model.get("from"), |
20 _from_model = _model.get("from"), |
21 _to_model = _model.get("to"), |
21 _to_model = _model.get("to"), |
22 _created_by = _model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan), |
22 _created_by = _model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan), |
55 }); |
55 }); |
56 |
56 |
57 if (this.renderer.isEditable()) { |
57 if (this.renderer.isEditable()) { |
58 |
58 |
59 var onFieldChange = _.throttle(function() { |
59 var onFieldChange = _.throttle(function() { |
60 _.defer(function() { |
60 _.defer(function() { |
61 if (_this.renderer.isEditable()) { |
61 if (_this.renderer.isEditable()) { |
62 var _data = { |
62 var _data = { |
63 title: _this.editor_$.find(".Rk-Edit-Title").val() |
63 title: _this.editor_$.find(".Rk-Edit-Title").val() |
64 }; |
64 }; |
65 if (_this.options.show_edge_editor_uri) { |
65 if (_this.options.show_edge_editor_uri) { |
66 _data.uri = _this.editor_$.find(".Rk-Edit-URI").val(); |
66 _data.uri = _this.editor_$.find(".Rk-Edit-URI").val(); |
|
67 } |
|
68 _this.editor_$.find(".Rk-Edit-Goto").attr("href",_data.uri || "#"); |
|
69 _model.set(_data); |
|
70 paper.view.draw(); |
|
71 } else { |
|
72 closeEditor(); |
67 } |
73 } |
68 _this.editor_$.find(".Rk-Edit-Goto").attr("href",_data.uri || "#"); |
74 }); |
69 _model.set(_data); |
|
70 paper.view.draw(); |
|
71 } else { |
|
72 closeEditor(); |
|
73 } |
|
74 }); |
|
75 },500); |
75 },500); |
76 |
76 |
77 this.editor_$.on("keyup", function(_e) { |
77 this.editor_$.on("keyup", function(_e) { |
78 if (_e.keyCode === 27) { |
78 if (_e.keyCode === 27) { |
79 closeEditor(); |
79 closeEditor(); |
142 Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$); |
142 Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$); |
143 this.editor_$.show(); |
143 this.editor_$.show(); |
144 paper.view.draw(); |
144 paper.view.draw(); |
145 } |
145 } |
146 }).value(); |
146 }).value(); |
147 // }); |
|
148 |
147 |
149 /* EdgeEditor End */ |
148 /* EdgeEditor End */ |
150 |
149 |
151 return EdgeEditor; |
150 return EdgeEditor; |
152 |
151 |