Task of Sisyphus: Filter bogus attributes generated by Gecko (again)

This commit is contained in:
Jacques Distler 2010-04-28 11:54:56 -05:00
parent d1678ceb49
commit 86a53d1dfa
4 changed files with 34 additions and 13 deletions

View file

@ -132,12 +132,13 @@
{"id": "zoom_panel", "title": "Change zoom level"}, {"id": "zoom_panel", "title": "Change zoom level"},
{"id": "zoomLabel", "textContent": "zoom:"}, {"id": "zoomLabel", "textContent": "zoom:"},
{"id": "sidepanel_handle", "textContent": "L a y e r s", "title": "Drag left/right to resize side panel"}, {"id": "sidepanel_handle", "textContent": "L a y e r s", "title": "Drag left/right to resize side panel"},
{"id": "main_icon", "title": "Main Menu"},
{"id": "tool_blur", "title": "Change gaussian blur value"}, {"id": "tool_blur", "title": "Change gaussian blur value"},
{"id": "tool_position", "title": "Align Element to Page"}, {"id": "tool_position", "title": "Align Element to Page"},
{"id": "idLabel", "title": "Identify the element"}, {"id": "idLabel", "title": "Identify the element"},
{"id": "tool_openclose_path", "title": "Open/close sub-path"}, {"id": "tool_openclose_path", "title": "Open/close sub-path"},
{"id": "tool_add_subpath", "title": "Add sub-path"}, {"id": "tool_add_subpath", "title": "Add sub-path"},
{"id": "cur_linejoin", "title": "Add sub-path"}, {"id": "toggle_stroke_tools", "title": "Show/hide more stroke tools"},
{"id": "linejoin_miter", "title": "Linejoin: Miter"}, {"id": "linejoin_miter", "title": "Linejoin: Miter"},
{"id": "linejoin_round", "title": "Linejoin: Round"}, {"id": "linejoin_round", "title": "Linejoin: Round"},
{"id": "linejoin_bevel", "title": "Linejoin: Bevel"}, {"id": "linejoin_bevel", "title": "Linejoin: Bevel"},
@ -150,6 +151,8 @@
{"id": "mode_connect", "title": "Connect two objects"}, {"id": "mode_connect", "title": "Connect two objects"},
{"id": "connector_no_arrow", "textContent": "No arrow"}, {"id": "connector_no_arrow", "textContent": "No arrow"},
{ {
"js_strings": { "js_strings": {
"QerrorsRevertToSource": "There were parsing errors in your SVG source.\nRevert back to original SVG source?", "QerrorsRevertToSource": "There were parsing errors in your SVG source.\nRevert back to original SVG source?",

View file

@ -452,7 +452,6 @@ script type="text/javascript" src="locale/locale.min.js"></script-->
</label> </label>
<label class="stroke_tool"> <label class="stroke_tool">
<span>Dash:</span>
<select id="stroke_style" title="Change stroke dash style"> <select id="stroke_style" title="Change stroke dash style">
<option selected="selected" value="none">&mdash;</option> <option selected="selected" value="none">&mdash;</option>
<option value="2,2">...</option> <option value="2,2">...</option>

View file

@ -1354,10 +1354,16 @@
var changeBlur = function(ctl, val, noUndo) { var changeBlur = function(ctl, val, noUndo) {
if(val == null) val = ctl.value; if(val == null) val = ctl.value;
$('#blur').val(val); $('#blur').val(val);
var complete = false;
if(!ctl || !ctl.handle) { if(!ctl || !ctl.handle) {
$('#blur_slider').slider('option', 'value', val); $('#blur_slider').slider('option', 'value', val);
complete = true;
}
if(noUndo) {
svgCanvas.setBlurNoUndo(val);
} else {
svgCanvas.setBlur(val, complete);
} }
svgCanvas.setBlur(val, noUndo);
} }
var operaRepaint = function() { var operaRepaint = function() {
@ -1752,16 +1758,22 @@
addDropDown('#blur_dropdown', function() { addDropDown('#blur_dropdown', function() {
}); });
var slideStart = false;
$("#blur_slider").slider({ $("#blur_slider").slider({
max: 10, max: 10,
step: .1, step: .1,
stop: function(evt, ui) { stop: function(evt, ui) {
slideStart = false;
changeBlur(ui); changeBlur(ui);
$('#blur_dropdown li').show(); $('#blur_dropdown li').show();
$(window).mouseup(); $(window).mouseup();
}, },
start: function() {
slideStart = true;
},
slide: function(evt, ui){ slide: function(evt, ui){
changeBlur(ui, null, true); changeBlur(ui, null, slideStart);
} }
}); });
@ -3440,7 +3452,7 @@
updateCanvas(true); updateCanvas(true);
// }); // });
// var revnums = "svg-editor.js ($Rev: 1548 $) "; // var revnums = "svg-editor.js ($Rev: 1550 $) ";
// revnums += svgCanvas.getVersion(); // revnums += svgCanvas.getVersion();
// $('#copyright')[0].setAttribute("title", revnums); // $('#copyright')[0].setAttribute("title", revnums);
@ -3528,15 +3540,19 @@
// Copy title for certain tool elements // Copy title for certain tool elements
var elems = { var elems = {
'#stroke_color': '#tool_stroke .icon_label, #tool_stroke .color_block', '#stroke_color': '#tool_stroke .icon_label, #tool_stroke .color_block',
// '#group_opacity': '#tool_opacity', // Change lang file '#fill_color': '#tool_fill label, #tool_fill .color_block',
// '#zoom': '#zoom_panel', '#linejoin_miter': '#cur_linejoin',
'#fill_color': '#tool_fill label, #tool_fill .color_block' '#linecap_butt': '#cur_linecap'
} }
$.each(elems, function(source, dest) { $.each(elems, function(source, dest) {
$(dest).attr('title', $(source).attr('title')); $(dest).attr('title', $(source)[0].title);
}); });
// Copy alignment titles
$('#multiselected_panel div[id^=tool_align]').each(function() {
$('#tool_pos' + this.id.substr(10))[0].title = this.title;
});
} }
}; };

View file

@ -1,4 +1,4 @@
/* /*
* svgcanvas.js * svgcanvas.js
* *
* Licensed under the Apache License, Version 2 * Licensed under the Apache License, Version 2
@ -1632,6 +1632,9 @@ function BatchCommand(text) {
// Namespaces have already been dealt with, so skip // Namespaces have already been dealt with, so skip
if(attr.nodeName.indexOf('xmlns:') === 0) continue; if(attr.nodeName.indexOf('xmlns:') === 0) continue;
//remove bogus attributes added by Gecko
if (attr.localName == '-moz-math-font-style') continue;
// only serialize attributes we don't use internally // only serialize attributes we don't use internally
if (attrVal != "" && if (attrVal != "" &&
$.inArray(attr.localName, ['width','height','xmlns','x','y','viewBox','id','overflow']) == -1) $.inArray(attr.localName, ['width','height','xmlns','x','y','viewBox','id','overflow']) == -1)