Skip to content

Commit

Permalink
#4. Fixed copy and paste.
Browse files Browse the repository at this point in the history
  • Loading branch information
argimenes committed Jun 10, 2018
1 parent 9a5c3db commit c420394
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/app/modules/standoff-properties-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,11 @@
var clipboardData = e.clipboardData || window.clipboardData;
var text = clipboardData.getData('text');
var frag = this.textToDocumentFragment(text);
this.container.insertBefore(frag, e.target.nextElementSibling);
if (this.container.children.length){
this.container.insertBefore(frag, e.target.nextElementSibling);
} else {
this.container.appendChild(frag);
}
this.setCarotByNode(e.target);
this.updateCurrentRanges();
};
Expand Down Expand Up @@ -646,7 +650,7 @@
};
Editor.prototype.getSelectionNodes = function () {
var range = window.getSelection().getRangeAt(0);
if (range.startOffset == 0 && range.endOffset == 0) {
if (range.collapsed) {
return null;
}
var endContainer = range.endContainer;
Expand Down

0 comments on commit c420394

Please sign in to comment.