jodit 3.8.5 → 3.9.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/.github/workflows/tests.yml +23 -0
- package/.idea/dictionaries/v_chupurnov.xml +1 -0
- package/.idea/workspace.xml +333 -1469
- package/CHANGELOG.MD +151 -25
- package/README.md +3 -3
- package/build/jodit.css +280 -258
- package/build/jodit.es2018.css +231 -213
- package/build/jodit.es2018.en.css +231 -213
- package/build/jodit.es2018.en.js +9981 -9818
- package/build/jodit.es2018.en.min.css +1 -1
- package/build/jodit.es2018.en.min.js +1 -10
- package/build/jodit.es2018.js +14124 -13961
- package/build/jodit.es2018.min.css +1 -1
- package/build/jodit.es2018.min.js +1 -10
- package/build/jodit.js +11285 -11049
- package/build/jodit.min.css +2 -2
- package/build/jodit.min.js +1 -10
- package/package.json +34 -33
- package/src/config.ts +8 -14
- package/src/core/async.ts +7 -18
- package/src/core/component/view-component.ts +0 -1
- package/src/core/constants.ts +7 -5
- package/src/core/create.ts +8 -27
- package/src/core/decorators/debounce.ts +0 -8
- package/src/core/decorators/hook.ts +0 -1
- package/src/core/decorators/nonenumerable.ts +1 -2
- package/src/core/decorators/persistent.ts +0 -3
- package/src/core/decorators/spy.ts +0 -1
- package/src/core/decorators/wait.ts +0 -1
- package/src/core/dom.ts +161 -205
- package/src/core/events/{events-native.ts → event-emitter.ts} +66 -35
- package/src/core/events/index.ts +1 -1
- package/src/core/events/observe-object.ts +0 -2
- package/src/core/global.ts +12 -8
- package/src/core/helpers/append-script.ts +0 -8
- package/src/core/helpers/array/as-array.ts +2 -5
- package/src/core/helpers/array/split-array.ts +0 -1
- package/src/core/helpers/array/to-array.ts +1 -0
- package/src/core/helpers/async/set-timeout.ts +0 -7
- package/src/core/helpers/browser.ts +0 -1
- package/src/core/helpers/checker/has-browser-color-picker.ts +0 -3
- package/src/core/helpers/checker/is-array.ts +0 -1
- package/src/core/helpers/checker/is-equal.ts +0 -3
- package/src/core/helpers/checker/is-function.ts +0 -2
- package/src/core/helpers/checker/is-html-from-word.ts +0 -3
- package/src/core/helpers/checker/is-html.ts +0 -1
- package/src/core/helpers/checker/is-number.ts +0 -1
- package/src/core/helpers/checker/is-numeric.ts +0 -2
- package/src/core/helpers/checker/is-plain-object.ts +0 -1
- package/src/core/helpers/checker/is-string.ts +0 -1
- package/src/core/helpers/checker/is-url.ts +0 -4
- package/src/core/helpers/color/color-to-hex.ts +2 -2
- package/src/core/helpers/config-proto.ts +0 -3
- package/src/core/helpers/convert-media-url-to-video-embed.ts +1 -6
- package/src/core/helpers/ctrl-key.ts +1 -3
- package/src/core/helpers/data-bind.ts +2 -8
- package/src/core/helpers/default-language.ts +0 -3
- package/src/core/helpers/each.ts +12 -0
- package/src/core/helpers/html/htmlspecialchars.ts +0 -4
- package/src/core/helpers/html/nl2br.ts +0 -1
- package/src/core/helpers/human-size-to-bytes.ts +1 -4
- package/src/core/helpers/normalize/normalize-color.ts +2 -3
- package/src/core/helpers/normalize/normalize-key-aliases.ts +0 -2
- package/src/core/helpers/normalize/normalize-path.ts +0 -2
- package/src/core/helpers/normalize/normalize-size.ts +0 -3
- package/src/core/helpers/selector.ts +0 -8
- package/src/core/helpers/size/get-content-width.ts +0 -2
- package/src/core/helpers/size/offset.ts +1 -7
- package/src/core/helpers/size/position.ts +0 -4
- package/src/core/helpers/string/camel-case.ts +1 -2
- package/src/core/helpers/string/i18n.ts +0 -7
- package/src/core/helpers/string/kebab-case.ts +7 -5
- package/src/core/helpers/string/stringify.ts +0 -3
- package/src/core/helpers/string/trim.ts +0 -2
- package/src/core/helpers/string/ucfirst.ts +2 -5
- package/src/core/helpers/type.ts +0 -1
- package/src/core/helpers/utils/get.ts +0 -2
- package/src/core/helpers/utils/mark-deprecated.ts +0 -4
- package/src/core/helpers/utils/set.ts +0 -2
- package/src/core/helpers/utils/utils.ts +52 -15
- package/src/core/plugin-system.ts +0 -31
- package/src/core/request/ajax.ts +212 -0
- package/src/core/request/config.ts +37 -0
- package/{types/types/core.js → src/core/request/index.ts} +3 -3
- package/src/core/request/response.ts +39 -0
- package/src/core/selection/select.ts +74 -40
- package/src/core/selection/style/api/element-has-same-style.ts +13 -0
- package/src/core/selection/style/api/get-suit-parent.ts +1 -1
- package/src/core/selection/style/api/is-normal-node.ts +1 -2
- package/src/core/selection/style/api/is-suit-element.ts +24 -4
- package/src/core/selection/style/api/toggle-styles.ts +0 -2
- package/src/core/selection/style/api/unwrap-children.ts +45 -16
- package/src/core/selection/style/api/wrap-unwrapped-text.ts +28 -23
- package/src/core/selection/style/apply-style.ts +19 -9
- package/src/core/traits/elms.ts +1 -0
- package/src/core/traits/mods.ts +1 -3
- package/src/core/ui/button/button/button.less +7 -3
- package/src/core/ui/button/button/button.ts +1 -1
- package/src/core/ui/button/group/group.less +5 -5
- package/src/core/ui/element.ts +0 -4
- package/src/core/ui/form/inputs/file/file.less +4 -4
- package/src/core/ui/form/validators/input.ts +0 -2
- package/src/core/ui/form/validators/select.ts +0 -1
- package/src/core/ui/helpers/get-control-type.ts +3 -3
- package/src/core/ui/icon.ts +0 -10
- package/src/core/ui/list/group.less +1 -1
- package/src/core/ui/list/group.ts +1 -6
- package/src/core/ui/list/list.ts +0 -3
- package/src/core/ui/popup/popup.ts +0 -11
- package/src/core/ui/progress-bar/progress-bar.less +8 -8
- package/src/core/view/view-with-toolbar.ts +0 -5
- package/src/core/view/view.ts +5 -21
- package/src/jodit.ts +14 -70
- package/src/modules/context-menu/context-menu.ts +4 -7
- package/src/modules/dialog/alert.ts +0 -6
- package/src/modules/dialog/confirm.ts +1 -1
- package/src/modules/dialog/dialog.ts +22 -47
- package/src/modules/file-browser/README.MD +1 -1
- package/src/modules/file-browser/data-provider.ts +22 -42
- package/src/modules/file-browser/file-browser.ts +3 -0
- package/src/modules/image-editor/image-editor.less +51 -46
- package/src/modules/index.ts +1 -1
- package/src/modules/status-bar/status-bar.less +12 -12
- package/src/modules/table.ts +122 -106
- package/src/modules/toolbar/button/button.less +5 -6
- package/src/modules/toolbar/button/button.ts +1 -1
- package/src/modules/toolbar/button/content.less +2 -2
- package/src/modules/uploader/uploader.ts +4 -3
- package/src/modules/widget/color-picker/color-picker.less +7 -6
- package/src/modules/widget/tabs/tabs.less +3 -3
- package/src/plugins/about/about.less +1 -1
- package/src/plugins/add-new-line/add-new-line.less +14 -15
- package/src/plugins/add-new-line/add-new-line.ts +1 -1
- package/src/plugins/clipboard/paste-storage/paste-storage.less +10 -11
- package/src/plugins/fix/clean-html.ts +39 -18
- package/src/plugins/fix/wrap-text-nodes.ts +1 -2
- package/src/plugins/fullsize/fullsize.less +5 -5
- package/src/plugins/image/image-properties/image-properties.less +11 -7
- package/src/plugins/image/image-properties/image-properties.ts +11 -8
- package/src/plugins/indent.ts +25 -18
- package/src/plugins/placeholder/placeholder.less +4 -4
- package/src/plugins/resizer/resizer.less +28 -23
- package/src/plugins/search/search.less +25 -25
- package/src/plugins/size/resize-handler.ts +1 -1
- package/src/plugins/size/size.ts +1 -3
- package/src/plugins/source/source.less +15 -15
- package/src/plugins/source/source.ts +1 -1
- package/src/plugins/table/select-cells.ts +23 -5
- package/src/plugins/xpath/xpath.less +3 -3
- package/src/styles/form.less +19 -14
- package/src/styles/modules/button-group.less +2 -2
- package/src/styles/modules/icon.less +9 -8
- package/src/types/ajax.d.ts +43 -6
- package/src/types/async.d.ts +5 -4
- package/src/types/events.d.ts +25 -10
- package/src/types/view.d.ts +2 -2
- package/tsconfig.json +1 -1
- package/types/config.d.ts +8 -14
- package/types/core/async.d.ts +3 -16
- package/types/core/component/view-component.d.ts +0 -1
- package/types/core/constants.d.ts +6 -5
- package/types/core/create.d.ts +0 -4
- package/types/core/decorators/debounce.d.ts +0 -8
- package/types/core/decorators/hook.d.ts +0 -1
- package/types/core/decorators/nonenumerable.d.ts +1 -2
- package/types/core/decorators/persistent.d.ts +0 -3
- package/types/core/decorators/wait.d.ts +0 -1
- package/types/core/dom.d.ts +47 -128
- package/types/core/events/{events-native.d.ts → event-emitter.d.ts} +26 -20
- package/types/core/events/index.d.ts +1 -1
- package/types/core/events/observe-object.d.ts +0 -2
- package/types/core/global.d.ts +2 -6
- package/types/core/helpers/append-script.d.ts +0 -8
- package/types/core/helpers/array/as-array.d.ts +3 -0
- package/types/core/helpers/array/split-array.d.ts +0 -1
- package/types/core/helpers/async/set-timeout.d.ts +0 -7
- package/types/core/helpers/browser.d.ts +0 -1
- package/types/core/helpers/checker/has-browser-color-picker.d.ts +0 -3
- package/types/core/helpers/checker/is-array.d.ts +0 -1
- package/types/core/helpers/checker/is-equal.d.ts +0 -3
- package/types/core/helpers/checker/is-function.d.ts +0 -2
- package/types/core/helpers/checker/is-html-from-word.d.ts +0 -3
- package/types/core/helpers/checker/is-html.d.ts +0 -1
- package/types/core/helpers/checker/is-number.d.ts +0 -1
- package/types/core/helpers/checker/is-numeric.d.ts +0 -2
- package/types/core/helpers/checker/is-plain-object.d.ts +0 -1
- package/types/core/helpers/checker/is-string.d.ts +0 -1
- package/types/core/helpers/checker/is-url.d.ts +0 -4
- package/types/core/helpers/color/color-to-hex.d.ts +2 -2
- package/types/core/helpers/config-proto.d.ts +0 -3
- package/types/core/helpers/convert-media-url-to-video-embed.d.ts +1 -6
- package/types/core/helpers/ctrl-key.d.ts +1 -3
- package/types/core/helpers/data-bind.d.ts +0 -6
- package/types/core/helpers/default-language.d.ts +0 -3
- package/types/core/helpers/each.d.ts +9 -0
- package/types/core/helpers/html/htmlspecialchars.d.ts +0 -4
- package/types/core/helpers/html/nl2br.d.ts +0 -1
- package/types/core/helpers/human-size-to-bytes.d.ts +1 -4
- package/types/core/helpers/normalize/normalize-color.d.ts +2 -3
- package/types/core/helpers/normalize/normalize-key-aliases.d.ts +0 -2
- package/types/core/helpers/normalize/normalize-path.d.ts +0 -2
- package/types/core/helpers/normalize/normalize-size.d.ts +0 -3
- package/types/core/helpers/selector.d.ts +0 -8
- package/types/core/helpers/size/get-content-width.d.ts +0 -2
- package/types/core/helpers/size/offset.d.ts +1 -7
- package/types/core/helpers/string/camel-case.d.ts +1 -2
- package/types/core/helpers/string/i18n.d.ts +0 -7
- package/types/core/helpers/string/kebab-case.d.ts +1 -5
- package/types/core/helpers/string/stringify.d.ts +0 -3
- package/types/core/helpers/string/trim.d.ts +0 -2
- package/types/core/helpers/string/ucfirst.d.ts +1 -4
- package/types/core/helpers/type.d.ts +0 -1
- package/types/core/helpers/utils/get.d.ts +0 -2
- package/types/core/helpers/utils/mark-deprecated.d.ts +0 -4
- package/types/core/helpers/utils/set.d.ts +0 -2
- package/types/core/helpers/utils/utils.d.ts +15 -18
- package/types/core/plugin-system.d.ts +0 -31
- package/types/core/request/ajax.d.ts +26 -0
- package/types/core/request/config.d.ts +14 -0
- package/{src/types/core.js → types/core/request/index.d.ts} +2 -3
- package/types/core/request/response.d.ts +16 -0
- package/types/core/selection/select.d.ts +8 -9
- package/types/core/selection/style/api/element-has-same-style.d.ts +4 -0
- package/types/core/selection/style/api/is-suit-element.d.ts +1 -0
- package/types/core/selection/style/api/toggle-styles.d.ts +0 -2
- package/types/core/selection/style/api/wrap-unwrapped-text.d.ts +2 -2
- package/types/core/traits/mods.d.ts +1 -3
- package/types/core/ui/element.d.ts +0 -4
- package/types/core/ui/form/validators/input.d.ts +0 -2
- package/types/core/ui/form/validators/select.d.ts +0 -1
- package/types/core/ui/helpers/get-control-type.d.ts +0 -2
- package/types/core/ui/icon.d.ts +0 -10
- package/types/core/ui/list/group.d.ts +1 -6
- package/types/core/ui/list/list.d.ts +0 -3
- package/types/core/ui/popup/popup.d.ts +0 -11
- package/types/core/view/view-with-toolbar.d.ts +0 -5
- package/types/core/view/view.d.ts +4 -20
- package/types/jodit.d.ts +2 -46
- package/types/modules/context-menu/context-menu.d.ts +3 -6
- package/types/modules/dialog/alert.d.ts +0 -6
- package/types/modules/dialog/confirm.d.ts +1 -1
- package/types/modules/dialog/dialog.d.ts +9 -28
- package/types/modules/file-browser/data-provider.d.ts +1 -1
- package/types/modules/index.d.ts +1 -1
- package/types/modules/table.d.ts +1 -1
- package/types/plugins/fix/clean-html.d.ts +4 -0
- package/types/plugins/size/resize-handler.d.ts +1 -1
- package/types/plugins/source/source.d.ts +1 -1
- package/types/types/ajax.d.ts +43 -6
- package/types/types/async.d.ts +5 -4
- package/types/types/events.d.ts +25 -10
- package/types/types/view.d.ts +2 -2
- package/.editorconfig +0 -15
- package/.eslintignore +0 -3
- package/.eslintrc.js +0 -109
- package/.prettierrc.json +0 -9
- package/.stylelintrc.json +0 -16
- package/app.css +0 -112
- package/composer.json +0 -12
- package/src/core/ajax.ts +0 -296
- package/src/types/core.d.ts +0 -7
- package/src/types/core.js.map +0 -1
- package/src/types/storage.d.ts +0 -13
- package/src/types/storage.js +0 -8
- package/src/types/storage.js.map +0 -1
- package/src/utils/create-entries.js +0 -57
- package/src/utils/css-variables-prefixes.js +0 -12
- package/src/utils/lang-loader.js +0 -57
- package/src/utils/lang-translater.js +0 -142
- package/src/utils/plugin-loader.js +0 -14
- package/src/utils/post-build.js +0 -28
- package/src/utils/svg-loader.js +0 -20
- package/types/core/ajax.d.ts +0 -59
- package/types/types/core.js.map +0 -1
- package/types/types/storage.js +0 -8
- package/types/types/storage.js.map +0 -1
package/src/modules/table.ts
CHANGED
|
@@ -46,6 +46,7 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
46
46
|
@debounce()
|
|
47
47
|
private recalculateStyles(): void {
|
|
48
48
|
const style = getContainer(this.j, Table, 'style', true);
|
|
49
|
+
|
|
49
50
|
const selectors: string[] = [];
|
|
50
51
|
|
|
51
52
|
this.selected.forEach(td => {
|
|
@@ -125,9 +126,11 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
125
126
|
*/
|
|
126
127
|
static getColumnsCount(table: HTMLTableElement): number {
|
|
127
128
|
const matrix = Table.formalMatrix(table);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
|
|
130
|
+
return matrix.reduce(
|
|
131
|
+
(max_count, cells) => Math.max(max_count, cells.length),
|
|
132
|
+
0
|
|
133
|
+
);
|
|
131
134
|
}
|
|
132
135
|
|
|
133
136
|
/**
|
|
@@ -182,6 +185,7 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
182
185
|
) {
|
|
183
186
|
return false;
|
|
184
187
|
}
|
|
188
|
+
|
|
185
189
|
matrix[i + row][currentColumn + column] = cell;
|
|
186
190
|
}
|
|
187
191
|
}
|
|
@@ -257,7 +261,7 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
257
261
|
let row: HTMLTableRowElement;
|
|
258
262
|
|
|
259
263
|
if (!line) {
|
|
260
|
-
const columnsCount
|
|
264
|
+
const columnsCount = Table.getColumnsCount(table);
|
|
261
265
|
|
|
262
266
|
row = create.element('tr');
|
|
263
267
|
|
|
@@ -287,7 +291,9 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
287
291
|
} else if (!after && line) {
|
|
288
292
|
line.parentNode && line.parentNode.insertBefore(row, line);
|
|
289
293
|
} else {
|
|
290
|
-
(
|
|
294
|
+
(table.getElementsByTagName('tbody')?.[0] || table).appendChild(
|
|
295
|
+
row
|
|
296
|
+
);
|
|
291
297
|
}
|
|
292
298
|
}
|
|
293
299
|
|
|
@@ -296,6 +302,7 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
296
302
|
*/
|
|
297
303
|
static removeRow(table: HTMLTableElement, rowIndex: number): void {
|
|
298
304
|
const box = Table.formalMatrix(table);
|
|
305
|
+
|
|
299
306
|
let dec: boolean;
|
|
300
307
|
const row = table.rows[rowIndex];
|
|
301
308
|
|
|
@@ -312,23 +319,26 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
312
319
|
) {
|
|
313
320
|
dec = true;
|
|
314
321
|
let nextCell = j + 1;
|
|
322
|
+
|
|
315
323
|
while (box[rowIndex + 1][nextCell] === cell) {
|
|
316
324
|
nextCell += 1;
|
|
317
325
|
}
|
|
318
326
|
|
|
319
|
-
const nextRow
|
|
327
|
+
const nextRow = Dom.next<HTMLTableRowElement>(
|
|
320
328
|
cell.parentNode,
|
|
321
|
-
|
|
329
|
+
elm => Dom.isTag(elm, 'tr'),
|
|
322
330
|
table
|
|
323
|
-
)
|
|
331
|
+
);
|
|
324
332
|
|
|
325
|
-
if (
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
333
|
+
if (nextRow) {
|
|
334
|
+
if (box[rowIndex + 1][nextCell]) {
|
|
335
|
+
nextRow.insertBefore(
|
|
336
|
+
cell,
|
|
337
|
+
box[rowIndex + 1][nextCell]
|
|
338
|
+
);
|
|
339
|
+
} else {
|
|
340
|
+
nextRow.appendChild(cell);
|
|
341
|
+
}
|
|
332
342
|
}
|
|
333
343
|
}
|
|
334
344
|
} else {
|
|
@@ -338,13 +348,9 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
338
348
|
dec &&
|
|
339
349
|
(cell.parentNode === row || cell !== box[rowIndex][j - 1])
|
|
340
350
|
) {
|
|
341
|
-
const rowSpan
|
|
351
|
+
const rowSpan = cell.rowSpan;
|
|
342
352
|
|
|
343
|
-
attr(
|
|
344
|
-
cell,
|
|
345
|
-
'rowspan',
|
|
346
|
-
rowSpan - 1 > 1 ? (rowSpan - 1).toString() : null
|
|
347
|
-
);
|
|
353
|
+
attr(cell, 'rowspan', rowSpan - 1 > 1 ? rowSpan - 1 : null);
|
|
348
354
|
}
|
|
349
355
|
}
|
|
350
356
|
);
|
|
@@ -361,7 +367,8 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
361
367
|
after: boolean,
|
|
362
368
|
create: ICreate
|
|
363
369
|
): void {
|
|
364
|
-
const box
|
|
370
|
+
const box = Table.formalMatrix(table);
|
|
371
|
+
|
|
365
372
|
let i: number;
|
|
366
373
|
|
|
367
374
|
if (j === undefined || j < 0) {
|
|
@@ -370,16 +377,17 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
370
377
|
|
|
371
378
|
for (i = 0; i < box.length; i += 1) {
|
|
372
379
|
const cell = create.element('td');
|
|
373
|
-
const td
|
|
380
|
+
const td = box[i][j];
|
|
381
|
+
|
|
374
382
|
let added: boolean = false;
|
|
383
|
+
|
|
375
384
|
if (after) {
|
|
376
385
|
if (
|
|
377
386
|
(box[i] && td && j + 1 >= box[i].length) ||
|
|
378
387
|
td !== box[i][j + 1]
|
|
379
388
|
) {
|
|
380
389
|
if (td.nextSibling) {
|
|
381
|
-
td.
|
|
382
|
-
td.parentNode.insertBefore(cell, td.nextSibling);
|
|
390
|
+
Dom.before(td.nextSibling, cell);
|
|
383
391
|
} else {
|
|
384
392
|
td.parentNode && td.parentNode.appendChild(cell);
|
|
385
393
|
}
|
|
@@ -390,17 +398,16 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
390
398
|
j - 1 < 0 ||
|
|
391
399
|
(box[i][j] !== box[i][j - 1] && box[i][j].parentNode)
|
|
392
400
|
) {
|
|
393
|
-
|
|
394
|
-
td.parentNode.insertBefore(cell, box[i][j]);
|
|
401
|
+
Dom.before(box[i][j], cell);
|
|
395
402
|
added = true;
|
|
396
403
|
}
|
|
397
404
|
}
|
|
405
|
+
|
|
398
406
|
if (!added) {
|
|
399
|
-
|
|
407
|
+
attr(
|
|
408
|
+
box[i][j],
|
|
400
409
|
'colspan',
|
|
401
|
-
(
|
|
402
|
-
parseInt(attr(box[i][j], 'colspan') || '1', 10) + 1
|
|
403
|
-
).toString()
|
|
410
|
+
parseInt(attr(box[i][j], 'colspan') || '1', 10) + 1
|
|
404
411
|
);
|
|
405
412
|
}
|
|
406
413
|
}
|
|
@@ -410,12 +417,14 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
410
417
|
* Remove column by index
|
|
411
418
|
*/
|
|
412
419
|
static removeColumn(table: HTMLTableElement, j: number): void {
|
|
413
|
-
const box
|
|
420
|
+
const box = Table.formalMatrix(table);
|
|
414
421
|
|
|
415
422
|
let dec: boolean;
|
|
416
423
|
each(box, (i: number, cells: HTMLTableCellElement[]) => {
|
|
417
|
-
const td
|
|
424
|
+
const td = cells[j];
|
|
425
|
+
|
|
418
426
|
dec = false;
|
|
427
|
+
|
|
419
428
|
if (j - 1 >= 0 && box[i][j - 1] === td) {
|
|
420
429
|
dec = true;
|
|
421
430
|
} else if (j + 1 < cells.length && box[i][j + 1] === td) {
|
|
@@ -423,8 +432,9 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
423
432
|
} else {
|
|
424
433
|
Dom.safeRemove(td);
|
|
425
434
|
}
|
|
435
|
+
|
|
426
436
|
if (dec && (i - 1 < 0 || td !== box[i - 1][j])) {
|
|
427
|
-
const colSpan
|
|
437
|
+
const colSpan = td.colSpan;
|
|
428
438
|
|
|
429
439
|
attr(
|
|
430
440
|
td,
|
|
@@ -446,6 +456,7 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
446
456
|
[Infinity, Infinity],
|
|
447
457
|
[0, 0]
|
|
448
458
|
];
|
|
459
|
+
|
|
449
460
|
const box = Table.formalMatrix(table);
|
|
450
461
|
let i: number, j: number, k: number;
|
|
451
462
|
|
|
@@ -501,20 +512,23 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
501
512
|
let i: number, j: number, min: number, not: boolean;
|
|
502
513
|
|
|
503
514
|
const __marked: HTMLTableCellElement[] = [],
|
|
504
|
-
box
|
|
515
|
+
box = Table.formalMatrix(table);
|
|
505
516
|
|
|
506
517
|
// remove extra colspans
|
|
507
518
|
for (j = 0; j < box[0].length; j += 1) {
|
|
508
519
|
min = 1000000;
|
|
509
520
|
not = false;
|
|
521
|
+
|
|
510
522
|
for (i = 0; i < box.length; i += 1) {
|
|
511
523
|
if (box[i][j] === undefined) {
|
|
512
524
|
continue; // broken table
|
|
513
525
|
}
|
|
526
|
+
|
|
514
527
|
if (box[i][j].colSpan < 2) {
|
|
515
528
|
not = true;
|
|
516
529
|
break;
|
|
517
530
|
}
|
|
531
|
+
|
|
518
532
|
min = Math.min(min, box[i][j].colSpan);
|
|
519
533
|
}
|
|
520
534
|
if (!not) {
|
|
@@ -522,6 +536,7 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
522
536
|
if (box[i][j] === undefined) {
|
|
523
537
|
continue; // broken table
|
|
524
538
|
}
|
|
539
|
+
|
|
525
540
|
Table.__mark(
|
|
526
541
|
box[i][j],
|
|
527
542
|
'colspan',
|
|
@@ -575,21 +590,21 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
575
590
|
box[i][j].hasAttribute('rowspan') &&
|
|
576
591
|
box[i][j].rowSpan === 1
|
|
577
592
|
) {
|
|
578
|
-
box[i][j]
|
|
593
|
+
attr(box[i][j], 'rowspan', null);
|
|
579
594
|
}
|
|
580
595
|
|
|
581
596
|
if (
|
|
582
597
|
box[i][j].hasAttribute('colspan') &&
|
|
583
598
|
box[i][j].colSpan === 1
|
|
584
599
|
) {
|
|
585
|
-
box[i][j]
|
|
600
|
+
attr(box[i][j], 'colspan', null);
|
|
586
601
|
}
|
|
587
602
|
|
|
588
603
|
if (
|
|
589
604
|
box[i][j].hasAttribute('class') &&
|
|
590
605
|
!attr(box[i][j], 'class')
|
|
591
606
|
) {
|
|
592
|
-
box[i][j]
|
|
607
|
+
attr(box[i][j], 'class', null);
|
|
593
608
|
}
|
|
594
609
|
}
|
|
595
610
|
}
|
|
@@ -602,7 +617,7 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
602
617
|
*/
|
|
603
618
|
static mergeSelected(table: HTMLTableElement, jodit: IJodit): void {
|
|
604
619
|
const html: string[] = [],
|
|
605
|
-
bound
|
|
620
|
+
bound = Table.getSelectedBound(
|
|
606
621
|
table,
|
|
607
622
|
Table.getSelectedCellsByTable(table)
|
|
608
623
|
);
|
|
@@ -753,13 +768,16 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
753
768
|
);
|
|
754
769
|
}
|
|
755
770
|
});
|
|
771
|
+
|
|
756
772
|
Dom.after(
|
|
757
773
|
Dom.closest(cell, 'tr', table) as HTMLTableRowElement,
|
|
758
774
|
tr
|
|
759
775
|
);
|
|
776
|
+
|
|
760
777
|
tr.appendChild(td);
|
|
761
778
|
} else {
|
|
762
779
|
Table.__mark(cell, 'rowspan', cell.rowSpan - 1, __marked);
|
|
780
|
+
|
|
763
781
|
Table.formalMatrix(
|
|
764
782
|
table,
|
|
765
783
|
(tdElm: HTMLTableCellElement, i: number, j: number) => {
|
|
@@ -777,6 +795,7 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
777
795
|
}
|
|
778
796
|
}
|
|
779
797
|
);
|
|
798
|
+
|
|
780
799
|
if (after) {
|
|
781
800
|
Dom.after(after, td);
|
|
782
801
|
} else {
|
|
@@ -792,6 +811,7 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
792
811
|
instance(jodit).removeSelection(cell);
|
|
793
812
|
}
|
|
794
813
|
);
|
|
814
|
+
|
|
795
815
|
this.normalizeTable(table);
|
|
796
816
|
}
|
|
797
817
|
|
|
@@ -803,60 +823,55 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
803
823
|
|
|
804
824
|
const __marked: HTMLTableCellElement[] = [];
|
|
805
825
|
|
|
806
|
-
Table.getSelectedCellsByTable(table).forEach(
|
|
807
|
-
(cell
|
|
808
|
-
coord = Table.formalCoordinate(table, cell);
|
|
809
|
-
if (cell.colSpan < 2) {
|
|
810
|
-
Table.formalMatrix(table, (tdElm, i, j) => {
|
|
811
|
-
if (
|
|
812
|
-
coord[1] === j &&
|
|
813
|
-
coord[0] !== i &&
|
|
814
|
-
tdElm !== cell
|
|
815
|
-
) {
|
|
816
|
-
Table.__mark(
|
|
817
|
-
tdElm,
|
|
818
|
-
'colspan',
|
|
819
|
-
tdElm.colSpan + 1,
|
|
820
|
-
__marked
|
|
821
|
-
);
|
|
822
|
-
}
|
|
823
|
-
});
|
|
824
|
-
} else {
|
|
825
|
-
Table.__mark(cell, 'colspan', cell.colSpan - 1, __marked);
|
|
826
|
-
}
|
|
826
|
+
Table.getSelectedCellsByTable(table).forEach(cell => {
|
|
827
|
+
coord = Table.formalCoordinate(table, cell);
|
|
827
828
|
|
|
828
|
-
|
|
829
|
-
|
|
829
|
+
if (cell.colSpan < 2) {
|
|
830
|
+
Table.formalMatrix(table, (tdElm, i, j) => {
|
|
831
|
+
if (coord[1] === j && coord[0] !== i && tdElm !== cell) {
|
|
832
|
+
Table.__mark(
|
|
833
|
+
tdElm,
|
|
834
|
+
'colspan',
|
|
835
|
+
tdElm.colSpan + 1,
|
|
836
|
+
__marked
|
|
837
|
+
);
|
|
838
|
+
}
|
|
839
|
+
});
|
|
840
|
+
} else {
|
|
841
|
+
Table.__mark(cell, 'colspan', cell.colSpan - 1, __marked);
|
|
842
|
+
}
|
|
830
843
|
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
}
|
|
844
|
+
td = jodit.createInside.element('td');
|
|
845
|
+
td.appendChild(jodit.createInside.element('br'));
|
|
834
846
|
|
|
835
|
-
|
|
847
|
+
if (cell.rowSpan > 1) {
|
|
848
|
+
Table.__mark(td, 'rowspan', cell.rowSpan, __marked);
|
|
849
|
+
}
|
|
836
850
|
|
|
837
|
-
|
|
851
|
+
const oldWidth = cell.offsetWidth; // get old width
|
|
838
852
|
|
|
839
|
-
|
|
853
|
+
Dom.after(cell, td);
|
|
840
854
|
|
|
841
|
-
|
|
842
|
-
cell,
|
|
843
|
-
'width',
|
|
844
|
-
(percentage * 100).toFixed(consts.ACCURACY) + '%',
|
|
845
|
-
__marked
|
|
846
|
-
);
|
|
855
|
+
percentage = oldWidth / table.offsetWidth / 2;
|
|
847
856
|
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
857
|
+
Table.__mark(
|
|
858
|
+
cell,
|
|
859
|
+
'width',
|
|
860
|
+
(percentage * 100).toFixed(consts.ACCURACY) + '%',
|
|
861
|
+
__marked
|
|
862
|
+
);
|
|
854
863
|
|
|
855
|
-
|
|
864
|
+
Table.__mark(
|
|
865
|
+
td,
|
|
866
|
+
'width',
|
|
867
|
+
(percentage * 100).toFixed(consts.ACCURACY) + '%',
|
|
868
|
+
__marked
|
|
869
|
+
);
|
|
856
870
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
871
|
+
Table.__unmark(__marked);
|
|
872
|
+
|
|
873
|
+
instance(jodit).removeSelection(cell);
|
|
874
|
+
});
|
|
860
875
|
|
|
861
876
|
Table.normalizeTable(table);
|
|
862
877
|
}
|
|
@@ -866,23 +881,31 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
866
881
|
*/
|
|
867
882
|
static setColumnWidthByDelta(
|
|
868
883
|
table: HTMLTableElement,
|
|
869
|
-
|
|
884
|
+
column: number,
|
|
870
885
|
delta: number,
|
|
871
886
|
noUnmark: boolean,
|
|
872
887
|
marked: HTMLTableCellElement[]
|
|
873
888
|
): void {
|
|
874
889
|
const box = Table.formalMatrix(table);
|
|
875
|
-
let i: number, w: number, percent: number;
|
|
876
890
|
|
|
877
|
-
for (i = 0; i < box.length; i += 1) {
|
|
878
|
-
|
|
879
|
-
|
|
891
|
+
for (let i = 0; i < box.length; i += 1) {
|
|
892
|
+
const cell = box[i][column];
|
|
893
|
+
|
|
894
|
+
if (cell.colSpan > 1 && box.length > 1) {
|
|
895
|
+
continue;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
const w = cell.offsetWidth;
|
|
899
|
+
const percent = ((w + delta) / table.offsetWidth) * 100;
|
|
900
|
+
|
|
880
901
|
Table.__mark(
|
|
881
|
-
|
|
902
|
+
cell,
|
|
882
903
|
'width',
|
|
883
904
|
percent.toFixed(consts.ACCURACY) + '%',
|
|
884
905
|
marked
|
|
885
906
|
);
|
|
907
|
+
|
|
908
|
+
break;
|
|
886
909
|
}
|
|
887
910
|
|
|
888
911
|
if (!noUnmark) {
|
|
@@ -897,9 +920,11 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
897
920
|
marked: HTMLTableCellElement[]
|
|
898
921
|
) {
|
|
899
922
|
marked.push(cell);
|
|
923
|
+
|
|
900
924
|
if (!(cell as any).__marked_value) {
|
|
901
925
|
(cell as any).__marked_value = {};
|
|
902
926
|
}
|
|
927
|
+
|
|
903
928
|
(cell as any).__marked_value[key] = value === undefined ? 1 : value;
|
|
904
929
|
}
|
|
905
930
|
|
|
@@ -913,33 +938,24 @@ export class Table extends ViewComponent<IJodit> {
|
|
|
913
938
|
case 'remove':
|
|
914
939
|
Dom.safeRemove(cell);
|
|
915
940
|
break;
|
|
941
|
+
|
|
916
942
|
case 'rowspan':
|
|
917
|
-
|
|
918
|
-
cell.setAttribute(
|
|
919
|
-
'rowspan',
|
|
920
|
-
value.toString()
|
|
921
|
-
);
|
|
922
|
-
} else {
|
|
923
|
-
cell.removeAttribute('rowspan');
|
|
924
|
-
}
|
|
943
|
+
attr(cell, 'rowspan', value > 1 ? value : null);
|
|
925
944
|
break;
|
|
945
|
+
|
|
926
946
|
case 'colspan':
|
|
927
|
-
|
|
928
|
-
cell.setAttribute(
|
|
929
|
-
'colspan',
|
|
930
|
-
value.toString()
|
|
931
|
-
);
|
|
932
|
-
} else {
|
|
933
|
-
cell.removeAttribute('colspan');
|
|
934
|
-
}
|
|
947
|
+
attr(cell, 'colspan', value > 1 ? value : null);
|
|
935
948
|
break;
|
|
949
|
+
|
|
936
950
|
case 'width':
|
|
937
951
|
cell.style.width = value.toString();
|
|
938
952
|
break;
|
|
939
953
|
}
|
|
954
|
+
|
|
940
955
|
delete (cell as any).__marked_value[key];
|
|
941
956
|
}
|
|
942
957
|
);
|
|
958
|
+
|
|
943
959
|
delete (cell as any).__marked_value;
|
|
944
960
|
}
|
|
945
961
|
});
|
|
@@ -17,13 +17,12 @@
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.jodit-toolbar-button {
|
|
20
|
-
border: 1px solid transparent;
|
|
21
|
-
border-radius: var(--border-radius-default);
|
|
22
|
-
overflow: hidden;
|
|
23
|
-
|
|
24
20
|
display: flex;
|
|
25
|
-
|
|
21
|
+
overflow: hidden;
|
|
26
22
|
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
border: 1px solid transparent;
|
|
25
|
+
border-radius: var(--border-radius-default);
|
|
27
26
|
|
|
28
27
|
.jodit-ui-button-icon-text();
|
|
29
28
|
|
|
@@ -41,12 +40,12 @@
|
|
|
41
40
|
|
|
42
41
|
&__trigger {
|
|
43
42
|
display: flex;
|
|
43
|
+
height: 100%;
|
|
44
44
|
align-items: center;
|
|
45
45
|
justify-content: center;
|
|
46
46
|
border-radius: 0 var(--border-radius-default)
|
|
47
47
|
var(--border-radius-default) 0;
|
|
48
48
|
opacity: 0.4;
|
|
49
|
-
height: 100%;
|
|
50
49
|
|
|
51
50
|
.jodit-ui-button-interaction();
|
|
52
51
|
.trigger-size(@icon-middle-size);
|
|
@@ -112,7 +112,7 @@ export class ToolbarButton<T extends IViewBased = IViewBased>
|
|
|
112
112
|
|
|
113
113
|
/** @override */
|
|
114
114
|
override onChangeTabIndex(): void {
|
|
115
|
-
attr(this.button, '
|
|
115
|
+
attr(this.button, 'tabindex', this.state.tabIndex);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
@watch('state.tooltip')
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
.jodit-toolbar-content {
|
|
12
12
|
.jodit-ui-button();
|
|
13
13
|
|
|
14
|
-
border: 1px solid transparent;
|
|
15
14
|
padding: 0;
|
|
15
|
+
border: 1px solid transparent;
|
|
16
16
|
|
|
17
17
|
&:hover:not([disabled]) {
|
|
18
18
|
background-color: transparent;
|
|
19
|
-
outline: 0;
|
|
20
19
|
opacity: 1;
|
|
20
|
+
outline: 0;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -22,7 +22,7 @@ import type {
|
|
|
22
22
|
} from '../../types';
|
|
23
23
|
import { Config } from '../../config';
|
|
24
24
|
import { IS_IE, TEXT_PLAIN } from '../../core/constants';
|
|
25
|
-
import { Ajax } from '../../core/
|
|
25
|
+
import { Ajax } from '../../core/request';
|
|
26
26
|
import {
|
|
27
27
|
attr,
|
|
28
28
|
error,
|
|
@@ -211,7 +211,7 @@ export class Uploader extends ViewComponent implements IUploader {
|
|
|
211
211
|
return data;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
private ajaxInstances: IAjax[] = [];
|
|
214
|
+
private ajaxInstances: IAjax<IUploaderAnswer>[] = [];
|
|
215
215
|
|
|
216
216
|
private send(
|
|
217
217
|
data: FormData | IDictionary<string>,
|
|
@@ -221,7 +221,7 @@ export class Uploader extends ViewComponent implements IUploader {
|
|
|
221
221
|
sendData = (
|
|
222
222
|
request: FormData | IDictionary<string> | string
|
|
223
223
|
): Promise<any> => {
|
|
224
|
-
const ajax = new Ajax(this.j, {
|
|
224
|
+
const ajax = new Ajax<IUploaderAnswer>(this.j, {
|
|
225
225
|
xhr: () => {
|
|
226
226
|
const xhr = new XMLHttpRequest();
|
|
227
227
|
|
|
@@ -286,6 +286,7 @@ export class Uploader extends ViewComponent implements IUploader {
|
|
|
286
286
|
|
|
287
287
|
return ajax
|
|
288
288
|
.send()
|
|
289
|
+
.then(resp => resp.json())
|
|
289
290
|
.then(resp => {
|
|
290
291
|
removeAjaxInstanceFromList();
|
|
291
292
|
success.call(this, resp);
|
|
@@ -7,17 +7,18 @@
|
|
|
7
7
|
@import (reference) '../../../styles/variables';
|
|
8
8
|
@import (reference) '../../../styles/mixins';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
--color-cell-size: 24px;
|
|
12
|
-
|
|
10
|
+
:root {
|
|
11
|
+
--color-picker-cell-size: 24px;
|
|
12
|
+
}
|
|
13
13
|
|
|
14
|
+
.jodit-color-picker {
|
|
14
15
|
margin: 0;
|
|
15
16
|
text-align: left;
|
|
16
17
|
user-select: none;
|
|
17
18
|
|
|
18
19
|
&__group {
|
|
19
20
|
display: flex;
|
|
20
|
-
max-width: calc(var(--color-cell-size) * 10);
|
|
21
|
+
max-width: calc(var(--color-picker-cell-size) * 10);
|
|
21
22
|
flex-wrap: wrap;
|
|
22
23
|
margin-bottom: calc(var(--padding-default) / 2);
|
|
23
24
|
white-space: normal;
|
|
@@ -26,8 +27,8 @@
|
|
|
26
27
|
&__color-item {
|
|
27
28
|
display: block;
|
|
28
29
|
|
|
29
|
-
width: var(--color-cell-size);
|
|
30
|
-
height: var(--color-cell-size);
|
|
30
|
+
width: var(--color-picker-cell-size);
|
|
31
|
+
height: var(--color-picker-cell-size);
|
|
31
32
|
|
|
32
33
|
border: 1px solid transparent;
|
|
33
34
|
text-align: center;
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
.font();
|
|
12
12
|
|
|
13
13
|
.jodit-tabs__buttons {
|
|
14
|
-
line-height: 18px;
|
|
15
|
-
margin-bottom: calc(var(--padding-default) / 2);
|
|
16
|
-
margin-top: 4px;
|
|
17
14
|
display: flex;
|
|
18
15
|
justify-content: center;
|
|
16
|
+
margin-top: 4px;
|
|
17
|
+
margin-bottom: calc(var(--padding-default) / 2);
|
|
18
|
+
line-height: 18px;
|
|
19
19
|
|
|
20
20
|
> * {
|
|
21
21
|
margin-left: calc(var(--padding-default) / 2);
|
|
@@ -13,24 +13,26 @@
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.jodit-add-new-line {
|
|
16
|
+
position: fixed;
|
|
17
|
+
z-index: 1;
|
|
18
|
+
top: 0;
|
|
19
|
+
|
|
20
|
+
display: block;
|
|
21
|
+
height: 1px;
|
|
22
|
+
|
|
16
23
|
box-sizing: border-box;
|
|
24
|
+
outline: none;
|
|
17
25
|
|
|
18
26
|
* {
|
|
19
27
|
box-sizing: border-box;
|
|
20
28
|
}
|
|
21
29
|
|
|
22
|
-
z-index: 1;
|
|
23
|
-
position: fixed;
|
|
24
|
-
height: 1px;
|
|
25
|
-
top: 0;
|
|
26
|
-
outline: none;
|
|
27
|
-
|
|
28
30
|
&::after {
|
|
29
|
-
content: '';
|
|
30
|
-
background-color: var(--color-new-line);
|
|
31
|
-
height: 1px;
|
|
32
31
|
display: block;
|
|
33
32
|
width: calc(100% - var(--width-icon));
|
|
33
|
+
height: 1px;
|
|
34
|
+
background-color: var(--color-new-line);
|
|
35
|
+
content: '';
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
span {
|
|
@@ -38,14 +40,13 @@
|
|
|
38
40
|
right: 0;
|
|
39
41
|
|
|
40
42
|
display: flex;
|
|
41
|
-
justify-content: center;
|
|
42
|
-
align-items: center;
|
|
43
|
-
|
|
44
43
|
width: var(--width-icon);
|
|
45
44
|
height: var(--height-icon);
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
46
47
|
|
|
47
|
-
background: var(--color-background-button-hover-opacity30);
|
|
48
48
|
border: 1px solid var(--color-new-line);
|
|
49
|
+
background: var(--color-background-button-hover-opacity30);
|
|
49
50
|
cursor: pointer;
|
|
50
51
|
|
|
51
52
|
&:hover {
|
|
@@ -61,8 +62,6 @@
|
|
|
61
62
|
width: 16px;
|
|
62
63
|
fill: var(--color-new-line);
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
display: block;
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
.jodit-source__mode {
|