Currently finding canvas element for a document node that
was moved to a different place requires knowing its original parent.
-var findCanvasElement = function(node) {
+var findCanvasElement = function(node, childOf) {
if(node.nodeType === Node.ELEMENT_NODE) {
return node.getData('canvasElement');
}
if(node.nodeType === Node.TEXT_NODE) {
if(node.nodeType === Node.ELEMENT_NODE) {
return node.getData('canvasElement');
}
if(node.nodeType === Node.TEXT_NODE) {
- return findCanvasElementInParent(node, node.parent());
+ return findCanvasElementInParent(node, childOf || node.parent());
referenceAction = 'after';
}
referenceAction = 'after';
}
- actionArg = (checkForExistence && utils.findCanvasElement(event.meta.node)) || event.meta.node;
+ actionArg = (checkForExistence && utils.findCanvasElement(event.meta.node, event.meta.parent)) || event.meta.node;
referenceElement[referenceAction](actionArg);
},
nodeMoved: function(event) {
referenceElement[referenceAction](actionArg);
},
nodeMoved: function(event) {