@ckeditor/ckeditor5-table 35.2.1 → 35.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-table",
|
|
3
|
-
"version": "35.
|
|
3
|
+
"version": "35.3.0",
|
|
4
4
|
"description": "Table feature for CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -12,34 +12,34 @@
|
|
|
12
12
|
],
|
|
13
13
|
"main": "src/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"ckeditor5": "^35.
|
|
15
|
+
"ckeditor5": "^35.3.0",
|
|
16
16
|
"lodash-es": "^4.17.15"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@ckeditor/ckeditor5-alignment": "^35.
|
|
20
|
-
"@ckeditor/ckeditor5-basic-styles": "^35.
|
|
21
|
-
"@ckeditor/ckeditor5-block-quote": "^35.
|
|
22
|
-
"@ckeditor/ckeditor5-clipboard": "^35.
|
|
23
|
-
"@ckeditor/ckeditor5-core": "^35.
|
|
19
|
+
"@ckeditor/ckeditor5-alignment": "^35.3.0",
|
|
20
|
+
"@ckeditor/ckeditor5-basic-styles": "^35.3.0",
|
|
21
|
+
"@ckeditor/ckeditor5-block-quote": "^35.3.0",
|
|
22
|
+
"@ckeditor/ckeditor5-clipboard": "^35.3.0",
|
|
23
|
+
"@ckeditor/ckeditor5-core": "^35.3.0",
|
|
24
24
|
"@ckeditor/ckeditor5-dev-utils": "^31.0.0",
|
|
25
|
-
"@ckeditor/ckeditor5-editor-classic": "^35.
|
|
26
|
-
"@ckeditor/ckeditor5-engine": "^35.
|
|
27
|
-
"@ckeditor/ckeditor5-highlight": "^35.
|
|
28
|
-
"@ckeditor/ckeditor5-horizontal-line": "^35.
|
|
29
|
-
"@ckeditor/ckeditor5-html-support": "^35.
|
|
30
|
-
"@ckeditor/ckeditor5-image": "^35.
|
|
31
|
-
"@ckeditor/ckeditor5-indent": "^35.
|
|
32
|
-
"@ckeditor/ckeditor5-link": "^35.
|
|
33
|
-
"@ckeditor/ckeditor5-list": "^35.
|
|
34
|
-
"@ckeditor/ckeditor5-media-embed": "^35.
|
|
35
|
-
"@ckeditor/ckeditor5-paragraph": "^35.
|
|
36
|
-
"@ckeditor/ckeditor5-theme-lark": "^35.
|
|
37
|
-
"@ckeditor/ckeditor5-typing": "^35.
|
|
38
|
-
"@ckeditor/ckeditor5-ui": "^35.
|
|
39
|
-
"@ckeditor/ckeditor5-undo": "^35.
|
|
40
|
-
"@ckeditor/ckeditor5-utils": "^35.
|
|
41
|
-
"@ckeditor/ckeditor5-widget": "^35.
|
|
42
|
-
"@ckeditor/ckeditor5-source-editing": "^35.
|
|
25
|
+
"@ckeditor/ckeditor5-editor-classic": "^35.3.0",
|
|
26
|
+
"@ckeditor/ckeditor5-engine": "^35.3.0",
|
|
27
|
+
"@ckeditor/ckeditor5-highlight": "^35.3.0",
|
|
28
|
+
"@ckeditor/ckeditor5-horizontal-line": "^35.3.0",
|
|
29
|
+
"@ckeditor/ckeditor5-html-support": "^35.3.0",
|
|
30
|
+
"@ckeditor/ckeditor5-image": "^35.3.0",
|
|
31
|
+
"@ckeditor/ckeditor5-indent": "^35.3.0",
|
|
32
|
+
"@ckeditor/ckeditor5-link": "^35.3.0",
|
|
33
|
+
"@ckeditor/ckeditor5-list": "^35.3.0",
|
|
34
|
+
"@ckeditor/ckeditor5-media-embed": "^35.3.0",
|
|
35
|
+
"@ckeditor/ckeditor5-paragraph": "^35.3.0",
|
|
36
|
+
"@ckeditor/ckeditor5-theme-lark": "^35.3.0",
|
|
37
|
+
"@ckeditor/ckeditor5-typing": "^35.3.0",
|
|
38
|
+
"@ckeditor/ckeditor5-ui": "^35.3.0",
|
|
39
|
+
"@ckeditor/ckeditor5-undo": "^35.3.0",
|
|
40
|
+
"@ckeditor/ckeditor5-utils": "^35.3.0",
|
|
41
|
+
"@ckeditor/ckeditor5-widget": "^35.3.0",
|
|
42
|
+
"@ckeditor/ckeditor5-source-editing": "^35.3.0",
|
|
43
43
|
"json-diff": "^0.5.4",
|
|
44
44
|
"webpack": "^5.58.1",
|
|
45
45
|
"webpack-cli": "^4.9.0"
|
|
@@ -89,7 +89,7 @@ export default class ToggleTableCaptionCommand extends Command {
|
|
|
89
89
|
// Try restoring the caption from the TableCaptionEditing plugin storage.
|
|
90
90
|
const newCaptionElement = savedCaptionElement || writer.createElement( 'caption' );
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
model.insertContent( newCaptionElement, tableElement, 'end' );
|
|
93
93
|
|
|
94
94
|
if ( focusCaptionOnShow ) {
|
|
95
95
|
writer.setSelection( newCaptionElement, 'in' );
|
|
@@ -114,7 +114,6 @@ export default class ToggleTableCaptionCommand extends Command {
|
|
|
114
114
|
// Store the caption content so it can be restored quickly if the user changes their mind.
|
|
115
115
|
tableCaptionEditing._saveCaption( tableElement, captionElement );
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
writer.remove( captionElement );
|
|
117
|
+
model.deleteContent( writer.createSelection( captionElement, 'on' ) );
|
|
119
118
|
}
|
|
120
119
|
}
|
package/src/tableselection.js
CHANGED
|
@@ -44,8 +44,10 @@ export default class TableSelection extends Plugin {
|
|
|
44
44
|
init() {
|
|
45
45
|
const editor = this.editor;
|
|
46
46
|
const model = editor.model;
|
|
47
|
+
const view = editor.editing.view;
|
|
47
48
|
|
|
48
49
|
this.listenTo( model, 'deleteContent', ( evt, args ) => this._handleDeleteContent( evt, args ), { priority: 'high' } );
|
|
50
|
+
this.listenTo( view.document, 'insertText', ( evt, data ) => this._handleInsertTextEvent( evt, data ), { priority: 'high' } );
|
|
49
51
|
|
|
50
52
|
this._defineSelectionConverter();
|
|
51
53
|
this._enablePluginDisabling(); // sic!
|
|
@@ -303,6 +305,41 @@ export default class TableSelection extends Plugin {
|
|
|
303
305
|
} );
|
|
304
306
|
}
|
|
305
307
|
|
|
308
|
+
/**
|
|
309
|
+
* This handler makes it possible to remove the content of all selected cells by starting to type.
|
|
310
|
+
* If you take a look at {@link #_defineSelectionConverter} you will find out that despite the multi-cell selection being set
|
|
311
|
+
* in the model, the view selection is collapsed in the last cell (because most browsers are unable to render multi-cell selections;
|
|
312
|
+
* yes, it's a hack).
|
|
313
|
+
*
|
|
314
|
+
* When multiple cells are selected in the model and the user starts to type, the
|
|
315
|
+
* {@link module:engine/view/document~Document#event:insertText} event carries information provided by the
|
|
316
|
+
* beforeinput DOM event, that in turn only knows about this collapsed DOM selection in the last cell.
|
|
317
|
+
*
|
|
318
|
+
* As a result, the selected cells have no chance to be cleaned up. To fix this, this listener intercepts
|
|
319
|
+
* the event and injects the custom view selection in the data that translates correctly to the actual state
|
|
320
|
+
* of the multi-cell selection in the model.
|
|
321
|
+
*
|
|
322
|
+
* @private
|
|
323
|
+
* @param {module:utils/eventinfo~EventInfo} event
|
|
324
|
+
* @param {module:engine/view/observer/domeventdata~DomEventData} data Insert text event data.
|
|
325
|
+
*/
|
|
326
|
+
_handleInsertTextEvent( evt, data ) {
|
|
327
|
+
const editor = this.editor;
|
|
328
|
+
const model = editor.model;
|
|
329
|
+
const modelSelection = model.document.selection;
|
|
330
|
+
const selectedCells = this.getSelectedTableCells( modelSelection );
|
|
331
|
+
|
|
332
|
+
if ( !selectedCells ) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const view = editor.editing.view;
|
|
337
|
+
const mapper = editor.editing.mapper;
|
|
338
|
+
const viewRanges = selectedCells.map( tableCell => view.createRangeOn( mapper.toViewElement( tableCell ) ) );
|
|
339
|
+
|
|
340
|
+
data.selection = view.createSelection( viewRanges );
|
|
341
|
+
}
|
|
342
|
+
|
|
306
343
|
/**
|
|
307
344
|
* Returns an array of table cells that should be selected based on the
|
|
308
345
|
* given anchor cell and target (focus) cell.
|