8
0
Quellcode durchsuchen

Remove exported getSelectedTableCell as it was used only in one place.

Maciej Gołaszewski vor 5 Jahren
Ursprung
Commit
a3bca8f9be

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

@@ -30,20 +30,6 @@ export function findAncestor( parentName, positionOrElement ) {
 }
 
 /**
- * Returns the first selected table cell from a multi-cell or in-cell selection.
- *
- *		const tableCell = getSelectedTableCell( editor.model.document.selection.getFirstPosition() );
- *
- * @param {module:engine/model/position~Position} position Document position.
- * @returns {module:engine/model/element~Element}
- */
-export function getSelectedTableCell( position ) {
-	const isTableCellSelected = position.nodeAfter && position.nodeAfter.is( 'tableCell' );
-
-	return isTableCellSelected ? position.nodeAfter : findAncestor( 'tableCell', position );
-}
-
-/**
  * A common method to update the numeric value. If a value is the default one, it will be unset.
  *
  * @param {String} key An attribute key.

+ 12 - 2
packages/ckeditor5-table/src/ui/utils.js

@@ -14,7 +14,7 @@ import Model from '@ckeditor/ckeditor5-ui/src/model';
 import ColorInputView from './colorinputview';
 import { isColor, isLength, isPercentage } from '@ckeditor/ckeditor5-engine/src/view/styles/utils';
 import { getTableWidgetAncestor } from '../utils';
-import { findAncestor, getSelectedTableCell } from '../commands/utils';
+import { findAncestor } from '../commands/utils';
 
 const DEFAULT_BALLOON_POSITIONS = BalloonPanelView.defaultPositions;
 const BALLOON_POSITIONS = [
@@ -81,7 +81,7 @@ export function getBalloonTablePositionData( editor ) {
  * @returns {module:utils/dom/position~Options}
  */
 export function getBalloonCellPositionData( editor ) {
-	const modelTableCell = getSelectedTableCell( editor.model.document.selection.getFirstPosition() );
+	const modelTableCell = getTableCellAtPosition( editor.model.document.selection.getFirstPosition() );
 	const viewTableCell = editor.editing.mapper.toViewElement( modelTableCell );
 
 	return {
@@ -467,3 +467,13 @@ function colorConfigToColorGridDefinitions( colorConfig ) {
 		}
 	} ) );
 }
+
+// Returns the first selected table cell from a multi-cell or in-cell selection.
+//
+// @param {module:engine/model/position~Position} position Document position.
+// @returns {module:engine/model/element~Element}
+function getTableCellAtPosition( position ) {
+	const isTableCellSelected = position.nodeAfter && position.nodeAfter.is( 'tableCell' );
+
+	return isTableCellSelected ? position.nodeAfter : findAncestor( 'tableCell', position );
+}