@progress/kendo-editor-common 1.12.3-develop.8 → 1.12.3
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/dist/cdn/js/kendo-editor-common.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/find-replace.js +11 -6
- package/dist/es/plugins/table-resize/column-resize.js +7 -1
- package/dist/es/plugins/table-resize/table-resize.js +6 -6
- package/dist/es/plugins/table-resize/utils.js +14 -0
- package/dist/npm/find-replace.js +11 -6
- package/dist/npm/plugins/table-resize/column-resize.js +6 -0
- package/dist/npm/plugins/table-resize/table-resize.js +5 -5
- package/dist/npm/plugins/table-resize/utils.d.ts +1 -0
- package/dist/npm/plugins/table-resize/utils.js +15 -0
- package/package.json +1 -1
package/dist/es/find-replace.js
CHANGED
|
@@ -33,13 +33,18 @@ export const findAt = (doc, searchOptions, start, end, exit) => {
|
|
|
33
33
|
text = nodes.map(t => t.text).join('');
|
|
34
34
|
exec = regExp.exec(text);
|
|
35
35
|
while (exec !== null) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
if (exec[0].length > 0) {
|
|
37
|
+
from = nodes[0].start + exec.index;
|
|
38
|
+
to = from + exec[0].length;
|
|
39
|
+
if (start <= from && end >= to && shouldMatchWord(exec, matchWord)) {
|
|
40
|
+
result.push(TextSelection.create(doc, from, to));
|
|
41
|
+
}
|
|
42
|
+
if (exit(result)) {
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
40
45
|
}
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
else {
|
|
47
|
+
regExp.lastIndex++;
|
|
43
48
|
}
|
|
44
49
|
exec = regExp.exec(text);
|
|
45
50
|
}
|
|
@@ -4,7 +4,7 @@ import { Decoration, DecorationSet } from 'prosemirror-view';
|
|
|
4
4
|
import { colgroupAttr } from '../../config/constants';
|
|
5
5
|
import { TableView, TableWrapperView } from './table-view';
|
|
6
6
|
import { parseStyle, setNodeStyle } from './../../utils';
|
|
7
|
-
import { cellIndexes, domCellAround, otherResizeHandle, otherResizing, edgeCell, tableColumnResizeKey as key } from './utils';
|
|
7
|
+
import { cellIndexes, domCellAround, otherResizeHandle, otherResizing, edgeCell, tableColumnResizeKey as key, splitCols } from './utils';
|
|
8
8
|
export function columnResizing() {
|
|
9
9
|
const handleWidth = 5, cellMinWidth = 25;
|
|
10
10
|
const plugin = new Plugin({
|
|
@@ -130,6 +130,12 @@ function handleMouseDown(view, event, cellMinWidth) {
|
|
|
130
130
|
let col, tableAttrs;
|
|
131
131
|
if (tableNode.attrs[colgroupAttr]) {
|
|
132
132
|
const colgroup = tableDom.firstChild;
|
|
133
|
+
if (splitCols(colgroup)) {
|
|
134
|
+
tableAttrs = {
|
|
135
|
+
...tableNode.attrs,
|
|
136
|
+
[colgroupAttr]: colgroup.outerHTML
|
|
137
|
+
};
|
|
138
|
+
}
|
|
133
139
|
col = colgroup.children[colSpan - 1];
|
|
134
140
|
if (!col.style.width) {
|
|
135
141
|
col.style.width = col.offsetWidth + 'px';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NodeSelection, Plugin } from 'prosemirror-state';
|
|
2
2
|
import { colgroupAttr, dataResizeDirTable, resizableAttr } from '../../config/constants';
|
|
3
|
-
import { getTable, tableResizeKey as key } from './utils';
|
|
3
|
+
import { getTable, tableResizeKey as key, splitCols } from './utils';
|
|
4
4
|
import { parseStyle, setNodeStyle, parentNode } from './../../utils';
|
|
5
5
|
import { directions } from './../resize-utils';
|
|
6
6
|
const commonDir = {
|
|
@@ -70,14 +70,14 @@ const handleMouseMove = (view, event) => {
|
|
|
70
70
|
const toPercents = (view, tr, tablePos) => {
|
|
71
71
|
const tableNode = view.state.doc.nodeAt(tablePos);
|
|
72
72
|
const tableDom = getTable(view.nodeDOM(tablePos));
|
|
73
|
-
const { width, height, colsWidth, rowsHeight, offsetWidth, offsetHeight } = tableSize(tableDom);
|
|
74
73
|
const colgroup = tableDom.firstChild;
|
|
74
|
+
let colsChanged = splitCols(colgroup);
|
|
75
|
+
const { width, height, colsWidth, rowsHeight, offsetWidth, offsetHeight } = tableSize(tableDom);
|
|
75
76
|
const cols = Array.from((colgroup && colgroup.children) || []);
|
|
76
|
-
let widthChanged = false;
|
|
77
77
|
cols.forEach((col, i) => {
|
|
78
78
|
if (col.style.width && !/%$/.test(col.style.width)) {
|
|
79
79
|
col.style.width = ((colsWidth[i]) * 100 / width) + '%';
|
|
80
|
-
|
|
80
|
+
colsChanged = true;
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
let heightChange = false;
|
|
@@ -92,13 +92,13 @@ const toPercents = (view, tr, tablePos) => {
|
|
|
92
92
|
if (parseStyle(tableAttrs.style).width !== offsetWidth + 'px') {
|
|
93
93
|
tableAttrs = setNodeStyle(tableAttrs, 'width', offsetWidth + 'px');
|
|
94
94
|
}
|
|
95
|
-
if (
|
|
95
|
+
if (colsChanged) {
|
|
96
96
|
tableAttrs[colgroupAttr] = colgroup.outerHTML;
|
|
97
97
|
}
|
|
98
98
|
if (heightChange) {
|
|
99
99
|
tableAttrs = setNodeStyle(tableAttrs, 'height', offsetHeight + 'px');
|
|
100
100
|
}
|
|
101
|
-
if (
|
|
101
|
+
if (colsChanged || heightChange) {
|
|
102
102
|
tr.setNodeMarkup(tablePos, null, tableAttrs);
|
|
103
103
|
}
|
|
104
104
|
};
|
|
@@ -88,3 +88,17 @@ export function edgeCell(view, event, indexes) {
|
|
|
88
88
|
const cell = tablePos + map.map[(map.width * indexes.rowIndex) + indexes.cellIndex];
|
|
89
89
|
return cell;
|
|
90
90
|
}
|
|
91
|
+
export function splitCols(colgroup) {
|
|
92
|
+
const cols = Array.from((colgroup && colgroup.children || []));
|
|
93
|
+
let splitted = false;
|
|
94
|
+
cols.forEach((col) => {
|
|
95
|
+
while (col.span > 1) {
|
|
96
|
+
const newCol = col.cloneNode();
|
|
97
|
+
newCol.span = 1;
|
|
98
|
+
colgroup.insertBefore(newCol, col);
|
|
99
|
+
col.span -= 1;
|
|
100
|
+
splitted = true;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return splitted;
|
|
104
|
+
}
|
package/dist/npm/find-replace.js
CHANGED
|
@@ -36,13 +36,18 @@ const findAt = (doc, searchOptions, start, end, exit) => {
|
|
|
36
36
|
text = nodes.map(t => t.text).join('');
|
|
37
37
|
exec = regExp.exec(text);
|
|
38
38
|
while (exec !== null) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
if (exec[0].length > 0) {
|
|
40
|
+
from = nodes[0].start + exec.index;
|
|
41
|
+
to = from + exec[0].length;
|
|
42
|
+
if (start <= from && end >= to && shouldMatchWord(exec, matchWord)) {
|
|
43
|
+
result.push(prosemirror_state_1.TextSelection.create(doc, from, to));
|
|
44
|
+
}
|
|
45
|
+
if (exit(result)) {
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
43
48
|
}
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
else {
|
|
50
|
+
regExp.lastIndex++;
|
|
46
51
|
}
|
|
47
52
|
exec = regExp.exec(text);
|
|
48
53
|
}
|
|
@@ -133,6 +133,12 @@ function handleMouseDown(view, event, cellMinWidth) {
|
|
|
133
133
|
let col, tableAttrs;
|
|
134
134
|
if (tableNode.attrs[constants_1.colgroupAttr]) {
|
|
135
135
|
const colgroup = tableDom.firstChild;
|
|
136
|
+
if ((0, utils_2.splitCols)(colgroup)) {
|
|
137
|
+
tableAttrs = {
|
|
138
|
+
...tableNode.attrs,
|
|
139
|
+
[constants_1.colgroupAttr]: colgroup.outerHTML
|
|
140
|
+
};
|
|
141
|
+
}
|
|
136
142
|
col = colgroup.children[colSpan - 1];
|
|
137
143
|
if (!col.style.width) {
|
|
138
144
|
col.style.width = col.offsetWidth + 'px';
|
|
@@ -73,14 +73,14 @@ const handleMouseMove = (view, event) => {
|
|
|
73
73
|
const toPercents = (view, tr, tablePos) => {
|
|
74
74
|
const tableNode = view.state.doc.nodeAt(tablePos);
|
|
75
75
|
const tableDom = (0, utils_1.getTable)(view.nodeDOM(tablePos));
|
|
76
|
-
const { width, height, colsWidth, rowsHeight, offsetWidth, offsetHeight } = tableSize(tableDom);
|
|
77
76
|
const colgroup = tableDom.firstChild;
|
|
77
|
+
let colsChanged = (0, utils_1.splitCols)(colgroup);
|
|
78
|
+
const { width, height, colsWidth, rowsHeight, offsetWidth, offsetHeight } = tableSize(tableDom);
|
|
78
79
|
const cols = Array.from((colgroup && colgroup.children) || []);
|
|
79
|
-
let widthChanged = false;
|
|
80
80
|
cols.forEach((col, i) => {
|
|
81
81
|
if (col.style.width && !/%$/.test(col.style.width)) {
|
|
82
82
|
col.style.width = ((colsWidth[i]) * 100 / width) + '%';
|
|
83
|
-
|
|
83
|
+
colsChanged = true;
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
let heightChange = false;
|
|
@@ -95,13 +95,13 @@ const toPercents = (view, tr, tablePos) => {
|
|
|
95
95
|
if ((0, utils_2.parseStyle)(tableAttrs.style).width !== offsetWidth + 'px') {
|
|
96
96
|
tableAttrs = (0, utils_2.setNodeStyle)(tableAttrs, 'width', offsetWidth + 'px');
|
|
97
97
|
}
|
|
98
|
-
if (
|
|
98
|
+
if (colsChanged) {
|
|
99
99
|
tableAttrs[constants_1.colgroupAttr] = colgroup.outerHTML;
|
|
100
100
|
}
|
|
101
101
|
if (heightChange) {
|
|
102
102
|
tableAttrs = (0, utils_2.setNodeStyle)(tableAttrs, 'height', offsetHeight + 'px');
|
|
103
103
|
}
|
|
104
|
-
if (
|
|
104
|
+
if (colsChanged || heightChange) {
|
|
105
105
|
tr.setNodeMarkup(tablePos, null, tableAttrs);
|
|
106
106
|
}
|
|
107
107
|
};
|
|
@@ -7,6 +7,7 @@ exports.getTable = getTable;
|
|
|
7
7
|
exports.domCellAround = domCellAround;
|
|
8
8
|
exports.cellIndexes = cellIndexes;
|
|
9
9
|
exports.edgeCell = edgeCell;
|
|
10
|
+
exports.splitCols = splitCols;
|
|
10
11
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
11
12
|
const prosemirror_tables_1 = require("prosemirror-tables");
|
|
12
13
|
const utils_1 = require("../../utils");
|
|
@@ -97,3 +98,17 @@ function edgeCell(view, event, indexes) {
|
|
|
97
98
|
const cell = tablePos + map.map[(map.width * indexes.rowIndex) + indexes.cellIndex];
|
|
98
99
|
return cell;
|
|
99
100
|
}
|
|
101
|
+
function splitCols(colgroup) {
|
|
102
|
+
const cols = Array.from((colgroup && colgroup.children || []));
|
|
103
|
+
let splitted = false;
|
|
104
|
+
cols.forEach((col) => {
|
|
105
|
+
while (col.span > 1) {
|
|
106
|
+
const newCol = col.cloneNode();
|
|
107
|
+
newCol.span = 1;
|
|
108
|
+
colgroup.insertBefore(newCol, col);
|
|
109
|
+
col.span -= 1;
|
|
110
|
+
splitted = true;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return splitted;
|
|
114
|
+
}
|