Skip to content

Commit

Permalink
Fix copy paste over highlighted text bug
Browse files Browse the repository at this point in the history
  • Loading branch information
danallison committed Jul 4, 2017
1 parent a9437e9 commit 0316a6e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions app/assets/javascripts/shared/Item/item.insertTextAtCursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ calculist.require(['Item','_','parseTextDoc','getNewGuid','transaction','cursorP
);

var start = Math.min(selection.anchorOffset, selection.extentOffset),
end = Math.max(selection.anchorOffset, selection.extentOffset),
range = _.range(start, end),
count = Math.max(selection.anchorOffset, selection.extentOffset) - start,
textArray = _.toArray(this.text);

_.pullAt(textArray, range);

textArray.splice(start, 0, insertingText);
textArray.splice(start, count, insertingText);

transaction(function () {
this.text = textArray.join('');
Expand Down

0 comments on commit 0316a6e

Please sign in to comment.