|
|
@@ -5,7 +5,13 @@
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
-CKEDITOR.define( [ 'document/operation', 'document/nodelist', 'document/insertoperation' ], function( Operation, NodeList ) {
|
|
|
+CKEDITOR.define( [
|
|
|
+ 'document/operation',
|
|
|
+ 'document/nodelist',
|
|
|
+ 'ckeditorerror',
|
|
|
+ 'utils',
|
|
|
+ 'document/insertoperation'
|
|
|
+], function( Operation, NodeList, CKEditorError, utils ) {
|
|
|
/**
|
|
|
*
|
|
|
*
|
|
|
@@ -23,7 +29,30 @@ CKEDITOR.define( [ 'document/operation', 'document/nodelist', 'document/insertop
|
|
|
}
|
|
|
|
|
|
_execute() {
|
|
|
- this.position.parent.children.remove( this.position.offset, this.nodeList.length );
|
|
|
+ var children = this.position.parent.children;
|
|
|
+ var offset = this.position.offset;
|
|
|
+
|
|
|
+ if ( CKEDITOR.isDebug ) {
|
|
|
+ var i = 0;
|
|
|
+
|
|
|
+ for ( var node of this.nodeList ) {
|
|
|
+ if ( !utils.isEqual( children.get( offset + i ), node ) ) {
|
|
|
+ /**
|
|
|
+ * The node which should be removed does not exists.
|
|
|
+ *
|
|
|
+ * @error operation-remove-node-does-not-exists:
|
|
|
+ * @param {document.RemoveOperation} removeOperation
|
|
|
+ * @param {document.Node} node
|
|
|
+ */
|
|
|
+ throw new CKEditorError(
|
|
|
+ 'operation-remove-node-does-not-exists: The node which should be removed does not exists.',
|
|
|
+ { removeOperation: this, node: this.node } );
|
|
|
+ }
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ children.remove( offset, this.nodeList.length );
|
|
|
}
|
|
|
|
|
|
reverseOperation() {
|