|
@@ -13,6 +13,7 @@ import RemoveOperation from '../operation/removeoperation.js';
|
|
|
import MoveOperation from '../operation/moveoperation.js';
|
|
import MoveOperation from '../operation/moveoperation.js';
|
|
|
import Element from '../element.js';
|
|
import Element from '../element.js';
|
|
|
import Position from '../position.js';
|
|
import Position from '../position.js';
|
|
|
|
|
+import CKEditorError from '../../../utils/ckeditorerror.js';
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* To provide specific OT behavior and better collisions solving, the {@link engine.model.Batch#rename Batch#rename} method
|
|
* To provide specific OT behavior and better collisions solving, the {@link engine.model.Batch#rename Batch#rename} method
|
|
@@ -50,6 +51,15 @@ function apply( batch, delta, operation ) {
|
|
|
* @param {engine.model.Element} element The element to rename.
|
|
* @param {engine.model.Element} element The element to rename.
|
|
|
*/
|
|
*/
|
|
|
register( 'rename', function( newName, element ) {
|
|
register( 'rename', function( newName, element ) {
|
|
|
|
|
+ if ( !( element instanceof Element ) ) {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Trying to rename an object which is not an instance of Element.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @error batch-rename-not-element-instance
|
|
|
|
|
+ */
|
|
|
|
|
+ throw new CKEditorError( 'batch-rename-not-element-instance: Trying to rename an object which is not an instance of Element.' );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const delta = new RenameDelta();
|
|
const delta = new RenameDelta();
|
|
|
this.addDelta( delta );
|
|
this.addDelta( delta );
|
|
|
|
|
|