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

This commit is contained in:
Jacques Distler 2010-02-17 14:52:46 -06:00
commit 82e8b83ee3

View file

@ -21,7 +21,9 @@ $(function() {
htmlns = "http://www.w3.org/1999/xhtml", htmlns = "http://www.w3.org/1999/xhtml",
mathns = "http://www.w3.org/1998/Math/MathML", mathns = "http://www.w3.org/1998/Math/MathML",
editingforeign = false, editingforeign = false,
svgdoc = S.svgroot.parentNode.ownerDocument; svgdoc = S.svgroot.parentNode.ownerDocument,
started,
newFO;
var properlySourceSizeTextArea = function(){ var properlySourceSizeTextArea = function(){
@ -200,7 +202,8 @@ $(function() {
if(svgCanvas.getMode() == "foreign") { if(svgCanvas.getMode() == "foreign") {
var newText = S.addSvgElementFromJson({ started = true;
newFO = S.addSvgElementFromJson({
"element": "foreignObject", "element": "foreignObject",
"attr": { "attr": {
"x": opts.start_x, "x": opts.start_x,
@ -225,7 +228,7 @@ $(function() {
m.appendChild(mi); m.appendChild(mi);
m.appendChild(mo); m.appendChild(mo);
m.appendChild(mi2); m.appendChild(mi2);
newText.appendChild(m); newFO.appendChild(m);
return { return {
started: true started: true
} }
@ -233,15 +236,14 @@ $(function() {
}, },
mouseUp: function(opts) { mouseUp: function(opts) {
var e = opts.event; var e = opts.event;
if(svgCanvas.getMode() == "foreign" && started) {
if(svgCanvas.getMode() == "foreign") { var attrs = $(newFO).attr(["width", "height"]);
var attrs = $(e.target).attr(["width", "height"]);
keep = (attrs.width != 0 || attrs.height != 0); keep = (attrs.width != 0 || attrs.height != 0);
svgCanvas.addToSelection([newFO], true);
svgCanvas.addToSelection([e.target], true);
return { return {
keep: keep, keep: keep,
element: e.target element: newFO
} }
} }