Make Embedded MathML Visible

Thanks to Jeff Schiller for tracking
down the problem (and committing 
preliminary MathML support to SVG-Edit).
This commit is contained in:
Jacques Distler 2010-02-10 00:11:14 -06:00
parent 7114e46817
commit d362b886c2
5 changed files with 259 additions and 84 deletions

View file

@ -166,8 +166,6 @@ function svg_edit_setup() {
var multiselected = false;
var editingsource = false;
var docprops = false;
var length_attrs = ['x','y','x1','x2','y1','y2','cx','cy','width','height','r','rx','ry','width','height','radius'];
var length_types = ['em','ex','px','cm','mm','in','pt','pc','%'];
var fillPaint = new $.jGraduate.Paint({solidColor: "FF0000"}); // solid red
var strokePaint = new $.jGraduate.Paint({solidColor: "000000"}); // solid black
@ -177,7 +175,7 @@ function svg_edit_setup() {
// with a gradient will appear black in Firefox, etc. See bug 308590
// https://bugzilla.mozilla.org/show_bug.cgi?id=308590
var saveHandler = function(window,svg) {
window.opener.postMessage(svg, window.location.protocol + '//' + window.location.host);
window.opener.postMessage(svg, window.location.protocol + '//' + window.location.host);
};
// called when we've selected a different element
@ -542,6 +540,15 @@ function svg_edit_setup() {
// TODO: Allow support for other types, or adding to existing tool
switch (tool.type) {
case 'tool_button':
var html = '<div class="tool_button">' + tool.id + '</div>';
var div = $(html).appendTo(panel);
if (tool.events) {
$.each(tool.events, function(evt, func) {
$(div).bind(evt, func);
});
}
break;
case 'select':
var html = '<label' + cont_id + '>'
+ '<select id="' + tool.id + '">';
@ -977,20 +984,7 @@ function svg_edit_setup() {
$('.attr_changer').change(function() {
var attr = this.getAttribute("data-attr");
var val = this.value;
var valid = false;
if($.inArray(attr, length_attrs) != -1) {
if(!isNaN(val)) {
valid = true;
} else {
//TODO: Allow the values in length_types, then uncomment this:
// val = val.toLowerCase();
// $.each(length_types, function(i, unit) {
// if(valid) return;
// var re = new RegExp('^-?[\\d\\.]+' + unit + '$');
// if(re.test(val)) valid = true;
// });
}
} else valid = true;
var valid = svgCanvas.isValidUnit(attr, val);
if(!valid) {
$.alert(uiStrings.invalidAttrValGiven);
@ -2711,7 +2705,7 @@ function svg_edit_setup() {
updateCanvas(true);
});
// var revnums = "svg-editor.js ($Rev: 1362 $) ";
// var revnums = "svg-editor.js ($Rev: 1367 $) ";
// revnums += svgCanvas.getVersion();
// $('#copyright')[0].setAttribute("title", revnums);
return svgCanvas;