|
|
@@ -18,6 +18,7 @@ import remove from '@ckeditor/ckeditor5-utils/src/dom/remove';
|
|
|
import ObservableMixin from '@ckeditor/ckeditor5-utils/src/observablemixin';
|
|
|
import CKEditorError from '@ckeditor/ckeditor5-utils/src/ckeditorerror';
|
|
|
import isText from '@ckeditor/ckeditor5-utils/src/dom/istext';
|
|
|
+import diffToChanges from '@ckeditor/ckeditor5-utils/src/difftochanges';
|
|
|
|
|
|
/**
|
|
|
* Renderer updates DOM structure and selection, to make them a reflection of the view structure and selection.
|
|
|
@@ -426,7 +427,15 @@ export default class Renderer {
|
|
|
}
|
|
|
|
|
|
if ( actualText != expectedText ) {
|
|
|
- domText.data = expectedText;
|
|
|
+ const actions = diffToChanges( diff( actualText, expectedText ), expectedText );
|
|
|
+
|
|
|
+ for ( const action of actions ) {
|
|
|
+ if ( action.type === 'insert' ) {
|
|
|
+ domText.insertData( action.index, action.values.join( '' ) );
|
|
|
+ } else { // 'delete'
|
|
|
+ domText.deleteData( action.index, action.howMany );
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|