equal
deleted
inserted
replaced
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), |
23 _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate); |
23 _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate); |
24 this.editor_$ |
24 this.editor_$ |
25 .html(_template({ |
25 .html(_template({ |
26 edge: { |
26 edge: { |
27 has_creator: !!_model.get("created_by"), |
27 has_creator: !!_model.get("created_by"), |
28 title: _model.get("title"), |
28 title: _model.get("title"), |
29 uri: _model.get("uri"), |
29 uri: _model.get("uri"), |
30 short_uri: Utils.shortenText((_model.get("uri") || "").replace(/^(https?:\/\/)?(www\.)?/,'').replace(/\/$/,''),40), |
30 short_uri: Utils.shortenText((_model.get("uri") || "").replace(/^(https?:\/\/)?(www\.)?/,'').replace(/\/$/,''),40), |
54 } |
54 } |
55 }); |
55 }); |
56 |
56 |
57 if (this.renderer.isEditable()) { |
57 if (this.renderer.isEditable()) { |
58 |
58 |
59 var onFieldChange = _(function() { |
59 var onFieldChange = _.throttle(function() { |
60 _(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(); |
|
73 } |
67 } |
74 }).defer(); |
68 _this.editor_$.find(".Rk-Edit-Goto").attr("href",_data.uri || "#"); |
75 }).throttle(500); |
69 _model.set(_data); |
|
70 paper.view.draw(); |
|
71 } else { |
|
72 closeEditor(); |
|
73 } |
|
74 }); |
|
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(); |
80 } |
80 } |
141 var _coords = this.source_representation.paper_coords; |
141 var _coords = this.source_representation.paper_coords; |
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 }); |
146 }).value(); |
|
147 // }); |
147 |
148 |
148 /* EdgeEditor End */ |
149 /* EdgeEditor End */ |
149 |
150 |
150 return EdgeEditor; |
151 return EdgeEditor; |
151 |
152 |