Skip to content

Commit

Permalink
Rich Text: Create range fragments by clone
Browse files Browse the repository at this point in the history
Avoid destroying original content incurred by extractContents
  • Loading branch information
aduth committed Jul 19, 2018
1 parent 9b26aab commit 2ca302b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions editor/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ export class RichText extends Component {
afterRange.setStart( selectionRange.endContainer, selectionRange.endOffset );
afterRange.setEnd( rootNode, dom.nodeIndex( rootNode.lastChild ) + 1 );

const beforeFragment = beforeRange.extractContents();
const afterFragment = afterRange.extractContents();
const beforeFragment = beforeRange.cloneContents();
const afterFragment = afterRange.cloneContents();

const { format } = this.props;
before = domToFormat( filterEmptyNodes( beforeFragment.childNodes ), format, this.editor );
Expand Down

0 comments on commit 2ca302b

Please sign in to comment.