Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2010-02-23 17:31:36 -06:00
commit c26faabf2d
2 changed files with 15 additions and 12 deletions

View file

@ -305,7 +305,7 @@ $(function() {
"id": getNextId(),
"points": (x+','+y+' '+x+','+y+' '+start_x+','+start_y),
"stroke": '#000',
"stroke-width": 3,
"stroke-width": 2,
"fill": "none",
"opacity": .5,
"style": "pointer-events:none"

View file

@ -60,9 +60,7 @@ $(function() {
function setItexString(tex) {
var elt = selElems[0];
try {
math = svgdoc.createElementNS(mathns, 'math');
// make an AJAX request to the server, to get the MathML
$.post(ajaxEndpoint, {'tex': tex, 'display': 'inline'}, function(data){
var math = svgdoc.createElementNS(mathns, 'math');
math.setAttributeNS(xmlnsns, 'xmlns', mathns);
math.setAttribute('display', 'inline');
var semantics = document.createElementNS(mathns, 'semantics');
@ -70,14 +68,19 @@ $(function() {
annotation.setAttribute('encoding', 'application/x-tex');
annotation.textContent = tex;
var mrow = document.createElementNS(mathns, 'mrow');
semantics.appendChild(mrow);
semantics.appendChild(annotation);
math.appendChild(semantics);
// make an AJAX request to the server, to get the MathML
$.post(ajaxEndpoint, {'tex': tex, 'display': 'inline'}, function(data){
var children = data.documentElement.childNodes;
while (children.length > 0) {
mrow.appendChild(children[0]);
}
semantics.appendChild(mrow);
semantics.appendChild(annotation);
math.appendChild(semantics);
S.sanitizeSvg(math);
//elt.setAttribute('width', math.clientWidth+5);
//elt.setAttribute('height', math.clientHeight+5);
S.call("changed", [elt]);
});
elt.replaceChild(math, elt.firstChild);
S.call("changed", [elt]);