Sfoglia il codice sorgente

Move getSelectedTableCells() to TableCellPropertyCommand.

Maciej Gołaszewski 5 anni fa
parent
commit
023d2e39df

+ 0 - 8
packages/ckeditor5-table/src/commands/utils.js

@@ -43,14 +43,6 @@ export function getSelectedTableCell( position ) {
 	return isTableCellSelected ? position.nodeAfter : findAncestor( 'tableCell', position );
 }
 
-export function getSelectedTableCells( model ) {
-	const selection = model.document.selection;
-
-	return Array.from( selection.getSelectedBlocks() )
-		.map( element => findAncestor( 'tableCell', model.createPositionAt( element, 0 ) ) )
-		.filter( tableCell => !!tableCell );
-}
-
 /**
  * A common method to update the numeric value. If a value is the default one, it will be unset.
  *

+ 10 - 1
packages/ckeditor5-table/src/tablecellproperties/commands/tablecellpropertycommand.js

@@ -9,7 +9,7 @@
 
 import Command from '@ckeditor/ckeditor5-core/src/command';
 
-import { getSelectedTableCells } from '../../commands/utils';
+import { findAncestor } from '../../commands/utils';
 
 /**
  * The table cell attribute command.
@@ -111,3 +111,12 @@ export default class TableCellPropertyCommand extends Command {
 		return everyCellHasAttribute ? firstCellValue : undefined;
 	}
 }
+
+// Returns all selected table cells.
+function getSelectedTableCells( model ) {
+	const selection = model.document.selection;
+
+	return Array.from( selection.getSelectedBlocks() )
+		.map( element => findAncestor( 'tableCell', model.createPositionAt( element, 0 ) ) )
+		.filter( tableCell => !!tableCell );
+}