- //var nodes = position.element.data('wlxmlNode').split({offset: position.offset}),
- // var nodes = position.element.data('wlxmlNode').transform('split', {offset: position.offset}),
- // newEmpty,
- // goto,
- // gotoOptions;
-
- // if(position.offsetAtBeginning)
- // newEmpty = nodes.first;
- // else if(position.offsetAtEnd)
- // newEmpty = nodes.second;
-
- // if(newEmpty) {
- // //goto = newEmpty.append({text: ''});
- // gotoOptions = {};
- // } else {
- // goto = nodes.second;
- // gotoOptions = {caretTo: 'start'};
- // }
- var node = position.element.wlxmlNode,
- result, goto, gotoOptions;
-
- node.document.transaction(function() {
- result = position.element.wlxmlNode.breakContent({offset: position.offset});
- }, this, gettext('Splitting text'));
-
- if(result.emptyText) {
- goto = result.emptyText;
- gotoOptions = {};
- } else {
- goto = result.second;
- gotoOptions = {caretTo: 'start'};
+ if(s.offset === 0) {
+ e.preventDefault();
+ prev = s.canvas.getPreviousTextElement(s.element);
+ if(prev) {
+ scroll('top', prev.dom[0]);
+ s.canvas.setCurrentElement(s.canvas.getDocumentElement(prev.dom.contents()[0]), {caretTo: 'end'});