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

Decorate model.deleteContent in order to handle cut on table fragment.

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

+ 11 - 1
packages/ckeditor5-table/src/tableclipboard.js

@@ -53,7 +53,17 @@ export default class TableClipboard extends Plugin {
 
 		this.listenTo( viewDocument, 'copy', ( evt, data ) => this._onCopyCut( evt, data ) );
 		this.listenTo( viewDocument, 'cut', ( evt, data ) => this._onCopyCut( evt, data ) );
-		this.listenTo( viewDocument, 'clipboardOutput', ( evt, data ) => this._onClipboardOutput( evt, data ) );
+
+		// TODO: move to table selection plugin as it looks like a general problem solver.
+
+		this.listenTo( editor.model, 'deleteContent', ( evt, args ) => {
+			const [ selection ] = args;
+			if ( this._tableSelection.hasMultiCellSelection && selection.is( 'documentSelection' ) ) {
+				evt.stop();
+
+				clearTableCellsContents( this.editor.model, this._tableSelection.getSelectedTableCells() );
+			}
+		}, { priority: 'high' } );
 	}
 
 	/**