removing ui strings
parent
ab1d178b4b
commit
26bf1fb7f0
|
@ -1,56 +0,0 @@
|
||||||
/*
|
|
||||||
* 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)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
methodDraw.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');
|
|
||||||
|
|
||||||
methodDraw.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 = methodDraw.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;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,180 +0,0 @@
|
||||||
/*
|
|
||||||
* ext-server_opensave.js
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2
|
|
||||||
*
|
|
||||||
* Copyright(c) 2010 Alexis Deveria
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
methodDraw.addExtension("server_opensave", {
|
|
||||||
callback: function() {
|
|
||||||
|
|
||||||
//var save_svg_action = 'extensions/filesave.php';
|
|
||||||
//var save_png_action = 'extensions/filesave.php';
|
|
||||||
|
|
||||||
// Create upload target (hidden iframe)
|
|
||||||
var target = $('<iframe name="output_frame" />').hide().appendTo('body');
|
|
||||||
|
|
||||||
//methodDraw.setCustomHandlers({
|
|
||||||
// save: function(win, data) {
|
|
||||||
// var svg = "<?xml version=\"1.0\"?>\n" + data;
|
|
||||||
//
|
|
||||||
// var title = svgCanvas.getDocumentTitle();
|
|
||||||
// var filename = title.replace(/[^a-z0-9\.\_\-]+/gi, '_');
|
|
||||||
//
|
|
||||||
// var form = $('<form>').attr({
|
|
||||||
// method: 'post',
|
|
||||||
// action: save_svg_action,
|
|
||||||
// target: 'output_frame'
|
|
||||||
// }) .append('<input type="hidden" name="output_svg" value="' + encodeURI(svg) + '">')
|
|
||||||
// .append('<input type="hidden" name="filename" value="' + filename + '">')
|
|
||||||
// .appendTo('body')
|
|
||||||
// .submit().remove();
|
|
||||||
// },
|
|
||||||
// pngsave: function(win, data) {
|
|
||||||
// var issues = data.issues;
|
|
||||||
//
|
|
||||||
// if(!$('#export_canvas').length) {
|
|
||||||
// $('<canvas>', {id: 'export_canvas'}).hide().appendTo('body');
|
|
||||||
// }
|
|
||||||
// var c = $('#export_canvas')[0];
|
|
||||||
//
|
|
||||||
// c.width = svgCanvas.contentW;
|
|
||||||
// c.height = svgCanvas.contentH;
|
|
||||||
// canvg(c, data.svg, {renderCallback: function() {
|
|
||||||
// var datauri = c.toDataURL('image/png');
|
|
||||||
//
|
|
||||||
// var uiStrings = methodDraw.uiStrings;
|
|
||||||
// var note = '';
|
|
||||||
//
|
|
||||||
// // Check if there's issues
|
|
||||||
// if(issues.length) {
|
|
||||||
// var pre = "\n \u2022 ";
|
|
||||||
// note += ("\n\n" + pre + issues.join(pre));
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if(note.length) {
|
|
||||||
// alert(note);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// var title = svgCanvas.getDocumentTitle();
|
|
||||||
// var filename = title.replace(/[^a-z0-9\.\_\-]+/gi, '_');
|
|
||||||
//
|
|
||||||
// var form = $('<form>').attr({
|
|
||||||
// method: 'post',
|
|
||||||
// action: save_png_action,
|
|
||||||
// target: 'output_frame'
|
|
||||||
// }) .append('<input type="hidden" name="output_png" value="' + datauri + '">')
|
|
||||||
// .append('<input type="hidden" name="filename" value="' + filename + '">')
|
|
||||||
// .appendTo('body')
|
|
||||||
// .submit().remove();
|
|
||||||
// }});
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//});
|
|
||||||
|
|
||||||
// Do nothing if client support is found
|
|
||||||
if(window.FileReader) return;
|
|
||||||
|
|
||||||
var cancelled = false;
|
|
||||||
|
|
||||||
// Change these to appropriate script file
|
|
||||||
var open_svg_action = 'extensions/fileopen.php?type=load_svg';
|
|
||||||
var import_svg_action = 'extensions/fileopen.php?type=import_svg';
|
|
||||||
var import_img_action = 'extensions/fileopen.php?type=import_img';
|
|
||||||
|
|
||||||
// Set up function for PHP uploader to use
|
|
||||||
methodDraw.processFile = function(str64, type) {
|
|
||||||
if(cancelled) {
|
|
||||||
cancelled = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#dialog_box').hide();
|
|
||||||
|
|
||||||
if(type != 'import_img') {
|
|
||||||
var xmlstr = svgCanvas.Utils.decode64(str64);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ( type ) {
|
|
||||||
case 'load_svg':
|
|
||||||
svgCanvas.clear();
|
|
||||||
svgCanvas.setSvgString(xmlstr);
|
|
||||||
methodDraw.updateCanvas();
|
|
||||||
break;
|
|
||||||
case 'import_svg':
|
|
||||||
svgCanvas.importSvgString(xmlstr);
|
|
||||||
methodDraw.updateCanvas();
|
|
||||||
break;
|
|
||||||
case 'import_img':
|
|
||||||
svgCanvas.setGoodImage(str64);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create upload form
|
|
||||||
var open_svg_form = $('<form>');
|
|
||||||
open_svg_form.attr({
|
|
||||||
enctype: 'multipart/form-data',
|
|
||||||
method: 'post',
|
|
||||||
action: open_svg_action,
|
|
||||||
target: 'output_frame'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Create import form
|
|
||||||
var import_svg_form = open_svg_form.clone().attr('action', import_svg_action);
|
|
||||||
|
|
||||||
// Create image form
|
|
||||||
var import_img_form = open_svg_form.clone().attr('action', import_img_action);
|
|
||||||
|
|
||||||
// It appears necessory to rebuild this input every time a file is
|
|
||||||
// selected so the same file can be picked and the change event can fire.
|
|
||||||
function rebuildInput(form) {
|
|
||||||
form.empty();
|
|
||||||
var inp = $('<input type="file" name="svg_file">').appendTo(form);
|
|
||||||
|
|
||||||
|
|
||||||
function submit() {
|
|
||||||
// This submits the form, which returns the file data using methodDraw.uploadSVG
|
|
||||||
form.submit();
|
|
||||||
|
|
||||||
rebuildInput(form);
|
|
||||||
$.process_cancel("Uploading...", function() {
|
|
||||||
cancelled = true;
|
|
||||||
$('#dialog_box').hide();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if(form[0] == open_svg_form[0]) {
|
|
||||||
inp.change(function() {
|
|
||||||
// This takes care of the "are you sure" dialog box
|
|
||||||
methodDraw.openPrep(function(ok) {
|
|
||||||
if(!ok) {
|
|
||||||
rebuildInput(form);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
submit();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
inp.change(function() {
|
|
||||||
// This submits the form, which returns the file data using methodDraw.uploadSVG
|
|
||||||
submit();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the input elements
|
|
||||||
rebuildInput(open_svg_form);
|
|
||||||
rebuildInput(import_svg_form);
|
|
||||||
rebuildInput(import_img_form);
|
|
||||||
|
|
||||||
// Add forms to buttons
|
|
||||||
$("#tool_open").show().prepend(open_svg_form);
|
|
||||||
$("#tool_import").show().prepend(import_svg_form);
|
|
||||||
$("#tool_image").prepend(import_img_form);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
.toggleClass('prompt',(type=='prompt'));
|
.toggleClass('prompt',(type=='prompt'));
|
||||||
btn_holder.empty();
|
btn_holder.empty();
|
||||||
|
|
||||||
var ok = $('<input type="button" value="' + uiStrings.common.ok + '">').appendTo(btn_holder);
|
var ok = $('<input type="button" value="OK">').appendTo(btn_holder);
|
||||||
|
|
||||||
if(type != 'alert') {
|
if(type != 'alert') {
|
||||||
$('<input type="button" value="' + uiStrings.common.cancel + '">')
|
$('<input type="button" value="Cancel">')
|
||||||
.appendTo(btn_holder)
|
.appendTo(btn_holder)
|
||||||
.on("click touchstart", function() { box.hide();callback(false)});
|
.on("click touchstart", function() { box.hide();callback(false)});
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
var svgCanvas;
|
var svgCanvas;
|
||||||
var Editor = {};
|
var Editor = {};
|
||||||
var is_ready = false;
|
var is_ready = false;
|
||||||
curConfig = {
|
var curConfig = {
|
||||||
canvas_expansion: 1,
|
canvas_expansion: 1,
|
||||||
dimensions: [580,400],
|
dimensions: [580,400],
|
||||||
initFill: {color: 'fff', opacity: 1},
|
initFill: {color: 'fff', opacity: 1},
|
||||||
|
@ -43,48 +43,7 @@
|
||||||
show_outside_canvas: false,
|
show_outside_canvas: false,
|
||||||
no_save_warning: true,
|
no_save_warning: true,
|
||||||
initFont: 'Helvetica, Arial, sans-serif'
|
initFont: 'Helvetica, Arial, sans-serif'
|
||||||
},
|
|
||||||
uiStrings = Editor.uiStrings = {
|
|
||||||
common: {
|
|
||||||
"ok":"OK",
|
|
||||||
"cancel":"Cancel",
|
|
||||||
"key_up":"Up",
|
|
||||||
"key_down":"Down",
|
|
||||||
"key_backspace":"Backspace",
|
|
||||||
"key_del":"Del"
|
|
||||||
|
|
||||||
},
|
|
||||||
// This is needed if the locale is English, since the locale strings are not read in that instance.
|
|
||||||
layers: {
|
|
||||||
"layer":"Layer"
|
|
||||||
},
|
|
||||||
notification: {
|
|
||||||
"invalidAttrValGiven":"Invalid value given",
|
|
||||||
"noContentToFitTo":"No content to fit to",
|
|
||||||
"dupeLayerName":"There is already a layer named that!",
|
|
||||||
"enterUniqueLayerName":"Please enter a unique layer name",
|
|
||||||
"enterNewLayerName":"Please enter the new layer name",
|
|
||||||
"layerHasThatName":"Layer already has that name",
|
|
||||||
"QmoveElemsToLayer":"Move selected elements to layer \"%s\"?",
|
|
||||||
"QwantToClear":"<strong>Do you want to clear the drawing?</strong>\nThis will also erase your undo history",
|
|
||||||
"QwantToOpen":"Do you want to open a new file?\nThis will also erase your undo history",
|
|
||||||
"QerrorsRevertToSource":"There were parsing errors in your SVG source.\nRevert back to original SVG source?",
|
|
||||||
"QignoreSourceChanges":"Ignore changes made to SVG source?",
|
|
||||||
"featNotSupported":"Feature not supported",
|
|
||||||
"enterNewImgURL":"Enter the new image URL",
|
|
||||||
"defsFailOnSave": "NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.",
|
|
||||||
"loadingImage":"Loading image, please wait...",
|
|
||||||
"saveFromBrowser": "Select \"Save As...\" in your browser to save this image as a %s file.",
|
|
||||||
"noteTheseIssues": "Also note the following issues: ",
|
|
||||||
"unsavedChanges": "There are unsaved changes.",
|
|
||||||
"enterNewLinkURL": "Enter the new hyperlink URL",
|
|
||||||
"errorLoadingSVG": "Error: Unable to load SVG data",
|
|
||||||
"URLloadFail": "Unable to load from URL",
|
|
||||||
"retrieving": 'Retrieving "%s" ...'
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
var curPrefs = {}; //$.extend({}, defaultPrefs);
|
var curPrefs = {}; //$.extend({}, defaultPrefs);
|
||||||
var customHandlers = {};
|
var customHandlers = {};
|
||||||
Editor.curConfig = curConfig;
|
Editor.curConfig = curConfig;
|
||||||
|
@ -344,10 +303,10 @@
|
||||||
.toggleClass('prompt',(type=='prompt'));
|
.toggleClass('prompt',(type=='prompt'));
|
||||||
btn_holder.empty();
|
btn_holder.empty();
|
||||||
|
|
||||||
var ok = $('<input type="button" value="' + uiStrings.common.ok + '">').appendTo(btn_holder);
|
var ok = $('<input type="button" value="OK">').appendTo(btn_holder);
|
||||||
|
|
||||||
if(type != 'alert') {
|
if(type != 'alert') {
|
||||||
$('<input type="button" value="' + uiStrings.common.cancel + '">')
|
$('<input type="button" value="Cancel">')
|
||||||
.appendTo(btn_holder)
|
.appendTo(btn_holder)
|
||||||
.on("click touchstart", function() { box.hide();callback(false)});
|
.on("click touchstart", function() { box.hide();callback(false)});
|
||||||
}
|
}
|
||||||
|
@ -429,47 +388,7 @@
|
||||||
var cur_context = '';
|
var cur_context = '';
|
||||||
|
|
||||||
var saveHandler = function(window,svg) {
|
var saveHandler = function(window,svg) {
|
||||||
Editor.show_save_warning = false;
|
|
||||||
|
|
||||||
// by default, we add the XML prolog back, systems integrating SVG-edit (wikis, CMSs)
|
|
||||||
// can just provide their own custom save handler and might not want the XML prolog
|
|
||||||
svg = '<?xml version="1.0"?>\n' + svg;
|
|
||||||
|
|
||||||
// Opens the SVG in new window, with warning about Mozilla bug #308590 when applicable
|
|
||||||
|
|
||||||
var ua = navigator.userAgent;
|
|
||||||
|
|
||||||
// Chrome 5 (and 6?) don't allow saving, show source instead ( http://code.google.com/p/chromium/issues/detail?id=46735 )
|
|
||||||
// IE9 doesn't allow standalone Data URLs ( https://connect.microsoft.com/IE/feedback/details/542600/data-uri-images-fail-when-loaded-by-themselves )
|
|
||||||
if(~ua.indexOf('MSIE')) {
|
|
||||||
showSourceEditor(0,true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var win = window.open("data:image/svg+xml;base64," + Utils.encode64(svg));
|
|
||||||
|
|
||||||
// Alert will only appear the first time saved OR the first time the bug is encountered
|
|
||||||
var done = $.pref('save_notice_done');
|
|
||||||
if(done !== "all") {
|
|
||||||
|
|
||||||
var note = uiStrings.notification.saveFromBrowser.replace('%s', 'SVG');
|
|
||||||
|
|
||||||
// Check if FF and has <defs/>
|
|
||||||
if(ua.indexOf('Gecko/') !== -1) {
|
|
||||||
if(svg.indexOf('<defs') !== -1) {
|
|
||||||
note += "\n\n" + uiStrings.notification.defsFailOnSave;
|
|
||||||
$.pref('save_notice_done', 'all');
|
|
||||||
done = "all";
|
|
||||||
} else {
|
|
||||||
$.pref('save_notice_done', 'part');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$.pref('save_notice_done', 'all');
|
|
||||||
}
|
|
||||||
|
|
||||||
if(done !== 'part') {
|
|
||||||
win.alert(note);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var exportHandler = function(window, data) {
|
var exportHandler = function(window, data) {
|
||||||
|
@ -487,12 +406,11 @@
|
||||||
exportWindow.location.href = datauri;
|
exportWindow.location.href = datauri;
|
||||||
var done = $.pref('export_notice_done');
|
var done = $.pref('export_notice_done');
|
||||||
if(done !== "all") {
|
if(done !== "all") {
|
||||||
var note = uiStrings.notification.saveFromBrowser.replace('%s', 'PNG');
|
var note ="Select \"Save As...\" in your browser to save this image as a PNG file.";
|
||||||
|
|
||||||
// Check if there's issues
|
// Check if there's issues
|
||||||
if(issues.length) {
|
if(issues.length) {
|
||||||
var pre = "\n \u2022 ";
|
var pre = "\n \u2022 ";
|
||||||
note += ("\n\n" + uiStrings.notification.noteTheseIssues + pre + issues.join(pre));
|
note += ("\n\n" + "Also note the following issues: " + pre + issues.join(pre));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note that this will also prevent the notice even though new issues may appear later.
|
// Note that this will also prevent the notice even though new issues may appear later.
|
||||||
|
@ -1588,7 +1506,6 @@
|
||||||
svgCanvas.bind("selected", selectedChanged);
|
svgCanvas.bind("selected", selectedChanged);
|
||||||
svgCanvas.bind("transition", elementTransition);
|
svgCanvas.bind("transition", elementTransition);
|
||||||
svgCanvas.bind("changed", elementChanged);
|
svgCanvas.bind("changed", elementChanged);
|
||||||
svgCanvas.bind("saved", saveHandler);
|
|
||||||
svgCanvas.bind("exported", exportHandler);
|
svgCanvas.bind("exported", exportHandler);
|
||||||
svgCanvas.bind("zoomed", zoomChanged);
|
svgCanvas.bind("zoomed", zoomChanged);
|
||||||
svgCanvas.bind("contextset", contextChanged);
|
svgCanvas.bind("contextset", contextChanged);
|
||||||
|
@ -1701,7 +1618,7 @@
|
||||||
var val = el.value * multiplier;
|
var val = el.value * multiplier;
|
||||||
var valid = svgedit.units.isValidUnit(attr, val, selectedElement);
|
var valid = svgedit.units.isValidUnit(attr, val, selectedElement);
|
||||||
if(!valid) {
|
if(!valid) {
|
||||||
$.alert(uiStrings.notification.invalidAttrValGiven);
|
$.alert("Invalid value given");
|
||||||
el.value = selectedElement.getAttribute(attr);
|
el.value = selectedElement.getAttribute(attr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2228,7 +2145,7 @@
|
||||||
|
|
||||||
var makeHyperlink = function() {
|
var makeHyperlink = function() {
|
||||||
if (selectedElement != null || multiselected) {
|
if (selectedElement != null || multiselected) {
|
||||||
$.prompt(uiStrings.notification.enterNewLinkURL, "http://", function(url) {
|
$.prompt("Enter the new hyperlink URL", "http://", function(url) {
|
||||||
if(url) svgCanvas.makeHyperlink(url);
|
if(url) svgCanvas.makeHyperlink(url);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2299,7 +2216,7 @@
|
||||||
|
|
||||||
var clickClear = function(){
|
var clickClear = function(){
|
||||||
var dims = curConfig.dimensions;
|
var dims = curConfig.dimensions;
|
||||||
$.confirm(uiStrings.notification.QwantToClear, function(ok) {
|
$.confirm("<strong>Do you want to clear the drawing?</strong>\nThis will also erase your undo history", function(ok) {
|
||||||
if(!ok) return;
|
if(!ok) return;
|
||||||
setSelectMode();
|
setSelectMode();
|
||||||
svgCanvas.deleteSelectedElements();
|
svgCanvas.deleteSelectedElements();
|
||||||
|
@ -2327,8 +2244,7 @@
|
||||||
var clickExport = function() {
|
var clickExport = function() {
|
||||||
// Open placeholder window (prevents popup)
|
// Open placeholder window (prevents popup)
|
||||||
if(!customHandlers.pngsave) {
|
if(!customHandlers.pngsave) {
|
||||||
var str = uiStrings.notification.loadingImage;
|
exportWindow = window.open("data:text/html;charset=utf-8,<title>Loading image, please wait...<\/title><h1>" + str + "<\/h1>");
|
||||||
exportWindow = window.open("data:text/html;charset=utf-8,<title>" + str + "<\/title><h1>" + str + "<\/h1>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(window.canvg) {
|
if(window.canvg) {
|
||||||
|
@ -2527,7 +2443,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!svgCanvas.setSvgString($('#svg_source_textarea').val())) {
|
if (!svgCanvas.setSvgString($('#svg_source_textarea').val())) {
|
||||||
$.confirm(uiStrings.notification.QerrorsRevertToSource, function(ok) {
|
$.confirm("There were parsing errors in your SVG source.\nRevert back to original SVG source?", function(ok) {
|
||||||
if(!ok) return false;
|
if(!ok) return false;
|
||||||
saveChanges();
|
saveChanges();
|
||||||
});
|
});
|
||||||
|
@ -2687,7 +2603,7 @@
|
||||||
|
|
||||||
if (editingsource) {
|
if (editingsource) {
|
||||||
if (orig_source !== $('#svg_source_textarea').val()) {
|
if (orig_source !== $('#svg_source_textarea').val()) {
|
||||||
$.confirm(uiStrings.notification.QignoreSourceChanges, function(ok) {
|
$.confirm("Ignore changes made to SVG source?", function(ok) {
|
||||||
if(ok) hideSourceEditor();
|
if(ok) hideSourceEditor();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -2772,7 +2688,7 @@
|
||||||
function promptImgURL() {
|
function promptImgURL() {
|
||||||
var curhref = svgCanvas.getHref(selectedElement);
|
var curhref = svgCanvas.getHref(selectedElement);
|
||||||
curhref = curhref.indexOf("data:") === 0?"":curhref;
|
curhref = curhref.indexOf("data:") === 0?"":curhref;
|
||||||
$.prompt(uiStrings.notification.enterNewImgURL, curhref, function(url) {
|
$.prompt("Enter the new image URL", curhref, function(url) {
|
||||||
if(url) setImageURL(url);
|
if(url) setImageURL(url);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2983,7 +2899,7 @@
|
||||||
$('#image_save_opts [value=embed]').attr('disabled','disabled');
|
$('#image_save_opts [value=embed]').attr('disabled','disabled');
|
||||||
$('#image_save_opts input').val(['ref']);
|
$('#image_save_opts input').val(['ref']);
|
||||||
curPrefs.img_save = 'ref';
|
curPrefs.img_save = 'ref';
|
||||||
$('#image_opt_embed').css('color','#666').attr('title',uiStrings.notification.featNotSupported);
|
$('#image_opt_embed').css('color','#666').attr('title', "Feature not supported");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},1000);
|
},1000);
|
||||||
|
@ -3100,7 +3016,7 @@
|
||||||
var h = height.val()
|
var h = height.val()
|
||||||
|
|
||||||
if(w != "fit" && !svgedit.units.isValidUnit('width', w)) {
|
if(w != "fit" && !svgedit.units.isValidUnit('width', w)) {
|
||||||
$.alert(uiStrings.notification.invalidAttrValGiven);
|
$.alert("Invalid value given");
|
||||||
width.parent().addClass('error');
|
width.parent().addClass('error');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3108,13 +3024,13 @@
|
||||||
width.parent().removeClass('error');
|
width.parent().removeClass('error');
|
||||||
|
|
||||||
if(h != "fit" && !svgedit.units.isValidUnit('height', h)) {
|
if(h != "fit" && !svgedit.units.isValidUnit('height', h)) {
|
||||||
$.alert(uiStrings.notification.invalidAttrValGiven);
|
$.alert("Invalid value given");
|
||||||
height.parent().addClass('error');
|
height.parent().addClass('error');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
height.parent().removeClass('error');
|
height.parent().removeClass('error');
|
||||||
if(!svgCanvas.setResolution(w, h)) {
|
if(!svgCanvas.setResolution(w, h)) {
|
||||||
$.alert(uiStrings.notification.noContentToFitTo);
|
$.alert("No content to fit to");
|
||||||
var dims = svgCanvas.getResolution()
|
var dims = svgCanvas.getResolution()
|
||||||
width.val(dims.w)
|
width.val(dims.w)
|
||||||
height.val(dims.h)
|
height.val(dims.h)
|
||||||
|
@ -3383,7 +3299,7 @@
|
||||||
mod = mod_bits[0] + '+';
|
mod = mod_bits[0] + '+';
|
||||||
key = mod_bits[1];
|
key = mod_bits[1];
|
||||||
}
|
}
|
||||||
key_str += (i?'/':'') + mod + (uiStrings['key_'+key] || key);
|
key_str += (i?'/':'') + mod + (key);
|
||||||
});
|
});
|
||||||
if(menu) {
|
if(menu) {
|
||||||
this.lastChild.textContent = t +' ['+key_str+']';
|
this.lastChild.textContent = t +' ['+key_str+']';
|
||||||
|
@ -3538,7 +3454,7 @@
|
||||||
// show_save_warning is set to "false" when the page is saved.
|
// show_save_warning is set to "false" when the page is saved.
|
||||||
if(!curConfig.no_save_warning && Editor.show_save_warning) {
|
if(!curConfig.no_save_warning && Editor.show_save_warning) {
|
||||||
// Browser already asks question about closing the page
|
// Browser already asks question about closing the page
|
||||||
return uiStrings.notification.unsavedChanges;
|
return "There are unsaved changes.";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3547,7 +3463,7 @@
|
||||||
if(undoMgr.getUndoStackSize() === 0) {
|
if(undoMgr.getUndoStackSize() === 0) {
|
||||||
func(true);
|
func(true);
|
||||||
} else {
|
} else {
|
||||||
$.confirm(uiStrings.notification.QwantToOpen, func);
|
$.confirm("Do you want to open a new file?\nThis will also erase your undo history", func);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4015,7 +3931,7 @@
|
||||||
if(success) {
|
if(success) {
|
||||||
callback(true);
|
callback(true);
|
||||||
} else {
|
} else {
|
||||||
$.alert(uiStrings.notification.errorLoadingSVG, function() {
|
$.alert("Error: Unable to load SVG data", function() {
|
||||||
callback(false);
|
callback(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -4060,7 +3976,7 @@
|
||||||
if(xhr.status != 404 && xhr.responseText) {
|
if(xhr.status != 404 && xhr.responseText) {
|
||||||
loadSvgString(xhr.responseText, cb);
|
loadSvgString(xhr.responseText, cb);
|
||||||
} else {
|
} else {
|
||||||
$.alert(uiStrings.notification.URLloadFail + ": \n"+err+'', cb);
|
$.alert("Unable to load from URL" + ": \n"+err+'', cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,11 +23,6 @@ if (!svgedit.path) {
|
||||||
|
|
||||||
var svgns = "http://www.w3.org/2000/svg";
|
var svgns = "http://www.w3.org/2000/svg";
|
||||||
|
|
||||||
var uiStrings = {
|
|
||||||
"pathNodeTooltip": "Drag node to move it. Double-click node to change segment type",
|
|
||||||
"pathCtrlPtTooltip": "Drag control point to adjust curve properties"
|
|
||||||
};
|
|
||||||
|
|
||||||
var segData = {
|
var segData = {
|
||||||
2: ['x','y'],
|
2: ['x','y'],
|
||||||
4: ['x','y'],
|
4: ['x','y'],
|
||||||
|
@ -137,7 +132,7 @@ svgedit.path.addPointGrip = function(index, x, y) {
|
||||||
'stroke-width': 1,
|
'stroke-width': 1,
|
||||||
'cursor': 'move',
|
'cursor': 'move',
|
||||||
'style': 'pointer-events:all',
|
'style': 'pointer-events:all',
|
||||||
'xlink:title': uiStrings.pathNodeTooltip
|
'xlink:title': "Drag node to move it. Double-click node to change segment type"
|
||||||
});
|
});
|
||||||
pointGrip = pointGripContainer.appendChild(pointGrip);
|
pointGrip = pointGripContainer.appendChild(pointGrip);
|
||||||
|
|
||||||
|
@ -182,7 +177,7 @@ svgedit.path.addCtrlGrip = function(id) {
|
||||||
'stroke-width': '3',
|
'stroke-width': '3',
|
||||||
'cursor': 'move',
|
'cursor': 'move',
|
||||||
'style': 'pointer-events:all',
|
'style': 'pointer-events:all',
|
||||||
'xlink:title': uiStrings.pathCtrlPtTooltip
|
'xlink:title': "Drag control point to adjust curve properties"
|
||||||
});
|
});
|
||||||
svgedit.path.getGripContainer().appendChild(pointGrip);
|
svgedit.path.getGripContainer().appendChild(pointGrip);
|
||||||
return pointGrip;
|
return pointGrip;
|
||||||
|
|
|
@ -416,15 +416,6 @@ svgedit.utilities.snapToGrid = function(value){
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
var snapToGrid = svgedit.utilities.snapToGrid;
|
var snapToGrid = svgedit.utilities.snapToGrid;
|
||||||
|
|
||||||
// Interface strings, usually for title elements
|
|
||||||
var uiStrings = {
|
|
||||||
"exportNoBlur": "Blurred elements will appear as un-blurred",
|
|
||||||
"exportNoforeignObject": "foreignObject elements will not appear",
|
|
||||||
"exportNoDashArray": "Strokes will appear filled",
|
|
||||||
"exportNoText": "Text may not appear as expected"
|
|
||||||
};
|
|
||||||
|
|
||||||
var visElems = 'a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use';
|
var visElems = 'a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use';
|
||||||
var ref_attrs = ["clip-path", "fill", "filter", "marker-end", "marker-mid", "marker-start", "mask", "stroke"];
|
var ref_attrs = ["clip-path", "fill", "filter", "marker-end", "marker-mid", "marker-start", "mask", "stroke"];
|
||||||
|
|
||||||
|
@ -5569,14 +5560,9 @@ this.save = function(opts) {
|
||||||
|
|
||||||
// no need for doctype, see http://jwatt.org/svg/authoring/#doctype-declaration
|
// no need for doctype, see http://jwatt.org/svg/authoring/#doctype-declaration
|
||||||
var str = this.svgCanvasToString();
|
var str = this.svgCanvasToString();
|
||||||
if (svgedit.browser.supportsBlobs()) {
|
|
||||||
var blob = new Blob([ str ], {type: "image/svg+xml;charset=utf-8"});
|
var blob = new Blob([ str ], {type: "image/svg+xml;charset=utf-8"});
|
||||||
var dropAutoBOM = true;
|
var dropAutoBOM = true;
|
||||||
saveAs(blob, "method-draw-image.svg", dropAutoBOM);
|
saveAs(blob, "method-draw-image.svg", dropAutoBOM);
|
||||||
}
|
|
||||||
else {
|
|
||||||
call("saved", str);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function: rasterExport
|
// Function: rasterExport
|
||||||
|
@ -5591,15 +5577,15 @@ this.rasterExport = function() {
|
||||||
|
|
||||||
// Selector and notice
|
// Selector and notice
|
||||||
var issue_list = {
|
var issue_list = {
|
||||||
'feGaussianBlur': uiStrings.exportNoBlur,
|
'feGaussianBlur': "Blurred elements will appear as un-blurred",
|
||||||
'foreignObject': uiStrings.exportNoforeignObject,
|
'foreignObject': "foreignObject elements will not appear",
|
||||||
'[stroke-dasharray]': uiStrings.exportNoDashArray
|
'[stroke-dasharray]': "Strokes will appear filled"
|
||||||
};
|
};
|
||||||
var content = $(svgcontent);
|
var content = $(svgcontent);
|
||||||
|
|
||||||
// Add font/text check if Canvas Text API is not implemented
|
// Add font/text check if Canvas Text API is not implemented
|
||||||
if(!("font" in $('<canvas>')[0].getContext('2d'))) {
|
if(!("font" in $('<canvas>')[0].getContext('2d'))) {
|
||||||
issue_list['text'] = uiStrings.exportNoText;
|
issue_list['text'] = "Text may not appear as expected";
|
||||||
}
|
}
|
||||||
|
|
||||||
$.each(issue_list, function(sel, descr) {
|
$.each(issue_list, function(sel, descr) {
|
||||||
|
@ -6741,15 +6727,6 @@ this.getVersion = function() {
|
||||||
return "svgcanvas.js ($Rev: 2082 $)";
|
return "svgcanvas.js ($Rev: 2082 $)";
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function: setUiStrings
|
|
||||||
// Update interface strings with given values
|
|
||||||
//
|
|
||||||
// Parameters:
|
|
||||||
// strs - Object with strings (see uiStrings for examples)
|
|
||||||
this.setUiStrings = function(strs) {
|
|
||||||
$.extend(uiStrings, strs.notification);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function: setConfig
|
// Function: setConfig
|
||||||
// Update configuration options with given values
|
// Update configuration options with given values
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue