Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #263 from ckeditor/i/6114b
Browse files Browse the repository at this point in the history
Internal: Rewritten the base selection handling. Closes ckeditor/ckeditor5#6114. Closes ckeditor/ckeditor5#6330. Closes ckeditor/ckeditor5#6346. Closes ckeditor/ckeditor5#6347.
  • Loading branch information
Reinmar authored Mar 6, 2020
2 parents 7749fc8 + 5548943 commit e6eb3cd
Show file tree
Hide file tree
Showing 12 changed files with 416 additions and 1,218 deletions.
15 changes: 3 additions & 12 deletions src/tableclipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ export default class TableClipboard extends Plugin {
const editor = this.editor;
const viewDocument = editor.editing.view.document;

/**
* A table selection plugin instance.
*
* @private
* @readonly
* @member {module:table/tableselection~TableSelection} module:tableclipboard~TableClipboard#_tableSelection
*/
this._tableSelection = editor.plugins.get( 'TableSelection' );

this.listenTo( viewDocument, 'copy', ( evt, data ) => this._onCopyCut( evt, data ) );
this.listenTo( viewDocument, 'cut', ( evt, data ) => this._onCopyCut( evt, data ) );
}
Expand All @@ -60,9 +51,9 @@ export default class TableClipboard extends Plugin {
* @private
*/
_onCopyCut( evt, data ) {
const tableSelection = this._tableSelection;
const tableSelection = this.editor.plugins.get( 'TableSelection' );

if ( !tableSelection.hasMultiCellSelection ) {
if ( !tableSelection.getSelectedTableCells() ) {
return;
}

Expand All @@ -72,7 +63,7 @@ export default class TableClipboard extends Plugin {
const dataController = this.editor.data;
const viewDocument = this.editor.editing.view.document;

const content = dataController.toView( this._tableSelection.getSelectionAsFragment() );
const content = dataController.toView( tableSelection.getSelectionAsFragment() );

viewDocument.fire( 'clipboardOutput', {
dataTransfer: data.dataTransfer,
Expand Down
Loading

0 comments on commit e6eb3cd

Please sign in to comment.