@ckeditor/ckeditor5-table 35.1.0 → 35.2.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/build/table.js +1 -1
- package/build/table.js.map +1 -0
- package/build/translations/ko.js +1 -1
- package/lang/translations/ko.po +1 -1
- package/package.json +26 -26
- package/src/index.js +1 -0
- package/src/tablecellproperties/tablecellpropertiesediting.js +4 -30
- package/src/tablecellproperties/tablecellpropertiesui.js +1 -1
- package/src/tablecellproperties/ui/tablecellpropertiesview.js +2 -0
- package/src/{tablecellproperties → tablecellwidth}/commands/tablecellwidthcommand.js +2 -3
- package/src/tablecellwidth/tablecellwidthediting.js +58 -0
- package/src/tablecolumnresize.js +2 -1
- package/src/tableproperties/ui/tablepropertiesview.js +2 -0
- package/src/ui/colorinputview.js +88 -51
- package/src/ui/inserttableview.js +40 -71
- package/src/utils/common.js +24 -0
- package/src/utils/ui/table-properties.js +7 -7
package/build/translations/ko.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e){const t=e.ko=e.ko||{};t.dictionary=Object.assign(t.dictionary||{},{"Align cell text to the bottom":"셀 텍스트를 아래로 정렬","Align cell text to the center":"셀 텍스트를 가로 가운데로 정렬","Align cell text to the left":"셀 텍스트를 왼쪽으로 정렬","Align cell text to the middle":"셀 텍스트를 세로 가운데로 정렬","Align cell text to the right":"셀 텍스트를 오른쪽으로 정렬","Align cell text to the top":"셀 텍스트를 위로 정렬","Align table to the left":"테이블을 왼쪽으로 정렬","Align table to the right":"테이블을 오른쪽으로 정렬",Alignment:"정렬",Background:"배경색",Border:"테두리","Cell properties":"셀 속성","Center table":"테이블을 가운데로 정렬",Color:"색","Color picker":"색상 선택기",Column:"열",Dashed:"파선","Delete column":"열 삭제","Delete row":"행 삭제",Dimensions:"크기",Dotted:"점선",Double:"이중선","Enter table caption":"테이블 캡션 입력",Groove:"음각선","Header column":"헤더 열","Header row":"헤더 행",Height:"세로","Horizontal text alignment toolbar":"가로 텍스트 정렬 도구 모음","Insert column left":"왼쪽에 열 삽입","Insert column right":"오른쪽에 열 삽입","Insert row above":"위에 행 삽입","Insert row below":"아래에 행 삽입","Insert table":"테이블 삽입",Inset:"측면 음각선","Justify cell text":"셀 텍스트를 양쪽으로 정렬","Merge cell down":"아래 셀과 병합","Merge cell left":"왼쪽 셀과 병합","Merge cell right":"오른쪽 셀과 병합","Merge cell up":"위 셀과 병합","Merge cells":"셀 병합",None:"선 없음",Outset:"측면 양각선",Padding:"여백",Ridge:"양각선",Row:"행","Select column":"열 선택","Select row":"행 선택",Solid:"실선","Split cell horizontally":"가로로 셀 분할","Split cell vertically":"세로로 셀 분할",Style:"스타일","Table alignment toolbar":"표 정렬 도구 모음","Table cell text alignment":"표 셀 텍스트 정렬","Table properties":"표 속성","Table toolbar":"표 도구 모음",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':'유효하지 않은 색입니다. "#FF0000"이나 "rgb(255,0,0)", 또는 "red"를 입력해 보세요.','The value is invalid. Try "10px" or "2em" or simply "2".':'유효하지 않은 값입니다. "10px"
|
|
1
|
+
!function(e){const t=e.ko=e.ko||{};t.dictionary=Object.assign(t.dictionary||{},{"Align cell text to the bottom":"셀 텍스트를 아래로 정렬","Align cell text to the center":"셀 텍스트를 가로 가운데로 정렬","Align cell text to the left":"셀 텍스트를 왼쪽으로 정렬","Align cell text to the middle":"셀 텍스트를 세로 가운데로 정렬","Align cell text to the right":"셀 텍스트를 오른쪽으로 정렬","Align cell text to the top":"셀 텍스트를 위로 정렬","Align table to the left":"테이블을 왼쪽으로 정렬","Align table to the right":"테이블을 오른쪽으로 정렬",Alignment:"정렬",Background:"배경색",Border:"테두리","Cell properties":"셀 속성","Center table":"테이블을 가운데로 정렬",Color:"색","Color picker":"색상 선택기",Column:"열",Dashed:"파선","Delete column":"열 삭제","Delete row":"행 삭제",Dimensions:"크기",Dotted:"점선",Double:"이중선","Enter table caption":"테이블 캡션 입력",Groove:"음각선","Header column":"헤더 열","Header row":"헤더 행",Height:"세로","Horizontal text alignment toolbar":"가로 텍스트 정렬 도구 모음","Insert column left":"왼쪽에 열 삽입","Insert column right":"오른쪽에 열 삽입","Insert row above":"위에 행 삽입","Insert row below":"아래에 행 삽입","Insert table":"테이블 삽입",Inset:"측면 음각선","Justify cell text":"셀 텍스트를 양쪽으로 정렬","Merge cell down":"아래 셀과 병합","Merge cell left":"왼쪽 셀과 병합","Merge cell right":"오른쪽 셀과 병합","Merge cell up":"위 셀과 병합","Merge cells":"셀 병합",None:"선 없음",Outset:"측면 양각선",Padding:"여백",Ridge:"양각선",Row:"행","Select column":"열 선택","Select row":"행 선택",Solid:"실선","Split cell horizontally":"가로로 셀 분할","Split cell vertically":"세로로 셀 분할",Style:"스타일","Table alignment toolbar":"표 정렬 도구 모음","Table cell text alignment":"표 셀 텍스트 정렬","Table properties":"표 속성","Table toolbar":"표 도구 모음",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':'유효하지 않은 색입니다. "#FF0000"이나 "rgb(255,0,0)", 또는 "red"를 입력해 보세요.','The value is invalid. Try "10px" or "2em" or simply "2".':'유효하지 않은 값입니다. "10px"나 "2em" 또는 그냥 "2"를 입력해 보세요.',"Toggle caption off":"캡션 지우기","Toggle caption on":"캡션 넣기","Vertical text alignment toolbar":"세로 텍스트 정렬 도구 모음",Width:"가로"})}(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
package/lang/translations/ko.po
CHANGED
|
@@ -242,7 +242,7 @@ msgstr "유효하지 않은 색입니다. \"#FF0000\"이나 \"rgb(255,0,0)\",
|
|
|
242
242
|
|
|
243
243
|
msgctxt "The localized error string that can be displayed next to length (padding, border width) fields that have an invalid value."
|
|
244
244
|
msgid "The value is invalid. Try \"10px\" or \"2em\" or simply \"2\"."
|
|
245
|
-
msgstr "유효하지 않은 값입니다. \"10px\"
|
|
245
|
+
msgstr "유효하지 않은 값입니다. \"10px\"나 \"2em\" 또는 그냥 \"2\"를 입력해 보세요."
|
|
246
246
|
|
|
247
247
|
msgctxt "The label used by assistive technologies describing a button that opens a color picker, where user can choose a configured color for a certain properties (eg.: background color, color, border-color etc.)."
|
|
248
248
|
msgid "Color picker"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-table",
|
|
3
|
-
"version": "35.
|
|
3
|
+
"version": "35.2.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.2.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.
|
|
24
|
-
"@ckeditor/ckeditor5-dev-utils": "^
|
|
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.
|
|
19
|
+
"@ckeditor/ckeditor5-alignment": "^35.2.0",
|
|
20
|
+
"@ckeditor/ckeditor5-basic-styles": "^35.2.0",
|
|
21
|
+
"@ckeditor/ckeditor5-block-quote": "^35.2.0",
|
|
22
|
+
"@ckeditor/ckeditor5-clipboard": "^35.2.0",
|
|
23
|
+
"@ckeditor/ckeditor5-core": "^35.2.0",
|
|
24
|
+
"@ckeditor/ckeditor5-dev-utils": "^31.0.0",
|
|
25
|
+
"@ckeditor/ckeditor5-editor-classic": "^35.2.0",
|
|
26
|
+
"@ckeditor/ckeditor5-engine": "^35.2.0",
|
|
27
|
+
"@ckeditor/ckeditor5-highlight": "^35.2.0",
|
|
28
|
+
"@ckeditor/ckeditor5-horizontal-line": "^35.2.0",
|
|
29
|
+
"@ckeditor/ckeditor5-html-support": "^35.2.0",
|
|
30
|
+
"@ckeditor/ckeditor5-image": "^35.2.0",
|
|
31
|
+
"@ckeditor/ckeditor5-indent": "^35.2.0",
|
|
32
|
+
"@ckeditor/ckeditor5-link": "^35.2.0",
|
|
33
|
+
"@ckeditor/ckeditor5-list": "^35.2.0",
|
|
34
|
+
"@ckeditor/ckeditor5-media-embed": "^35.2.0",
|
|
35
|
+
"@ckeditor/ckeditor5-paragraph": "^35.2.0",
|
|
36
|
+
"@ckeditor/ckeditor5-theme-lark": "^35.2.0",
|
|
37
|
+
"@ckeditor/ckeditor5-typing": "^35.2.0",
|
|
38
|
+
"@ckeditor/ckeditor5-ui": "^35.2.0",
|
|
39
|
+
"@ckeditor/ckeditor5-undo": "^35.2.0",
|
|
40
|
+
"@ckeditor/ckeditor5-utils": "^35.2.0",
|
|
41
|
+
"@ckeditor/ckeditor5-widget": "^35.2.0",
|
|
42
|
+
"@ckeditor/ckeditor5-source-editing": "^35.2.0",
|
|
43
43
|
"json-diff": "^0.5.4",
|
|
44
44
|
"webpack": "^5.58.1",
|
|
45
45
|
"webpack-cli": "^4.9.0"
|
package/src/index.js
CHANGED
|
@@ -15,6 +15,7 @@ export { default as TableToolbar } from './tabletoolbar';
|
|
|
15
15
|
export { default as TableCellProperties } from './tablecellproperties';
|
|
16
16
|
export { default as TableCellPropertiesEditing } from './tablecellproperties/tablecellpropertiesediting';
|
|
17
17
|
export { default as TableCellPropertiesUI } from './tablecellproperties/tablecellpropertiesui';
|
|
18
|
+
export { default as TableCellWidthEditing } from './tablecellwidth/tablecellwidthediting';
|
|
18
19
|
export { default as TableProperties } from './tableproperties';
|
|
19
20
|
export { default as TablePropertiesEditing } from './tableproperties/tablepropertiesediting';
|
|
20
21
|
export { default as TablePropertiesUI } from './tableproperties/tablepropertiesui';
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
11
|
import { addBorderRules, addPaddingRules, addBackgroundRules } from 'ckeditor5/src/engine';
|
|
12
12
|
|
|
13
|
-
import { downcastAttributeToStyle,
|
|
13
|
+
import { downcastAttributeToStyle, upcastBorderStyles } from './../converters/tableproperties';
|
|
14
14
|
import TableEditing from './../tableediting';
|
|
15
|
+
import TableCellWidthEditing from '../tablecellwidth/tablecellwidthediting';
|
|
15
16
|
import TableCellPaddingCommand from './commands/tablecellpaddingcommand';
|
|
16
|
-
import TableCellWidthCommand from './commands/tablecellwidthcommand';
|
|
17
17
|
import TableCellHeightCommand from './commands/tablecellheightcommand';
|
|
18
18
|
import TableCellBackgroundColorCommand from './commands/tablecellbackgroundcolorcommand';
|
|
19
19
|
import TableCellVerticalAlignmentCommand from './commands/tablecellverticalalignmentcommand';
|
|
@@ -22,6 +22,7 @@ import TableCellBorderStyleCommand from './commands/tablecellborderstylecommand'
|
|
|
22
22
|
import TableCellBorderColorCommand from './commands/tablecellbordercolorcommand';
|
|
23
23
|
import TableCellBorderWidthCommand from './commands/tablecellborderwidthcommand';
|
|
24
24
|
import { getNormalizedDefaultProperties } from '../utils/table-properties';
|
|
25
|
+
import { enableProperty } from '../utils/common';
|
|
25
26
|
|
|
26
27
|
const VALIGN_VALUES_REG_EXP = /^(top|middle|bottom)$/;
|
|
27
28
|
const ALIGN_VALUES_REG_EXP = /^(left|center|right|justify)$/;
|
|
@@ -59,7 +60,7 @@ export default class TableCellPropertiesEditing extends Plugin {
|
|
|
59
60
|
* @inheritDoc
|
|
60
61
|
*/
|
|
61
62
|
static get requires() {
|
|
62
|
-
return [ TableEditing ];
|
|
63
|
+
return [ TableEditing, TableCellWidthEditing ];
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
/**
|
|
@@ -92,13 +93,6 @@ export default class TableCellPropertiesEditing extends Plugin {
|
|
|
92
93
|
editor.commands.add( 'tableCellBorderColor', new TableCellBorderColorCommand( editor, defaultTableCellProperties.borderColor ) );
|
|
93
94
|
editor.commands.add( 'tableCellBorderWidth', new TableCellBorderWidthCommand( editor, defaultTableCellProperties.borderWidth ) );
|
|
94
95
|
|
|
95
|
-
enableProperty( schema, conversion, {
|
|
96
|
-
modelAttribute: 'tableCellWidth',
|
|
97
|
-
styleName: 'width',
|
|
98
|
-
defaultValue: defaultTableCellProperties.width
|
|
99
|
-
} );
|
|
100
|
-
editor.commands.add( 'tableCellWidth', new TableCellWidthCommand( editor, defaultTableCellProperties.width ) );
|
|
101
|
-
|
|
102
96
|
enableProperty( schema, conversion, {
|
|
103
97
|
modelAttribute: 'tableCellHeight',
|
|
104
98
|
styleName: 'height',
|
|
@@ -288,23 +282,3 @@ function enableVerticalAlignmentProperty( schema, conversion, defaultValue ) {
|
|
|
288
282
|
}
|
|
289
283
|
} );
|
|
290
284
|
}
|
|
291
|
-
|
|
292
|
-
// Enables conversion for an attribute for simple view-model mappings.
|
|
293
|
-
//
|
|
294
|
-
// @param {module:engine/model/schema~Schema} schema
|
|
295
|
-
// @param {module:engine/conversion/conversion~Conversion} conversion
|
|
296
|
-
// @param {Object} options
|
|
297
|
-
// @param {String} options.modelAttribute
|
|
298
|
-
// @param {String} options.styleName
|
|
299
|
-
// @param {String} options.defaultValue The default value for the specified `modelAttribute`.
|
|
300
|
-
// @param {Boolean} [options.reduceBoxSides=false]
|
|
301
|
-
function enableProperty( schema, conversion, options ) {
|
|
302
|
-
const { modelAttribute } = options;
|
|
303
|
-
|
|
304
|
-
schema.extend( 'tableCell', {
|
|
305
|
-
allowAttributes: [ modelAttribute ]
|
|
306
|
-
} );
|
|
307
|
-
|
|
308
|
-
upcastStyleToAttribute( conversion, { viewElement: /^(td|th)$/, ...options } );
|
|
309
|
-
downcastAttributeToStyle( conversion, { modelElement: 'tableCell', ...options } );
|
|
310
|
-
}
|
|
@@ -33,8 +33,8 @@ const propertyToCommandMap = {
|
|
|
33
33
|
borderStyle: 'tableCellBorderStyle',
|
|
34
34
|
borderColor: 'tableCellBorderColor',
|
|
35
35
|
borderWidth: 'tableCellBorderWidth',
|
|
36
|
-
width: 'tableCellWidth',
|
|
37
36
|
height: 'tableCellHeight',
|
|
37
|
+
width: 'tableCellWidth',
|
|
38
38
|
padding: 'tableCellPadding',
|
|
39
39
|
backgroundColor: 'tableCellBackgroundColor',
|
|
40
40
|
horizontalAlignment: 'tableCellHorizontalAlignment',
|
|
@@ -409,8 +409,10 @@ export default class TableCellPropertiesView extends View {
|
|
|
409
409
|
[
|
|
410
410
|
this.borderStyleDropdown,
|
|
411
411
|
this.borderColorInput,
|
|
412
|
+
this.borderColorInput.fieldView.dropdownView.buttonView,
|
|
412
413
|
this.borderWidthInput,
|
|
413
414
|
this.backgroundInput,
|
|
415
|
+
this.backgroundInput.fieldView.dropdownView.buttonView,
|
|
414
416
|
this.widthInput,
|
|
415
417
|
this.heightInput,
|
|
416
418
|
this.paddingInput,
|
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* @module table/tablecellproperties/commands/tablecellwidthcommand
|
|
8
8
|
*/
|
|
9
|
-
|
|
10
|
-
import TableCellPropertyCommand from './tablecellpropertycommand';
|
|
9
|
+
import TableCellPropertyCommand from '../../tablecellproperties/commands/tablecellpropertycommand';
|
|
11
10
|
import { addDefaultUnitToNumericValue } from '../../utils/table-properties';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* The table cell width command.
|
|
15
14
|
*
|
|
16
|
-
* The command is registered by the {@link module:table/
|
|
15
|
+
* The command is registered by the {@link module:table/tablecellwidth/tablecellwidthediting~TableCellWidthEditing} as
|
|
17
16
|
* the `'tableCellWidth'` editor command.
|
|
18
17
|
*
|
|
19
18
|
* To change the width of selected cells, execute the command:
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @module table/tablecellwidth/tablecellwidthediting
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Plugin } from 'ckeditor5/src/core';
|
|
11
|
+
|
|
12
|
+
import TableEditing from './../tableediting';
|
|
13
|
+
import TableCellWidthCommand from './commands/tablecellwidthcommand';
|
|
14
|
+
import { getNormalizedDefaultProperties } from '../utils/table-properties';
|
|
15
|
+
import { enableProperty } from '../utils/common';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The table cell width editing feature.
|
|
19
|
+
*
|
|
20
|
+
* Introduces `tableCellWidth` table cell model attribute alongside with its converters
|
|
21
|
+
* and a command.
|
|
22
|
+
*
|
|
23
|
+
* @extends module:core/plugin~Plugin
|
|
24
|
+
*/
|
|
25
|
+
export default class TableCellWidthEditing extends Plugin {
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
static get pluginName() {
|
|
30
|
+
return 'TableCellWidthEditing';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
static get requires() {
|
|
37
|
+
return [ TableEditing ];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @inheritDoc
|
|
42
|
+
*/
|
|
43
|
+
init() {
|
|
44
|
+
const editor = this.editor;
|
|
45
|
+
|
|
46
|
+
const defaultTableCellProperties = getNormalizedDefaultProperties(
|
|
47
|
+
editor.config.get( 'table.tableCellProperties.defaultProperties' )
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
enableProperty( editor.model.schema, editor.conversion, {
|
|
51
|
+
modelAttribute: 'tableCellWidth',
|
|
52
|
+
styleName: 'width',
|
|
53
|
+
defaultValue: defaultTableCellProperties.width
|
|
54
|
+
} );
|
|
55
|
+
|
|
56
|
+
editor.commands.add( 'tableCellWidth', new TableCellWidthCommand( editor, defaultTableCellProperties.width ) );
|
|
57
|
+
}
|
|
58
|
+
}
|
package/src/tablecolumnresize.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { Plugin } from 'ckeditor5/src/core';
|
|
11
11
|
import TableColumnResizeEditing from './tablecolumnresize/tablecolumnresizeediting';
|
|
12
|
+
import TableCellWidthEditing from './tablecellwidth/tablecellwidthediting';
|
|
12
13
|
|
|
13
14
|
import '../theme/tablecolumnresize.css';
|
|
14
15
|
|
|
@@ -24,7 +25,7 @@ export default class TableColumnResize extends Plugin {
|
|
|
24
25
|
* @inheritDoc
|
|
25
26
|
*/
|
|
26
27
|
static get requires() {
|
|
27
|
-
return [ TableColumnResizeEditing ];
|
|
28
|
+
return [ TableColumnResizeEditing, TableCellWidthEditing ];
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
/**
|
|
@@ -360,8 +360,10 @@ export default class TablePropertiesView extends View {
|
|
|
360
360
|
[
|
|
361
361
|
this.borderStyleDropdown,
|
|
362
362
|
this.borderColorInput,
|
|
363
|
+
this.borderColorInput.fieldView.dropdownView.buttonView,
|
|
363
364
|
this.borderWidthInput,
|
|
364
365
|
this.backgroundInput,
|
|
366
|
+
this.backgroundInput.fieldView.dropdownView.buttonView,
|
|
365
367
|
this.widthInput,
|
|
366
368
|
this.heightInput,
|
|
367
369
|
this.alignmentToolbar,
|
package/src/ui/colorinputview.js
CHANGED
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* @module table/ui/colorinputview
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { View, InputTextView, ButtonView, createDropdown, ColorGridView } from 'ckeditor5/src/ui';
|
|
10
|
+
import { View, InputTextView, ButtonView, createDropdown, ColorGridView, FocusCycler, ViewCollection } from 'ckeditor5/src/ui';
|
|
11
11
|
import { icons } from 'ckeditor5/src/core';
|
|
12
|
+
import { FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
|
|
12
13
|
|
|
13
14
|
import '../../theme/colorinput.css';
|
|
14
15
|
|
|
@@ -34,8 +35,6 @@ export default class ColorInputView extends View {
|
|
|
34
35
|
constructor( locale, options ) {
|
|
35
36
|
super( locale );
|
|
36
37
|
|
|
37
|
-
const bind = this.bindTemplate;
|
|
38
|
-
|
|
39
38
|
/**
|
|
40
39
|
* The value of the input.
|
|
41
40
|
*
|
|
@@ -45,14 +44,6 @@ export default class ColorInputView extends View {
|
|
|
45
44
|
*/
|
|
46
45
|
this.set( 'value', '' );
|
|
47
46
|
|
|
48
|
-
/**
|
|
49
|
-
* The `id` attribute of the input (i.e. to pair with the `<label>` element).
|
|
50
|
-
*
|
|
51
|
-
* @observable
|
|
52
|
-
* @member {String} #id
|
|
53
|
-
*/
|
|
54
|
-
this.set( 'id' );
|
|
55
|
-
|
|
56
47
|
/**
|
|
57
48
|
* Controls whether the input view is in read-only mode.
|
|
58
49
|
*
|
|
@@ -62,16 +53,6 @@ export default class ColorInputView extends View {
|
|
|
62
53
|
*/
|
|
63
54
|
this.set( 'isReadOnly', false );
|
|
64
55
|
|
|
65
|
-
/**
|
|
66
|
-
* Set to `true` when the field has some error. Usually controlled via
|
|
67
|
-
* {@link module:ui/labeledinput/labeledinputview~LabeledInputView#errorText}.
|
|
68
|
-
*
|
|
69
|
-
* @observable
|
|
70
|
-
* @member {Boolean} #hasError
|
|
71
|
-
* @default false
|
|
72
|
-
*/
|
|
73
|
-
this.set( 'hasError', false );
|
|
74
|
-
|
|
75
56
|
/**
|
|
76
57
|
* An observable flag set to `true` when the input is focused by the user.
|
|
77
58
|
* `false` otherwise.
|
|
@@ -94,40 +75,54 @@ export default class ColorInputView extends View {
|
|
|
94
75
|
this.set( 'isEmpty', true );
|
|
95
76
|
|
|
96
77
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
78
|
+
* A cached reference to the options passed to the constructor.
|
|
79
|
+
*
|
|
80
|
+
* @member {Object}
|
|
81
|
+
*/
|
|
82
|
+
this.options = options;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Tracks information about the DOM focus in the view.
|
|
99
86
|
*
|
|
100
|
-
* @
|
|
101
|
-
* @member {
|
|
87
|
+
* @readonly
|
|
88
|
+
* @member {module:utils/focustracker~FocusTracker}
|
|
102
89
|
*/
|
|
103
|
-
this.
|
|
90
|
+
this.focusTracker = new FocusTracker();
|
|
104
91
|
|
|
105
92
|
/**
|
|
106
|
-
* A
|
|
93
|
+
* A collection of views that can be focused in the view.
|
|
107
94
|
*
|
|
108
|
-
* @
|
|
95
|
+
* @readonly
|
|
96
|
+
* @protected
|
|
97
|
+
* @member {module:ui/viewcollection~ViewCollection}
|
|
109
98
|
*/
|
|
110
|
-
this.
|
|
99
|
+
this._focusables = new ViewCollection();
|
|
111
100
|
|
|
112
101
|
/**
|
|
113
102
|
* An instance of the dropdown allowing to select a color from a grid.
|
|
114
103
|
*
|
|
115
|
-
* @protected
|
|
116
104
|
* @member {module:ui/dropdown/dropdown~DropdownView}
|
|
117
105
|
*/
|
|
118
|
-
this.
|
|
106
|
+
this.dropdownView = this._createDropdownView();
|
|
119
107
|
|
|
120
108
|
/**
|
|
121
109
|
* An instance of the input allowing the user to type a color value.
|
|
122
110
|
*
|
|
123
|
-
* @protected
|
|
124
111
|
* @member {module:ui/inputtext/inputtextview~InputTextView}
|
|
125
112
|
*/
|
|
126
|
-
this.
|
|
113
|
+
this.inputView = this._createInputTextView();
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
117
|
+
*
|
|
118
|
+
* @readonly
|
|
119
|
+
* @member {module:utils/keystrokehandler~KeystrokeHandler}
|
|
120
|
+
*/
|
|
121
|
+
this.keystrokes = new KeystrokeHandler();
|
|
127
122
|
|
|
128
123
|
/**
|
|
129
124
|
* The flag that indicates whether the user is still typing.
|
|
130
|
-
* If set to true, it means that the text input field ({@link #
|
|
125
|
+
* If set to true, it means that the text input field ({@link #inputView}) still has the focus.
|
|
131
126
|
* So, we should interrupt the user by replacing the input's value.
|
|
132
127
|
*
|
|
133
128
|
* @protected
|
|
@@ -135,36 +130,72 @@ export default class ColorInputView extends View {
|
|
|
135
130
|
*/
|
|
136
131
|
this._stillTyping = false;
|
|
137
132
|
|
|
133
|
+
/**
|
|
134
|
+
* Helps cycling over focusable items in the view.
|
|
135
|
+
*
|
|
136
|
+
* @readonly
|
|
137
|
+
* @protected
|
|
138
|
+
* @member {module:ui/focuscycler~FocusCycler}
|
|
139
|
+
*/
|
|
140
|
+
this._focusCycler = new FocusCycler( {
|
|
141
|
+
focusables: this._focusables,
|
|
142
|
+
focusTracker: this.focusTracker,
|
|
143
|
+
keystrokeHandler: this.keystrokes,
|
|
144
|
+
actions: {
|
|
145
|
+
// Navigate items backwards using the <kbd>Shift</kbd> + <kbd>Tab</kbd> keystroke.
|
|
146
|
+
focusPrevious: 'shift + tab',
|
|
147
|
+
|
|
148
|
+
// Navigate items forwards using the <kbd>Tab</kbd> key.
|
|
149
|
+
focusNext: 'tab'
|
|
150
|
+
}
|
|
151
|
+
} );
|
|
152
|
+
|
|
138
153
|
this.setTemplate( {
|
|
139
154
|
tag: 'div',
|
|
140
155
|
attributes: {
|
|
141
156
|
class: [
|
|
142
157
|
'ck',
|
|
143
|
-
'ck-input-color'
|
|
144
|
-
|
|
145
|
-
],
|
|
146
|
-
id: bind.to( 'id' ),
|
|
147
|
-
'aria-invalid': bind.if( 'hasError', true ),
|
|
148
|
-
'aria-describedby': bind.to( 'ariaDescribedById' )
|
|
158
|
+
'ck-input-color'
|
|
159
|
+
]
|
|
149
160
|
},
|
|
150
161
|
children: [
|
|
151
|
-
this.
|
|
152
|
-
this.
|
|
162
|
+
this.dropdownView,
|
|
163
|
+
this.inputView
|
|
153
164
|
]
|
|
154
165
|
} );
|
|
155
166
|
|
|
156
167
|
this.on( 'change:value', ( evt, name, inputValue ) => this._setInputValue( inputValue ) );
|
|
157
168
|
}
|
|
158
169
|
|
|
170
|
+
/**
|
|
171
|
+
* @inheritDoc
|
|
172
|
+
*/
|
|
173
|
+
render() {
|
|
174
|
+
super.render();
|
|
175
|
+
|
|
176
|
+
// Start listening for the keystrokes coming from the dropdown panel view.
|
|
177
|
+
this.keystrokes.listenTo( this.dropdownView.panelView.element );
|
|
178
|
+
}
|
|
179
|
+
|
|
159
180
|
/**
|
|
160
181
|
* Focuses the input.
|
|
161
182
|
*/
|
|
162
183
|
focus() {
|
|
163
|
-
this.
|
|
184
|
+
this.inputView.focus();
|
|
164
185
|
}
|
|
165
186
|
|
|
166
187
|
/**
|
|
167
|
-
*
|
|
188
|
+
* @inheritDoc
|
|
189
|
+
*/
|
|
190
|
+
destroy() {
|
|
191
|
+
super.destroy();
|
|
192
|
+
|
|
193
|
+
this.focusTracker.destroy();
|
|
194
|
+
this.keystrokes.destroy();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Creates and configures the {@link #dropdownView}.
|
|
168
199
|
*
|
|
169
200
|
* @private
|
|
170
201
|
*/
|
|
@@ -215,6 +246,12 @@ export default class ColorInputView extends View {
|
|
|
215
246
|
dropdown.panelView.children.add( colorGrid );
|
|
216
247
|
dropdown.bind( 'isEnabled' ).to( this, 'isReadOnly', value => !value );
|
|
217
248
|
|
|
249
|
+
this._focusables.add( removeColorButton );
|
|
250
|
+
this._focusables.add( colorGrid );
|
|
251
|
+
|
|
252
|
+
this.focusTracker.add( removeColorButton.element );
|
|
253
|
+
this.focusTracker.add( colorGrid.element );
|
|
254
|
+
|
|
218
255
|
return dropdown;
|
|
219
256
|
}
|
|
220
257
|
|
|
@@ -222,7 +259,7 @@ export default class ColorInputView extends View {
|
|
|
222
259
|
* Creates and configures an instance of {@link module:ui/inputtext/inputtextview~InputTextView}.
|
|
223
260
|
*
|
|
224
261
|
* @private
|
|
225
|
-
* @returns {module:ui/inputtext/inputtextview~InputTextView} A configured instance to be set as {@link #
|
|
262
|
+
* @returns {module:ui/inputtext/inputtextview~InputTextView} A configured instance to be set as {@link #inputView}.
|
|
226
263
|
*/
|
|
227
264
|
_createInputTextView() {
|
|
228
265
|
const locale = this.locale;
|
|
@@ -275,7 +312,7 @@ export default class ColorInputView extends View {
|
|
|
275
312
|
removeColorButton.label = removeColorButtonLabel;
|
|
276
313
|
removeColorButton.on( 'execute', () => {
|
|
277
314
|
this.value = defaultColor;
|
|
278
|
-
this.
|
|
315
|
+
this.dropdownView.isOpen = false;
|
|
279
316
|
this.fire( 'input' );
|
|
280
317
|
} );
|
|
281
318
|
|
|
@@ -283,7 +320,7 @@ export default class ColorInputView extends View {
|
|
|
283
320
|
}
|
|
284
321
|
|
|
285
322
|
/**
|
|
286
|
-
* Creates and configures the color grid inside the {@link #
|
|
323
|
+
* Creates and configures the color grid inside the {@link #dropdownView}.
|
|
287
324
|
*
|
|
288
325
|
* @private
|
|
289
326
|
*/
|
|
@@ -295,7 +332,7 @@ export default class ColorInputView extends View {
|
|
|
295
332
|
|
|
296
333
|
colorGrid.on( 'execute', ( evtData, data ) => {
|
|
297
334
|
this.value = data.value;
|
|
298
|
-
this.
|
|
335
|
+
this.dropdownView.isOpen = false;
|
|
299
336
|
this.fire( 'input' );
|
|
300
337
|
} );
|
|
301
338
|
colorGrid.bind( 'selectedColor' ).to( this, 'value' );
|
|
@@ -304,7 +341,7 @@ export default class ColorInputView extends View {
|
|
|
304
341
|
}
|
|
305
342
|
|
|
306
343
|
/**
|
|
307
|
-
* Sets {@link #
|
|
344
|
+
* Sets {@link #inputView}'s value property to the color value or color label,
|
|
308
345
|
* if there is one and the user is not typing.
|
|
309
346
|
*
|
|
310
347
|
* Handles cases like:
|
|
@@ -322,9 +359,9 @@ export default class ColorInputView extends View {
|
|
|
322
359
|
const mappedColor = this.options.colorDefinitions.find( def => normalizedInputValue === normalizeColor( def.color ) );
|
|
323
360
|
|
|
324
361
|
if ( mappedColor ) {
|
|
325
|
-
this.
|
|
362
|
+
this.inputView.value = mappedColor.label;
|
|
326
363
|
} else {
|
|
327
|
-
this.
|
|
364
|
+
this.inputView.value = inputValue || '';
|
|
328
365
|
}
|
|
329
366
|
}
|
|
330
367
|
}
|