- var asideElement = position.element.divide({tag: 'aside', klass: 'footnote', offset: position.offset});
+ if(cursor.isSelectingWithinElement()) {
+ asideElement = position.element.wrapWithNodeElement({tag: 'aside', klass: 'footnote', start: cursor.getSelectionStart().offset, end: cursor.getSelectionEnd().offset});
+ } else {
+ asideElement = position.element.divide({tag: 'aside', klass: 'footnote', offset: position.offset});
+ asideElement.append({text: ''});
+ }