Procházet zdrojové kódy

Merge pull request #156 from ckeditor/t/ckeditor5-core/148

Other: Change to string reference for TableUtils when using editor.plugins.get.
Piotr Jasiun před 7 roky
rodič
revize
94d0bf088a

+ 1 - 2
packages/ckeditor5-table/src/commands/insertcolumncommand.js

@@ -9,7 +9,6 @@
 
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import { findAncestor } from './utils';
-import TableUtils from '../tableutils';
 
 /**
  * The insert column command.
@@ -70,7 +69,7 @@ export default class InsertColumnCommand extends Command {
 	execute() {
 		const editor = this.editor;
 		const selection = editor.model.document.selection;
-		const tableUtils = editor.plugins.get( TableUtils );
+		const tableUtils = editor.plugins.get( 'TableUtils' );
 
 		const firstPosition = selection.getFirstPosition();
 

+ 1 - 2
packages/ckeditor5-table/src/commands/insertrowcommand.js

@@ -9,7 +9,6 @@
 
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import { findAncestor } from './utils';
-import TableUtils from '../tableutils';
 
 /**
  * The insert row command.
@@ -69,7 +68,7 @@ export default class InsertRowCommand extends Command {
 	execute() {
 		const editor = this.editor;
 		const selection = editor.model.document.selection;
-		const tableUtils = editor.plugins.get( TableUtils );
+		const tableUtils = editor.plugins.get( 'TableUtils' );
 
 		const tableCell = findAncestor( 'tableCell', selection.getFirstPosition() );
 		const tableRow = tableCell.parent;

+ 1 - 2
packages/ckeditor5-table/src/commands/inserttablecommand.js

@@ -9,7 +9,6 @@
 
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import { findOptimalInsertionPosition } from '@ckeditor/ckeditor5-widget/src/utils';
-import TableUtils from '../tableutils';
 
 /**
  * The insert table command.
@@ -49,7 +48,7 @@ export default class InsertTableCommand extends Command {
 	execute( options = {} ) {
 		const model = this.editor.model;
 		const selection = model.document.selection;
-		const tableUtils = this.editor.plugins.get( TableUtils );
+		const tableUtils = this.editor.plugins.get( 'TableUtils' );
 
 		const rows = parseInt( options.rows ) || 2;
 		const columns = parseInt( options.columns ) || 2;

+ 1 - 2
packages/ckeditor5-table/src/commands/mergecellcommand.js

@@ -10,7 +10,6 @@
 import Command from '@ckeditor/ckeditor5-core/src/command';
 import TableWalker from '../tablewalker';
 import { findAncestor, updateNumericAttribute } from './utils';
-import TableUtils from '../tableutils';
 
 /**
  * The merge cell command.
@@ -127,7 +126,7 @@ export default class MergeCellCommand extends Command {
 			return;
 		}
 
-		const tableUtils = this.editor.plugins.get( TableUtils );
+		const tableUtils = this.editor.plugins.get( 'TableUtils' );
 
 		// First get the cell on proper direction.
 		const cellToMerge = this.isHorizontal ?

+ 1 - 2
packages/ckeditor5-table/src/commands/removecolumncommand.js

@@ -10,7 +10,6 @@
 import Command from '@ckeditor/ckeditor5-core/src/command';
 
 import TableWalker from '../tablewalker';
-import TableUtils from '../tableutils';
 import { findAncestor, updateNumericAttribute } from './utils';
 
 /**
@@ -31,7 +30,7 @@ export default class RemoveColumnCommand extends Command {
 	refresh() {
 		const editor = this.editor;
 		const selection = editor.model.document.selection;
-		const tableUtils = editor.plugins.get( TableUtils );
+		const tableUtils = editor.plugins.get( 'TableUtils' );
 
 		const tableCell = findAncestor( 'tableCell', selection.getFirstPosition() );
 

+ 1 - 2
packages/ckeditor5-table/src/commands/splitcellcommand.js

@@ -8,7 +8,6 @@
  */
 
 import Command from '@ckeditor/ckeditor5-core/src/command';
-import TableUtils from '../tableutils';
 import { findAncestor } from './utils';
 
 /**
@@ -68,7 +67,7 @@ export default class SplitCellCommand extends Command {
 
 		const isHorizontally = this.direction === 'horizontally';
 
-		const tableUtils = this.editor.plugins.get( TableUtils );
+		const tableUtils = this.editor.plugins.get( 'TableUtils' );
 
 		if ( isHorizontally ) {
 			tableUtils.splitCellHorizontally( tableCell, 2 );

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

@@ -228,7 +228,7 @@ export default class TableEditing extends Plugin {
 			const isLastRow = currentRowIndex === table.childCount - 1;
 
 			if ( isForward && isLastRow && isLastCellInRow ) {
-				editor.plugins.get( TableUtils ).insertRows( table, { at: table.childCount } );
+				editor.plugins.get( 'TableUtils' ).insertRows( table, { at: table.childCount } );
 			}
 
 			let cellToFocus;