Skip to content

Commit

Permalink
Avoid selection fixing on multiple table cells selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
niegowski committed Oct 4, 2024
1 parent 2ae8696 commit c744843
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/ckeditor5-table/src/tableselection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,12 @@ export default class TableSelection extends Plugin {
highlighted.add( viewElement );
}

const lastViewCell = conversionApi.mapper.toViewElement( selectedCells[ selectedCells.length - 1 ] );
viewWriter.setSelection( lastViewCell, 0 );
// TODO ShadowRoot - find nearest selectable position so browser won't try to fix it
const lastModelCell = selectedCells[ selectedCells.length - 1 ];
const modelRange = editor.model.schema.getNearestSelectionRange( editor.model.createPositionAt( lastModelCell, 0 ), 'forward' );
const viewRange = conversionApi.mapper.toViewRange( modelRange );

viewWriter.setSelection( viewRange.start );
}, { priority: 'lowest' } ) );

function clearHighlightedTableCells( viewWriter: DowncastWriter ) {
Expand Down

0 comments on commit c744843

Please sign in to comment.