Skip to content

Commit

Permalink
fix #883
Browse files Browse the repository at this point in the history
  • Loading branch information
jhchen committed Aug 23, 2016
1 parent c75e22f commit 5aee3a3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import DeltaOp from 'rich-text/lib/op';
import Emitter from './emitter';
import Parchment from 'parchment';
import CodeBlock from '../formats/code';
import CursorBlot from '../blots/cursor';
import Block, { bubbleFormats } from '../blots/block';
import clone from 'clone';
import equal from 'deep-equal';
Expand Down Expand Up @@ -198,7 +199,8 @@ class Editor {
let textBlot = Parchment.find(mutations[0].target);
let formats = bubbleFormats(textBlot);
let index = textBlot.offset(this.scroll);
let oldText = new Delta().insert(mutations[0].oldValue);
let oldValue = mutations[0].oldValue.replace(CursorBlot.CONTENTS, '');
let oldText = new Delta().insert(oldValue);
let newText = new Delta().insert(textBlot.value());
let diffDelta = new Delta().retain(index).concat(oldText.diff(newText));
change = diffDelta.ops.reduce(function(delta, op) {
Expand Down

0 comments on commit 5aee3a3

Please sign in to comment.