| author | ymh <ymh.work@gmail.com> |
| Fri, 12 Jun 2015 14:46:08 +0200 | |
| changeset 468 | 364c367df7fc |
| parent 461 | 48235ed6b07d |
| child 469 | 374e17d0d96a |
| permissions | -rw-r--r-- |
| 284 | 1 |
|
|
468
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
2 |
define(['jquery', 'underscore', 'requtils', 'renderer/baseeditor', 'renderer/shapebuilder', 'ckeditor-jquery'], function ($, _, requtils, BaseEditor, ShapeBuilder) { |
|
293
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
284
diff
changeset
|
3 |
'use strict'; |
|
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
284
diff
changeset
|
4 |
|
| 284 | 5 |
var Utils = requtils.getUtils(); |
6 |
||
7 |
/* NodeEditor Begin */ |
|
8 |
//var NodeEditor = Renderer.NodeEditor = Utils.inherit(Renderer._BaseEditor); |
|
9 |
var NodeEditor = Utils.inherit(BaseEditor); |
|
10 |
||
11 |
_(NodeEditor.prototype).extend({ |
|
|
435
e529b633c339
Add shape management, correction on shape manip[ulation on the client, correct 404 error on space creation, increment version
ymh <ymh.work@gmail.com>
parents:
434
diff
changeset
|
12 |
_init: function() { |
|
e529b633c339
Add shape management, correction on shape manip[ulation on the client, correct 404 error on space creation, increment version
ymh <ymh.work@gmail.com>
parents:
434
diff
changeset
|
13 |
BaseEditor.prototype._init.apply(this); |
|
e529b633c339
Add shape management, correction on shape manip[ulation on the client, correct 404 error on space creation, increment version
ymh <ymh.work@gmail.com>
parents:
434
diff
changeset
|
14 |
this.template = this.options.templates['templates/nodeeditor.html']; |
| 450 | 15 |
//this.templates['default']= this.options.templates['templates/nodeeditor.html']; |
16 |
//fusionner avec this.options.node_editor_templates |
|
|
435
e529b633c339
Add shape management, correction on shape manip[ulation on the client, correct 404 error on space creation, increment version
ymh <ymh.work@gmail.com>
parents:
434
diff
changeset
|
17 |
this.readOnlyTemplate = this.options.templates['templates/nodeeditor_readonly.html']; |
|
e529b633c339
Add shape management, correction on shape manip[ulation on the client, correct 404 error on space creation, increment version
ymh <ymh.work@gmail.com>
parents:
434
diff
changeset
|
18 |
}, |
| 284 | 19 |
draw: function() { |
20 |
var _model = this.source_representation.model, |
|
21 |
_created_by = _model.get("created_by") || Utils._USER_PLACEHOLDER(this.renkan), |
|
22 |
_template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate ), |
|
23 |
_image_placeholder = this.options.static_url + "img/image-placeholder.png", |
|
24 |
_size = (_model.get("size") || 0); |
|
25 |
this.editor_$ |
|
26 |
.html(_template({ |
|
27 |
node: { |
|
28 |
has_creator: !!_model.get("created_by"), |
|
29 |
title: _model.get("title"), |
|
30 |
uri: _model.get("uri"), |
|
31 |
short_uri: Utils.shortenText((_model.get("uri") || "").replace(/^(https?:\/\/)?(www\.)?/,'').replace(/\/$/,''),40), |
|
32 |
description: _model.get("description"), |
|
33 |
image: _model.get("image") || "", |
|
34 |
image_placeholder: _image_placeholder, |
|
|
458
423bdf56d103
migrated to style, added dash style to client + small refactoring for shapes + triangle
ymh <ymh.work@gmail.com>
parents:
435
diff
changeset
|
35 |
color: (_model.has("style") && _model.get("style").color) || _created_by.get("color"), |
|
459
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
36 |
thickness: (_model.has("style") && _model.get("style").thickness) || 1, |
|
458
423bdf56d103
migrated to style, added dash style to client + small refactoring for shapes + triangle
ymh <ymh.work@gmail.com>
parents:
435
diff
changeset
|
37 |
dash: _model.has("style") && _model.get("style").dash ? "checked" : "", |
| 284 | 38 |
clip_path: _model.get("clip_path") || false, |
39 |
created_by_color: _created_by.get("color"), |
|
40 |
created_by_title: _created_by.get("title"), |
|
| 330 | 41 |
size: (_size > 0 ? "+" : "") + _size, |
42 |
shape: _model.get("shape") || "circle" |
|
| 284 | 43 |
}, |
44 |
renkan: this.renkan, |
|
45 |
options: this.options, |
|
|
458
423bdf56d103
migrated to style, added dash style to client + small refactoring for shapes + triangle
ymh <ymh.work@gmail.com>
parents:
435
diff
changeset
|
46 |
shortenText: Utils.shortenText, |
|
423bdf56d103
migrated to style, added dash style to client + small refactoring for shapes + triangle
ymh <ymh.work@gmail.com>
parents:
435
diff
changeset
|
47 |
shapes : _(ShapeBuilder.builders).omit('svg').keys().value(), |
| 284 | 48 |
})); |
49 |
this.redraw(); |
|
50 |
var _this = this, |
|
|
468
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
51 |
editorInstance = _this.options.show_node_editor_description_richtext ? |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
52 |
$(".Rk-Edit-Description").ckeditor(_this.options.richtext_editor_config) : |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
53 |
false, |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
54 |
closeEditor = function() { |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
55 |
_this.editor_$.off("keyup"); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
56 |
_this.editor_$.find("input, textarea, select").off("change keyup paste"); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
57 |
_this.editor_$.find(".Rk-Edit-Image-File").off('change'); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
58 |
_this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").off('hover'); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
59 |
_this.editor_$.find(".Rk-Edit-Size-Btn").off('click'); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
60 |
_this.editor_$.find(".Rk-Edit-Image-Del").off('click'); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
61 |
_this.editor_$.find(".Rk-Edit-ColorPicker").find("li").off('hover click'); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
62 |
_this.editor_$.find(".Rk-CloseX").off('click'); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
63 |
_this.editor_$.find(".Rk-Edit-Goto").off('click'); |
|
435
e529b633c339
Add shape management, correction on shape manip[ulation on the client, correct 404 error on space creation, increment version
ymh <ymh.work@gmail.com>
parents:
434
diff
changeset
|
64 |
|
|
468
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
65 |
if(_this.options.show_node_editor_description_richtext) { |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
66 |
if(typeof _this.blurListener !== 'undefined') { |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
67 |
_this.editorBlurListener.removeListener(); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
68 |
} |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
69 |
if(typeof editorInstance.editor !== 'undefined') { |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
70 |
editorInstance.editor.destroy(); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
71 |
} |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
72 |
} |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
73 |
_this.renderer.removeRepresentation(_this); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
74 |
paper.view.draw(); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
75 |
}; |
| 284 | 76 |
|
77 |
this.editor_$.find(".Rk-CloseX").click(closeEditor); |
|
78 |
||
79 |
this.editor_$.find(".Rk-Edit-Goto").click(function() { |
|
80 |
if (!_model.get("uri")) { |
|
81 |
return false; |
|
82 |
} |
|
83 |
}); |
|
84 |
||
85 |
if (this.renderer.isEditable()) { |
|
86 |
||
| 433 | 87 |
var onFieldChange = _.throttle(function() { |
88 |
_.defer(function() { |
|
89 |
if (_this.renderer.isEditable()) { |
|
90 |
var _data = { |
|
91 |
title: _this.editor_$.find(".Rk-Edit-Title").val() |
|
92 |
}; |
|
93 |
if (_this.options.show_node_editor_uri) { |
|
94 |
_data.uri = _this.editor_$.find(".Rk-Edit-URI").val(); |
|
95 |
_this.editor_$.find(".Rk-Edit-Goto").attr("href",_data.uri || "#"); |
|
96 |
} |
|
97 |
if (_this.options.show_node_editor_image) { |
|
98 |
_data.image = _this.editor_$.find(".Rk-Edit-Image").val(); |
|
99 |
_this.editor_$.find(".Rk-Edit-ImgPreview").attr("src", _data.image || _image_placeholder); |
|
100 |
} |
|
101 |
if (_this.options.show_node_editor_description) { |
|
|
468
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
102 |
if(_this.options.show_node_editor_description_richtext && |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
103 |
typeof editorInstance.editor !== 'undefined' && |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
104 |
editorInstance.editor.checkDirty()) |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
105 |
{ |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
106 |
_data.description = editorInstance.editor.getData(); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
107 |
editorInstance.editor.resetDirty(); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
108 |
} |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
109 |
else { |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
110 |
_data.description = _this.editor_$.find(".Rk-Edit-Description").val(); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
111 |
} |
| 433 | 112 |
} |
|
458
423bdf56d103
migrated to style, added dash style to client + small refactoring for shapes + triangle
ymh <ymh.work@gmail.com>
parents:
435
diff
changeset
|
113 |
if (_this.options.show_node_editor_style) { |
|
423bdf56d103
migrated to style, added dash style to client + small refactoring for shapes + triangle
ymh <ymh.work@gmail.com>
parents:
435
diff
changeset
|
114 |
var dash = _this.editor_$.find(".Rk-Edit-Dash").is(':checked'); |
|
423bdf56d103
migrated to style, added dash style to client + small refactoring for shapes + triangle
ymh <ymh.work@gmail.com>
parents:
435
diff
changeset
|
115 |
_data.style = _.assign( ((_model.has("style") && _.clone(_model.get("style"))) || {}), {dash: dash}); |
|
423bdf56d103
migrated to style, added dash style to client + small refactoring for shapes + triangle
ymh <ymh.work@gmail.com>
parents:
435
diff
changeset
|
116 |
} |
| 433 | 117 |
if (_this.options.change_shapes) { |
118 |
if(_model.get("shape")!==_this.editor_$.find(".Rk-Edit-Shape").val()){ |
|
119 |
_data.shape = _this.editor_$.find(".Rk-Edit-Shape").val(); |
|
| 284 | 120 |
} |
| 433 | 121 |
} |
122 |
_model.set(_data); |
|
123 |
_this.redraw(); |
|
124 |
} else { |
|
125 |
closeEditor(); |
|
126 |
} |
|
127 |
}); |
|
|
468
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
128 |
}, 1000); |
| 433 | 129 |
|
| 284 | 130 |
this.editor_$.on("keyup", function(_e) { |
131 |
if (_e.keyCode === 27) { |
|
132 |
closeEditor(); |
|
133 |
} |
|
134 |
}); |
|
135 |
||
| 330 | 136 |
this.editor_$.find("input, textarea, select").on("change keyup paste", onFieldChange); |
|
468
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
137 |
if( _this.options.show_node_editor_description && |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
138 |
_this.options.show_node_editor_description_richtext && |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
139 |
typeof editorInstance.editor !== 'undefined') |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
140 |
{ |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
141 |
editorInstance.editor.on("change", onFieldChange); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
142 |
_this.editorBlurListener = editorInstance.editor.on("blur", onFieldChange); |
|
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
143 |
} |
| 284 | 144 |
|
| 385 | 145 |
if(_this.options.allow_image_upload) { |
146 |
this.editor_$.find(".Rk-Edit-Image-File").change(function() { |
|
147 |
if (this.files.length) { |
|
148 |
var f = this.files[0], |
|
149 |
fr = new FileReader(); |
|
150 |
if (f.type.substr(0,5) !== "image") { |
|
151 |
alert(_this.renkan.translate("This file is not an image")); |
|
152 |
return; |
|
153 |
} |
|
154 |
if (f.size > (_this.options.uploaded_image_max_kb * 1024)) { |
|
155 |
alert(_this.renkan.translate("Image size must be under ") + _this.options.uploaded_image_max_kb + _this.renkan.translate("KB")); |
|
156 |
return; |
|
157 |
} |
|
158 |
fr.onload = function(e) { |
|
159 |
_this.editor_$.find(".Rk-Edit-Image").val(e.target.result); |
|
160 |
onFieldChange(); |
|
161 |
}; |
|
162 |
fr.readAsDataURL(f); |
|
| 284 | 163 |
} |
| 385 | 164 |
}); |
165 |
} |
|
| 284 | 166 |
this.editor_$.find(".Rk-Edit-Title")[0].focus(); |
167 |
||
168 |
var _picker = _this.editor_$.find(".Rk-Edit-ColorPicker"); |
|
169 |
||
170 |
this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover( |
|
171 |
function(_e) { |
|
172 |
_e.preventDefault(); |
|
173 |
_picker.show(); |
|
174 |
}, |
|
175 |
function(_e) { |
|
176 |
_e.preventDefault(); |
|
177 |
_picker.hide(); |
|
178 |
} |
|
179 |
); |
|
180 |
||
181 |
_picker.find("li").hover( |
|
182 |
function(_e) { |
|
183 |
_e.preventDefault(); |
|
184 |
_this.editor_$.find(".Rk-Edit-Color").css("background", $(this).attr("data-color")); |
|
185 |
}, |
|
186 |
function(_e) { |
|
187 |
_e.preventDefault(); |
|
|
458
423bdf56d103
migrated to style, added dash style to client + small refactoring for shapes + triangle
ymh <ymh.work@gmail.com>
parents:
435
diff
changeset
|
188 |
_this.editor_$.find(".Rk-Edit-Color").css("background", (_model.has("style") && _model.get("style").color) || (_model.get("created_by") || Utils._USER_PLACEHOLDER(_this.renkan)).get("color")); |
| 284 | 189 |
} |
190 |
).click(function(_e) { |
|
191 |
_e.preventDefault(); |
|
192 |
if (_this.renderer.isEditable()) { |
|
|
458
423bdf56d103
migrated to style, added dash style to client + small refactoring for shapes + triangle
ymh <ymh.work@gmail.com>
parents:
435
diff
changeset
|
193 |
_model.set("style", _.assign( ((_model.has("style") && _.clone(_model.get("style"))) || {}), {color: $(this).attr("data-color")})); |
| 284 | 194 |
_picker.hide(); |
195 |
paper.view.draw(); |
|
196 |
} else { |
|
197 |
closeEditor(); |
|
198 |
} |
|
199 |
}); |
|
200 |
||
201 |
var shiftSize = function(n) { |
|
202 |
if (_this.renderer.isEditable()) { |
|
203 |
var _newsize = n+(_model.get("size") || 0); |
|
|
459
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
204 |
_this.editor_$.find("#Rk-Edit-Size-Value").text((_newsize > 0 ? "+" : "") + _newsize); |
| 284 | 205 |
_model.set("size", _newsize); |
206 |
paper.view.draw(); |
|
207 |
} else { |
|
208 |
closeEditor(); |
|
209 |
} |
|
210 |
}; |
|
211 |
||
|
459
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
212 |
this.editor_$.find("#Rk-Edit-Size-Down").click(function() { |
| 284 | 213 |
shiftSize(-1); |
214 |
return false; |
|
215 |
}); |
|
|
459
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
216 |
this.editor_$.find("#Rk-Edit-Size-Up").click(function() { |
| 284 | 217 |
shiftSize(1); |
218 |
return false; |
|
219 |
}); |
|
| 433 | 220 |
|
|
459
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
221 |
var shiftThickness = function(n) { |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
222 |
if (_this.renderer.isEditable()) { |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
223 |
var _oldThickness = ((_model.has('style') && _model.get('style').thickness) || 1), |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
224 |
_newThickness = n + _oldThickness; |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
225 |
if(_newThickness < 1 ) { |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
226 |
_newThickness = 1; |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
227 |
} |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
228 |
else if (_newThickness > _this.options.node_stroke_witdh_scale) { |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
229 |
_newThickness = _this.options.node_stroke_witdh_scale; |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
230 |
} |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
231 |
if (_newThickness !== _oldThickness) { |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
232 |
_this.editor_$.find("#Rk-Edit-Thickness-Value").text(_newThickness); |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
233 |
_model.set("style", _.assign( ((_model.has("style") && _.clone(_model.get("style"))) || {}), {thickness: _newThickness})); |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
234 |
paper.view.draw(); |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
235 |
} |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
236 |
} |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
237 |
else { |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
238 |
closeEditor(); |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
239 |
} |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
240 |
}; |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
241 |
|
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
242 |
this.editor_$.find("#Rk-Edit-Thickness-Down").click(function() { |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
243 |
shiftThickness(-1); |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
244 |
return false; |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
245 |
}); |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
246 |
this.editor_$.find("#Rk-Edit-Thickness-Up").click(function() { |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
247 |
shiftThickness(1); |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
248 |
return false; |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
249 |
}); |
|
98cae534083d
add node and edge stroke width + adjust text + arrow placement + conrol arrow visibility
ymh <ymh.work@gmail.com>
parents:
458
diff
changeset
|
250 |
|
|
384
6a7930a0d4d1
Close #60 - Add a trash icon to delete the image URL
rougeronj
parents:
331
diff
changeset
|
251 |
this.editor_$.find(".Rk-Edit-Image-Del").click(function() { |
|
435
e529b633c339
Add shape management, correction on shape manip[ulation on the client, correct 404 error on space creation, increment version
ymh <ymh.work@gmail.com>
parents:
434
diff
changeset
|
252 |
_this.editor_$.find(".Rk-Edit-Image").val(''); |
|
e529b633c339
Add shape management, correction on shape manip[ulation on the client, correct 404 error on space creation, increment version
ymh <ymh.work@gmail.com>
parents:
434
diff
changeset
|
253 |
onFieldChange(); |
|
384
6a7930a0d4d1
Close #60 - Add a trash icon to delete the image URL
rougeronj
parents:
331
diff
changeset
|
254 |
return false; |
|
6a7930a0d4d1
Close #60 - Add a trash icon to delete the image URL
rougeronj
parents:
331
diff
changeset
|
255 |
}); |
| 284 | 256 |
} else { |
257 |
if (typeof this.source_representation.highlighted === "object") { |
|
258 |
var titlehtml = this.source_representation.highlighted.replace(_(_model.get("title")).escape(),'<span class="Rk-Highlighted">$1</span>'); |
|
259 |
this.editor_$.find(".Rk-Display-Title" + (_model.get("uri") ? " a" : "")).html(titlehtml); |
|
260 |
if (this.options.show_node_tooltip_description) { |
|
261 |
this.editor_$.find(".Rk-Display-Description").html(this.source_representation.highlighted.replace(_(_model.get("description")).escape(),'<span class="Rk-Highlighted">$1</span>')); |
|
262 |
} |
|
263 |
} |
|
264 |
} |
|
265 |
this.editor_$.find("img").load(function() { |
|
266 |
_this.redraw(); |
|
267 |
}); |
|
268 |
}, |
|
269 |
redraw: function() { |
|
| 447 | 270 |
if (this.options.popup_editor){ |
271 |
var _coords = this.source_representation.paper_coords; |
|
|
468
364c367df7fc
add rich text editor for description
ymh <ymh.work@gmail.com>
parents:
461
diff
changeset
|
272 |
Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * 0.75, this.editor_$); |
| 447 | 273 |
} |
| 284 | 274 |
this.editor_$.show(); |
275 |
paper.view.draw(); |
|
276 |
} |
|
| 433 | 277 |
}).value(); |
|
434
0d5998b32a7c
clean, and finalize lodash migration
ymh <ymh.work@gmail.com>
parents:
433
diff
changeset
|
278 |
|
| 284 | 279 |
/* NodeEditor End */ |
|
293
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
284
diff
changeset
|
280 |
|
| 284 | 281 |
return NodeEditor; |
282 |
||
|
293
fba23fde14ba
Correct jshint errors and force it on build
ymh <ymh.work@gmail.com>
parents:
284
diff
changeset
|
283 |
}); |