Преглед изворни кода

Apply suggestions from code review

Co-authored-by: Maciej <jodator@jodator.net>
Kuba Niegowski пре 5 година
родитељ
комит
7aa2f44cbf

+ 1 - 1
packages/ckeditor5-table/src/tablenavigation.js

@@ -197,7 +197,7 @@ export default class TableNavigation extends Plugin {
 		const selectedCells = getSelectedTableCells( selection );
 
 		if ( selectedCells.length ) {
-			let focusCell = null;
+			let focusCell;
 
 			if ( expandSelection ) {
 				focusCell = this.editor.plugins.get( 'TableSelection' ).getFocusCell();

+ 7 - 0
packages/ckeditor5-table/src/tableselection.js

@@ -111,6 +111,13 @@ export default class TableSelection extends Plugin {
 	 * Sets the model selection based on given anchor and target cells (can be the same cell).
 	 * Takes care of setting the backward flag.
 	 *
+	 *		const modelRoot = editor.model.document.getRoot();
+	 *		const firstCell = modelRoot.getNodeByPath( [ 0, 0, 0 ] );
+	 *		const lastCell = modelRoot.getNodeByPath( [ 0, 0, 1 ] );
+	 *
+	 *		const tableSelection = editor.plugins.get( 'TableSelection' );
+	 *		tableSelection.setCellSelection( firstCell, lastCell );
+	 *
 	 * @param {module:engine/model/element~Element} anchorCell
 	 * @param {module:engine/model/element~Element} targetCell
 	 */