Feature #4399 update svg-edit to r2051 (25 oct 2011)

skala
Juan Carlos Raña 13 years ago
parent 40c5200227
commit a630724037
  1. 22
      main/inc/lib/svg-edit/AUTHORS
  2. 19
      main/inc/lib/svg-edit/LICENSE
  3. 21
      main/inc/lib/svg-edit/README
  4. 55
      main/inc/lib/svg-edit/extensions/ext-server_moinsave.js
  5. 2
      main/inc/lib/svg-edit/sanitize.js
  6. 10
      main/inc/lib/svg-edit/svg-editor.css
  7. 29
      main/inc/lib/svg-edit/svg-editor.js
  8. 12
      main/inc/lib/svg-edit/svgcanvas.js

@ -0,0 +1,22 @@
Narendra Sisodiya <narendra.sisodiya@gmail.com>
Pavol Rusnak <rusnakp@gmail.com>
Jeff Schiller <codedread@gmail.com>
Vidar Hokstad <vidar.hokstad@gmail.com>
Alexis Deveria <adeveria@gmail.com>
Translation credits:
ar: Tarik Belaam <dubraise@gmail.com> (العربية)
cs: Jan Ptacek <jan.ptacek@gmail.com> (Čeština)
de: Reimar Bauer <rb.proj@googlemail.com> (Deutsch)
es: Alicia Puerto <alicia.puerto.g@gmail.com> (Español)
fa: Payman Delshad <payman@opera.com> (فارسی)
fr: wormsxulla <wormsxulla@yahoo.com> (Français)
fy: Wander Nauta <info@wandernauta.nl> (Frysk)
hi: Tavish Naruka <tavishnaruka@gmail.com> (हि)
ja: Dong <iwadon@yarhalla.jpn.org> (日本語)
nl: Jaap Blom <jaap.blom@gmail.com> (Nederlands)
ro: Christian Tzurcanu <christian.tzurcanu@gmail.com> (Româneşte)
ru: Laurent Dufloux <laurent.dufloux@etu.upmc.fr> (Русский)
sk: Pavol Rusnak <rusnakp@gmail.com> (Slovenčina)
zh-TW: 黃瀚生 (Han Sheng Huang) <zenixls2@gmail.com> (台灣正體)

@ -0,0 +1,19 @@
Copyright (c) 2009-2011 by SVG-edit authors (see AUTHORS file)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

@ -0,0 +1,21 @@
SVG-edit, a web based SVG editor
http://code.google.com/p/svg-edit/
see AUTHORS file for authors
-----
SVG-edit contains code from these projects:
jQuery JavaScript Library v1.3.2
http://jquery.com/
Copyright (c) 2009 John Resig
jQuery js-Hotkeys
http://code.google.com/p/js-hotkeys/
Copyright (c) 2008 Tzury Bar Yochay
jPicker
http://www.digitalmagicpro.com/jPicker/
Copyright (c) 2009 Christopher T. Tillman

@ -0,0 +1,55 @@
/*
* ext-server_moinsave.js
*
* Licensed under the Apache License, Version 2
*
* Copyright(c) 2010 Alexis Deveria
* 2011 MoinMoin:ReimarBauer
* adopted for moinmoins item storage. it sends in one post png and svg data
* (I agree to dual license my work to additional GPLv2 or later)
*
*/
svgEditor.addExtension("server_opensave", {
callback: function() {
var save_svg_action = '/+modify';
// Create upload target (hidden iframe)
var target = $('<iframe name="output_frame" src="#"/>').hide().appendTo('body');
svgEditor.setCustomHandlers({
save: function(win, data) {
var svg = "<?xml version=\"1.0\"?>\n" + data;
var qstr = $.param.querystring();
var name = qstr.substr(9).split('/+get/')[1];
var svg_data = svgedit.utilities.encode64(svg);
if(!$('#export_canvas').length) {
$('<canvas>', {id: 'export_canvas'}).hide().appendTo('body');
}
var c = $('#export_canvas')[0];
c.width = svgCanvas.contentW;
c.height = svgCanvas.contentH;
$.getScript('canvg/canvg.js', function() {
canvg(c, svg, {renderCallback: function() {
var datauri = c.toDataURL('image/png');
var uiStrings = svgEditor.uiStrings;
var png_data = svgedit.utilities.encode64(datauri);
var form = $('<form>').attr({
method: 'post',
action: save_svg_action + '/' + name,
target: 'output_frame'
}) .append('<input type="hidden" name="png_data" value="' + png_data + '">')
.append('<input type="hidden" name="filepath" value="' + svg_data + '">')
.append('<input type="hidden" name="filename" value="' + 'drawing.svg">')
.append('<input type="hidden" name="contenttype" value="application/x-svgdraw">')
.appendTo('body')
.submit().remove();
}})});
alert("Saved! Return to Item View!");
top.window.location = '/'+name;
},
});
}
});

@ -91,7 +91,7 @@ var svgWhiteList_ = {
"mn": [],
"mo": ["fence", "lspace", "maxsize", "minsize", "rspace", "stretchy"],
"mover": [],
"mpadded": ["lspace", "width"],
"mpadded": ["lspace", "width", "height", "depth", "voffset"],
"mphantom": [],
"mprescripts": [],
"mroot": [],

@ -2,6 +2,16 @@
background: #D0D0D0;
}
html, body, div{
-webkit-user-select: text;
-khtml-user-select: text;
-moz-user-select: text;
-o-user-select: text;
user-select: text;
/* this will work for QtWebKit in future */
-webkit-user-drag: text;
}
#browser-not-supported {
font-size: 0.8em;
font-family: Verdana, Helvetica, Arial;

@ -920,11 +920,14 @@
var timer;
var pos = $(show_sel).position();
$(hold_sel).css({'left': pos.left+34, 'top': pos.top+77});
// Clicking the "show" icon should set the current mode
shower.mousedown(function(evt) {
if(shower.hasClass('disabled')) return false;
var holder = $(show_sel.replace('_show',''));
var l = holder[0].style.left;
var holder = $(hold_sel);
var l = pos.left+34;
var w = holder.width()*-1;
var time = holder.data('shown_popop')?200:0;
timer = setTimeout(function() {
@ -953,9 +956,6 @@
});
// $('#tools_rect').mouseleave(function(){$('#tools_rect').fadeOut();});
var pos = $(show_sel).position();
$(hold_sel).css({'left': pos.left+34, 'top': pos.top+77});
});
setFlyoutTitles();
@ -2142,6 +2142,7 @@
// Made public for UI customization.
// TODO: Group UI functions into a public svgEditor.ui interface.
Editor.addDropDown = function(elem, callback, dropUp) {
if ($(elem).length == 0) return; // Quit if called on non-existant element
var button = $(elem).find('button');
var list = $(elem).find('ul').attr('id', $(elem)[0].id + '-list');
@ -3282,8 +3283,15 @@
(function() {
workarea.scroll(function() {
$('#ruler_x')[0].scrollLeft = workarea[0].scrollLeft;
$('#ruler_y')[0].scrollTop = workarea[0].scrollTop;
// TODO: jQuery's scrollLeft/Top() wouldn't require a null check
if ($('#ruler_x').length != 0) {
$('#ruler_x')[0].scrollLeft = workarea[0].scrollLeft;
}
if ($('#ruler_y').length != 0) {
$('#ruler_y')[0].scrollTop = workarea[0].scrollTop;
}
});
}());
@ -3999,7 +4007,7 @@
{sel:'#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel', fn: cancelOverlays, evt: 'click', key: ['esc', false, false], hidekey: true},
{sel:'#tool_source_save', fn: saveSourceEditor, evt: 'click'},
{sel:'#tool_docprops_save', fn: saveDocProperties, evt: 'click'},
{sel:'#tool_docprops', fn: showDocProperties, evt: 'mouseup', key: ['D', true]},
{sel:'#tool_docprops', fn: showDocProperties, evt: 'mouseup'},
{sel:'#tool_prefs_save', fn: savePreferences, evt: 'click'},
{sel:'#tool_prefs_option', fn: function() {showPreferences();return false}, evt: 'mouseup'},
{sel:'#tool_delete,#tool_delete_multi', fn: deleteSelected, evt: 'click', key: ['del/backspace', true]},
@ -4232,8 +4240,9 @@
}
$('#rulers').toggle(!!curConfig.showRulers);
$('#show_rulers')[0].checked = curConfig.showRulers;
if(curConfig.showRulers) {
$('#show_rulers')[0].checked = true;
}
if(curConfig.gridSnapping) {
$('#grid_snapping_on')[0].checked = true;
}

@ -4308,8 +4308,8 @@ var pathActions = canvas.pathActions = function() {
last_x += (last_x - last.x2);
last_y += (last_y - last.y2);
} else if(firstCtrl) {
last_x = firstCtrl[0];
last_y = firstCtrl[1];
last_x = firstCtrl[0]/current_zoom;
last_y = firstCtrl[1]/current_zoom;
}
svgedit.path.replacePathSeg(6, index, [pt_x, pt_y, last_x, last_y, alt_x, alt_y], drawn_path);
}
@ -8602,6 +8602,14 @@ this.updateCanvas = function(w, h) {
y: y
});
var bg_img = getElem('background_image');
if (bg_img) {
assignAttributes(bg_img, {
'width': '100%',
'height': '100%'
});
}
selectorManager.selectorParentGroup.setAttribute("transform","translate(" + x + "," + y + ")");
return {x:x, y:y, old_x:old_x, old_y:old_y, d_x:x - old_x, d_y:y - old_y};

Loading…
Cancel
Save