Properly-formed URLs will not have spaces, so no need to replace; no need for "/" escaping unless within HTML doc; properly encode loadingImage window text; support loading of (properly URL encoded) non-base64 "data:image/svg+xml;utf8,"-style data URIs
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2782 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
91a627d53d
commit
0d34fcfa7d
|
@ -83,7 +83,7 @@ svgEditor.addExtension("Connector", function(S) {
|
||||||
function showPanel(on) {
|
function showPanel(on) {
|
||||||
var conn_rules = $('#connector_rules');
|
var conn_rules = $('#connector_rules');
|
||||||
if(!conn_rules.length) {
|
if(!conn_rules.length) {
|
||||||
conn_rules = $('<style id="connector_rules"><\/style>').appendTo('head');
|
conn_rules = $('<style id="connector_rules"></style>').appendTo('head');
|
||||||
}
|
}
|
||||||
conn_rules.text(!on?"":"#tool_clone, #tool_topath, #tool_angle, #xy_panel { display: none !important; }");
|
conn_rules.text(!on?"":"#tool_clone, #tool_topath, #tool_angle, #xy_panel { display: none !important; }");
|
||||||
$('#connector_panel').toggle(on);
|
$('#connector_panel').toggle(on);
|
||||||
|
|
|
@ -30,7 +30,7 @@ svgEditor.addExtension("foreignObject", function(S) {
|
||||||
function showPanel(on) {
|
function showPanel(on) {
|
||||||
var fc_rules = $('#fc_rules');
|
var fc_rules = $('#fc_rules');
|
||||||
if(!fc_rules.length) {
|
if(!fc_rules.length) {
|
||||||
fc_rules = $('<style id="fc_rules"><\/style>').appendTo('head');
|
fc_rules = $('<style id="fc_rules"></style>').appendTo('head');
|
||||||
}
|
}
|
||||||
fc_rules.text(!on?"":" #tool_topath { display: none !important; }");
|
fc_rules.text(!on?"":" #tool_topath { display: none !important; }");
|
||||||
$('#foreignObject_panel').toggle(on);
|
$('#foreignObject_panel').toggle(on);
|
||||||
|
|
|
@ -17,13 +17,13 @@ svgEditor.addExtension("overview_window", function() { 'use strict';
|
||||||
<div id=\"overview_window_content\" style=\"position:relative; left:12px; top:0px;\">\
|
<div id=\"overview_window_content\" style=\"position:relative; left:12px; top:0px;\">\
|
||||||
<div style=\"background-color:#A0A0A0; display:inline-block; overflow:visible;\">\
|
<div style=\"background-color:#A0A0A0; display:inline-block; overflow:visible;\">\
|
||||||
<svg id=\"overviewMiniView\" width=\"150\" height=\"100\" x=\"0\" y=\"0\" viewBox=\"0 0 4800 3600\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\
|
<svg id=\"overviewMiniView\" width=\"150\" height=\"100\" x=\"0\" y=\"0\" viewBox=\"0 0 4800 3600\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\
|
||||||
<use x=\"0\" y=\"0\" xlink:href=\"#svgroot\"> <\/use>\
|
<use x=\"0\" y=\"0\" xlink:href=\"#svgroot\"> </use>\
|
||||||
</svg>\
|
</svg>\
|
||||||
<div id=\"overview_window_view_box\" style=\"min-width:50px; min-height:50px; position:absolute; top:30px; left:30px; z-index:5; background-color:rgba(255,0,102,0.3);\">\
|
<div id=\"overview_window_view_box\" style=\"min-width:50px; min-height:50px; position:absolute; top:30px; left:30px; z-index:5; background-color:rgba(255,0,102,0.3);\">\
|
||||||
<\/div>\
|
</div>\
|
||||||
<\/div>\
|
</div>\
|
||||||
<\/div>\
|
</div>\
|
||||||
<\/div>";
|
</div>";
|
||||||
$("#sidepanels").append(propsWindowHtml);
|
$("#sidepanels").append(propsWindowHtml);
|
||||||
|
|
||||||
//define dynamic animation of the view box.
|
//define dynamic animation of the view box.
|
||||||
|
|
|
@ -40,7 +40,7 @@ svgEditor.addExtension("polygon", function(S) {'use strict';
|
||||||
function showPanel(on){
|
function showPanel(on){
|
||||||
var fc_rules = $('#fc_rules');
|
var fc_rules = $('#fc_rules');
|
||||||
if (!fc_rules.length) {
|
if (!fc_rules.length) {
|
||||||
fc_rules = $('<style id="fc_rules"><\/style>').appendTo('head');
|
fc_rules = $('<style id="fc_rules"></style>').appendTo('head');
|
||||||
}
|
}
|
||||||
fc_rules.text(!on ? "" : " #tool_topath { display: none !important; }");
|
fc_rules.text(!on ? "" : " #tool_topath { display: none !important; }");
|
||||||
$('#polygon_panel').toggle(on);
|
$('#polygon_panel').toggle(on);
|
||||||
|
|
|
@ -88,7 +88,7 @@ svgEditor.addExtension('shapes', function() {'use strict';
|
||||||
var vb = [-off, -off, size + off*2, size + off*2].join(' ');
|
var vb = [-off, -off, size + off*2, size + off*2].join(' ');
|
||||||
var stroke = fill ? 0: (size/30);
|
var stroke = fill ? 0: (size/30);
|
||||||
var shape_icon = new DOMParser().parseFromString(
|
var shape_icon = new DOMParser().parseFromString(
|
||||||
'<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="' + vb + '"><path fill="'+(fill?'#333':'none')+'" stroke="#000" stroke-width="' + stroke + '" /><\/svg><\/svg>',
|
'<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="' + vb + '"><path fill="'+(fill?'#333':'none')+'" stroke="#000" stroke-width="' + stroke + '" /></svg></svg>',
|
||||||
'text/xml');
|
'text/xml');
|
||||||
|
|
||||||
var width = 24;
|
var width = 24;
|
||||||
|
|
|
@ -27,7 +27,7 @@ svgEditor.addExtension('star', function(S){'use strict';
|
||||||
function showPanel(on){
|
function showPanel(on){
|
||||||
var fc_rules = $('#fc_rules');
|
var fc_rules = $('#fc_rules');
|
||||||
if (!fc_rules.length) {
|
if (!fc_rules.length) {
|
||||||
fc_rules = $('<style id="fc_rules"><\/style>').appendTo('head');
|
fc_rules = $('<style id="fc_rules"></style>').appendTo('head');
|
||||||
}
|
}
|
||||||
fc_rules.text(!on ? '' : ' #tool_topath { display: none !important; }');
|
fc_rules.text(!on ? '' : ' #tool_topath { display: none !important; }');
|
||||||
$('#star_panel').toggle(on);
|
$('#star_panel').toggle(on);
|
||||||
|
|
|
@ -501,8 +501,6 @@ TODOS
|
||||||
}
|
}
|
||||||
if (src) {
|
if (src) {
|
||||||
if (src.indexOf('data:') === 0) {
|
if (src.indexOf('data:') === 0) {
|
||||||
// plusses get replaced by spaces, so re-insert
|
|
||||||
src = src.replace(/ /g, '+');
|
|
||||||
editor.loadFromDataURI(src);
|
editor.loadFromDataURI(src);
|
||||||
} else {
|
} else {
|
||||||
editor.loadFromString(src);
|
editor.loadFromString(src);
|
||||||
|
@ -2348,7 +2346,7 @@ TODOS
|
||||||
|
|
||||||
var rule_elem = $('#tool_size_rules');
|
var rule_elem = $('#tool_size_rules');
|
||||||
if (!rule_elem.length) {
|
if (!rule_elem.length) {
|
||||||
rule_elem = $('<style id="tool_size_rules"><\/style>').appendTo('head');
|
rule_elem = $('<style id="tool_size_rules"></style>').appendTo('head');
|
||||||
} else {
|
} else {
|
||||||
rule_elem.empty();
|
rule_elem.empty();
|
||||||
}
|
}
|
||||||
|
@ -3591,7 +3589,9 @@ TODOS
|
||||||
// Open placeholder window (prevents popup)
|
// Open placeholder window (prevents popup)
|
||||||
if (!customHandlers.exportImage) {
|
if (!customHandlers.exportImage) {
|
||||||
var str = uiStrings.notification.loadingImage;
|
var str = uiStrings.notification.loadingImage;
|
||||||
exportWindow = window.open('data:text/html;charset=utf-8,<title>' + str + '<\/title><h1>' + str + '<\/h1>');
|
exportWindow = window.open(
|
||||||
|
'data:text/html;charset=utf-8,' + encodeURIComponent('<title>' + str + '</title><h1>' + str + '</h1>')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
var quality = parseInt($('#image-slider').val(), 10)/100;
|
var quality = parseInt($('#image-slider').val(), 10)/100;
|
||||||
if (window.canvg) {
|
if (window.canvg) {
|
||||||
|
@ -3667,7 +3667,7 @@ TODOS
|
||||||
if (supportsNonSS) {return;}
|
if (supportsNonSS) {return;}
|
||||||
var wf_rules = $('#wireframe_rules');
|
var wf_rules = $('#wireframe_rules');
|
||||||
if (!wf_rules.length) {
|
if (!wf_rules.length) {
|
||||||
wf_rules = $('<style id="wireframe_rules"><\/style>').appendTo('head');
|
wf_rules = $('<style id="wireframe_rules"></style>').appendTo('head');
|
||||||
} else {
|
} else {
|
||||||
wf_rules.empty();
|
wf_rules.empty();
|
||||||
}
|
}
|
||||||
|
@ -5095,9 +5095,19 @@ TODOS
|
||||||
|
|
||||||
editor.loadFromDataURI = function(str) {
|
editor.loadFromDataURI = function(str) {
|
||||||
editor.ready(function() {
|
editor.ready(function() {
|
||||||
var pre = 'data:image/svg+xml;base64,';
|
var base64 = false;
|
||||||
var src = str.substring(pre.length);
|
var pre = str.match(/^data:image\/svg\+xml;base64,/);
|
||||||
loadSvgString(Utils.decode64(src));
|
if (pre) {
|
||||||
|
base64 = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pre = str.match(/^data:image\/svg\+xml(?:;(?:utf8)?)?,/);
|
||||||
|
}
|
||||||
|
if (pre) {
|
||||||
|
pre = pre[0];
|
||||||
|
}
|
||||||
|
var src = str.slice(pre.length);
|
||||||
|
loadSvgString(base64 ? Utils.decode64(src) : decodeURIComponent(src));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue