-// commands.register('wrap-node', function(canvas) {
-// var cursor = canvas.getCursor(),
-// selectionStart = cursor.getSelectionStart(),
-// selectionEnd = cursor.getSelectionEnd(),
-// parent1 = selectionStart.element.parent() || undefined,
-// parent2 = selectionEnd.element.parent() || undefined;
+commands.register('wrap-node', function(canvas) {
+ var cursor = canvas.getCursor(),
+ selectionStart = cursor.getSelectionStart(),
+ selectionEnd = cursor.getSelectionEnd(),
+ parent1 = selectionStart.element.parent() || undefined,
+ parent2 = selectionEnd.element.parent() || undefined;
+
+ var node1 = parent1.data('wlxmlNode'),
+ node2 = parent2.data('wlxmlNode'),
+ doc = node1.document;