insertNewNode: function(wlxmlTag, wlxmlClass) {\r
//TODO: Insert inline\r
var anchor = $(window.getSelection().anchorNode);\r
+ var anchorOffset = window.getSelection().anchorOffset;\r
if(anchor[0].nodeType === Node.TEXT_NODE)\r
anchor = anchor.parent();\r
if(anchor.text() === '') {\r
todel.remove();\r
}\r
var newNode = this._createNode(wlxmlTag || anchor.attr('wlxml-tag'), wlxmlClass || anchor.attr('wlxml-class'));\r
- anchor.after(newNode);\r
+ if(anchorOffset === 0)\r
+ anchor.before(newNode)\r
+ else\r
+ anchor.after(newNode);\r
mediator.nodeCreated(newNode);\r
isDirty = true;\r
},\r