@gravity-ui/markdown-editor 13.17.1 → 13.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/build/cjs/bundle/config/action-names.d.ts +1 -1
- package/build/cjs/bundle/config/action-names.js +1 -0
- package/build/cjs/bundle/config/icons.d.ts +1 -1
- package/build/cjs/bundle/config/icons.js +3 -0
- package/build/cjs/bundle/config/wysiwyg.d.ts +1 -0
- package/build/cjs/bundle/config/wysiwyg.js +13 -1
- package/build/cjs/extensions/behavior/Clipboard/clipboard.js +4 -1
- package/build/cjs/extensions/markdown/Table/actions/innerActions.d.ts +1 -1
- package/build/cjs/extensions/yfm/GPT/ErrorScreen/ErrorScreen.css +18 -0
- package/build/cjs/extensions/yfm/GPT/ErrorScreen/ErrorScreen.d.ts +8 -0
- package/build/cjs/extensions/yfm/GPT/ErrorScreen/ErrorScreen.js +21 -0
- package/build/cjs/extensions/yfm/GPT/ErrorScreen/types.d.ts +14 -0
- package/build/cjs/extensions/yfm/GPT/ErrorScreen/types.js +2 -0
- package/build/cjs/extensions/yfm/GPT/GptDialog/GptDialog.css +75 -0
- package/build/cjs/extensions/yfm/GPT/GptDialog/GptDialog.d.ts +28 -0
- package/build/cjs/extensions/yfm/GPT/GptDialog/GptDialog.js +102 -0
- package/build/cjs/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.css +22 -0
- package/build/cjs/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.d.ts +3 -0
- package/build/cjs/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.js +21 -0
- package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.classname.d.ts +1 -0
- package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.classname.js +5 -0
- package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.css +8 -0
- package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.d.ts +14 -0
- package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.js +28 -0
- package/build/cjs/extensions/yfm/GPT/IconRefuge/index.d.ts +2 -0
- package/build/cjs/extensions/yfm/GPT/IconRefuge/index.js +5 -0
- package/build/cjs/extensions/yfm/GPT/PresetList/PresetList.d.ts +9 -0
- package/build/cjs/extensions/yfm/GPT/PresetList/PresetList.js +29 -0
- package/build/cjs/extensions/yfm/GPT/PresetList/Presetlist.css +6 -0
- package/build/cjs/extensions/yfm/GPT/actions.d.ts +2 -0
- package/build/cjs/extensions/yfm/GPT/actions.js +14 -0
- package/build/cjs/extensions/yfm/GPT/commands.d.ts +2 -0
- package/build/cjs/extensions/yfm/GPT/commands.js +13 -0
- package/build/cjs/extensions/yfm/GPT/constants.d.ts +13 -0
- package/build/cjs/extensions/yfm/GPT/constants.js +15 -0
- package/build/cjs/extensions/yfm/GPT/gptExtension/gptExtension.d.ts +13 -0
- package/build/cjs/extensions/yfm/GPT/gptExtension/gptExtension.js +18 -0
- package/build/cjs/extensions/yfm/GPT/gptExtension/view.css +17 -0
- package/build/cjs/extensions/yfm/GPT/gptExtension/view.d.ts +36 -0
- package/build/cjs/extensions/yfm/GPT/gptExtension/view.js +167 -0
- package/build/cjs/extensions/yfm/GPT/hooks/useGpt.d.ts +27 -0
- package/build/cjs/extensions/yfm/GPT/hooks/useGpt.js +155 -0
- package/build/cjs/extensions/yfm/GPT/hooks/useGptHotKeys.d.ts +2 -0
- package/build/cjs/extensions/yfm/GPT/hooks/useGptHotKeys.js +8 -0
- package/build/cjs/extensions/yfm/GPT/hooks/useOverflowingHorizontalItems.d.ts +13 -0
- package/build/cjs/extensions/yfm/GPT/hooks/useOverflowingHorizontalItems.js +70 -0
- package/build/cjs/extensions/yfm/GPT/hooks/usePresetList.d.ts +14 -0
- package/build/cjs/extensions/yfm/GPT/hooks/usePresetList.js +36 -0
- package/build/cjs/extensions/yfm/GPT/index.d.ts +2 -0
- package/build/cjs/extensions/yfm/GPT/index.js +5 -0
- package/build/cjs/extensions/yfm/GPT/plugin.d.ts +13 -0
- package/build/cjs/extensions/yfm/GPT/plugin.js +47 -0
- package/build/cjs/extensions/yfm/GPT/toolbar.d.ts +3 -0
- package/build/cjs/extensions/yfm/GPT/toolbar.js +22 -0
- package/build/cjs/extensions/yfm/GPT/utils.d.ts +13 -0
- package/build/cjs/extensions/yfm/GPT/utils.js +31 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.d.ts +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.js +0 -8
- package/build/cjs/extensions/yfm/index.d.ts +1 -0
- package/build/cjs/extensions/yfm/index.js +1 -0
- package/build/cjs/i18n/gpt/dialog/en.json +16 -0
- package/build/cjs/i18n/gpt/dialog/index.d.ts +19 -0
- package/build/cjs/i18n/gpt/dialog/index.js +8 -0
- package/build/cjs/i18n/gpt/dialog/ru.json +16 -0
- package/build/cjs/i18n/gpt/errors/en.json +5 -0
- package/build/cjs/i18n/gpt/errors/index.d.ts +8 -0
- package/build/cjs/i18n/gpt/errors/index.js +8 -0
- package/build/cjs/i18n/gpt/errors/ru.json +5 -0
- package/build/cjs/i18n/gpt/extension/en.json +6 -0
- package/build/cjs/i18n/gpt/extension/index.d.ts +9 -0
- package/build/cjs/i18n/gpt/extension/index.js +8 -0
- package/build/cjs/i18n/gpt/extension/ru.json +6 -0
- package/build/cjs/i18n/gpt/loading/en.json +3 -0
- package/build/cjs/i18n/gpt/loading/index.d.ts +6 -0
- package/build/cjs/i18n/gpt/loading/index.js +8 -0
- package/build/cjs/i18n/gpt/loading/ru.json +3 -0
- package/build/cjs/i18n/menubar/en.json +1 -0
- package/build/cjs/i18n/menubar/index.d.ts +2 -1
- package/build/cjs/i18n/menubar/ru.json +1 -0
- package/build/cjs/icons/GPT.d.ts +2 -0
- package/build/cjs/icons/GPT.js +22 -0
- package/build/cjs/icons/GPTLoading.d.ts +2 -0
- package/build/cjs/icons/GPTLoading.js +12 -0
- package/build/cjs/icons/index.d.ts +3 -1
- package/build/cjs/icons/index.js +5 -1
- package/build/cjs/react-utils/useAutoFocus.d.ts +1 -1
- package/build/cjs/react-utils/useAutoFocus.js +2 -2
- package/build/cjs/react-utils/useNodeResizing.js +7 -2
- package/build/cjs/table-utils/commands/appendColumn.js +42 -33
- package/build/cjs/table-utils/commands/appendRow.js +40 -22
- package/build/cjs/table-utils/commands/removeColumn.js +18 -20
- package/build/cjs/table-utils/commands/removeRow.js +12 -9
- package/build/cjs/table-utils/table-desc.d.ts +53 -0
- package/build/cjs/table-utils/table-desc.js +149 -0
- package/build/cjs/table-utils/utils.d.ts +1 -1
- package/build/cjs/table-utils/utils.js +19 -12
- package/build/cjs/version.js +1 -1
- package/build/esm/bundle/config/action-names.d.ts +1 -1
- package/build/esm/bundle/config/action-names.js +1 -0
- package/build/esm/bundle/config/icons.d.ts +1 -1
- package/build/esm/bundle/config/icons.js +2 -0
- package/build/esm/bundle/config/wysiwyg.d.ts +1 -0
- package/build/esm/bundle/config/wysiwyg.js +12 -0
- package/build/esm/extensions/behavior/Clipboard/clipboard.js +4 -1
- package/build/esm/extensions/markdown/Table/actions/innerActions.d.ts +1 -1
- package/build/esm/extensions/yfm/GPT/ErrorScreen/ErrorScreen.css +18 -0
- package/build/esm/extensions/yfm/GPT/ErrorScreen/ErrorScreen.d.ts +9 -0
- package/build/esm/extensions/yfm/GPT/ErrorScreen/ErrorScreen.js +17 -0
- package/build/esm/extensions/yfm/GPT/ErrorScreen/types.d.ts +14 -0
- package/build/esm/extensions/yfm/GPT/ErrorScreen/types.js +1 -0
- package/build/esm/extensions/yfm/GPT/GptDialog/GptDialog.css +75 -0
- package/build/esm/extensions/yfm/GPT/GptDialog/GptDialog.d.ts +29 -0
- package/build/esm/extensions/yfm/GPT/GptDialog/GptDialog.js +98 -0
- package/build/esm/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.css +22 -0
- package/build/esm/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.d.ts +4 -0
- package/build/esm/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.js +17 -0
- package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.classname.d.ts +1 -0
- package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.classname.js +2 -0
- package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.css +8 -0
- package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.d.ts +15 -0
- package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.js +25 -0
- package/build/esm/extensions/yfm/GPT/IconRefuge/index.d.ts +2 -0
- package/build/esm/extensions/yfm/GPT/IconRefuge/index.js +1 -0
- package/build/esm/extensions/yfm/GPT/PresetList/PresetList.d.ts +10 -0
- package/build/esm/extensions/yfm/GPT/PresetList/PresetList.js +25 -0
- package/build/esm/extensions/yfm/GPT/PresetList/Presetlist.css +6 -0
- package/build/esm/extensions/yfm/GPT/actions.d.ts +2 -0
- package/build/esm/extensions/yfm/GPT/actions.js +10 -0
- package/build/esm/extensions/yfm/GPT/commands.d.ts +2 -0
- package/build/esm/extensions/yfm/GPT/commands.js +9 -0
- package/build/esm/extensions/yfm/GPT/constants.d.ts +13 -0
- package/build/esm/extensions/yfm/GPT/constants.js +12 -0
- package/build/esm/extensions/yfm/GPT/gptExtension/gptExtension.d.ts +13 -0
- package/build/esm/extensions/yfm/GPT/gptExtension/gptExtension.js +14 -0
- package/build/esm/extensions/yfm/GPT/gptExtension/view.css +17 -0
- package/build/esm/extensions/yfm/GPT/gptExtension/view.d.ts +37 -0
- package/build/esm/extensions/yfm/GPT/gptExtension/view.js +163 -0
- package/build/esm/extensions/yfm/GPT/hooks/useGpt.d.ts +27 -0
- package/build/esm/extensions/yfm/GPT/hooks/useGpt.js +151 -0
- package/build/esm/extensions/yfm/GPT/hooks/useGptHotKeys.d.ts +2 -0
- package/build/esm/extensions/yfm/GPT/hooks/useGptHotKeys.js +4 -0
- package/build/esm/extensions/yfm/GPT/hooks/useOverflowingHorizontalItems.d.ts +13 -0
- package/build/esm/extensions/yfm/GPT/hooks/useOverflowingHorizontalItems.js +65 -0
- package/build/esm/extensions/yfm/GPT/hooks/usePresetList.d.ts +14 -0
- package/build/esm/extensions/yfm/GPT/hooks/usePresetList.js +32 -0
- package/build/esm/extensions/yfm/GPT/index.d.ts +2 -0
- package/build/esm/extensions/yfm/GPT/index.js +2 -0
- package/build/esm/extensions/yfm/GPT/plugin.d.ts +13 -0
- package/build/esm/extensions/yfm/GPT/plugin.js +43 -0
- package/build/esm/extensions/yfm/GPT/toolbar.d.ts +3 -0
- package/build/esm/extensions/yfm/GPT/toolbar.js +18 -0
- package/build/esm/extensions/yfm/GPT/utils.d.ts +13 -0
- package/build/esm/extensions/yfm/GPT/utils.js +23 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.d.ts +1 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.js +1 -9
- package/build/esm/extensions/yfm/index.d.ts +1 -0
- package/build/esm/extensions/yfm/index.js +1 -0
- package/build/esm/i18n/gpt/dialog/en.json +16 -0
- package/build/esm/i18n/gpt/dialog/index.d.ts +19 -0
- package/build/esm/i18n/gpt/dialog/index.js +4 -0
- package/build/esm/i18n/gpt/dialog/ru.json +16 -0
- package/build/esm/i18n/gpt/errors/en.json +5 -0
- package/build/esm/i18n/gpt/errors/index.d.ts +8 -0
- package/build/esm/i18n/gpt/errors/index.js +4 -0
- package/build/esm/i18n/gpt/errors/ru.json +5 -0
- package/build/esm/i18n/gpt/extension/en.json +6 -0
- package/build/esm/i18n/gpt/extension/index.d.ts +9 -0
- package/build/esm/i18n/gpt/extension/index.js +4 -0
- package/build/esm/i18n/gpt/extension/ru.json +6 -0
- package/build/esm/i18n/gpt/loading/en.json +3 -0
- package/build/esm/i18n/gpt/loading/index.d.ts +6 -0
- package/build/esm/i18n/gpt/loading/index.js +4 -0
- package/build/esm/i18n/gpt/loading/ru.json +3 -0
- package/build/esm/i18n/menubar/en.json +1 -0
- package/build/esm/i18n/menubar/index.d.ts +2 -1
- package/build/esm/i18n/menubar/ru.json +1 -0
- package/build/esm/icons/GPT.d.ts +2 -0
- package/build/esm/icons/GPT.js +19 -0
- package/build/esm/icons/GPTLoading.d.ts +2 -0
- package/build/esm/icons/GPTLoading.js +9 -0
- package/build/esm/icons/index.d.ts +3 -1
- package/build/esm/icons/index.js +3 -1
- package/build/esm/react-utils/useAutoFocus.d.ts +1 -1
- package/build/esm/react-utils/useAutoFocus.js +2 -2
- package/build/esm/react-utils/useNodeResizing.js +7 -2
- package/build/esm/table-utils/commands/appendColumn.js +44 -35
- package/build/esm/table-utils/commands/appendRow.js +42 -24
- package/build/esm/table-utils/commands/removeColumn.js +18 -20
- package/build/esm/table-utils/commands/removeRow.js +14 -11
- package/build/esm/table-utils/table-desc.d.ts +53 -0
- package/build/esm/table-utils/table-desc.js +144 -0
- package/build/esm/table-utils/utils.d.ts +1 -1
- package/build/esm/table-utils/utils.js +18 -12
- package/build/esm/version.js +1 -1
- package/build/styles.css +146 -0
- package/package.json +2 -1
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import isNumber from 'is-number';
|
|
2
|
+
import { isTableBodyNode, isTableNode } from './utils';
|
|
3
|
+
export class TableDesc {
|
|
4
|
+
constructor(
|
|
5
|
+
/* eslint-disable @typescript-eslint/parameter-properties */
|
|
6
|
+
rows, cols, rowsDesc, baseOffset) {
|
|
7
|
+
this.rows = rows;
|
|
8
|
+
this.cols = cols;
|
|
9
|
+
this.rowsDesc = rowsDesc;
|
|
10
|
+
this.baseOffset = baseOffset;
|
|
11
|
+
}
|
|
12
|
+
static create(table) {
|
|
13
|
+
if (this.__cache.has(table))
|
|
14
|
+
return this.__cache.get(table);
|
|
15
|
+
if (!isTableNode(table))
|
|
16
|
+
return null;
|
|
17
|
+
const tbody = table.lastChild;
|
|
18
|
+
if (!tbody || !isTableBodyNode(tbody))
|
|
19
|
+
return null;
|
|
20
|
+
// table –> tbody -> ...
|
|
21
|
+
const baseOffset = 2;
|
|
22
|
+
const rows = [];
|
|
23
|
+
tbody.forEach((trow, offset) => {
|
|
24
|
+
rows.push({ node: trow, offset, cells: [] });
|
|
25
|
+
});
|
|
26
|
+
tbody.forEach((trow, _1, trowIndex) => {
|
|
27
|
+
trow.forEach((tcell, offset, tcellRealIndex) => {
|
|
28
|
+
var _a;
|
|
29
|
+
const rowDesc = rows[trowIndex];
|
|
30
|
+
let tcellIndex = tcellRealIndex;
|
|
31
|
+
while (rowDesc.cells[tcellIndex]) {
|
|
32
|
+
tcellIndex++;
|
|
33
|
+
}
|
|
34
|
+
const cellDesc = (rowDesc.cells[tcellIndex] = {
|
|
35
|
+
type: 'real',
|
|
36
|
+
node: tcell,
|
|
37
|
+
offset,
|
|
38
|
+
});
|
|
39
|
+
const map = [trowIndex, tcellIndex];
|
|
40
|
+
if (isNumber(tcell.attrs['colspan'])) {
|
|
41
|
+
rowDesc.colspan = true;
|
|
42
|
+
const colspan = (cellDesc.colspan = parseInt(tcell.attrs['colspan'], 10));
|
|
43
|
+
for (let i = 1; i < colspan; i++) {
|
|
44
|
+
rowDesc.cells[tcellIndex + i] = {
|
|
45
|
+
type: 'virtual',
|
|
46
|
+
colspan: map,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (isNumber(tcell.attrs['rowspan'])) {
|
|
51
|
+
rowDesc.rowspan = true;
|
|
52
|
+
const rowspan = (cellDesc.rowspan = parseInt(tcell.attrs['rowspan'], 10));
|
|
53
|
+
for (let i = 1; i < rowspan; i++) {
|
|
54
|
+
const colspan = (_a = cellDesc.colspan) !== null && _a !== void 0 ? _a : 1;
|
|
55
|
+
for (let j = 0; j < colspan; j++)
|
|
56
|
+
rows[trowIndex + i].cells[tcellIndex + j] = {
|
|
57
|
+
type: 'virtual',
|
|
58
|
+
rowspan: map,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
const desc = new this(rows.length, rows[0].cells.length, rows, baseOffset);
|
|
65
|
+
this.__cache.set(table, desc);
|
|
66
|
+
return desc;
|
|
67
|
+
}
|
|
68
|
+
rowHasVirtualCells(rowIndex) {
|
|
69
|
+
var _a;
|
|
70
|
+
return (_a = this.rowsDesc[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells.some((cell) => cell.type === 'virtual');
|
|
71
|
+
}
|
|
72
|
+
columnHasVirtualCells(columnIndex) {
|
|
73
|
+
return this.rowsDesc.some((row) => { var _a; return ((_a = row.cells[columnIndex]) === null || _a === void 0 ? void 0 : _a.type) === 'virtual'; });
|
|
74
|
+
}
|
|
75
|
+
isSafeColumn(columnIndex) {
|
|
76
|
+
return this.rowsDesc.every((row) => {
|
|
77
|
+
var _a;
|
|
78
|
+
const cell = row.cells[columnIndex];
|
|
79
|
+
if (cell.type === 'real' && (!cell.colspan || cell.colspan === 1))
|
|
80
|
+
return true;
|
|
81
|
+
if (cell.type === 'virtual' && ((_a = cell.rowspan) === null || _a === void 0 ? void 0 : _a[1]) === columnIndex)
|
|
82
|
+
return true;
|
|
83
|
+
return false;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
isSafeRow(rowIndex) {
|
|
87
|
+
var _a;
|
|
88
|
+
return (_a = this.rowsDesc[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells.every((cell) => {
|
|
89
|
+
var _a;
|
|
90
|
+
if (cell.type === 'real' && (!cell.rowspan || cell.rowspan === 1))
|
|
91
|
+
return true;
|
|
92
|
+
if (cell.type === 'virtual' && ((_a = cell.colspan) === null || _a === void 0 ? void 0 : _a[0]) === rowIndex)
|
|
93
|
+
return true;
|
|
94
|
+
return false;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
getOffsetForRow(rowIndex) {
|
|
98
|
+
var _a;
|
|
99
|
+
return this.baseOffset + ((_a = this.rowsDesc[rowIndex]) === null || _a === void 0 ? void 0 : _a.offset);
|
|
100
|
+
}
|
|
101
|
+
getRelativePosForRow(rowIndex) {
|
|
102
|
+
const from = this.getOffsetForRow(rowIndex);
|
|
103
|
+
const to = from + this.rowsDesc[rowIndex].node.nodeSize;
|
|
104
|
+
return { from, to };
|
|
105
|
+
}
|
|
106
|
+
getRelativePosForCell(rowIndex, columnIndex) {
|
|
107
|
+
var _a;
|
|
108
|
+
const cell = (_a = this.rowsDesc[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells[columnIndex];
|
|
109
|
+
const rowOffset = this.getOffsetForRow(rowIndex);
|
|
110
|
+
if ((cell === null || cell === void 0 ? void 0 : cell.type) === 'real') {
|
|
111
|
+
// 1 – open boundary for row node
|
|
112
|
+
const from = rowOffset + 1 + cell.offset;
|
|
113
|
+
const to = from + cell.node.nodeSize;
|
|
114
|
+
return { type: 'real', from, to };
|
|
115
|
+
}
|
|
116
|
+
if ((cell === null || cell === void 0 ? void 0 : cell.type) === 'virtual') {
|
|
117
|
+
let index = columnIndex;
|
|
118
|
+
while (--index >= 0) {
|
|
119
|
+
const cell = this.rowsDesc[rowIndex].cells[index];
|
|
120
|
+
if (cell.type === 'real') {
|
|
121
|
+
const closest = rowOffset + 1 + cell.offset + cell.node.nodeSize;
|
|
122
|
+
return { type: 'virtual', closestPos: closest };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return { type: 'virtual', closestPos: rowOffset + 1 };
|
|
126
|
+
}
|
|
127
|
+
throw new Error(`Impossible to calculate offset for cell with position [${rowIndex},${columnIndex}]`);
|
|
128
|
+
}
|
|
129
|
+
getRelativePosForColumn(columnIndex) {
|
|
130
|
+
const ranges = [];
|
|
131
|
+
for (let i = 0; i < this.rows; i++) {
|
|
132
|
+
ranges.push(this.getRelativePosForCell(i, columnIndex));
|
|
133
|
+
}
|
|
134
|
+
return ranges;
|
|
135
|
+
}
|
|
136
|
+
getCellNodeType() {
|
|
137
|
+
const isRealCell = (cell) => cell.type === 'real';
|
|
138
|
+
return this.rowsDesc[0].cells.find(isRealCell).node.type;
|
|
139
|
+
}
|
|
140
|
+
getRowNodeType() {
|
|
141
|
+
return this.rowsDesc[0].node.type;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
TableDesc.__cache = new WeakMap();
|
|
@@ -25,7 +25,7 @@ export declare const findChildTableBody: (node: PmNode) => {
|
|
|
25
25
|
node: PmNode;
|
|
26
26
|
pos: number;
|
|
27
27
|
}[];
|
|
28
|
-
export declare const getTableDimensions: (node: PmNode
|
|
28
|
+
export declare const getTableDimensions: (node: PmNode) => {
|
|
29
29
|
rows: number;
|
|
30
30
|
cols: number;
|
|
31
31
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import isNumber from 'is-number';
|
|
2
2
|
import { findChildren, findParentNode, findParentNodeClosestToPos, } from 'prosemirror-utils';
|
|
3
3
|
import { isTextSelection } from '../utils/selection';
|
|
4
4
|
import { TableRole } from './const';
|
|
@@ -18,17 +18,23 @@ export const findChildTableRows = (node) => findChildren(node, isTableRowNode);
|
|
|
18
18
|
export const findChildTableCells = (node) => findChildren(node, isTableCellNode);
|
|
19
19
|
export const findChildTableBody = (node) => findChildren(node, isTableBodyNode);
|
|
20
20
|
export const getTableDimensions = (node) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
rows
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
21
|
+
let rows = 0, cols = 0;
|
|
22
|
+
const tbody = node.firstChild;
|
|
23
|
+
tbody === null || tbody === void 0 ? void 0 : tbody.forEach((trow, _1, trowIndex) => {
|
|
24
|
+
rows++;
|
|
25
|
+
if (trowIndex === 0) {
|
|
26
|
+
trow.forEach((tcell, _2) => {
|
|
27
|
+
const cellAttrs = tcell.attrs;
|
|
28
|
+
if (isNumber(cellAttrs['colspan'])) {
|
|
29
|
+
cols += parseInt(cellAttrs['colspan'], 10);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
cols++;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return { rows, cols };
|
|
32
38
|
};
|
|
33
39
|
export function atEndOfCell(view, dir) {
|
|
34
40
|
if (!isTextSelection(view.state.selection))
|
package/build/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** During build process, the current version will be injected here */
|
|
2
|
-
export const VERSION = typeof '13.
|
|
2
|
+
export const VERSION = typeof '13.18.1' !== 'undefined' ? '13.18.1' : 'unknown';
|
package/build/styles.css
CHANGED
|
@@ -1242,6 +1242,130 @@ body :has(.g-md-resizable_resizing) {
|
|
|
1242
1242
|
line-height: var(--g-text-body-1-line-height);
|
|
1243
1243
|
font-weight: var(--g-text-body-font-weight);
|
|
1244
1244
|
}
|
|
1245
|
+
.g-md-gpt-dialog-error-screen__content {
|
|
1246
|
+
display: flex;
|
|
1247
|
+
align-items: center;
|
|
1248
|
+
margin-bottom: var(--g-spacing-2);
|
|
1249
|
+
}
|
|
1250
|
+
.g-md-gpt-dialog-error-screen__icon {
|
|
1251
|
+
color: var(--g-color-base-danger-heavy);
|
|
1252
|
+
}
|
|
1253
|
+
.g-md-gpt-dialog-error-screen__text {
|
|
1254
|
+
flex: auto;
|
|
1255
|
+
font-size: var(--g-text-body-2-font-size);
|
|
1256
|
+
font-weight: 500;
|
|
1257
|
+
}
|
|
1258
|
+
.g-md-gpt-dialog-error-screen__buttons {
|
|
1259
|
+
display: flex;
|
|
1260
|
+
align-items: center;
|
|
1261
|
+
gap: var(--g-spacing-2);
|
|
1262
|
+
}
|
|
1263
|
+
.g-md-gpt-dialog__header-top {
|
|
1264
|
+
display: flex;
|
|
1265
|
+
align-items: center;
|
|
1266
|
+
}
|
|
1267
|
+
.g-md-gpt-dialog__custom-prompt-input {
|
|
1268
|
+
margin-right: var(--g-spacing-2);
|
|
1269
|
+
}
|
|
1270
|
+
.g-md-gpt-dialog__custom-prompt-input .g-text-input__control {
|
|
1271
|
+
font-size: var(--g-text-body-2-font-size);
|
|
1272
|
+
}
|
|
1273
|
+
.g-md-gpt-dialog__header-bottom {
|
|
1274
|
+
margin-top: var(--g-spacing-2);
|
|
1275
|
+
}
|
|
1276
|
+
.g-md-gpt-dialog__custom-prompt {
|
|
1277
|
+
display: flex;
|
|
1278
|
+
flex: auto;
|
|
1279
|
+
align-items: center;
|
|
1280
|
+
}
|
|
1281
|
+
.g-md-gpt-dialog__alone-presets-text {
|
|
1282
|
+
margin-right: var(--g-spacing-8);
|
|
1283
|
+
}
|
|
1284
|
+
.g-md-gpt-dialog__alone-presets {
|
|
1285
|
+
display: flex;
|
|
1286
|
+
flex: auto;
|
|
1287
|
+
align-items: center;
|
|
1288
|
+
width: 100%;
|
|
1289
|
+
font-size: var(--g-text-body-2-font-size);
|
|
1290
|
+
font-weight: 500;
|
|
1291
|
+
}
|
|
1292
|
+
.g-md-gpt-dialog__alone-presets .g-md-gpt-dialog-preset-list {
|
|
1293
|
+
flex: auto;
|
|
1294
|
+
}
|
|
1295
|
+
.g-md-gpt-dialog__answer-title {
|
|
1296
|
+
font-size: var(--g-text-body-2-font-size);
|
|
1297
|
+
font-weight: 500;
|
|
1298
|
+
}
|
|
1299
|
+
.g-md-gpt-dialog__gpt-icon {
|
|
1300
|
+
margin-right: var(--g-spacing-1);
|
|
1301
|
+
}
|
|
1302
|
+
.g-md-gpt-dialog__try-again-button {
|
|
1303
|
+
margin-right: var(--g-spacing-2);
|
|
1304
|
+
}
|
|
1305
|
+
.g-md-gpt-dialog__body {
|
|
1306
|
+
margin: var(--g-spacing-2) calc(-1 * var(--g-spacing-3));
|
|
1307
|
+
padding: var(--g-spacing-4) var(--g-spacing-3);
|
|
1308
|
+
border-top: 1px solid var(--g-color-line-generic);
|
|
1309
|
+
}
|
|
1310
|
+
.g-md-gpt-dialog__answer {
|
|
1311
|
+
overflow: auto;
|
|
1312
|
+
max-height: 300px;
|
|
1313
|
+
}
|
|
1314
|
+
.g-md-gpt-dialog__answer-actions {
|
|
1315
|
+
display: flex;
|
|
1316
|
+
align-items: center;
|
|
1317
|
+
}
|
|
1318
|
+
.g-md-gpt-dialog__feedback-message {
|
|
1319
|
+
margin-left: var(--g-spacing-2);
|
|
1320
|
+
}
|
|
1321
|
+
.g-md-gpt-dialog__like-button {
|
|
1322
|
+
margin-right: var(--g-spacing-2);
|
|
1323
|
+
}
|
|
1324
|
+
.g-md-gpt-dialog__close-button {
|
|
1325
|
+
margin-right: var(--g-spacing-2);
|
|
1326
|
+
margin-left: auto;
|
|
1327
|
+
}
|
|
1328
|
+
.g-md-gpt-dialog__footer {
|
|
1329
|
+
display: flex;
|
|
1330
|
+
align-items: center;
|
|
1331
|
+
margin-top: var(--g-spacing-2);
|
|
1332
|
+
}
|
|
1333
|
+
.g-md-gpt-dialog__description-alert {
|
|
1334
|
+
min-height: 34px;
|
|
1335
|
+
margin-top: var(--g-spacing-3);
|
|
1336
|
+
padding: var(--g-spacing-1) var(--g-spacing-2);
|
|
1337
|
+
}
|
|
1338
|
+
.icon-refuge {
|
|
1339
|
+
display: inline-flex;
|
|
1340
|
+
justify-content: center;
|
|
1341
|
+
align-items: center;
|
|
1342
|
+
}
|
|
1343
|
+
.icon-refuge_inline {
|
|
1344
|
+
display: inline-flex;
|
|
1345
|
+
}
|
|
1346
|
+
.g-md-gpt-dialog-preset-list__preset + .g-md-gpt-dialog-preset-list__preset {
|
|
1347
|
+
margin-left: var(--g-spacing-2);
|
|
1348
|
+
}
|
|
1349
|
+
.g-md-gpt-dialog-preset-list__more-button-wrapper {
|
|
1350
|
+
margin-left: var(--g-spacing-2);
|
|
1351
|
+
}
|
|
1352
|
+
.g-md-gpt-widget-deco {
|
|
1353
|
+
background-color: var(--g-color-base-info-light-hover);
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
.g-md-gpt-popup {
|
|
1357
|
+
--layer-navigation-bar: 900;
|
|
1358
|
+
pointer-events: initial;
|
|
1359
|
+
}
|
|
1360
|
+
.g-md-gpt-popup[class] {
|
|
1361
|
+
border-radius: var(--g-spacing-2);
|
|
1362
|
+
}
|
|
1363
|
+
.g-md-gpt-popup__content {
|
|
1364
|
+
width: 720px;
|
|
1365
|
+
padding: var(--g-spacing-3);
|
|
1366
|
+
pointer-events: all;
|
|
1367
|
+
box-shadow: -8px 2px 16px -4px var(--g-color-private-purple-150), 8px 2px 16px -4px var(--g-color-private-blue-150);
|
|
1368
|
+
}
|
|
1245
1369
|
.g-md-image-skeleton {
|
|
1246
1370
|
vertical-align: middle;
|
|
1247
1371
|
}
|
|
@@ -1425,6 +1549,28 @@ body :has(.g-md-resizable_resizing) {
|
|
|
1425
1549
|
.table-cell-floating-icon {
|
|
1426
1550
|
transform: rotate(90deg);
|
|
1427
1551
|
}
|
|
1552
|
+
.g-md-gpt-dialog-loading-screen__header {
|
|
1553
|
+
display: flex;
|
|
1554
|
+
align-items: center;
|
|
1555
|
+
margin-bottom: 8px;
|
|
1556
|
+
}
|
|
1557
|
+
.g-md-gpt-dialog-loading-screen__icon {
|
|
1558
|
+
margin-right: 4px;
|
|
1559
|
+
}
|
|
1560
|
+
.g-md-gpt-dialog-loading-screen__text {
|
|
1561
|
+
margin-right: 8px;
|
|
1562
|
+
font-size: var(--g-text-body-2-font-size);
|
|
1563
|
+
font-weight: 500;
|
|
1564
|
+
}
|
|
1565
|
+
.g-md-gpt-dialog-loading-screen__skeleton-small-button {
|
|
1566
|
+
width: 90px;
|
|
1567
|
+
height: 28px;
|
|
1568
|
+
margin-right: 8px;
|
|
1569
|
+
}
|
|
1570
|
+
.g-md-gpt-dialog-loading-screen__skeleton-medium-button {
|
|
1571
|
+
width: 120px;
|
|
1572
|
+
height: 28px;
|
|
1573
|
+
}
|
|
1428
1574
|
.g-md-img-size-node-view__wrapper {
|
|
1429
1575
|
position: relative;
|
|
1430
1576
|
display: inline-block;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/markdown-editor",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.18.1",
|
|
4
4
|
"description": "Markdown wysiwyg and markup editor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -195,6 +195,7 @@
|
|
|
195
195
|
"prosemirror-utils": "1.2.0",
|
|
196
196
|
"prosemirror-view": "1.33.6",
|
|
197
197
|
"react-error-boundary": "^3.1.4",
|
|
198
|
+
"react-hotkeys-hook": "4.5.0",
|
|
198
199
|
"react-use": "^17.3.2",
|
|
199
200
|
"tslib": "^2.3.1"
|
|
200
201
|
},
|