8
0
Просмотр исходного кода

Make delete commands optional in table selection integrations.

Maciej Gołaszewski 5 лет назад
Родитель
Сommit
9495780d99
1 измененных файлов с 12 добавлено и 6 удалено
  1. 12 6
      packages/ckeditor5-table/src/tableselection.js

+ 12 - 6
packages/ckeditor5-table/src/tableselection.js

@@ -114,14 +114,20 @@ export default class TableSelection extends Plugin {
 		const editor = this.editor;
 
 		const deleteCommand = editor.commands.get( 'delete' );
+
+		if ( deleteCommand ) {
+			this.listenTo( deleteCommand, 'execute', event => {
+				this._handleDeleteCommand( event, { isForward: false } );
+			}, { priority: 'high' } );
+		}
+
 		const forwardDeleteCommand = editor.commands.get( 'forwardDelete' );
 
-		this.listenTo( deleteCommand, 'execute', event => {
-			this._handleDeleteCommand( event, { isForward: false } );
-		}, { priority: 'high' } );
-		this.listenTo( forwardDeleteCommand, 'execute', event => {
-			this._handleDeleteCommand( event, { isForward: true } );
-		}, { priority: 'high' } );
+		if ( forwardDeleteCommand ) {
+			this.listenTo( forwardDeleteCommand, 'execute', event => {
+				this._handleDeleteCommand( event, { isForward: true } );
+			}, { priority: 'high' } );
+		}
 	}
 
 	/**