- if(!selection.isCollapsed && element1.parent().sameNode(element2.parent())) {
- var parent = element1.parent(),
- offsetStart = selection.anchorOffset,
- offsetEnd = selection.focusOffset;
-
- if(element1.sameNode(element2)) {
- element1.wrapWithNodeElement({tag: params.wlxmlTag, klass: params.wlxmlClass, start: offsetStart, end: offsetEnd});
+ if(cursor.isSelecting() && cursor.isSelectingSiblings()) {
+ if(cursor.isSelectingWithinElement()) {
+ selectionStart.element.wrapWithNodeElement({tag: params.wlxmlTag, klass: params.wlxmlClass, start: selectionStart.offset, end: selectionEnd.offset});