- if(currentElement) {
- canvas.wlxmlDocument.startTransaction();
- added = currentElement.data('wlxmlNode').after({
- tagName: currentElement.getWlxmlTag() || 'div',
- attrs: {'class': currentElement.getWlxmlClass() || 'p'}
+ if(currentElement && !currentElement.wlxmlNode.isRoot()) {
+ canvas.wlxmlDocument.transaction(function() {
+ var added = currentElement.wlxmlNode.after({
+ tagName: currentElement.wlxmlNode.getTagName() || 'div',
+ attrs: {'class': currentElement.wlxmlNode.getClass() || 'p'}
+ });
+ added.append({text:''});
+ return added;
+ }, {
+ metadata: {
+ description: gettext('Splitting text')
+ },
+ success: function(ret) {
+ canvas.setCurrentElement(utils.getElementForNode(ret), {caretTo: 'start'});
+ }