@ckeditor/ckeditor5-table 0.0.0-nightly-20260118.0 → 0.0.0-nightly-next-20260118.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/ckeditor5-metadata.json +16 -7
- package/{src → dist}/augmentation.d.ts +0 -15
- package/{src → dist}/commands/insertcolumncommand.d.ts +1 -1
- package/{src → dist}/commands/insertrowcommand.d.ts +1 -1
- package/{src → dist}/commands/inserttablecommand.d.ts +1 -1
- package/{src → dist}/commands/inserttablelayoutcommand.d.ts +1 -1
- package/{src → dist}/commands/mergecellcommand.d.ts +3 -3
- package/{src → dist}/commands/mergecellscommand.d.ts +1 -1
- package/{src → dist}/commands/removecolumncommand.d.ts +1 -1
- package/{src → dist}/commands/removerowcommand.d.ts +1 -1
- package/{src → dist}/commands/selectcolumncommand.d.ts +1 -1
- package/{src → dist}/commands/selectrowcommand.d.ts +1 -1
- package/{src → dist}/commands/setheadercolumncommand.d.ts +1 -1
- package/{src → dist}/commands/setheaderrowcommand.d.ts +1 -1
- package/{src → dist}/commands/splitcellcommand.d.ts +1 -1
- package/{src → dist}/converters/downcast.d.ts +2 -2
- package/{src → dist}/converters/table-caption-post-fixer.d.ts +1 -1
- package/{src → dist}/converters/table-cell-paragraph-post-fixer.d.ts +1 -1
- package/{src → dist}/converters/table-cell-refresh-handler.d.ts +1 -1
- package/{src → dist}/converters/table-headings-refresh-handler.d.ts +1 -1
- package/{src → dist}/converters/table-layout-post-fixer.d.ts +1 -1
- package/{src → dist}/converters/tableproperties.d.ts +2 -2
- package/{src → dist}/converters/upcasttable.d.ts +1 -1
- package/dist/index-content.css +30 -30
- package/dist/index-editor.css +104 -170
- package/dist/index.css +147 -237
- package/dist/index.css.map +1 -1
- package/{src → dist}/index.d.ts +2 -5
- package/dist/index.js +423 -2408
- package/dist/index.js.map +1 -1
- package/{src → dist}/plaintableoutput.d.ts +1 -1
- package/{src → dist}/table.d.ts +2 -2
- package/{src → dist}/tablecaption/tablecaptionediting.d.ts +2 -2
- package/{src → dist}/tablecaption/tablecaptionui.d.ts +1 -1
- package/{src → dist}/tablecaption/toggletablecaptioncommand.d.ts +1 -1
- package/{src → dist}/tablecaption/utils.d.ts +1 -1
- package/{src → dist}/tablecaption.d.ts +1 -1
- package/{src → dist}/tablecellproperties/commands/tablecellbackgroundcolorcommand.d.ts +1 -1
- package/{src → dist}/tablecellproperties/commands/tablecellbordercolorcommand.d.ts +2 -2
- package/{src → dist}/tablecellproperties/commands/tablecellborderstylecommand.d.ts +2 -2
- package/{src → dist}/tablecellproperties/commands/tablecellborderwidthcommand.d.ts +2 -2
- package/{src → dist}/tablecellproperties/commands/tablecellheightcommand.d.ts +1 -1
- package/{src → dist}/tablecellproperties/commands/tablecellhorizontalalignmentcommand.d.ts +1 -1
- package/{src → dist}/tablecellproperties/commands/tablecellpaddingcommand.d.ts +2 -2
- package/{src → dist}/tablecellproperties/commands/tablecellpropertycommand.d.ts +2 -2
- package/{src → dist}/tablecellproperties/commands/tablecelltypecommand.d.ts +2 -6
- package/{src → dist}/tablecellproperties/commands/tablecellverticalalignmentcommand.d.ts +1 -1
- package/{src → dist}/tablecellproperties/tablecellpropertiesediting.d.ts +1 -1
- package/{src → dist}/tablecellproperties/tablecellpropertiesui.d.ts +2 -2
- package/dist/tablecellproperties/tablecellpropertiesutils.d.ts +18 -0
- package/{src/tablecellproperties/ui/tablecellpropertiesviewexperimental.d.ts → dist/tablecellproperties/ui/tablecellpropertiesview.d.ts} +11 -12
- package/{src → dist}/tablecellproperties.d.ts +1 -1
- package/{src → dist}/tablecellwidth/commands/tablecellwidthcommand.d.ts +1 -1
- package/{src → dist}/tablecellwidth/tablecellwidthediting.d.ts +1 -1
- package/{src → dist}/tableclipboard.d.ts +3 -3
- package/{src → dist}/tablecolumnresize/converters.d.ts +1 -1
- package/{src → dist}/tablecolumnresize/tablecolumnresizeediting.d.ts +2 -2
- package/{src → dist}/tablecolumnresize/tablewidthscommand.d.ts +2 -2
- package/{src → dist}/tablecolumnresize/utils.d.ts +2 -2
- package/{src → dist}/tablecolumnresize.d.ts +1 -1
- package/{src → dist}/tableconfig.d.ts +26 -6
- package/{src → dist}/tableediting.d.ts +3 -3
- package/{src → dist}/tablekeyboard.d.ts +3 -3
- package/{src → dist}/tablelayout/commands/tabletypecommand.d.ts +1 -1
- package/{src → dist}/tablelayout/tablelayoutediting.d.ts +1 -1
- package/{src → dist}/tablelayout/tablelayoutui.d.ts +1 -1
- package/{src → dist}/tablelayout.d.ts +1 -1
- package/{src → dist}/tablemouse/mouseeventsobserver.d.ts +1 -1
- package/{src → dist}/tablemouse.d.ts +1 -1
- package/{src → dist}/tableproperties/commands/tablealignmentcommand.d.ts +1 -1
- package/{src → dist}/tableproperties/commands/tablebackgroundcolorcommand.d.ts +1 -1
- package/{src → dist}/tableproperties/commands/tablebordercolorcommand.d.ts +2 -2
- package/{src → dist}/tableproperties/commands/tableborderstylecommand.d.ts +2 -2
- package/{src → dist}/tableproperties/commands/tableborderwidthcommand.d.ts +2 -2
- package/{src → dist}/tableproperties/commands/tableheightcommand.d.ts +1 -1
- package/{src → dist}/tableproperties/commands/tablepropertycommand.d.ts +2 -2
- package/{src → dist}/tableproperties/commands/tablewidthcommand.d.ts +1 -1
- package/{src → dist}/tableproperties/tablepropertiesediting.d.ts +1 -1
- package/{src → dist}/tableproperties/tablepropertiesui.d.ts +2 -2
- package/{src → dist}/tableproperties/ui/tablepropertiesview.d.ts +10 -2
- package/{src → dist}/tableproperties.d.ts +1 -1
- package/{src → dist}/tableselection.d.ts +2 -2
- package/{src → dist}/tabletoolbar.d.ts +2 -2
- package/{src → dist}/tableui.d.ts +1 -1
- package/{src → dist}/tableutils.d.ts +2 -2
- package/{src → dist}/tablewalker.d.ts +1 -1
- package/{src → dist}/ui/colorinputview.d.ts +2 -2
- package/{src → dist}/ui/inserttableview.d.ts +2 -2
- package/{src → dist}/utils/common.d.ts +2 -2
- package/{src → dist}/utils/structure.d.ts +1 -1
- package/{src → dist}/utils/table-properties.d.ts +1 -1
- package/{src → dist}/utils/ui/contextualballoon.d.ts +2 -2
- package/{src → dist}/utils/ui/table-properties.d.ts +2 -2
- package/{src → dist}/utils/ui/widget.d.ts +1 -1
- package/package.json +26 -49
- package/build/table.js +0 -5
- package/build/translations/af.js +0 -1
- package/build/translations/ar.js +0 -1
- package/build/translations/ast.js +0 -1
- package/build/translations/az.js +0 -1
- package/build/translations/be.js +0 -1
- package/build/translations/bg.js +0 -1
- package/build/translations/bn.js +0 -1
- package/build/translations/bs.js +0 -1
- package/build/translations/ca.js +0 -1
- package/build/translations/cs.js +0 -1
- package/build/translations/da.js +0 -1
- package/build/translations/de-ch.js +0 -1
- package/build/translations/de.js +0 -1
- package/build/translations/el.js +0 -1
- package/build/translations/en-au.js +0 -1
- package/build/translations/en-gb.js +0 -1
- package/build/translations/eo.js +0 -1
- package/build/translations/es-co.js +0 -1
- package/build/translations/es.js +0 -1
- package/build/translations/et.js +0 -1
- package/build/translations/eu.js +0 -1
- package/build/translations/fa.js +0 -1
- package/build/translations/fi.js +0 -1
- package/build/translations/fr.js +0 -1
- package/build/translations/gl.js +0 -1
- package/build/translations/gu.js +0 -1
- package/build/translations/he.js +0 -1
- package/build/translations/hi.js +0 -1
- package/build/translations/hr.js +0 -1
- package/build/translations/hu.js +0 -1
- package/build/translations/hy.js +0 -1
- package/build/translations/id.js +0 -1
- package/build/translations/it.js +0 -1
- package/build/translations/ja.js +0 -1
- package/build/translations/jv.js +0 -1
- package/build/translations/kk.js +0 -1
- package/build/translations/km.js +0 -1
- package/build/translations/kn.js +0 -1
- package/build/translations/ko.js +0 -1
- package/build/translations/ku.js +0 -1
- package/build/translations/lt.js +0 -1
- package/build/translations/lv.js +0 -1
- package/build/translations/ms.js +0 -1
- package/build/translations/nb.js +0 -1
- package/build/translations/ne.js +0 -1
- package/build/translations/nl.js +0 -1
- package/build/translations/no.js +0 -1
- package/build/translations/oc.js +0 -1
- package/build/translations/pl.js +0 -1
- package/build/translations/pt-br.js +0 -1
- package/build/translations/pt.js +0 -1
- package/build/translations/ro.js +0 -1
- package/build/translations/ru.js +0 -1
- package/build/translations/si.js +0 -1
- package/build/translations/sk.js +0 -1
- package/build/translations/sl.js +0 -1
- package/build/translations/sq.js +0 -1
- package/build/translations/sr-latn.js +0 -1
- package/build/translations/sr.js +0 -1
- package/build/translations/sv.js +0 -1
- package/build/translations/th.js +0 -1
- package/build/translations/ti.js +0 -1
- package/build/translations/tk.js +0 -1
- package/build/translations/tr.js +0 -1
- package/build/translations/tt.js +0 -1
- package/build/translations/ug.js +0 -1
- package/build/translations/uk.js +0 -1
- package/build/translations/ur.js +0 -1
- package/build/translations/uz.js +0 -1
- package/build/translations/vi.js +0 -1
- package/build/translations/zh-cn.js +0 -1
- package/build/translations/zh.js +0 -1
- package/lang/contexts.json +0 -82
- package/lang/translations/af.po +0 -332
- package/lang/translations/ar.po +0 -332
- package/lang/translations/ast.po +0 -332
- package/lang/translations/az.po +0 -332
- package/lang/translations/be.po +0 -332
- package/lang/translations/bg.po +0 -332
- package/lang/translations/bn.po +0 -334
- package/lang/translations/bs.po +0 -332
- package/lang/translations/ca.po +0 -332
- package/lang/translations/cs.po +0 -332
- package/lang/translations/da.po +0 -332
- package/lang/translations/de-ch.po +0 -332
- package/lang/translations/de.po +0 -332
- package/lang/translations/el.po +0 -332
- package/lang/translations/en-au.po +0 -332
- package/lang/translations/en-gb.po +0 -332
- package/lang/translations/en.po +0 -332
- package/lang/translations/eo.po +0 -332
- package/lang/translations/es-co.po +0 -332
- package/lang/translations/es.po +0 -332
- package/lang/translations/et.po +0 -332
- package/lang/translations/eu.po +0 -332
- package/lang/translations/fa.po +0 -332
- package/lang/translations/fi.po +0 -332
- package/lang/translations/fr.po +0 -332
- package/lang/translations/gl.po +0 -332
- package/lang/translations/gu.po +0 -332
- package/lang/translations/he.po +0 -332
- package/lang/translations/hi.po +0 -332
- package/lang/translations/hr.po +0 -332
- package/lang/translations/hu.po +0 -332
- package/lang/translations/hy.po +0 -332
- package/lang/translations/id.po +0 -332
- package/lang/translations/it.po +0 -332
- package/lang/translations/ja.po +0 -332
- package/lang/translations/jv.po +0 -332
- package/lang/translations/kk.po +0 -332
- package/lang/translations/km.po +0 -332
- package/lang/translations/kn.po +0 -332
- package/lang/translations/ko.po +0 -332
- package/lang/translations/ku.po +0 -332
- package/lang/translations/lt.po +0 -332
- package/lang/translations/lv.po +0 -332
- package/lang/translations/ms.po +0 -332
- package/lang/translations/nb.po +0 -332
- package/lang/translations/ne.po +0 -332
- package/lang/translations/nl.po +0 -332
- package/lang/translations/no.po +0 -332
- package/lang/translations/oc.po +0 -332
- package/lang/translations/pl.po +0 -332
- package/lang/translations/pt-br.po +0 -332
- package/lang/translations/pt.po +0 -332
- package/lang/translations/ro.po +0 -332
- package/lang/translations/ru.po +0 -332
- package/lang/translations/si.po +0 -332
- package/lang/translations/sk.po +0 -332
- package/lang/translations/sl.po +0 -332
- package/lang/translations/sq.po +0 -332
- package/lang/translations/sr-latn.po +0 -332
- package/lang/translations/sr.po +0 -332
- package/lang/translations/sv.po +0 -332
- package/lang/translations/th.po +0 -332
- package/lang/translations/ti.po +0 -332
- package/lang/translations/tk.po +0 -332
- package/lang/translations/tr.po +0 -332
- package/lang/translations/tt.po +0 -332
- package/lang/translations/ug.po +0 -332
- package/lang/translations/uk.po +0 -332
- package/lang/translations/ur.po +0 -332
- package/lang/translations/uz.po +0 -332
- package/lang/translations/vi.po +0 -332
- package/lang/translations/zh-cn.po +0 -332
- package/lang/translations/zh.po +0 -332
- package/src/augmentation.js +0 -5
- package/src/commands/insertcolumncommand.js +0 -71
- package/src/commands/insertrowcommand.js +0 -70
- package/src/commands/inserttablecommand.js +0 -69
- package/src/commands/inserttablelayoutcommand.js +0 -65
- package/src/commands/mergecellcommand.js +0 -206
- package/src/commands/mergecellscommand.js +0 -94
- package/src/commands/removecolumncommand.js +0 -109
- package/src/commands/removerowcommand.js +0 -82
- package/src/commands/selectcolumncommand.js +0 -60
- package/src/commands/selectrowcommand.js +0 -56
- package/src/commands/setheadercolumncommand.js +0 -76
- package/src/commands/setheaderrowcommand.js +0 -83
- package/src/commands/splitcellcommand.js +0 -58
- package/src/converters/downcast.js +0 -298
- package/src/converters/table-caption-post-fixer.js +0 -55
- package/src/converters/table-cell-paragraph-post-fixer.js +0 -109
- package/src/converters/table-cell-refresh-handler.js +0 -47
- package/src/converters/table-headings-refresh-handler.js +0 -51
- package/src/converters/table-layout-post-fixer.js +0 -369
- package/src/converters/tableproperties.js +0 -444
- package/src/converters/upcasttable.js +0 -385
- package/src/index.js +0 -98
- package/src/plaintableoutput.js +0 -49
- package/src/table.js +0 -50
- package/src/tablecaption/tablecaptionediting.js +0 -136
- package/src/tablecaption/tablecaptionui.js +0 -64
- package/src/tablecaption/toggletablecaptioncommand.js +0 -105
- package/src/tablecaption/utils.js +0 -61
- package/src/tablecaption.js +0 -34
- package/src/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +0 -30
- package/src/tablecellproperties/commands/tablecellbordercolorcommand.js +0 -44
- package/src/tablecellproperties/commands/tablecellborderstylecommand.js +0 -44
- package/src/tablecellproperties/commands/tablecellborderwidthcommand.js +0 -64
- package/src/tablecellproperties/commands/tablecellheightcommand.js +0 -51
- package/src/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +0 -30
- package/src/tablecellproperties/commands/tablecellpaddingcommand.js +0 -64
- package/src/tablecellproperties/commands/tablecellpropertycommand.js +0 -138
- package/src/tablecellproperties/commands/tablecelltypecommand.js +0 -167
- package/src/tablecellproperties/commands/tablecellverticalalignmentcommand.js +0 -38
- package/src/tablecellproperties/tablecellpropertiesediting.js +0 -412
- package/src/tablecellproperties/tablecellpropertiesui.js +0 -385
- package/src/tablecellproperties/tablecellpropertiesuiexperimental.d.ts +0 -128
- package/src/tablecellproperties/tablecellpropertiesuiexperimental.js +0 -408
- package/src/tablecellproperties/ui/tablecellpropertiesview.d.ts +0 -229
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +0 -612
- package/src/tablecellproperties/ui/tablecellpropertiesviewexperimental.js +0 -744
- package/src/tablecellproperties.js +0 -40
- package/src/tablecellwidth/commands/tablecellwidthcommand.js +0 -51
- package/src/tablecellwidth/tablecellwidthediting.js +0 -53
- package/src/tableclipboard.js +0 -500
- package/src/tablecolumnresize/constants.js +0 -33
- package/src/tablecolumnresize/converters.js +0 -62
- package/src/tablecolumnresize/tablecolumnresizeediting.js +0 -729
- package/src/tablecolumnresize/tablewidthscommand.js +0 -61
- package/src/tablecolumnresize/utils.js +0 -370
- package/src/tablecolumnresize.js +0 -36
- package/src/tableconfig.js +0 -5
- package/src/tableediting.js +0 -246
- package/src/tablekeyboard.js +0 -273
- package/src/tablelayout/commands/tabletypecommand.js +0 -68
- package/src/tablelayout/tablelayoutediting.js +0 -295
- package/src/tablelayout/tablelayoutui.js +0 -196
- package/src/tablelayout.js +0 -37
- package/src/tablemouse/mouseeventsobserver.js +0 -34
- package/src/tablemouse.js +0 -178
- package/src/tableproperties/commands/tablealignmentcommand.js +0 -30
- package/src/tableproperties/commands/tablebackgroundcolorcommand.js +0 -30
- package/src/tableproperties/commands/tablebordercolorcommand.js +0 -44
- package/src/tableproperties/commands/tableborderstylecommand.js +0 -44
- package/src/tableproperties/commands/tableborderwidthcommand.js +0 -64
- package/src/tableproperties/commands/tableheightcommand.js +0 -54
- package/src/tableproperties/commands/tablepropertycommand.js +0 -103
- package/src/tableproperties/commands/tablewidthcommand.js +0 -54
- package/src/tableproperties/tablepropertiesediting.js +0 -546
- package/src/tableproperties/tablepropertiesui.js +0 -374
- package/src/tableproperties/tablepropertiesuiexperimental.d.ts +0 -136
- package/src/tableproperties/tablepropertiesuiexperimental.js +0 -375
- package/src/tableproperties/ui/tablepropertiesview.js +0 -520
- package/src/tableproperties/ui/tablepropertiesviewexperimental.d.ts +0 -216
- package/src/tableproperties/ui/tablepropertiesviewexperimental.js +0 -544
- package/src/tableproperties.js +0 -40
- package/src/tableselection.js +0 -323
- package/src/tabletoolbar.js +0 -63
- package/src/tableui.js +0 -335
- package/src/tableutils.js +0 -1282
- package/src/tablewalker.js +0 -489
- package/src/ui/colorinputview.js +0 -305
- package/src/ui/inserttableview.js +0 -192
- package/src/utils/common.js +0 -118
- package/src/utils/structure.js +0 -452
- package/src/utils/table-properties.js +0 -121
- package/src/utils/ui/contextualballoon.js +0 -111
- package/src/utils/ui/table-properties.js +0 -390
- package/src/utils/ui/table-propertiesexperimental.d.ts +0 -215
- package/src/utils/ui/table-propertiesexperimental.js +0 -391
- package/src/utils/ui/widget.js +0 -56
- package/theme/colorinput.css +0 -39
- package/theme/formrow-experimental.css +0 -15
- package/theme/formrow.css +0 -13
- package/theme/inserttable.css +0 -10
- package/theme/table.css +0 -144
- package/theme/tablecaption.css +0 -66
- package/theme/tablecellproperties-experimental.css +0 -4
- package/theme/tablecellproperties.css +0 -28
- package/theme/tablecolumnresize.css +0 -62
- package/theme/tableediting.css +0 -10
- package/theme/tableform-experimental.css +0 -61
- package/theme/tableform.css +0 -64
- package/theme/tablelayout.css +0 -74
- package/theme/tableproperties-experimental.css +0 -78
- package/theme/tableproperties.css +0 -18
- package/theme/tableselection.css +0 -10
- /package/{src → dist}/tablecolumnresize/constants.d.ts +0 -0
package/src/tableui.js
DELETED
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module table/tableui
|
|
7
|
-
*/
|
|
8
|
-
import { Plugin } from 'ckeditor5/src/core.js';
|
|
9
|
-
import { IconTable, IconTableColumn, IconTableRow, IconTableMergeCell } from 'ckeditor5/src/icons.js';
|
|
10
|
-
import { addListToDropdown, createDropdown, UIModel, SplitButtonView, SwitchButtonView, MenuBarMenuView } from 'ckeditor5/src/ui.js';
|
|
11
|
-
import { Collection } from 'ckeditor5/src/utils.js';
|
|
12
|
-
import { InsertTableView } from './ui/inserttableview.js';
|
|
13
|
-
/**
|
|
14
|
-
* The table UI plugin. It introduces:
|
|
15
|
-
*
|
|
16
|
-
* * The `'insertTable'` dropdown,
|
|
17
|
-
* * The `'menuBar:insertTable'` menu bar menu,
|
|
18
|
-
* * The `'tableColumn'` dropdown,
|
|
19
|
-
* * The `'tableRow'` dropdown,
|
|
20
|
-
* * The `'mergeTableCells'` split button.
|
|
21
|
-
*
|
|
22
|
-
* The `'tableColumn'`, `'tableRow'` and `'mergeTableCells'` dropdowns work best with {@link module:table/tabletoolbar~TableToolbar}.
|
|
23
|
-
*/
|
|
24
|
-
export class TableUI extends Plugin {
|
|
25
|
-
/**
|
|
26
|
-
* @inheritDoc
|
|
27
|
-
*/
|
|
28
|
-
static get pluginName() {
|
|
29
|
-
return 'TableUI';
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @inheritDoc
|
|
33
|
-
*/
|
|
34
|
-
static get isOfficialPlugin() {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* @inheritDoc
|
|
39
|
-
*/
|
|
40
|
-
init() {
|
|
41
|
-
const editor = this.editor;
|
|
42
|
-
const t = this.editor.t;
|
|
43
|
-
const contentLanguageDirection = editor.locale.contentLanguageDirection;
|
|
44
|
-
const isContentLtr = contentLanguageDirection === 'ltr';
|
|
45
|
-
editor.ui.componentFactory.add('insertTable', locale => {
|
|
46
|
-
const command = editor.commands.get('insertTable');
|
|
47
|
-
const dropdownView = createDropdown(locale);
|
|
48
|
-
dropdownView.bind('isEnabled').to(command);
|
|
49
|
-
// Decorate dropdown's button.
|
|
50
|
-
dropdownView.buttonView.set({
|
|
51
|
-
icon: IconTable,
|
|
52
|
-
label: t('Insert table'),
|
|
53
|
-
tooltip: true
|
|
54
|
-
});
|
|
55
|
-
let insertTableView;
|
|
56
|
-
dropdownView.on('change:isOpen', () => {
|
|
57
|
-
if (insertTableView) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
// Prepare custom view for dropdown's panel.
|
|
61
|
-
insertTableView = new InsertTableView(locale);
|
|
62
|
-
dropdownView.panelView.children.add(insertTableView);
|
|
63
|
-
insertTableView.delegate('execute').to(dropdownView);
|
|
64
|
-
dropdownView.on('execute', () => {
|
|
65
|
-
editor.execute('insertTable', { rows: insertTableView.rows, columns: insertTableView.columns });
|
|
66
|
-
editor.editing.view.focus();
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
return dropdownView;
|
|
70
|
-
});
|
|
71
|
-
editor.ui.componentFactory.add('menuBar:insertTable', locale => {
|
|
72
|
-
const command = editor.commands.get('insertTable');
|
|
73
|
-
const menuView = new MenuBarMenuView(locale);
|
|
74
|
-
const insertTableView = new InsertTableView(locale);
|
|
75
|
-
insertTableView.delegate('execute').to(menuView);
|
|
76
|
-
menuView.on('change:isOpen', (event, name, isOpen) => {
|
|
77
|
-
if (!isOpen) {
|
|
78
|
-
insertTableView.reset();
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
insertTableView.on('execute', () => {
|
|
82
|
-
editor.execute('insertTable', { rows: insertTableView.rows, columns: insertTableView.columns });
|
|
83
|
-
editor.editing.view.focus();
|
|
84
|
-
});
|
|
85
|
-
menuView.buttonView.set({
|
|
86
|
-
label: t('Table'),
|
|
87
|
-
icon: IconTable
|
|
88
|
-
});
|
|
89
|
-
menuView.panelView.children.add(insertTableView);
|
|
90
|
-
menuView.bind('isEnabled').to(command);
|
|
91
|
-
return menuView;
|
|
92
|
-
});
|
|
93
|
-
editor.ui.componentFactory.add('tableColumn', locale => {
|
|
94
|
-
const options = [
|
|
95
|
-
{
|
|
96
|
-
type: 'switchbutton',
|
|
97
|
-
model: {
|
|
98
|
-
commandName: 'setTableColumnHeader',
|
|
99
|
-
label: t('Header column'),
|
|
100
|
-
bindIsOn: true
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
{ type: 'separator' },
|
|
104
|
-
{
|
|
105
|
-
type: 'button',
|
|
106
|
-
model: {
|
|
107
|
-
commandName: isContentLtr ? 'insertTableColumnLeft' : 'insertTableColumnRight',
|
|
108
|
-
label: t('Insert column left')
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
type: 'button',
|
|
113
|
-
model: {
|
|
114
|
-
commandName: isContentLtr ? 'insertTableColumnRight' : 'insertTableColumnLeft',
|
|
115
|
-
label: t('Insert column right')
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
type: 'button',
|
|
120
|
-
model: {
|
|
121
|
-
commandName: 'removeTableColumn',
|
|
122
|
-
label: t('Delete column')
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
type: 'button',
|
|
127
|
-
model: {
|
|
128
|
-
commandName: 'selectTableColumn',
|
|
129
|
-
label: t('Select column')
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
];
|
|
133
|
-
return this._prepareDropdown(t('Column'), IconTableColumn, options, locale);
|
|
134
|
-
});
|
|
135
|
-
editor.ui.componentFactory.add('tableRow', locale => {
|
|
136
|
-
const options = [
|
|
137
|
-
{
|
|
138
|
-
type: 'switchbutton',
|
|
139
|
-
model: {
|
|
140
|
-
commandName: 'setTableRowHeader',
|
|
141
|
-
label: t('Header row'),
|
|
142
|
-
bindIsOn: true
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
{ type: 'separator' },
|
|
146
|
-
{
|
|
147
|
-
type: 'button',
|
|
148
|
-
model: {
|
|
149
|
-
commandName: 'insertTableRowAbove',
|
|
150
|
-
label: t('Insert row above')
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
type: 'button',
|
|
155
|
-
model: {
|
|
156
|
-
commandName: 'insertTableRowBelow',
|
|
157
|
-
label: t('Insert row below')
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
type: 'button',
|
|
162
|
-
model: {
|
|
163
|
-
commandName: 'removeTableRow',
|
|
164
|
-
label: t('Delete row')
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
type: 'button',
|
|
169
|
-
model: {
|
|
170
|
-
commandName: 'selectTableRow',
|
|
171
|
-
label: t('Select row')
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
];
|
|
175
|
-
return this._prepareDropdown(t('Row'), IconTableRow, options, locale);
|
|
176
|
-
});
|
|
177
|
-
editor.ui.componentFactory.add('mergeTableCells', locale => {
|
|
178
|
-
const options = [
|
|
179
|
-
{
|
|
180
|
-
type: 'button',
|
|
181
|
-
model: {
|
|
182
|
-
commandName: 'mergeTableCellUp',
|
|
183
|
-
label: t('Merge cell up')
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
type: 'button',
|
|
188
|
-
model: {
|
|
189
|
-
commandName: isContentLtr ? 'mergeTableCellRight' : 'mergeTableCellLeft',
|
|
190
|
-
label: t('Merge cell right')
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
type: 'button',
|
|
195
|
-
model: {
|
|
196
|
-
commandName: 'mergeTableCellDown',
|
|
197
|
-
label: t('Merge cell down')
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
type: 'button',
|
|
202
|
-
model: {
|
|
203
|
-
commandName: isContentLtr ? 'mergeTableCellLeft' : 'mergeTableCellRight',
|
|
204
|
-
label: t('Merge cell left')
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
{ type: 'separator' },
|
|
208
|
-
{
|
|
209
|
-
type: 'button',
|
|
210
|
-
model: {
|
|
211
|
-
commandName: 'splitTableCellVertically',
|
|
212
|
-
label: t('Split cell vertically')
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
type: 'button',
|
|
217
|
-
model: {
|
|
218
|
-
commandName: 'splitTableCellHorizontally',
|
|
219
|
-
label: t('Split cell horizontally')
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
];
|
|
223
|
-
return this._prepareMergeSplitButtonDropdown(t('Merge cells'), IconTableMergeCell, options, locale);
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Creates a dropdown view from a set of options.
|
|
228
|
-
*
|
|
229
|
-
* @param label The dropdown button label.
|
|
230
|
-
* @param icon An icon for the dropdown button.
|
|
231
|
-
* @param options The list of options for the dropdown.
|
|
232
|
-
*/
|
|
233
|
-
_prepareDropdown(label, icon, options, locale) {
|
|
234
|
-
const editor = this.editor;
|
|
235
|
-
const dropdownView = createDropdown(locale);
|
|
236
|
-
const commands = this._fillDropdownWithListOptions(dropdownView, options);
|
|
237
|
-
// Decorate dropdown's button.
|
|
238
|
-
dropdownView.buttonView.set({
|
|
239
|
-
label,
|
|
240
|
-
icon,
|
|
241
|
-
tooltip: true
|
|
242
|
-
});
|
|
243
|
-
// Make dropdown button disabled when all options are disabled.
|
|
244
|
-
dropdownView.bind('isEnabled').toMany(commands, 'isEnabled', (...areEnabled) => {
|
|
245
|
-
return areEnabled.some(isEnabled => isEnabled);
|
|
246
|
-
});
|
|
247
|
-
this.listenTo(dropdownView, 'execute', evt => {
|
|
248
|
-
editor.execute(evt.source.commandName);
|
|
249
|
-
// Toggling a switch button view should not move the focus to the editable.
|
|
250
|
-
if (!(evt.source instanceof SwitchButtonView)) {
|
|
251
|
-
editor.editing.view.focus();
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
return dropdownView;
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Creates a dropdown view with a {@link module:ui/dropdown/button/splitbuttonview~SplitButtonView} for
|
|
258
|
-
* merge (and split)–related commands.
|
|
259
|
-
*
|
|
260
|
-
* @param label The dropdown button label.
|
|
261
|
-
* @param icon An icon for the dropdown button.
|
|
262
|
-
* @param options The list of options for the dropdown.
|
|
263
|
-
*/
|
|
264
|
-
_prepareMergeSplitButtonDropdown(label, icon, options, locale) {
|
|
265
|
-
const editor = this.editor;
|
|
266
|
-
const dropdownView = createDropdown(locale, SplitButtonView);
|
|
267
|
-
const mergeCommandName = 'mergeTableCells';
|
|
268
|
-
// Main command.
|
|
269
|
-
const mergeCommand = editor.commands.get(mergeCommandName);
|
|
270
|
-
// Subcommands in the dropdown.
|
|
271
|
-
const commands = this._fillDropdownWithListOptions(dropdownView, options);
|
|
272
|
-
dropdownView.buttonView.set({
|
|
273
|
-
label,
|
|
274
|
-
icon,
|
|
275
|
-
tooltip: true,
|
|
276
|
-
isEnabled: true
|
|
277
|
-
});
|
|
278
|
-
// Make dropdown button disabled when all options are disabled together with the main command.
|
|
279
|
-
dropdownView.bind('isEnabled').toMany([mergeCommand, ...commands], 'isEnabled', (...areEnabled) => {
|
|
280
|
-
return areEnabled.some(isEnabled => isEnabled);
|
|
281
|
-
});
|
|
282
|
-
// Merge selected table cells when the main part of the split button is clicked.
|
|
283
|
-
this.listenTo(dropdownView.buttonView, 'execute', () => {
|
|
284
|
-
editor.execute(mergeCommandName);
|
|
285
|
-
editor.editing.view.focus();
|
|
286
|
-
});
|
|
287
|
-
// Execute commands for events coming from the list in the dropdown panel.
|
|
288
|
-
this.listenTo(dropdownView, 'execute', evt => {
|
|
289
|
-
editor.execute(evt.source.commandName);
|
|
290
|
-
editor.editing.view.focus();
|
|
291
|
-
});
|
|
292
|
-
return dropdownView;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* Injects a {@link module:ui/list/listview~ListView} into the passed dropdown with buttons
|
|
296
|
-
* which execute editor commands as configured in passed options.
|
|
297
|
-
*
|
|
298
|
-
* @param options The list of options for the dropdown.
|
|
299
|
-
* @returns Commands the list options are interacting with.
|
|
300
|
-
*/
|
|
301
|
-
_fillDropdownWithListOptions(dropdownView, options) {
|
|
302
|
-
const editor = this.editor;
|
|
303
|
-
const commands = [];
|
|
304
|
-
const itemDefinitions = new Collection();
|
|
305
|
-
for (const option of options) {
|
|
306
|
-
addListOption(option, editor, commands, itemDefinitions);
|
|
307
|
-
}
|
|
308
|
-
addListToDropdown(dropdownView, itemDefinitions);
|
|
309
|
-
return commands;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Adds an option to a list view.
|
|
314
|
-
*
|
|
315
|
-
* @param option A configuration option.
|
|
316
|
-
* @param commands The list of commands to update.
|
|
317
|
-
* @param itemDefinitions A collection of dropdown items to update with the given option.
|
|
318
|
-
*/
|
|
319
|
-
function addListOption(option, editor, commands, itemDefinitions) {
|
|
320
|
-
if (option.type === 'button' || option.type === 'switchbutton') {
|
|
321
|
-
const model = option.model = new UIModel(option.model);
|
|
322
|
-
const { commandName, bindIsOn } = option.model;
|
|
323
|
-
const command = editor.commands.get(commandName);
|
|
324
|
-
commands.push(command);
|
|
325
|
-
model.set({ commandName });
|
|
326
|
-
model.bind('isEnabled').to(command);
|
|
327
|
-
if (bindIsOn) {
|
|
328
|
-
model.bind('isOn').to(command, 'value');
|
|
329
|
-
}
|
|
330
|
-
model.set({
|
|
331
|
-
withText: true
|
|
332
|
-
});
|
|
333
|
-
}
|
|
334
|
-
itemDefinitions.add(option);
|
|
335
|
-
}
|