qms-angular 1.0.87 → 1.0.88
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/README.md +5 -1
- package/bundles/qms-angular.umd.js +121 -29
- package/bundles/qms-angular.umd.js.map +1 -1
- package/esm2015/lib/components/badges/qms-badges.component.js +1 -1
- package/esm2015/lib/components/banner/qms-banner/qms-banner.component.js +1 -1
- package/esm2015/lib/components/banner/qms-banner-confirm/qms-banner-confirm.component.js +1 -1
- package/esm2015/lib/components/banner/qms-banner-loading/qms-banner-loading.component.js +1 -1
- package/esm2015/lib/components/button/button-toggle.js +1 -1
- package/esm2015/lib/components/button/button.js +3 -3
- package/esm2015/lib/components/comment/comment.js +1 -1
- package/esm2015/lib/components/dialog/dialog.js +2 -2
- package/esm2015/lib/components/list/list.js +2 -2
- package/esm2015/lib/components/qms-paginator/qms-paginator.component.js +16 -7
- package/esm2015/lib/components/related/list-other-related/list-related.component.js +1 -1
- package/esm2015/lib/components/related/risk/list/list.component.js +1 -1
- package/esm2015/lib/components/related/risk/result/result.component.js +1 -1
- package/esm2015/lib/components/rich-text/rich-text.js +1 -1
- package/esm2015/lib/components/table/table-action.js +2 -2
- package/esm2015/lib/components/tooltip/tooltip.js +1 -1
- package/esm2015/lib/components/tree/tree.component.js +1 -1
- package/esm2015/lib/components/treeNew/tree.component.js +18 -2
- package/esm2015/lib/directives/text-truncate/text-truncate.directive.js +54 -0
- package/esm2015/lib/qms-angular.module.js +4 -1
- package/esm2015/lib/qms-ckeditor-components/common/functions/common.function.js +3 -1
- package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +1 -1
- package/esm2015/public-api.js +2 -1
- package/fesm2015/qms-angular.js +112 -30
- package/fesm2015/qms-angular.js.map +1 -1
- package/lib/components/qms-paginator/qms-paginator.component.d.ts +1 -0
- package/lib/components/treeNew/tree.component.d.ts +1 -0
- package/lib/directives/text-truncate/text-truncate.directive.d.ts +14 -0
- package/lib.theme.scss +178 -3
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/qms-angular.metadata.json +1 -1
- package/src/assets/fonts/Material/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2 +0 -0
- package/src/assets/fonts/Material/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUce.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFUZ0bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFVZ0b.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFVp0bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFW50bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWJ0bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWZ0bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWp0bbck.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCFPrEHJA.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCGPrEHJA.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCHPrEHJA.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCIPrE.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCMPrEHJA.woff2 +0 -0
- package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ar.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/az.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/bg.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/cs.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/da.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/de-ch.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/de.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/en-au.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/en-gb.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/es.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/et.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/fa.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/fi.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/fr.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/gl.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/hi.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/hr.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/hu.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/id.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/it.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ja.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ko.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ku.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/lt.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/lv.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/nb.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ne.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/nl.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/no.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/pl.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/pt-br.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ro.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ru.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sk.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sq.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sr-latn.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sr.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sv.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/th.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/tk.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/tr.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ug.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/uk.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/vi.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/zh-cn.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/zh.js +1 -1
- package/src/assets/qms-ckeditor-plugin/package-lock.json +0 -1
- package/src/assets/qms-ckeditor-plugin/package.json +0 -1
- package/src/assets/qms-ckeditor-plugin/src/ckeditor.js +5 -5
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/insertcolumncommand.js +83 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/insertrowcommand.js +82 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/inserttablecommand.js +76 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/mergecellcommand.js +272 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/mergecellscommand.js +122 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/removecolumncommand.js +122 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/removerowcommand.js +97 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/selectcolumncommand.js +63 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/selectrowcommand.js +56 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/setheadercolumncommand.js +95 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/setheaderrowcommand.js +105 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/splitcellcommand.js +68 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/downcast.js +529 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-cell-paragraph-post-fixer.js +136 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-cell-refresh-post-fixer.js +75 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-heading-rows-refresh-post-fixer.js +55 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-layout-post-fixer.js +399 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/tableproperties.js +126 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/upcasttable.js +211 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/index.js +42 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/table.js +103 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellbordercolorcommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellborderstylecommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellborderwidthcommand.js +62 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellheightcommand.js +51 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellpaddingcommand.js +62 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellpropertycommand.js +110 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellverticalalignmentcommand.js +43 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellwidthcommand.js +51 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/tablecellpropertiesediting.js +204 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/tablecellpropertiesui.js +401 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/ui/tablecellpropertiesview.js +829 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties.js +80 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableclipboard.js +586 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableediting.js +160 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablekeyboard.js +343 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablemouse/mouseeventsobserver.js +72 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablemouse.js +218 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablealignmentcommand.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablebackgroundcolorcommand.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablebordercolorcommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableborderstylecommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableborderwidthcommand.js +62 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableheightcommand.js +51 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablepropertycommand.js +98 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablewidthcommand.js +51 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/tablepropertiesediting.js +182 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/tablepropertiesui.js +397 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/ui/tablepropertiesview.js +714 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties.js +81 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableselection.js +357 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tabletoolbar.js +111 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableui.js +359 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableutils.js +909 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablewalker.js +538 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/colorinput.css +39 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/form.css +11 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/formrow.css +23 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-cell-properties.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-column.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-merge-cell.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-properties.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-row.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/inserttable.css +10 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/snippet.css +3876 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/table.css +67 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tablecaption.css +53 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tablecellproperties.css +28 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableediting.css +10 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableform.css +59 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableproperties.css +18 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableselection.css +10 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/colorinputview.js +343 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/formrowview.js +103 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/inserttableview.js +222 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/common.js +57 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/selection.js +276 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/structure.js +543 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/table-properties.js +66 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/contextualballoon.js +130 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/table-properties.js +397 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/widget.js +62 -0
- package/src/lib/components/qms-paginator/qms-paginator.component.scss +4 -1
- package/src/themes/core/_mat-icon.scss +60 -60
- package/src/themes/core/_table.scss +55 -2
- package/src/themes/core/_typography.scss +108 -108
- package/src/assets/fonts/OpenSans/OpenSans.woff2 +0 -0
@@ -0,0 +1,829 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @module table/tablecellproperties/ui/tablecellpropertiesview
|
8
|
+
*/
|
9
|
+
|
10
|
+
import {
|
11
|
+
LabeledFieldView,
|
12
|
+
createLabeledDropdown,
|
13
|
+
createLabeledInputText,
|
14
|
+
LabelView,
|
15
|
+
addListToDropdown,
|
16
|
+
ToolbarView,
|
17
|
+
ButtonView,
|
18
|
+
FocusCycler,
|
19
|
+
View,
|
20
|
+
ViewCollection,
|
21
|
+
FormHeaderView,
|
22
|
+
submitHandler
|
23
|
+
} from 'ckeditor5/src/ui';
|
24
|
+
import { KeystrokeHandler, FocusTracker } from 'ckeditor5/src/utils';
|
25
|
+
import { icons } from 'ckeditor5/src/core';
|
26
|
+
|
27
|
+
import {
|
28
|
+
fillToolbar,
|
29
|
+
getBorderStyleDefinitions,
|
30
|
+
getBorderStyleLabels,
|
31
|
+
getLabeledColorInputCreator
|
32
|
+
} from '../../utils/ui/table-properties';
|
33
|
+
import FormRowView from '../../ui/formrowview';
|
34
|
+
|
35
|
+
import '../../theme/form.css';
|
36
|
+
import '../../theme/tableform.css';
|
37
|
+
import '../../theme/tablecellproperties.css';
|
38
|
+
|
39
|
+
const ALIGNMENT_ICONS = {
|
40
|
+
left: icons.alignLeft,
|
41
|
+
center: icons.alignCenter,
|
42
|
+
right: icons.alignRight,
|
43
|
+
justify: icons.alignJustify,
|
44
|
+
top: icons.alignTop,
|
45
|
+
middle: icons.alignMiddle,
|
46
|
+
bottom: icons.alignBottom
|
47
|
+
};
|
48
|
+
|
49
|
+
/**
|
50
|
+
* The class representing a table cell properties form, allowing users to customize
|
51
|
+
* certain style aspects of a table cell, for instance, border, padding, text alignment, etc..
|
52
|
+
*
|
53
|
+
* @extends module:ui/view~View
|
54
|
+
*/
|
55
|
+
export default class TableCellPropertiesView extends View {
|
56
|
+
/**
|
57
|
+
* @param {module:utils/locale~Locale} locale The {@link module:core/editor/editor~Editor#locale} instance.
|
58
|
+
* @param {Object} options Additional configuration of the view.
|
59
|
+
* @param {module:table/table~TableColorConfig} options.borderColors A configuration of the border
|
60
|
+
* color palette used by the
|
61
|
+
* {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView#borderColorInput}.
|
62
|
+
* @param {module:table/table~TableColorConfig} options.backgroundColors A configuration of the background
|
63
|
+
* color palette used by the
|
64
|
+
* {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView#backgroundInput}.
|
65
|
+
*/
|
66
|
+
constructor( locale, options ) {
|
67
|
+
super( locale );
|
68
|
+
|
69
|
+
this.set( {
|
70
|
+
/**
|
71
|
+
* The value of the cell border style.
|
72
|
+
*
|
73
|
+
* @observable
|
74
|
+
* @default ''
|
75
|
+
* @member #borderStyle
|
76
|
+
*/
|
77
|
+
borderStyle: '',
|
78
|
+
|
79
|
+
/**
|
80
|
+
* The value of the cell border width style.
|
81
|
+
*
|
82
|
+
* @observable
|
83
|
+
* @default ''
|
84
|
+
* @member #borderWidth
|
85
|
+
*/
|
86
|
+
borderWidth: '',
|
87
|
+
|
88
|
+
/**
|
89
|
+
* The value of the cell border color style.
|
90
|
+
*
|
91
|
+
* @observable
|
92
|
+
* @default ''
|
93
|
+
* @member #borderColor
|
94
|
+
*/
|
95
|
+
borderColor: '',
|
96
|
+
|
97
|
+
/**
|
98
|
+
* The value of the cell padding style.
|
99
|
+
*
|
100
|
+
* @observable
|
101
|
+
* @default ''
|
102
|
+
* @member #padding
|
103
|
+
*/
|
104
|
+
padding: '',
|
105
|
+
|
106
|
+
/**
|
107
|
+
* The value of the cell background color style.
|
108
|
+
*
|
109
|
+
* @observable
|
110
|
+
* @default ''
|
111
|
+
* @member #backgroundColor
|
112
|
+
*/
|
113
|
+
backgroundColor: '',
|
114
|
+
|
115
|
+
/**
|
116
|
+
* The value of the table cell width style.
|
117
|
+
*
|
118
|
+
* @observable
|
119
|
+
* @default ''
|
120
|
+
* @member #width
|
121
|
+
*/
|
122
|
+
width: '',
|
123
|
+
|
124
|
+
/**
|
125
|
+
* The value of the table cell height style.
|
126
|
+
*
|
127
|
+
* @observable
|
128
|
+
* @default ''
|
129
|
+
* @member #height
|
130
|
+
*/
|
131
|
+
height: '',
|
132
|
+
|
133
|
+
/**
|
134
|
+
* The value of the horizontal text alignment style.
|
135
|
+
*
|
136
|
+
* @observable
|
137
|
+
* @default ''
|
138
|
+
* @member #horizontalAlignment
|
139
|
+
*/
|
140
|
+
horizontalAlignment: '',
|
141
|
+
|
142
|
+
/**
|
143
|
+
* The value of the vertical text alignment style.
|
144
|
+
*
|
145
|
+
* @observable
|
146
|
+
* @default ''
|
147
|
+
* @member #verticalAlignment
|
148
|
+
*/
|
149
|
+
verticalAlignment: ''
|
150
|
+
} );
|
151
|
+
|
152
|
+
/**
|
153
|
+
* Options passed to the view. See {@link #constructor} to learn more.
|
154
|
+
*
|
155
|
+
* @member {Object}
|
156
|
+
*/
|
157
|
+
this.options = options;
|
158
|
+
|
159
|
+
const { borderStyleDropdown, borderWidthInput, borderColorInput, borderRowLabel } = this._createBorderFields();
|
160
|
+
const { backgroundRowLabel, backgroundInput } = this._createBackgroundFields();
|
161
|
+
const { widthInput, operatorLabel, heightInput, dimensionsLabel } = this._createDimensionFields();
|
162
|
+
const { horizontalAlignmentToolbar, verticalAlignmentToolbar, alignmentLabel } = this._createAlignmentFields();
|
163
|
+
|
164
|
+
/**
|
165
|
+
* Tracks information about the DOM focus in the form.
|
166
|
+
*
|
167
|
+
* @readonly
|
168
|
+
* @member {module:utils/focustracker~FocusTracker}
|
169
|
+
*/
|
170
|
+
this.focusTracker = new FocusTracker();
|
171
|
+
|
172
|
+
/**
|
173
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
174
|
+
*
|
175
|
+
* @readonly
|
176
|
+
* @member {module:utils/keystrokehandler~KeystrokeHandler}
|
177
|
+
*/
|
178
|
+
this.keystrokes = new KeystrokeHandler();
|
179
|
+
|
180
|
+
/**
|
181
|
+
* A collection of child views in the form.
|
182
|
+
*
|
183
|
+
* @readonly
|
184
|
+
* @type {module:ui/viewcollection~ViewCollection}
|
185
|
+
*/
|
186
|
+
this.children = this.createCollection();
|
187
|
+
|
188
|
+
/**
|
189
|
+
* A dropdown that allows selecting the style of the table cell border.
|
190
|
+
*
|
191
|
+
* @readonly
|
192
|
+
* @member {module:ui/dropdown/dropdownview~DropdownView}
|
193
|
+
*/
|
194
|
+
this.borderStyleDropdown = borderStyleDropdown;
|
195
|
+
|
196
|
+
/**
|
197
|
+
* An input that allows specifying the width of the table cell border.
|
198
|
+
*
|
199
|
+
* @readonly
|
200
|
+
* @member {module:ui/inputtext/inputtextview~InputTextView}
|
201
|
+
*/
|
202
|
+
this.borderWidthInput = borderWidthInput;
|
203
|
+
|
204
|
+
/**
|
205
|
+
* An input that allows specifying the color of the table cell border.
|
206
|
+
*
|
207
|
+
* @readonly
|
208
|
+
* @member {module:table/ui/colorinputview~ColorInputView}
|
209
|
+
*/
|
210
|
+
this.borderColorInput = borderColorInput;
|
211
|
+
|
212
|
+
/**
|
213
|
+
* An input that allows specifying the table cell background color.
|
214
|
+
*
|
215
|
+
* @readonly
|
216
|
+
* @member {module:table/ui/colorinputview~ColorInputView}
|
217
|
+
*/
|
218
|
+
this.backgroundInput = backgroundInput;
|
219
|
+
|
220
|
+
/**
|
221
|
+
* An input that allows specifying the table cell padding.
|
222
|
+
*
|
223
|
+
* @readonly
|
224
|
+
* @member {module:ui/inputtext/inputtextview~InputTextView}
|
225
|
+
*/
|
226
|
+
this.paddingInput = this._createPaddingField();
|
227
|
+
|
228
|
+
/**
|
229
|
+
* An input that allows specifying the table cell width.
|
230
|
+
*
|
231
|
+
* @readonly
|
232
|
+
* @member {module:ui/inputtext/inputtextview~InputTextView}
|
233
|
+
*/
|
234
|
+
this.widthInput = widthInput;
|
235
|
+
|
236
|
+
/**
|
237
|
+
* An input that allows specifying the table cell height.
|
238
|
+
*
|
239
|
+
* @readonly
|
240
|
+
* @member {module:ui/inputtext/inputtextview~InputTextView}
|
241
|
+
*/
|
242
|
+
this.heightInput = heightInput;
|
243
|
+
|
244
|
+
/**
|
245
|
+
* A toolbar with buttons that allow changing the horizontal text alignment in a table cell.
|
246
|
+
*
|
247
|
+
* @readonly
|
248
|
+
* @member {module:ui/toolbar/toolbar~ToolbarView}
|
249
|
+
*/
|
250
|
+
this.horizontalAlignmentToolbar = horizontalAlignmentToolbar;
|
251
|
+
|
252
|
+
/**
|
253
|
+
* A toolbar with buttons that allow changing the vertical text alignment in a table cell.
|
254
|
+
*
|
255
|
+
* @readonly
|
256
|
+
* @member {module:ui/toolbar/toolbar~ToolbarView}
|
257
|
+
*/
|
258
|
+
this.verticalAlignmentToolbar = verticalAlignmentToolbar;
|
259
|
+
|
260
|
+
// Defer creating to make sure other fields are present and the Save button can
|
261
|
+
// bind its #isEnabled to their error messages so there's no way to save unless all
|
262
|
+
// fields are valid.
|
263
|
+
const { saveButtonView, cancelButtonView } = this._createActionButtons();
|
264
|
+
|
265
|
+
/**
|
266
|
+
* The "Save" button view.
|
267
|
+
*
|
268
|
+
* @member {module:ui/button/buttonview~ButtonView}
|
269
|
+
*/
|
270
|
+
this.saveButtonView = saveButtonView;
|
271
|
+
|
272
|
+
/**
|
273
|
+
* The "Cancel" button view.
|
274
|
+
*
|
275
|
+
* @member {module:ui/button/buttonview~ButtonView}
|
276
|
+
*/
|
277
|
+
this.cancelButtonView = cancelButtonView;
|
278
|
+
|
279
|
+
/**
|
280
|
+
* A collection of views that can be focused in the form.
|
281
|
+
*
|
282
|
+
* @readonly
|
283
|
+
* @protected
|
284
|
+
* @member {module:ui/viewcollection~ViewCollection}
|
285
|
+
*/
|
286
|
+
this._focusables = new ViewCollection();
|
287
|
+
|
288
|
+
/**
|
289
|
+
* Helps cycling over {@link #_focusables} in the form.
|
290
|
+
*
|
291
|
+
* @readonly
|
292
|
+
* @protected
|
293
|
+
* @member {module:ui/focuscycler~FocusCycler}
|
294
|
+
*/
|
295
|
+
this._focusCycler = new FocusCycler( {
|
296
|
+
focusables: this._focusables,
|
297
|
+
focusTracker: this.focusTracker,
|
298
|
+
keystrokeHandler: this.keystrokes,
|
299
|
+
actions: {
|
300
|
+
// Navigate form fields backwards using the Shift + Tab keystroke.
|
301
|
+
focusPrevious: 'shift + tab',
|
302
|
+
|
303
|
+
// Navigate form fields forwards using the Tab key.
|
304
|
+
focusNext: 'tab'
|
305
|
+
}
|
306
|
+
} );
|
307
|
+
|
308
|
+
// Form header.
|
309
|
+
this.children.add( new FormHeaderView( locale, {
|
310
|
+
label: this.t( 'Cell properties' )
|
311
|
+
} ) );
|
312
|
+
|
313
|
+
// Border row.
|
314
|
+
this.children.add( new FormRowView( locale, {
|
315
|
+
labelView: borderRowLabel,
|
316
|
+
children: [
|
317
|
+
borderRowLabel,
|
318
|
+
borderStyleDropdown,
|
319
|
+
borderColorInput,
|
320
|
+
borderWidthInput
|
321
|
+
],
|
322
|
+
class: 'ck-table-form__border-row'
|
323
|
+
} ) );
|
324
|
+
|
325
|
+
// Background.
|
326
|
+
this.children.add( new FormRowView( locale, {
|
327
|
+
labelView: backgroundRowLabel,
|
328
|
+
children: [
|
329
|
+
backgroundRowLabel,
|
330
|
+
backgroundInput
|
331
|
+
],
|
332
|
+
class: 'ck-table-form__background-row'
|
333
|
+
} ) );
|
334
|
+
|
335
|
+
// Dimensions row and padding.
|
336
|
+
this.children.add( new FormRowView( locale, {
|
337
|
+
children: [
|
338
|
+
// Dimensions row.
|
339
|
+
new FormRowView( locale, {
|
340
|
+
labelView: dimensionsLabel,
|
341
|
+
children: [
|
342
|
+
dimensionsLabel,
|
343
|
+
widthInput,
|
344
|
+
operatorLabel,
|
345
|
+
heightInput
|
346
|
+
],
|
347
|
+
class: 'ck-table-form__dimensions-row'
|
348
|
+
} ),
|
349
|
+
// Padding row.
|
350
|
+
new FormRowView( locale, {
|
351
|
+
children: [
|
352
|
+
this.paddingInput
|
353
|
+
],
|
354
|
+
class: 'ck-table-cell-properties-form__padding-row'
|
355
|
+
} )
|
356
|
+
]
|
357
|
+
} ) );
|
358
|
+
|
359
|
+
// Text alignment row.
|
360
|
+
this.children.add( new FormRowView( locale, {
|
361
|
+
labelView: alignmentLabel,
|
362
|
+
children: [
|
363
|
+
alignmentLabel,
|
364
|
+
horizontalAlignmentToolbar,
|
365
|
+
verticalAlignmentToolbar
|
366
|
+
],
|
367
|
+
class: 'ck-table-cell-properties-form__alignment-row'
|
368
|
+
} ) );
|
369
|
+
|
370
|
+
// Action row.
|
371
|
+
this.children.add( new FormRowView( locale, {
|
372
|
+
children: [
|
373
|
+
this.saveButtonView,
|
374
|
+
this.cancelButtonView
|
375
|
+
],
|
376
|
+
class: 'ck-table-form__action-row'
|
377
|
+
} ) );
|
378
|
+
|
379
|
+
this.setTemplate( {
|
380
|
+
tag: 'form',
|
381
|
+
attributes: {
|
382
|
+
class: [
|
383
|
+
'ck',
|
384
|
+
'ck-form',
|
385
|
+
'ck-table-form',
|
386
|
+
'ck-table-cell-properties-form'
|
387
|
+
],
|
388
|
+
// https://github.com/ckeditor/ckeditor5-link/issues/90
|
389
|
+
tabindex: '-1'
|
390
|
+
},
|
391
|
+
children: this.children
|
392
|
+
} );
|
393
|
+
}
|
394
|
+
|
395
|
+
/**
|
396
|
+
* @inheritDoc
|
397
|
+
*/
|
398
|
+
render() {
|
399
|
+
super.render();
|
400
|
+
|
401
|
+
// Enable the "submit" event for this view. It can be triggered by the #saveButtonView
|
402
|
+
// which is of the "submit" DOM "type".
|
403
|
+
submitHandler( {
|
404
|
+
view: this
|
405
|
+
} );
|
406
|
+
|
407
|
+
[
|
408
|
+
this.borderStyleDropdown,
|
409
|
+
this.borderColorInput,
|
410
|
+
this.borderWidthInput,
|
411
|
+
this.backgroundInput,
|
412
|
+
this.widthInput,
|
413
|
+
this.heightInput,
|
414
|
+
this.paddingInput,
|
415
|
+
this.horizontalAlignmentToolbar,
|
416
|
+
this.verticalAlignmentToolbar,
|
417
|
+
this.saveButtonView,
|
418
|
+
this.cancelButtonView
|
419
|
+
].forEach( view => {
|
420
|
+
// Register the view as focusable.
|
421
|
+
this._focusables.add( view );
|
422
|
+
|
423
|
+
// Register the view in the focus tracker.
|
424
|
+
this.focusTracker.add( view.element );
|
425
|
+
} );
|
426
|
+
|
427
|
+
// Mainly for closing using "Esc" and navigation using "Tab".
|
428
|
+
this.keystrokes.listenTo( this.element );
|
429
|
+
}
|
430
|
+
|
431
|
+
/**
|
432
|
+
* Focuses the fist focusable field in the form.
|
433
|
+
*/
|
434
|
+
focus() {
|
435
|
+
this._focusCycler.focusFirst();
|
436
|
+
}
|
437
|
+
|
438
|
+
/**
|
439
|
+
* Creates the following form fields:
|
440
|
+
*
|
441
|
+
* * {@link #borderStyleDropdown},
|
442
|
+
* * {@link #borderWidthInput},
|
443
|
+
* * {@link #borderColorInput}.
|
444
|
+
*
|
445
|
+
* @private
|
446
|
+
* @returns {Object.<String,module:ui/view~View>}
|
447
|
+
*/
|
448
|
+
_createBorderFields() {
|
449
|
+
const colorInputCreator = getLabeledColorInputCreator( {
|
450
|
+
colorConfig: this.options.borderColors,
|
451
|
+
columns: 5
|
452
|
+
} );
|
453
|
+
const locale = this.locale;
|
454
|
+
const t = this.t;
|
455
|
+
|
456
|
+
// -- Group label ---------------------------------------------
|
457
|
+
|
458
|
+
const borderRowLabel = new LabelView( locale );
|
459
|
+
borderRowLabel.text = t( 'Border' );
|
460
|
+
|
461
|
+
// -- Style ---------------------------------------------------
|
462
|
+
|
463
|
+
const styleLabels = getBorderStyleLabels( t );
|
464
|
+
const borderStyleDropdown = new LabeledFieldView( locale, createLabeledDropdown );
|
465
|
+
borderStyleDropdown.set( {
|
466
|
+
label: t( 'Style' ),
|
467
|
+
class: 'ck-table-form__border-style'
|
468
|
+
} );
|
469
|
+
|
470
|
+
borderStyleDropdown.fieldView.buttonView.set( {
|
471
|
+
isOn: false,
|
472
|
+
withText: true,
|
473
|
+
tooltip: t( 'Style' )
|
474
|
+
} );
|
475
|
+
|
476
|
+
borderStyleDropdown.fieldView.buttonView.bind( 'label' ).to( this, 'borderStyle', value => {
|
477
|
+
return styleLabels[ value ? value : 'none' ];
|
478
|
+
} );
|
479
|
+
|
480
|
+
borderStyleDropdown.fieldView.on( 'execute', evt => {
|
481
|
+
this.borderStyle = evt.source._borderStyleValue;
|
482
|
+
} );
|
483
|
+
|
484
|
+
borderStyleDropdown.bind( 'isEmpty' ).to( this, 'borderStyle', value => !value );
|
485
|
+
|
486
|
+
addListToDropdown( borderStyleDropdown.fieldView, getBorderStyleDefinitions( this ) );
|
487
|
+
|
488
|
+
// -- Width ---------------------------------------------------
|
489
|
+
|
490
|
+
const borderWidthInput = new LabeledFieldView( locale, createLabeledInputText );
|
491
|
+
|
492
|
+
borderWidthInput.set( {
|
493
|
+
label: t( 'Width' ),
|
494
|
+
class: 'ck-table-form__border-width'
|
495
|
+
} );
|
496
|
+
|
497
|
+
borderWidthInput.fieldView.bind( 'value' ).to( this, 'borderWidth' );
|
498
|
+
borderWidthInput.bind( 'isEnabled' ).to( this, 'borderStyle', isBorderStyleSet );
|
499
|
+
borderWidthInput.fieldView.on( 'input', () => {
|
500
|
+
this.borderWidth = borderWidthInput.fieldView.element.value;
|
501
|
+
} );
|
502
|
+
|
503
|
+
// -- Color ---------------------------------------------------
|
504
|
+
|
505
|
+
const borderColorInput = new LabeledFieldView( locale, colorInputCreator );
|
506
|
+
|
507
|
+
borderColorInput.set( {
|
508
|
+
label: t( 'Color' ),
|
509
|
+
class: 'ck-table-form__border-color'
|
510
|
+
} );
|
511
|
+
|
512
|
+
borderColorInput.fieldView.bind( 'value' ).to( this, 'borderColor' );
|
513
|
+
borderColorInput.bind( 'isEnabled' ).to( this, 'borderStyle', isBorderStyleSet );
|
514
|
+
|
515
|
+
borderColorInput.fieldView.on( 'input', () => {
|
516
|
+
this.borderColor = borderColorInput.fieldView.value;
|
517
|
+
} );
|
518
|
+
|
519
|
+
// Reset the border color and width fields when style is "none".
|
520
|
+
// https://github.com/ckeditor/ckeditor5/issues/6227
|
521
|
+
this.on( 'change:borderStyle', ( evt, name, value ) => {
|
522
|
+
if ( !isBorderStyleSet( value ) ) {
|
523
|
+
this.borderColor = '';
|
524
|
+
this.borderWidth = '';
|
525
|
+
}
|
526
|
+
} );
|
527
|
+
|
528
|
+
return {
|
529
|
+
borderRowLabel,
|
530
|
+
borderStyleDropdown,
|
531
|
+
borderColorInput,
|
532
|
+
borderWidthInput
|
533
|
+
};
|
534
|
+
}
|
535
|
+
|
536
|
+
/**
|
537
|
+
* Creates the following form fields:
|
538
|
+
*
|
539
|
+
* * {@link #backgroundInput}.
|
540
|
+
*
|
541
|
+
* @private
|
542
|
+
* @returns {Object.<String,module:ui/view~View>}
|
543
|
+
*/
|
544
|
+
_createBackgroundFields() {
|
545
|
+
const locale = this.locale;
|
546
|
+
const t = this.t;
|
547
|
+
|
548
|
+
// -- Group label ---------------------------------------------
|
549
|
+
|
550
|
+
const backgroundRowLabel = new LabelView( locale );
|
551
|
+
backgroundRowLabel.text = t( 'Background' );
|
552
|
+
|
553
|
+
// -- Background color input -----------------------------------
|
554
|
+
|
555
|
+
const colorInputCreator = getLabeledColorInputCreator( {
|
556
|
+
colorConfig: this.options.backgroundColors,
|
557
|
+
columns: 5
|
558
|
+
} );
|
559
|
+
|
560
|
+
const backgroundInput = new LabeledFieldView( locale, colorInputCreator );
|
561
|
+
|
562
|
+
backgroundInput.set( {
|
563
|
+
label: t( 'Color' ),
|
564
|
+
class: 'ck-table-cell-properties-form__background'
|
565
|
+
} );
|
566
|
+
|
567
|
+
backgroundInput.fieldView.bind( 'value' ).to( this, 'backgroundColor' );
|
568
|
+
backgroundInput.fieldView.on( 'input', () => {
|
569
|
+
this.backgroundColor = backgroundInput.fieldView.value;
|
570
|
+
} );
|
571
|
+
|
572
|
+
return {
|
573
|
+
backgroundRowLabel,
|
574
|
+
backgroundInput
|
575
|
+
};
|
576
|
+
}
|
577
|
+
|
578
|
+
/**
|
579
|
+
* Creates the following form fields:
|
580
|
+
*
|
581
|
+
* * {@link #widthInput}.
|
582
|
+
* * {@link #heightInput}.
|
583
|
+
*
|
584
|
+
* @private
|
585
|
+
* @returns {module:ui/labeledfield/labeledfieldview~LabeledFieldView}
|
586
|
+
*/
|
587
|
+
_createDimensionFields() {
|
588
|
+
const locale = this.locale;
|
589
|
+
const t = this.t;
|
590
|
+
|
591
|
+
// -- Label ---------------------------------------------------
|
592
|
+
|
593
|
+
const dimensionsLabel = new LabelView( locale );
|
594
|
+
dimensionsLabel.text = t( 'Dimensions' );
|
595
|
+
|
596
|
+
// -- Width ---------------------------------------------------
|
597
|
+
|
598
|
+
const widthInput = new LabeledFieldView( locale, createLabeledInputText );
|
599
|
+
|
600
|
+
widthInput.set( {
|
601
|
+
label: t( 'Width' ),
|
602
|
+
class: 'ck-table-form__dimensions-row__width'
|
603
|
+
} );
|
604
|
+
|
605
|
+
widthInput.fieldView.bind( 'value' ).to( this, 'width' );
|
606
|
+
widthInput.fieldView.on( 'input', () => {
|
607
|
+
this.width = widthInput.fieldView.element.value;
|
608
|
+
} );
|
609
|
+
|
610
|
+
// -- Operator ---------------------------------------------------
|
611
|
+
|
612
|
+
const operatorLabel = new View( locale );
|
613
|
+
operatorLabel.setTemplate( {
|
614
|
+
tag: 'span',
|
615
|
+
attributes: {
|
616
|
+
class: [
|
617
|
+
'ck-table-form__dimension-operator'
|
618
|
+
]
|
619
|
+
},
|
620
|
+
children: [
|
621
|
+
{ text: '×' }
|
622
|
+
]
|
623
|
+
} );
|
624
|
+
|
625
|
+
// -- Height ---------------------------------------------------
|
626
|
+
|
627
|
+
const heightInput = new LabeledFieldView( locale, createLabeledInputText );
|
628
|
+
|
629
|
+
heightInput.set( {
|
630
|
+
label: t( 'Height' ),
|
631
|
+
class: 'ck-table-form__dimensions-row__height'
|
632
|
+
} );
|
633
|
+
|
634
|
+
heightInput.fieldView.bind( 'value' ).to( this, 'height' );
|
635
|
+
heightInput.fieldView.on( 'input', () => {
|
636
|
+
this.height = heightInput.fieldView.element.value;
|
637
|
+
} );
|
638
|
+
|
639
|
+
return {
|
640
|
+
dimensionsLabel,
|
641
|
+
widthInput,
|
642
|
+
operatorLabel,
|
643
|
+
heightInput
|
644
|
+
};
|
645
|
+
}
|
646
|
+
|
647
|
+
/**
|
648
|
+
* Creates the following form fields:
|
649
|
+
*
|
650
|
+
* * {@link #paddingInput}.
|
651
|
+
*
|
652
|
+
* @private
|
653
|
+
* @returns {module:ui/labeledfield/labeledfieldview~LabeledFieldView}
|
654
|
+
*/
|
655
|
+
_createPaddingField() {
|
656
|
+
const locale = this.locale;
|
657
|
+
const t = this.t;
|
658
|
+
|
659
|
+
const paddingInput = new LabeledFieldView( locale, createLabeledInputText );
|
660
|
+
|
661
|
+
paddingInput.set( {
|
662
|
+
label: t( 'Padding' ),
|
663
|
+
class: 'ck-table-cell-properties-form__padding'
|
664
|
+
} );
|
665
|
+
|
666
|
+
paddingInput.fieldView.bind( 'value' ).to( this, 'padding' );
|
667
|
+
paddingInput.fieldView.on( 'input', () => {
|
668
|
+
this.padding = paddingInput.fieldView.element.value;
|
669
|
+
} );
|
670
|
+
|
671
|
+
return paddingInput;
|
672
|
+
}
|
673
|
+
|
674
|
+
/**
|
675
|
+
* Creates the following form fields:
|
676
|
+
*
|
677
|
+
* * {@link #horizontalAlignmentToolbar},
|
678
|
+
* * {@link #verticalAlignmentToolbar}.
|
679
|
+
*
|
680
|
+
* @private
|
681
|
+
* @returns {Object.<String,module:ui/view~View>}
|
682
|
+
*/
|
683
|
+
_createAlignmentFields() {
|
684
|
+
const locale = this.locale;
|
685
|
+
const t = this.t;
|
686
|
+
|
687
|
+
const alignmentLabel = new LabelView( locale );
|
688
|
+
|
689
|
+
alignmentLabel.text = t( 'Table cell text alignment' );
|
690
|
+
|
691
|
+
// -- Horizontal ---------------------------------------------------
|
692
|
+
|
693
|
+
const horizontalAlignmentToolbar = new ToolbarView( locale );
|
694
|
+
const isContentRTL = this.locale.contentLanguageDirection === 'rtl';
|
695
|
+
|
696
|
+
horizontalAlignmentToolbar.set( {
|
697
|
+
isCompact: true,
|
698
|
+
ariaLabel: t( 'Horizontal text alignment toolbar' )
|
699
|
+
} );
|
700
|
+
|
701
|
+
fillToolbar( {
|
702
|
+
view: this,
|
703
|
+
icons: ALIGNMENT_ICONS,
|
704
|
+
toolbar: horizontalAlignmentToolbar,
|
705
|
+
labels: this._horizontalAlignmentLabels,
|
706
|
+
propertyName: 'horizontalAlignment',
|
707
|
+
nameToValue: name => {
|
708
|
+
return name === ( isContentRTL ? 'right' : 'left' ) ? '' : name;
|
709
|
+
}
|
710
|
+
} );
|
711
|
+
|
712
|
+
// -- Vertical -----------------------------------------------------
|
713
|
+
|
714
|
+
const verticalAlignmentToolbar = new ToolbarView( locale );
|
715
|
+
|
716
|
+
verticalAlignmentToolbar.set( {
|
717
|
+
isCompact: true,
|
718
|
+
ariaLabel: t( 'Vertical text alignment toolbar' )
|
719
|
+
} );
|
720
|
+
|
721
|
+
fillToolbar( {
|
722
|
+
view: this,
|
723
|
+
icons: ALIGNMENT_ICONS,
|
724
|
+
toolbar: verticalAlignmentToolbar,
|
725
|
+
labels: this._verticalAlignmentLabels,
|
726
|
+
propertyName: 'verticalAlignment',
|
727
|
+
nameToValue: name => {
|
728
|
+
return name === 'middle' ? '' : name;
|
729
|
+
}
|
730
|
+
} );
|
731
|
+
|
732
|
+
return {
|
733
|
+
horizontalAlignmentToolbar,
|
734
|
+
verticalAlignmentToolbar,
|
735
|
+
alignmentLabel
|
736
|
+
};
|
737
|
+
}
|
738
|
+
|
739
|
+
/**
|
740
|
+
* Creates the following form controls:
|
741
|
+
*
|
742
|
+
* * {@link #saveButtonView},
|
743
|
+
* * {@link #cancelButtonView}.
|
744
|
+
*
|
745
|
+
* @private
|
746
|
+
* @returns {Object.<String,module:ui/view~View>}
|
747
|
+
*/
|
748
|
+
_createActionButtons() {
|
749
|
+
const locale = this.locale;
|
750
|
+
const t = this.t;
|
751
|
+
const saveButtonView = new ButtonView( locale );
|
752
|
+
const cancelButtonView = new ButtonView( locale );
|
753
|
+
const fieldsThatShouldValidateToSave = [
|
754
|
+
this.borderWidthInput,
|
755
|
+
this.borderColorInput,
|
756
|
+
this.backgroundInput,
|
757
|
+
this.paddingInput
|
758
|
+
];
|
759
|
+
|
760
|
+
saveButtonView.set( {
|
761
|
+
label: t( 'Save' ),
|
762
|
+
icon: icons.check,
|
763
|
+
class: 'ck-button-save',
|
764
|
+
type: 'submit',
|
765
|
+
withText: true
|
766
|
+
} );
|
767
|
+
|
768
|
+
saveButtonView.bind( 'isEnabled' ).toMany( fieldsThatShouldValidateToSave, 'errorText', ( ...errorTexts ) => {
|
769
|
+
return errorTexts.every( errorText => !errorText );
|
770
|
+
} );
|
771
|
+
|
772
|
+
cancelButtonView.set( {
|
773
|
+
label: t( 'Cancel' ),
|
774
|
+
icon: icons.cancel,
|
775
|
+
class: 'ck-button-cancel',
|
776
|
+
type: 'cancel',
|
777
|
+
withText: true
|
778
|
+
} );
|
779
|
+
|
780
|
+
cancelButtonView.delegate( 'execute' ).to( this, 'cancel' );
|
781
|
+
|
782
|
+
return {
|
783
|
+
saveButtonView, cancelButtonView
|
784
|
+
};
|
785
|
+
}
|
786
|
+
|
787
|
+
/**
|
788
|
+
* Provides localized labels for {@link #horizontalAlignmentToolbar} buttons.
|
789
|
+
*
|
790
|
+
* @private
|
791
|
+
* @type {Object.<String,String>}
|
792
|
+
*/
|
793
|
+
get _horizontalAlignmentLabels() {
|
794
|
+
const locale = this.locale;
|
795
|
+
const t = this.t;
|
796
|
+
|
797
|
+
const left = t( 'Align cell text to the left' );
|
798
|
+
const center = t( 'Align cell text to the center' );
|
799
|
+
const right = t( 'Align cell text to the right' );
|
800
|
+
const justify = t( 'Justify cell text' );
|
801
|
+
|
802
|
+
// Returns object with a proper order of labels.
|
803
|
+
if ( locale.uiLanguageDirection === 'rtl' ) {
|
804
|
+
return { right, center, left, justify };
|
805
|
+
} else {
|
806
|
+
return { left, center, right, justify };
|
807
|
+
}
|
808
|
+
}
|
809
|
+
|
810
|
+
/**
|
811
|
+
* Provides localized labels for {@link #verticalAlignmentToolbar} buttons.
|
812
|
+
*
|
813
|
+
* @private
|
814
|
+
* @type {Object.<String,String>}
|
815
|
+
*/
|
816
|
+
get _verticalAlignmentLabels() {
|
817
|
+
const t = this.t;
|
818
|
+
|
819
|
+
return {
|
820
|
+
top: t( 'Align cell text to the top' ),
|
821
|
+
middle: t( 'Align cell text to the middle' ),
|
822
|
+
bottom: t( 'Align cell text to the bottom' )
|
823
|
+
};
|
824
|
+
}
|
825
|
+
}
|
826
|
+
|
827
|
+
function isBorderStyleSet( value ) {
|
828
|
+
return !!value;
|
829
|
+
}
|