Making tabbing consistent
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2615 eee81c28-f429-11dd-99c0-75d572ba1ddd
This commit is contained in:
@@ -10,37 +10,37 @@
|
|||||||
|
|
||||||
svgEditor.addExtension("server_opensave", {
|
svgEditor.addExtension("server_opensave", {
|
||||||
callback: function() {
|
callback: function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
function getFileNameFromTitle () {
|
function getFileNameFromTitle () {
|
||||||
var title = svgCanvas.getDocumentTitle();
|
var title = svgCanvas.getDocumentTitle();
|
||||||
return $.trim(title).replace(/[^a-z0-9\.\_\-]+/gi, '_');
|
return $.trim(title).replace(/[^a-z0-9\.\_\-]+/gi, '_');
|
||||||
}
|
}
|
||||||
function clientDownloadSupport (filename, suffix, uri) {
|
function clientDownloadSupport (filename, suffix, uri) {
|
||||||
var a,
|
var a,
|
||||||
support = $('<a>')[0].download === '';
|
support = $('<a>')[0].download === '';
|
||||||
if (support) {
|
if (support) {
|
||||||
a = $('<a>hidden</a>').attr({download: (filename || 'image') + suffix, href: uri}).css('display', 'none').appendTo('body');
|
a = $('<a>hidden</a>').attr({download: (filename || 'image') + suffix, href: uri}).css('display', 'none').appendTo('body');
|
||||||
a[0].click();
|
a[0].click();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var open_svg_action, import_svg_action, import_img_action,
|
var open_svg_action, import_svg_action, import_img_action,
|
||||||
open_svg_form, import_svg_form, import_img_form,
|
open_svg_form, import_svg_form, import_img_form,
|
||||||
save_svg_action = 'extensions/filesave.php',
|
save_svg_action = 'extensions/filesave.php',
|
||||||
save_img_action = 'extensions/filesave.php',
|
save_img_action = 'extensions/filesave.php',
|
||||||
// Create upload target (hidden iframe)
|
// Create upload target (hidden iframe)
|
||||||
cancelled = false;
|
cancelled = false;
|
||||||
|
|
||||||
$('<iframe name="output_frame" src="#"/>').hide().appendTo('body');
|
$('<iframe name="output_frame" src="#"/>').hide().appendTo('body');
|
||||||
svgEditor.setCustomHandlers({
|
svgEditor.setCustomHandlers({
|
||||||
save: function(win, data) {
|
save: function(win, data) {
|
||||||
var svg = "<?xml version=\"1.0\"?>\n" + data,
|
var svg = "<?xml version=\"1.0\"?>\n" + data,
|
||||||
filename = getFileNameFromTitle();
|
filename = getFileNameFromTitle();
|
||||||
|
|
||||||
//if (clientDownloadSupport(filename, '.svg', 'data:image/svg+xml,' + encodeURI(data))) { // Firefox limits size of file
|
//if (clientDownloadSupport(filename, '.svg', 'data:image/svg+xml,' + encodeURI(data))) { // Firefox limits size of file
|
||||||
if (clientDownloadSupport(filename, '.svg', 'data:image/svg+xml;base64,' + svgedit.utilities.encode64(data))) {
|
if (clientDownloadSupport(filename, '.svg', 'data:image/svg+xml;base64,' + svgedit.utilities.encode64(data))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('<form>').attr({
|
$('<form>').attr({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
@@ -53,9 +53,9 @@ svgEditor.addExtension("server_opensave", {
|
|||||||
},
|
},
|
||||||
exportImage: function(win, data) {
|
exportImage: function(win, data) {
|
||||||
var c,
|
var c,
|
||||||
issues = data.issues,
|
issues = data.issues,
|
||||||
mimeType = data.mimeType,
|
mimeType = data.mimeType,
|
||||||
quality = data.quality;
|
quality = data.quality;
|
||||||
|
|
||||||
if(!$('#export_canvas').length) {
|
if(!$('#export_canvas').length) {
|
||||||
$('<canvas>', {id: 'export_canvas'}).hide().appendTo('body');
|
$('<canvas>', {id: 'export_canvas'}).hide().appendTo('body');
|
||||||
@@ -66,9 +66,9 @@ svgEditor.addExtension("server_opensave", {
|
|||||||
c.height = svgCanvas.contentH;
|
c.height = svgCanvas.contentH;
|
||||||
canvg(c, data.svg, {renderCallback: function() {
|
canvg(c, data.svg, {renderCallback: function() {
|
||||||
var pre, filename, suffix,
|
var pre, filename, suffix,
|
||||||
datauri = quality ? c.toDataURL(mimeType, quality) : c.toDataURL(mimeType),
|
datauri = quality ? c.toDataURL(mimeType, quality) : c.toDataURL(mimeType),
|
||||||
uiStrings = svgEditor.uiStrings,
|
uiStrings = svgEditor.uiStrings,
|
||||||
note = '';
|
note = '';
|
||||||
|
|
||||||
// Check if there's issues
|
// Check if there's issues
|
||||||
if(issues.length) {
|
if(issues.length) {
|
||||||
@@ -81,18 +81,18 @@ svgEditor.addExtension("server_opensave", {
|
|||||||
}
|
}
|
||||||
|
|
||||||
filename = getFileNameFromTitle();
|
filename = getFileNameFromTitle();
|
||||||
suffix = '.' + data.type.toLowerCase();
|
suffix = '.' + data.type.toLowerCase();
|
||||||
|
|
||||||
if (clientDownloadSupport(filename, suffix, datauri)) {
|
if (clientDownloadSupport(filename, suffix, datauri)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$('<form>').attr({
|
$('<form>').attr({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
action: save_img_action,
|
action: save_img_action,
|
||||||
target: 'output_frame'
|
target: 'output_frame'
|
||||||
}) .append('<input type="hidden" name="output_img" value="' + datauri + '">')
|
}) .append('<input type="hidden" name="output_img" value="' + datauri + '">')
|
||||||
.append('<input type="hidden" name="mime" value="' + mimeType + '">')
|
.append('<input type="hidden" name="mime" value="' + mimeType + '">')
|
||||||
.append('<input type="hidden" name="filename" value="' + filename + '">')
|
.append('<input type="hidden" name="filename" value="' + filename + '">')
|
||||||
.appendTo('body')
|
.appendTo('body')
|
||||||
.submit().remove();
|
.submit().remove();
|
||||||
@@ -112,7 +112,7 @@ svgEditor.addExtension("server_opensave", {
|
|||||||
|
|
||||||
// Set up function for PHP uploader to use
|
// Set up function for PHP uploader to use
|
||||||
svgEditor.processFile = function(str64, type) {
|
svgEditor.processFile = function(str64, type) {
|
||||||
var xmlstr;
|
var xmlstr;
|
||||||
if(cancelled) {
|
if(cancelled) {
|
||||||
cancelled = false;
|
cancelled = false;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
$output = file_get_contents($file);
|
$output = file_get_contents($file);
|
||||||
|
|
||||||
$type = $_REQUEST['type'];
|
$type = $_REQUEST['type'];
|
||||||
if (!in_array($type, array('load_svg', 'import_svg', 'import_img'))) {
|
if (!in_array($type, array('load_svg', 'import_svg', 'import_img'))) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$prefix = '';
|
$prefix = '';
|
||||||
|
|
||||||
|
|||||||
@@ -1654,7 +1654,7 @@
|
|||||||
var label = $('#g_title')[0];
|
var label = $('#g_title')[0];
|
||||||
label.value = title;
|
label.value = title;
|
||||||
setInputWidth(label);
|
setInputWidth(label);
|
||||||
$('#g_title').prop('disabled', el_name == 'use');
|
$('#g_title').prop('disabled', el_name == 'use');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menu_items[(el_name === 'g' ? 'en' : 'dis') + 'ableContextMenuItems']('#ungroup');
|
menu_items[(el_name === 'g' ? 'en' : 'dis') + 'ableContextMenuItems']('#ungroup');
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>SVG Edit</title>
|
<title>SVG Edit</title>
|
||||||
<link rel="stylesheet" type="text/css" href="style.css">
|
<link rel="stylesheet" type="text/css" href="style.css">
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
Reference in New Issue
Block a user