jodit 3.6.16 → 3.7.2
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/.eslintrc.js +1 -1
- package/{ISSUE_TEMPLATE.md → .github/ISSUE_TEMPLATE.md} +0 -0
- package/{PULL_REQUEST_TEMPLATE.md → .github/PULL_REQUEST_TEMPLATE.md} +0 -0
- package/CHANGELOG.MD +76 -5
- package/build/jodit.css +23 -19
- package/build/jodit.es2018.css +22 -18
- package/build/jodit.es2018.en.css +22 -18
- package/build/jodit.es2018.en.js +153 -99
- package/build/jodit.es2018.en.min.css +1 -1
- package/build/jodit.es2018.en.min.js +2 -2
- package/build/jodit.es2018.js +153 -99
- package/build/jodit.es2018.min.css +1 -1
- package/build/jodit.es2018.min.js +2 -2
- package/build/jodit.js +884 -809
- package/build/jodit.min.css +2 -2
- package/build/jodit.min.js +2 -2
- package/package.json +24 -24
- package/src/core/async.ts +22 -8
- package/src/core/component/component.ts +4 -2
- package/src/core/component/view-component.ts +1 -1
- package/src/core/decorators/cache.ts +1 -1
- package/src/core/decorators/component.ts +1 -1
- package/src/core/decorators/debounce.ts +5 -4
- package/src/core/decorators/idle.ts +40 -0
- package/src/core/decorators/index.ts +1 -0
- package/src/core/decorators/nonenumerable.ts +1 -1
- package/src/core/decorators/spy.ts +2 -3
- package/src/core/decorators/watch.ts +9 -5
- package/src/core/events/events-native.ts +1 -1
- package/src/core/global.ts +7 -3
- package/src/core/helpers/checker/is-plain-object.ts +1 -2
- package/src/core/helpers/checker/is-url.ts +4 -1
- package/src/core/helpers/scroll-into-view.ts +1 -1
- package/src/core/helpers/size/position.ts +1 -22
- package/src/core/helpers/string/stringify.ts +2 -2
- package/src/core/helpers/type.ts +0 -44
- package/src/core/helpers/utils/utils.ts +1 -1
- package/src/core/plugin.ts +3 -1
- package/src/core/ui/button/button/button.ts +2 -2
- package/src/core/ui/button/group/group.ts +6 -4
- package/src/core/ui/element.ts +2 -2
- package/src/core/ui/form/block/block.ts +1 -1
- package/src/core/ui/form/form.ts +5 -5
- package/src/core/ui/form/inputs/area/area.ts +3 -3
- package/src/core/ui/form/inputs/checkbox/checkbox.ts +2 -2
- package/src/core/ui/form/inputs/file/file.ts +6 -4
- package/src/core/ui/form/inputs/input/input.ts +7 -5
- package/src/core/ui/form/inputs/select/select.ts +9 -7
- package/src/core/ui/list/group.ts +4 -4
- package/src/core/ui/list/list.ts +2 -2
- package/src/core/ui/popup/popup.ts +3 -3
- package/src/core/ui/progress-bar/progress-bar.ts +3 -3
- package/src/core/view/view-with-toolbar.ts +5 -2
- package/src/core/view/view.ts +2 -2
- package/src/jodit.ts +37 -15
- package/src/modules/context-menu/context-menu.ts +1 -1
- package/src/modules/dialog/dialog.ts +4 -4
- package/src/modules/file-browser/builders/context-menu.ts +1 -1
- package/src/modules/file-browser/data-provider.ts +1 -1
- package/src/modules/file-browser/file-browser.ts +3 -3
- package/src/modules/image-editor/image-editor.ts +1 -1
- package/src/modules/observer/observer.ts +1 -1
- package/src/modules/observer/snapshot.ts +1 -1
- package/src/modules/status-bar/status-bar.ts +1 -1
- package/src/modules/table.ts +3 -1
- package/src/modules/toolbar/button/button.ts +13 -10
- package/src/modules/toolbar/button/content.ts +3 -3
- package/src/modules/toolbar/collection/collection.ts +9 -6
- package/src/modules/toolbar/collection/editor-collection.ts +26 -4
- package/src/modules/uploader/uploader.ts +1 -1
- package/src/modules/widget/file-selector/file-selector.ts +1 -1
- package/src/plugins/about/about.ts +1 -1
- package/src/plugins/class-span/class-span.ts +3 -3
- package/src/plugins/clipboard/clipboard.ts +28 -24
- package/src/plugins/clipboard/paste/helpers.ts +5 -8
- package/src/plugins/clipboard/paste/paste.ts +3 -3
- package/src/plugins/fix/clean-html.ts +3 -3
- package/src/plugins/image/helpers.ts +1 -1
- package/src/plugins/inline-popup/inline-popup.ts +1 -1
- package/src/plugins/keyboard/delete.ts +1 -1
- package/src/plugins/keyboard/enter.ts +26 -26
- package/src/plugins/limit.ts +2 -2
- package/src/plugins/link/link.ts +3 -3
- package/src/plugins/media/video/index.ts +1 -1
- package/src/plugins/ordered-list.ts +64 -61
- package/src/plugins/redo-undo.ts +3 -3
- package/src/plugins/search/search.ts +2 -2
- package/src/plugins/select.ts +3 -2
- package/src/plugins/size/resize-handler.ts +2 -2
- package/src/plugins/size/size.ts +2 -2
- package/src/plugins/source/editor/engines/ace.ts +8 -8
- package/src/plugins/source/editor/engines/area.ts +15 -13
- package/src/plugins/source/source.ts +1 -1
- package/src/plugins/symbols/symbols.ts +3 -3
- package/src/plugins/table/config.ts +3 -1
- package/src/plugins/table/resize-cells.ts +21 -16
- package/src/plugins/table/select-cells.ts +44 -6
- package/src/plugins/table/table-keyboard-navigation.ts +134 -131
- package/src/plugins/table/table.less +24 -17
- package/src/types/async.d.ts +2 -0
- package/src/types/core.ts +13 -0
- package/src/types/index.d.ts +1 -0
- package/src/types/jodit.d.ts +2 -0
- package/test/tests/acceptance/editorTest.js +37 -0
- package/test/tests/acceptance/tableTest.js +23 -14
- package/tsconfig.json +1 -0
- package/webpack.config.js +1 -0
|
@@ -16,160 +16,163 @@ import { Table } from '../../modules';
|
|
|
16
16
|
export function tableKeyboardNavigation(editor: IJodit): void {
|
|
17
17
|
editor.e
|
|
18
18
|
.off('.tableKeyboardNavigation')
|
|
19
|
-
.on(
|
|
20
|
-
|
|
21
|
-
| void => {
|
|
22
|
-
|
|
19
|
+
.on(
|
|
20
|
+
'keydown.tableKeyboardNavigation',
|
|
21
|
+
(event: KeyboardEvent): false | void => {
|
|
22
|
+
let current: Element, block: HTMLElement;
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
if (
|
|
25
|
+
event.key === consts.KEY_TAB ||
|
|
26
|
+
event.key === consts.KEY_LEFT ||
|
|
27
|
+
event.key === consts.KEY_RIGHT ||
|
|
28
|
+
event.key === consts.KEY_UP ||
|
|
29
|
+
event.key === consts.KEY_DOWN
|
|
30
|
+
) {
|
|
31
|
+
current = editor.s.current() as Element;
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
block = Dom.up(
|
|
34
|
+
current,
|
|
35
|
+
(elm: Node | null) =>
|
|
36
|
+
elm &&
|
|
37
|
+
elm.nodeName &&
|
|
38
|
+
/^td|th$/i.test(elm.nodeName),
|
|
39
|
+
editor.editor
|
|
40
|
+
) as HTMLTableCellElement;
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
if (!block) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
const range = editor.s.range;
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
48
|
+
if (event.key !== consts.KEY_TAB && current !== block) {
|
|
49
|
+
if (
|
|
50
|
+
((event.key === consts.KEY_LEFT ||
|
|
51
|
+
event.key === consts.KEY_UP) &&
|
|
52
|
+
(Dom.prev(
|
|
53
|
+
current,
|
|
54
|
+
(elm: Node | null) =>
|
|
55
|
+
event.key === consts.KEY_UP
|
|
56
|
+
? Dom.isTag(elm, 'br')
|
|
57
|
+
: Boolean(elm),
|
|
58
|
+
block
|
|
59
|
+
) ||
|
|
60
|
+
(event.key !== consts.KEY_UP &&
|
|
61
|
+
Dom.isText(current) &&
|
|
62
|
+
range.startOffset !== 0))) ||
|
|
63
|
+
((event.key === consts.KEY_RIGHT ||
|
|
64
|
+
event.key === consts.KEY_DOWN) &&
|
|
65
|
+
(Dom.next(
|
|
66
|
+
current,
|
|
67
|
+
(elm: Node | null) =>
|
|
68
|
+
event.key === consts.KEY_DOWN
|
|
69
|
+
? Dom.isTag(elm, 'br')
|
|
70
|
+
: Boolean(elm),
|
|
71
|
+
block
|
|
72
|
+
) ||
|
|
73
|
+
(event.key !== consts.KEY_DOWN &&
|
|
74
|
+
Dom.isText(current) &&
|
|
75
|
+
current.nodeValue &&
|
|
76
|
+
range.startOffset !==
|
|
77
|
+
current.nodeValue.length)))
|
|
78
|
+
) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
78
81
|
}
|
|
82
|
+
} else {
|
|
83
|
+
return;
|
|
79
84
|
}
|
|
80
|
-
} else {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
const table = Dom.up(
|
|
87
|
+
block,
|
|
88
|
+
(elm: Node | null) => elm && /^table$/i.test(elm.nodeName),
|
|
89
|
+
editor.editor
|
|
90
|
+
) as HTMLTableElement;
|
|
91
|
+
let next: HTMLTableCellElement | null = null;
|
|
90
92
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
switch (event.key) {
|
|
94
|
+
case consts.KEY_TAB:
|
|
95
|
+
// case consts.KEY_RIGHT:
|
|
96
|
+
case consts.KEY_LEFT: {
|
|
97
|
+
const sibling: string =
|
|
98
|
+
event.key === consts.KEY_LEFT || event.shiftKey
|
|
99
|
+
? 'prev'
|
|
100
|
+
: 'next';
|
|
99
101
|
|
|
100
|
-
next = (Dom as any)[sibling](
|
|
101
|
-
block,
|
|
102
|
-
(elm: Node | null) =>
|
|
103
|
-
elm &&
|
|
104
|
-
/^td|th$/i.test((elm as HTMLElement).tagName),
|
|
105
|
-
table
|
|
106
|
-
) as HTMLTableCellElement;
|
|
107
|
-
|
|
108
|
-
if (!next) {
|
|
109
|
-
Table.appendRow(
|
|
110
|
-
table,
|
|
111
|
-
sibling === 'next'
|
|
112
|
-
? false
|
|
113
|
-
: (table.querySelector(
|
|
114
|
-
'tr'
|
|
115
|
-
) as HTMLTableRowElement),
|
|
116
|
-
sibling === 'next',
|
|
117
|
-
editor.createInside
|
|
118
|
-
);
|
|
119
102
|
next = (Dom as any)[sibling](
|
|
120
103
|
block,
|
|
121
104
|
(elm: Node | null) =>
|
|
122
|
-
elm &&
|
|
105
|
+
elm &&
|
|
106
|
+
/^td|th$/i.test((elm as HTMLElement).tagName),
|
|
123
107
|
table
|
|
124
108
|
) as HTMLTableCellElement;
|
|
109
|
+
|
|
110
|
+
if (!next) {
|
|
111
|
+
Table.appendRow(
|
|
112
|
+
table,
|
|
113
|
+
sibling === 'next'
|
|
114
|
+
? false
|
|
115
|
+
: (table.querySelector(
|
|
116
|
+
'tr'
|
|
117
|
+
) as HTMLTableRowElement),
|
|
118
|
+
sibling === 'next',
|
|
119
|
+
editor.createInside
|
|
120
|
+
);
|
|
121
|
+
next = (Dom as any)[sibling](
|
|
122
|
+
block,
|
|
123
|
+
(elm: Node | null) =>
|
|
124
|
+
elm && Dom.isCell(elm, editor.ew),
|
|
125
|
+
table
|
|
126
|
+
) as HTMLTableCellElement;
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
125
129
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
let i = 0,
|
|
132
|
-
j = 0;
|
|
130
|
+
case consts.KEY_UP:
|
|
131
|
+
case consts.KEY_DOWN:
|
|
132
|
+
{
|
|
133
|
+
let i = 0,
|
|
134
|
+
j = 0;
|
|
133
135
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
const matrix = Table.formalMatrix(
|
|
137
|
+
table,
|
|
138
|
+
(elm, _i, _j) => {
|
|
139
|
+
if (elm === block) {
|
|
140
|
+
i = _i;
|
|
141
|
+
j = _j;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
if (event.key === consts.KEY_UP) {
|
|
146
|
+
if (matrix[i - 1] !== undefined) {
|
|
147
|
+
next = matrix[i - 1][j];
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
if (matrix[i + 1] !== undefined) {
|
|
151
|
+
next = matrix[i + 1][j];
|
|
140
152
|
}
|
|
141
|
-
}
|
|
142
|
-
);
|
|
143
|
-
if (event.key === consts.KEY_UP) {
|
|
144
|
-
if (matrix[i - 1] !== undefined) {
|
|
145
|
-
next = matrix[i - 1][j];
|
|
146
|
-
}
|
|
147
|
-
} else {
|
|
148
|
-
if (matrix[i + 1] !== undefined) {
|
|
149
|
-
next = matrix[i + 1][j];
|
|
150
153
|
}
|
|
151
154
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
155
157
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
} else {
|
|
162
|
-
if (event.key === consts.KEY_TAB) {
|
|
163
|
-
editor.s.select(next, true);
|
|
158
|
+
if (next) {
|
|
159
|
+
if (!next.firstChild) {
|
|
160
|
+
const first = editor.createInside.element('br');
|
|
161
|
+
next.appendChild(first);
|
|
162
|
+
editor.s.setCursorBefore(first);
|
|
164
163
|
} else {
|
|
165
|
-
|
|
166
|
-
next,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
if (event.key === consts.KEY_TAB) {
|
|
165
|
+
editor.s.select(next, true);
|
|
166
|
+
} else {
|
|
167
|
+
editor.s.setCursorIn(
|
|
168
|
+
next,
|
|
169
|
+
event.key === consts.KEY_RIGHT ||
|
|
170
|
+
event.key === consts.KEY_DOWN
|
|
171
|
+
);
|
|
172
|
+
}
|
|
170
173
|
}
|
|
174
|
+
return false;
|
|
171
175
|
}
|
|
172
|
-
return false;
|
|
173
176
|
}
|
|
174
|
-
|
|
177
|
+
);
|
|
175
178
|
}
|
|
@@ -8,24 +8,24 @@
|
|
|
8
8
|
@import (reference) '../../styles/variables';
|
|
9
9
|
|
|
10
10
|
.jodit-table-resizer {
|
|
11
|
-
cursor: col-resize;
|
|
12
11
|
position: absolute;
|
|
13
12
|
z-index: 3;
|
|
14
|
-
padding-left: calc(var(--padding-default) / 2);
|
|
15
13
|
padding-right: calc(var(--padding-default) / 2);
|
|
14
|
+
padding-left: calc(var(--padding-default) / 2);
|
|
16
15
|
margin-left: calc(var(--padding-default) / -2);
|
|
16
|
+
cursor: col-resize;
|
|
17
17
|
|
|
18
18
|
&::after {
|
|
19
|
-
content: '';
|
|
20
19
|
display: block;
|
|
21
|
-
height: 100%;
|
|
22
20
|
width: 0;
|
|
21
|
+
height: 100%;
|
|
23
22
|
border: 0;
|
|
23
|
+
content: '';
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
&_moved {
|
|
27
|
-
background-color: var(--color-background-selection);
|
|
28
27
|
z-index: 2;
|
|
28
|
+
background-color: var(--color-background-selection);
|
|
29
29
|
|
|
30
30
|
&::after {
|
|
31
31
|
border-right: 1px solid var(--color-border)-moved;
|
|
@@ -35,20 +35,26 @@
|
|
|
35
35
|
|
|
36
36
|
.jodit-wysiwyg {
|
|
37
37
|
table {
|
|
38
|
+
max-width: 100%;
|
|
38
39
|
border: none;
|
|
40
|
+
|
|
41
|
+
margin-top: 1em;
|
|
42
|
+
margin-bottom: 1em;
|
|
43
|
+
|
|
39
44
|
border-collapse: collapse;
|
|
40
|
-
table-layout: fixed;
|
|
41
45
|
empty-cells: show;
|
|
42
|
-
|
|
46
|
+
table-layout: fixed;
|
|
43
47
|
|
|
44
48
|
tr {
|
|
45
49
|
user-select: none;
|
|
46
50
|
|
|
47
51
|
th,
|
|
48
52
|
td {
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
min-width: 2em;
|
|
54
|
+
padding: 0.4em;
|
|
55
|
+
border: 1px solid #bfbfbf;
|
|
51
56
|
user-select: text;
|
|
57
|
+
vertical-align: middle;
|
|
52
58
|
}
|
|
53
59
|
}
|
|
54
60
|
}
|
|
@@ -63,30 +69,31 @@
|
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
.jodit-form__container {
|
|
72
|
+
min-width: 180px;
|
|
66
73
|
padding: 0;
|
|
67
74
|
margin: 0;
|
|
68
|
-
min-width: 180px;
|
|
69
75
|
font-size: 0;
|
|
70
76
|
|
|
71
77
|
& > div {
|
|
72
78
|
& > span {
|
|
79
|
+
display: inline-block;
|
|
80
|
+
|
|
73
81
|
width: var(--width_element_default);
|
|
74
82
|
height: var(--height_element_default);
|
|
75
83
|
|
|
76
|
-
display: inline-block;
|
|
77
|
-
vertical-align: top;
|
|
78
84
|
box-sizing: border-box;
|
|
79
85
|
border: 1px solid var(--color-border);
|
|
80
|
-
margin-left: 2px;
|
|
81
86
|
margin-bottom: 2px;
|
|
87
|
+
margin-left: 2px;
|
|
88
|
+
vertical-align: top;
|
|
82
89
|
|
|
83
90
|
&:first-child {
|
|
84
91
|
margin-left: 0;
|
|
85
92
|
}
|
|
86
93
|
|
|
87
94
|
&.jodit_hovered {
|
|
88
|
-
background: var(--color-background-hover);
|
|
89
95
|
border-color: var(--color-background-hover);
|
|
96
|
+
background: var(--color-background-hover);
|
|
90
97
|
}
|
|
91
98
|
}
|
|
92
99
|
}
|
|
@@ -96,8 +103,8 @@
|
|
|
96
103
|
font-size: var(--font-size-default);
|
|
97
104
|
|
|
98
105
|
label {
|
|
99
|
-
text-align: left;
|
|
100
106
|
padding-top: 0;
|
|
107
|
+
text-align: left;
|
|
101
108
|
|
|
102
109
|
input {
|
|
103
110
|
margin-right: var(--padding-default);
|
|
@@ -107,9 +114,9 @@
|
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
label {
|
|
110
|
-
text-align: center;
|
|
111
|
-
font-size: 14px;
|
|
112
117
|
padding: 8px;
|
|
113
118
|
margin: 0;
|
|
119
|
+
font-size: 14px;
|
|
120
|
+
text-align: center;
|
|
114
121
|
}
|
|
115
122
|
}
|
package/src/types/async.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Jodit Editor (https://xdsoft.net/jodit/)
|
|
3
|
+
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
|
+
* Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { Component } from '../core/component';
|
|
8
|
+
import type { IDictionary } from './types';
|
|
9
|
+
|
|
10
|
+
export type DecoratorHandler = <T extends Component & IDictionary>(
|
|
11
|
+
target: T,
|
|
12
|
+
propertyKey: string
|
|
13
|
+
) => void;
|
package/src/types/index.d.ts
CHANGED
package/src/types/jodit.d.ts
CHANGED
|
@@ -815,4 +815,41 @@ describe('Jodit Editor Tests', function () {
|
|
|
815
815
|
});
|
|
816
816
|
});
|
|
817
817
|
});
|
|
818
|
+
|
|
819
|
+
describe('Readiness', () => {
|
|
820
|
+
describe('Method waitForReady', () => {
|
|
821
|
+
describe('Sync init', () => {
|
|
822
|
+
it('Should return resolved promise', done => {
|
|
823
|
+
const jodit = getJodit();
|
|
824
|
+
|
|
825
|
+
expect(jodit.isReady).is.true;
|
|
826
|
+
|
|
827
|
+
jodit.waitForReady().then(j => {
|
|
828
|
+
expect(jodit).eq(j);
|
|
829
|
+
expect(jodit.isReady).is.true;
|
|
830
|
+
done();
|
|
831
|
+
});
|
|
832
|
+
});
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
describe('Async init', () => {
|
|
836
|
+
it('Should return resolved promise', done => {
|
|
837
|
+
unmockPromise();
|
|
838
|
+
const jodit = getJodit({
|
|
839
|
+
events: {
|
|
840
|
+
createEditor: () => delay(100)
|
|
841
|
+
}
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
expect(jodit.isReady).is.false;
|
|
845
|
+
|
|
846
|
+
jodit.waitForReady().then(j => {
|
|
847
|
+
expect(jodit).eq(j);
|
|
848
|
+
expect(jodit.isReady).is.true;
|
|
849
|
+
done();
|
|
850
|
+
});
|
|
851
|
+
});
|
|
852
|
+
});
|
|
853
|
+
});
|
|
854
|
+
});
|
|
818
855
|
});
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Released under MIT see LICENSE.txt in the project root for license information.
|
|
4
4
|
* Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
|
|
5
5
|
*/
|
|
6
|
+
|
|
6
7
|
describe('Tables Jodit Editor Tests', function () {
|
|
7
8
|
describe('Methods', function () {
|
|
8
9
|
it('After init container must has one element .jodit-table-resizer', function () {
|
|
@@ -1180,15 +1181,16 @@ describe('Tables Jodit Editor Tests', function () {
|
|
|
1180
1181
|
});
|
|
1181
1182
|
|
|
1182
1183
|
describe('Select cells', function () {
|
|
1183
|
-
it('When we press mouse button over cell and move mouse to another cell, it should select all cells in bound', function () {
|
|
1184
|
+
it('When we press mouse button over cell and move mouse to another cell, it should select all cells in bound', function (done) {
|
|
1184
1185
|
const editor = getJodit();
|
|
1185
1186
|
|
|
1186
|
-
editor.value =
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1187
|
+
editor.value = `<table>
|
|
1188
|
+
<tbody>
|
|
1189
|
+
<tr><td>1</td><td>2</td></tr>
|
|
1190
|
+
<tr><td>3</td><td>4</td></tr>
|
|
1191
|
+
<tr><td>5</td><td>6</td></tr>
|
|
1192
|
+
</tbody>
|
|
1193
|
+
</table>`;
|
|
1192
1194
|
|
|
1193
1195
|
let td = editor.editor.querySelector('td');
|
|
1194
1196
|
|
|
@@ -1196,11 +1198,14 @@ describe('Tables Jodit Editor Tests', function () {
|
|
|
1196
1198
|
|
|
1197
1199
|
td = editor.editor.querySelectorAll('td')[3];
|
|
1198
1200
|
|
|
1199
|
-
simulateEvent(['mousemove', 'mouseup'], td);
|
|
1201
|
+
simulateEvent(['mousemove', 'mouseup', 'click'], td);
|
|
1200
1202
|
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1203
|
+
editor.async.requestIdleCallback(() => {
|
|
1204
|
+
expect(
|
|
1205
|
+
editor.getInstance('Table', editor.o).selected.size
|
|
1206
|
+
).equals(4);
|
|
1207
|
+
done();
|
|
1208
|
+
});
|
|
1204
1209
|
});
|
|
1205
1210
|
|
|
1206
1211
|
describe('Set custom selected border color', function () {
|
|
@@ -1325,6 +1330,8 @@ describe('Tables Jodit Editor Tests', function () {
|
|
|
1325
1330
|
'</tbody>' +
|
|
1326
1331
|
'</table>';
|
|
1327
1332
|
|
|
1333
|
+
editor.editor.scrollIntoView();
|
|
1334
|
+
|
|
1328
1335
|
let td = editor.editor.querySelector('td');
|
|
1329
1336
|
|
|
1330
1337
|
simulateEvent('mousedown', td);
|
|
@@ -1442,10 +1449,12 @@ describe('Tables Jodit Editor Tests', function () {
|
|
|
1442
1449
|
'<tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr>' +
|
|
1443
1450
|
'</table>';
|
|
1444
1451
|
|
|
1452
|
+
editor.editor.scrollIntoView();
|
|
1453
|
+
|
|
1445
1454
|
const td = editor.editor.querySelectorAll('td')[1],
|
|
1446
1455
|
box = td.getBoundingClientRect();
|
|
1447
1456
|
|
|
1448
|
-
simulateEvent('mousemove',
|
|
1457
|
+
simulateEvent('mousemove', td, function (options) {
|
|
1449
1458
|
options.clientX = box.left;
|
|
1450
1459
|
options.offsetX = 0;
|
|
1451
1460
|
options.pageX = 0;
|
|
@@ -1454,7 +1463,6 @@ describe('Tables Jodit Editor Tests', function () {
|
|
|
1454
1463
|
|
|
1455
1464
|
simulateEvent(
|
|
1456
1465
|
'mousedown',
|
|
1457
|
-
1,
|
|
1458
1466
|
editor.container.querySelector('.jodit-table-resizer'),
|
|
1459
1467
|
function (options) {
|
|
1460
1468
|
options.clientX = box.left;
|
|
@@ -1463,7 +1471,7 @@ describe('Tables Jodit Editor Tests', function () {
|
|
|
1463
1471
|
}
|
|
1464
1472
|
);
|
|
1465
1473
|
|
|
1466
|
-
simulateEvent('mousemove',
|
|
1474
|
+
simulateEvent('mousemove', editor.ew, function (options) {
|
|
1467
1475
|
options.clientX = box.left + 500; // can move only on 5 pixels
|
|
1468
1476
|
options.pageX = 0;
|
|
1469
1477
|
options.pageY = 0;
|
|
@@ -1476,6 +1484,7 @@ describe('Tables Jodit Editor Tests', function () {
|
|
|
1476
1484
|
10
|
|
1477
1485
|
) < 55
|
|
1478
1486
|
).is.true;
|
|
1487
|
+
|
|
1479
1488
|
done();
|
|
1480
1489
|
});
|
|
1481
1490
|
|
package/tsconfig.json
CHANGED
package/webpack.config.js
CHANGED
|
@@ -84,6 +84,7 @@ module.exports = (env, argv, dir = __dirname, onlyTS = false) => {
|
|
|
84
84
|
isESNext: ESNext,
|
|
85
85
|
isTest: isTest,
|
|
86
86
|
'process.env': {
|
|
87
|
+
HOMEPAGE: JSON.stringify(pkg.homepage),
|
|
87
88
|
TARGET_ES: JSON.stringify(ES),
|
|
88
89
|
NODE_ENV: JSON.stringify(mode),
|
|
89
90
|
EXCLUDE_LANGS: JSON.stringify(excludeLangs)
|