32 short_uri: Utils.shortenText((_model.get("uri") || "").replace(/^(https?:\/\/)?(www\.)?/,'').replace(/\/$/,''),40), |
32 short_uri: Utils.shortenText((_model.get("uri") || "").replace(/^(https?:\/\/)?(www\.)?/,'').replace(/\/$/,''),40), |
33 description: _model.get("description"), |
33 description: _model.get("description"), |
34 image: _model.get("image") || "", |
34 image: _model.get("image") || "", |
35 image_placeholder: _image_placeholder, |
35 image_placeholder: _image_placeholder, |
36 color: (_model.has("style") && _model.get("style").color) || _created_by.get("color"), |
36 color: (_model.has("style") && _model.get("style").color) || _created_by.get("color"), |
|
37 title_size: (_model.has("style") && _model.get("style").title_size) || 1, |
|
38 title_color: (_model.has("style") && _model.get("style").title_color) || this.options.node_title_color, |
37 thickness: (_model.has("style") && _model.get("style").thickness) || 1, |
39 thickness: (_model.has("style") && _model.get("style").thickness) || 1, |
38 dash: _model.has("style") && _model.get("style").dash ? "checked" : "", |
40 dash: _model.has("style") && _model.get("style").dash ? "checked" : "", |
39 clip_path: _model.get("clip_path") || false, |
41 clip_path: _model.get("clip_path") || false, |
40 created_by_color: _created_by.get("color"), |
42 created_by_color: _created_by.get("color"), |
41 created_by_title: _created_by.get("title"), |
43 created_by_title: _created_by.get("title"), |
281 shiftThickness(-1); |
283 shiftThickness(-1); |
282 return false; |
284 return false; |
283 }); |
285 }); |
284 this.editor_$.find("#Rk-Edit-Thickness-Up").click(function() { |
286 this.editor_$.find("#Rk-Edit-Thickness-Up").click(function() { |
285 shiftThickness(1); |
287 shiftThickness(1); |
|
288 return false; |
|
289 }); |
|
290 |
|
291 var shiftTitleSize = function(n) { |
|
292 var min = _this.options.node_title_size_min; |
|
293 var max = _this.options.node_title_size_max; |
|
294 if (_this.renderer.isEditable()) { |
|
295 var _oldTitleSize = ((_model.has('style') && _model.get('style').title_size) || 1), |
|
296 _newTitleSize = n + _oldTitleSize; |
|
297 if(_newTitleSize < min ) { |
|
298 _newTitleSize = min; |
|
299 } |
|
300 else if (_newTitleSize > max) { |
|
301 _newTitleSize = max; |
|
302 } |
|
303 if (_newTitleSize !== _oldTitleSize) { |
|
304 _this.editor_$.find("#Rk-Edit-Title-Size-Value").text(_newTitleSize.toFixed(1)); |
|
305 _model.set("style", _.assign( ((_model.has("style") && _.clone(_model.get("style"))) || {}), {title_size: _newTitleSize})); |
|
306 paper.view.draw(); |
|
307 } |
|
308 } |
|
309 else { |
|
310 closeEditor(); |
|
311 } |
|
312 }; |
|
313 |
|
314 |
|
315 var _pickerTitle = _this.editor_$.find(".Rk-Editor-ColorPicker-Title"); |
|
316 |
|
317 this.editor_$.find(".Rk-Editor-p-title-color").hover( |
|
318 function(_e) { |
|
319 _e.preventDefault(); |
|
320 _pickerTitle.show(); |
|
321 }, |
|
322 function(_e) { |
|
323 _e.preventDefault(); |
|
324 _pickerTitle.hide(); |
|
325 } |
|
326 ); |
|
327 |
|
328 _pickerTitle.find("li").hover( |
|
329 function(_e) { |
|
330 _e.preventDefault(); |
|
331 _this.editor_$.find(".Rk-Editor-p-title-color .Rk-Edit-Color").css("background", $(this).attr("data-color")); |
|
332 }, |
|
333 function(_e) { |
|
334 _e.preventDefault(); |
|
335 var title_color = (_model.has("style") && _model.get("style").title_color) || _this.options.node_fill_color; |
|
336 _this.editor_$.find(".Rk-Editor-p-title-color .Rk-Edit-Color").css("background", title_color); |
|
337 } |
|
338 ).click(function(_e) { |
|
339 _e.preventDefault(); |
|
340 if (_this.renderer.isEditable()) { |
|
341 _model.set("style", _.assign( ((_model.has("style") && _.clone(_model.get("style"))) || {}), {title_color: $(this).attr("data-color")})); |
|
342 _pickerTitle.hide(); |
|
343 paper.view.draw(); |
|
344 } else { |
|
345 closeEditor(); |
|
346 } |
|
347 }); |
|
348 |
|
349 |
|
350 this.editor_$.find("#Rk-Edit-Title-Size-Down").click(function() { |
|
351 var step = _this.options.node_title_size_step; |
|
352 shiftTitleSize(-step); |
|
353 return false; |
|
354 }); |
|
355 this.editor_$.find("#Rk-Edit-Title-Size-Up").click(function() { |
|
356 var step = _this.options.node_title_size_step; |
|
357 shiftTitleSize(step); |
286 return false; |
358 return false; |
287 }); |
359 }); |
288 |
360 |
289 this.editor_$.find(".Rk-Edit-Image-Del").click(function() { |
361 this.editor_$.find(".Rk-Edit-Image-Del").click(function() { |
290 _this.editor_$.find(".Rk-Edit-Image").val(''); |
362 _this.editor_$.find(".Rk-Edit-Image").val(''); |