@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.
Files changed (197) hide show
  1. package/README.md +4 -0
  2. package/build/cjs/bundle/config/action-names.d.ts +1 -1
  3. package/build/cjs/bundle/config/action-names.js +1 -0
  4. package/build/cjs/bundle/config/icons.d.ts +1 -1
  5. package/build/cjs/bundle/config/icons.js +3 -0
  6. package/build/cjs/bundle/config/wysiwyg.d.ts +1 -0
  7. package/build/cjs/bundle/config/wysiwyg.js +13 -1
  8. package/build/cjs/extensions/behavior/Clipboard/clipboard.js +4 -1
  9. package/build/cjs/extensions/markdown/Table/actions/innerActions.d.ts +1 -1
  10. package/build/cjs/extensions/yfm/GPT/ErrorScreen/ErrorScreen.css +18 -0
  11. package/build/cjs/extensions/yfm/GPT/ErrorScreen/ErrorScreen.d.ts +8 -0
  12. package/build/cjs/extensions/yfm/GPT/ErrorScreen/ErrorScreen.js +21 -0
  13. package/build/cjs/extensions/yfm/GPT/ErrorScreen/types.d.ts +14 -0
  14. package/build/cjs/extensions/yfm/GPT/ErrorScreen/types.js +2 -0
  15. package/build/cjs/extensions/yfm/GPT/GptDialog/GptDialog.css +75 -0
  16. package/build/cjs/extensions/yfm/GPT/GptDialog/GptDialog.d.ts +28 -0
  17. package/build/cjs/extensions/yfm/GPT/GptDialog/GptDialog.js +102 -0
  18. package/build/cjs/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.css +22 -0
  19. package/build/cjs/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.d.ts +3 -0
  20. package/build/cjs/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.js +21 -0
  21. package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.classname.d.ts +1 -0
  22. package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.classname.js +5 -0
  23. package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.css +8 -0
  24. package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.d.ts +14 -0
  25. package/build/cjs/extensions/yfm/GPT/IconRefuge/IconRefuge.js +28 -0
  26. package/build/cjs/extensions/yfm/GPT/IconRefuge/index.d.ts +2 -0
  27. package/build/cjs/extensions/yfm/GPT/IconRefuge/index.js +5 -0
  28. package/build/cjs/extensions/yfm/GPT/PresetList/PresetList.d.ts +9 -0
  29. package/build/cjs/extensions/yfm/GPT/PresetList/PresetList.js +29 -0
  30. package/build/cjs/extensions/yfm/GPT/PresetList/Presetlist.css +6 -0
  31. package/build/cjs/extensions/yfm/GPT/actions.d.ts +2 -0
  32. package/build/cjs/extensions/yfm/GPT/actions.js +14 -0
  33. package/build/cjs/extensions/yfm/GPT/commands.d.ts +2 -0
  34. package/build/cjs/extensions/yfm/GPT/commands.js +13 -0
  35. package/build/cjs/extensions/yfm/GPT/constants.d.ts +13 -0
  36. package/build/cjs/extensions/yfm/GPT/constants.js +15 -0
  37. package/build/cjs/extensions/yfm/GPT/gptExtension/gptExtension.d.ts +13 -0
  38. package/build/cjs/extensions/yfm/GPT/gptExtension/gptExtension.js +18 -0
  39. package/build/cjs/extensions/yfm/GPT/gptExtension/view.css +17 -0
  40. package/build/cjs/extensions/yfm/GPT/gptExtension/view.d.ts +36 -0
  41. package/build/cjs/extensions/yfm/GPT/gptExtension/view.js +167 -0
  42. package/build/cjs/extensions/yfm/GPT/hooks/useGpt.d.ts +27 -0
  43. package/build/cjs/extensions/yfm/GPT/hooks/useGpt.js +155 -0
  44. package/build/cjs/extensions/yfm/GPT/hooks/useGptHotKeys.d.ts +2 -0
  45. package/build/cjs/extensions/yfm/GPT/hooks/useGptHotKeys.js +8 -0
  46. package/build/cjs/extensions/yfm/GPT/hooks/useOverflowingHorizontalItems.d.ts +13 -0
  47. package/build/cjs/extensions/yfm/GPT/hooks/useOverflowingHorizontalItems.js +70 -0
  48. package/build/cjs/extensions/yfm/GPT/hooks/usePresetList.d.ts +14 -0
  49. package/build/cjs/extensions/yfm/GPT/hooks/usePresetList.js +36 -0
  50. package/build/cjs/extensions/yfm/GPT/index.d.ts +2 -0
  51. package/build/cjs/extensions/yfm/GPT/index.js +5 -0
  52. package/build/cjs/extensions/yfm/GPT/plugin.d.ts +13 -0
  53. package/build/cjs/extensions/yfm/GPT/plugin.js +47 -0
  54. package/build/cjs/extensions/yfm/GPT/toolbar.d.ts +3 -0
  55. package/build/cjs/extensions/yfm/GPT/toolbar.js +22 -0
  56. package/build/cjs/extensions/yfm/GPT/utils.d.ts +13 -0
  57. package/build/cjs/extensions/yfm/GPT/utils.js +31 -0
  58. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.d.ts +1 -1
  59. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.js +0 -8
  60. package/build/cjs/extensions/yfm/index.d.ts +1 -0
  61. package/build/cjs/extensions/yfm/index.js +1 -0
  62. package/build/cjs/i18n/gpt/dialog/en.json +16 -0
  63. package/build/cjs/i18n/gpt/dialog/index.d.ts +19 -0
  64. package/build/cjs/i18n/gpt/dialog/index.js +8 -0
  65. package/build/cjs/i18n/gpt/dialog/ru.json +16 -0
  66. package/build/cjs/i18n/gpt/errors/en.json +5 -0
  67. package/build/cjs/i18n/gpt/errors/index.d.ts +8 -0
  68. package/build/cjs/i18n/gpt/errors/index.js +8 -0
  69. package/build/cjs/i18n/gpt/errors/ru.json +5 -0
  70. package/build/cjs/i18n/gpt/extension/en.json +6 -0
  71. package/build/cjs/i18n/gpt/extension/index.d.ts +9 -0
  72. package/build/cjs/i18n/gpt/extension/index.js +8 -0
  73. package/build/cjs/i18n/gpt/extension/ru.json +6 -0
  74. package/build/cjs/i18n/gpt/loading/en.json +3 -0
  75. package/build/cjs/i18n/gpt/loading/index.d.ts +6 -0
  76. package/build/cjs/i18n/gpt/loading/index.js +8 -0
  77. package/build/cjs/i18n/gpt/loading/ru.json +3 -0
  78. package/build/cjs/i18n/menubar/en.json +1 -0
  79. package/build/cjs/i18n/menubar/index.d.ts +2 -1
  80. package/build/cjs/i18n/menubar/ru.json +1 -0
  81. package/build/cjs/icons/GPT.d.ts +2 -0
  82. package/build/cjs/icons/GPT.js +22 -0
  83. package/build/cjs/icons/GPTLoading.d.ts +2 -0
  84. package/build/cjs/icons/GPTLoading.js +12 -0
  85. package/build/cjs/icons/index.d.ts +3 -1
  86. package/build/cjs/icons/index.js +5 -1
  87. package/build/cjs/react-utils/useAutoFocus.d.ts +1 -1
  88. package/build/cjs/react-utils/useAutoFocus.js +2 -2
  89. package/build/cjs/react-utils/useNodeResizing.js +7 -2
  90. package/build/cjs/table-utils/commands/appendColumn.js +42 -33
  91. package/build/cjs/table-utils/commands/appendRow.js +40 -22
  92. package/build/cjs/table-utils/commands/removeColumn.js +18 -20
  93. package/build/cjs/table-utils/commands/removeRow.js +12 -9
  94. package/build/cjs/table-utils/table-desc.d.ts +53 -0
  95. package/build/cjs/table-utils/table-desc.js +149 -0
  96. package/build/cjs/table-utils/utils.d.ts +1 -1
  97. package/build/cjs/table-utils/utils.js +19 -12
  98. package/build/cjs/version.js +1 -1
  99. package/build/esm/bundle/config/action-names.d.ts +1 -1
  100. package/build/esm/bundle/config/action-names.js +1 -0
  101. package/build/esm/bundle/config/icons.d.ts +1 -1
  102. package/build/esm/bundle/config/icons.js +2 -0
  103. package/build/esm/bundle/config/wysiwyg.d.ts +1 -0
  104. package/build/esm/bundle/config/wysiwyg.js +12 -0
  105. package/build/esm/extensions/behavior/Clipboard/clipboard.js +4 -1
  106. package/build/esm/extensions/markdown/Table/actions/innerActions.d.ts +1 -1
  107. package/build/esm/extensions/yfm/GPT/ErrorScreen/ErrorScreen.css +18 -0
  108. package/build/esm/extensions/yfm/GPT/ErrorScreen/ErrorScreen.d.ts +9 -0
  109. package/build/esm/extensions/yfm/GPT/ErrorScreen/ErrorScreen.js +17 -0
  110. package/build/esm/extensions/yfm/GPT/ErrorScreen/types.d.ts +14 -0
  111. package/build/esm/extensions/yfm/GPT/ErrorScreen/types.js +1 -0
  112. package/build/esm/extensions/yfm/GPT/GptDialog/GptDialog.css +75 -0
  113. package/build/esm/extensions/yfm/GPT/GptDialog/GptDialog.d.ts +29 -0
  114. package/build/esm/extensions/yfm/GPT/GptDialog/GptDialog.js +98 -0
  115. package/build/esm/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.css +22 -0
  116. package/build/esm/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.d.ts +4 -0
  117. package/build/esm/extensions/yfm/GPT/GptDialog/LoadingScreen/LoadingScreen.js +17 -0
  118. package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.classname.d.ts +1 -0
  119. package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.classname.js +2 -0
  120. package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.css +8 -0
  121. package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.d.ts +15 -0
  122. package/build/esm/extensions/yfm/GPT/IconRefuge/IconRefuge.js +25 -0
  123. package/build/esm/extensions/yfm/GPT/IconRefuge/index.d.ts +2 -0
  124. package/build/esm/extensions/yfm/GPT/IconRefuge/index.js +1 -0
  125. package/build/esm/extensions/yfm/GPT/PresetList/PresetList.d.ts +10 -0
  126. package/build/esm/extensions/yfm/GPT/PresetList/PresetList.js +25 -0
  127. package/build/esm/extensions/yfm/GPT/PresetList/Presetlist.css +6 -0
  128. package/build/esm/extensions/yfm/GPT/actions.d.ts +2 -0
  129. package/build/esm/extensions/yfm/GPT/actions.js +10 -0
  130. package/build/esm/extensions/yfm/GPT/commands.d.ts +2 -0
  131. package/build/esm/extensions/yfm/GPT/commands.js +9 -0
  132. package/build/esm/extensions/yfm/GPT/constants.d.ts +13 -0
  133. package/build/esm/extensions/yfm/GPT/constants.js +12 -0
  134. package/build/esm/extensions/yfm/GPT/gptExtension/gptExtension.d.ts +13 -0
  135. package/build/esm/extensions/yfm/GPT/gptExtension/gptExtension.js +14 -0
  136. package/build/esm/extensions/yfm/GPT/gptExtension/view.css +17 -0
  137. package/build/esm/extensions/yfm/GPT/gptExtension/view.d.ts +37 -0
  138. package/build/esm/extensions/yfm/GPT/gptExtension/view.js +163 -0
  139. package/build/esm/extensions/yfm/GPT/hooks/useGpt.d.ts +27 -0
  140. package/build/esm/extensions/yfm/GPT/hooks/useGpt.js +151 -0
  141. package/build/esm/extensions/yfm/GPT/hooks/useGptHotKeys.d.ts +2 -0
  142. package/build/esm/extensions/yfm/GPT/hooks/useGptHotKeys.js +4 -0
  143. package/build/esm/extensions/yfm/GPT/hooks/useOverflowingHorizontalItems.d.ts +13 -0
  144. package/build/esm/extensions/yfm/GPT/hooks/useOverflowingHorizontalItems.js +65 -0
  145. package/build/esm/extensions/yfm/GPT/hooks/usePresetList.d.ts +14 -0
  146. package/build/esm/extensions/yfm/GPT/hooks/usePresetList.js +32 -0
  147. package/build/esm/extensions/yfm/GPT/index.d.ts +2 -0
  148. package/build/esm/extensions/yfm/GPT/index.js +2 -0
  149. package/build/esm/extensions/yfm/GPT/plugin.d.ts +13 -0
  150. package/build/esm/extensions/yfm/GPT/plugin.js +43 -0
  151. package/build/esm/extensions/yfm/GPT/toolbar.d.ts +3 -0
  152. package/build/esm/extensions/yfm/GPT/toolbar.js +18 -0
  153. package/build/esm/extensions/yfm/GPT/utils.d.ts +13 -0
  154. package/build/esm/extensions/yfm/GPT/utils.js +23 -0
  155. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.d.ts +1 -1
  156. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.js +1 -9
  157. package/build/esm/extensions/yfm/index.d.ts +1 -0
  158. package/build/esm/extensions/yfm/index.js +1 -0
  159. package/build/esm/i18n/gpt/dialog/en.json +16 -0
  160. package/build/esm/i18n/gpt/dialog/index.d.ts +19 -0
  161. package/build/esm/i18n/gpt/dialog/index.js +4 -0
  162. package/build/esm/i18n/gpt/dialog/ru.json +16 -0
  163. package/build/esm/i18n/gpt/errors/en.json +5 -0
  164. package/build/esm/i18n/gpt/errors/index.d.ts +8 -0
  165. package/build/esm/i18n/gpt/errors/index.js +4 -0
  166. package/build/esm/i18n/gpt/errors/ru.json +5 -0
  167. package/build/esm/i18n/gpt/extension/en.json +6 -0
  168. package/build/esm/i18n/gpt/extension/index.d.ts +9 -0
  169. package/build/esm/i18n/gpt/extension/index.js +4 -0
  170. package/build/esm/i18n/gpt/extension/ru.json +6 -0
  171. package/build/esm/i18n/gpt/loading/en.json +3 -0
  172. package/build/esm/i18n/gpt/loading/index.d.ts +6 -0
  173. package/build/esm/i18n/gpt/loading/index.js +4 -0
  174. package/build/esm/i18n/gpt/loading/ru.json +3 -0
  175. package/build/esm/i18n/menubar/en.json +1 -0
  176. package/build/esm/i18n/menubar/index.d.ts +2 -1
  177. package/build/esm/i18n/menubar/ru.json +1 -0
  178. package/build/esm/icons/GPT.d.ts +2 -0
  179. package/build/esm/icons/GPT.js +19 -0
  180. package/build/esm/icons/GPTLoading.d.ts +2 -0
  181. package/build/esm/icons/GPTLoading.js +9 -0
  182. package/build/esm/icons/index.d.ts +3 -1
  183. package/build/esm/icons/index.js +3 -1
  184. package/build/esm/react-utils/useAutoFocus.d.ts +1 -1
  185. package/build/esm/react-utils/useAutoFocus.js +2 -2
  186. package/build/esm/react-utils/useNodeResizing.js +7 -2
  187. package/build/esm/table-utils/commands/appendColumn.js +44 -35
  188. package/build/esm/table-utils/commands/appendRow.js +42 -24
  189. package/build/esm/table-utils/commands/removeColumn.js +18 -20
  190. package/build/esm/table-utils/commands/removeRow.js +14 -11
  191. package/build/esm/table-utils/table-desc.d.ts +53 -0
  192. package/build/esm/table-utils/table-desc.js +144 -0
  193. package/build/esm/table-utils/utils.d.ts +1 -1
  194. package/build/esm/table-utils/utils.js +18 -12
  195. package/build/esm/version.js +1 -1
  196. package/build/styles.css +146 -0
  197. package/package.json +2 -1
@@ -1,39 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.appendRow = void 0;
4
- const prosemirror_model_1 = require("prosemirror-model");
5
4
  const prosemirror_utils_1 = require("prosemirror-utils");
6
5
  const __1 = require("..");
6
+ const table_desc_1 = require("../table-desc");
7
7
  const appendRow = (state, dispatch, _, attrs) => {
8
- var _a;
9
8
  if (!attrs)
10
9
  return false;
11
- const { tablePos, rowNumber, direction } = attrs;
12
- const tableNode = (_a = (0, prosemirror_utils_1.findParentNodeClosestToPos)(state.doc.resolve(tablePos + 1), __1.isTableNode)) === null || _a === void 0 ? void 0 : _a.node;
13
- if (!tableNode)
10
+ const { tablePos, rowNumber, direction = 'after' } = attrs;
11
+ const res = (0, prosemirror_utils_1.findParentNodeClosestToPos)(state.doc.resolve(tablePos + 1), __1.isTableNode);
12
+ if (!res)
14
13
  return false;
15
- const parentBody = (0, prosemirror_utils_1.findChildren)(tableNode, __1.isTableBodyNode, false).pop();
16
- if (!parentBody)
14
+ const tableNode = res.node;
15
+ const tableDesc = table_desc_1.TableDesc.create(tableNode);
16
+ if (!tableDesc)
17
17
  return false;
18
- let parentRow;
19
- if (rowNumber !== undefined) {
20
- parentRow = (0, __1.findChildTableRows)(tableNode)[rowNumber];
18
+ const rowIndex = rowNumber !== null && rowNumber !== void 0 ? rowNumber : tableDesc.rows - 1; // if rowNumber is not defined, that means last row
19
+ const isFirstRow = rowIndex === 0;
20
+ const isLastRow = rowIndex === tableDesc.rows - 1;
21
+ let pos = -1;
22
+ if (isFirstRow && direction === 'before')
23
+ pos = tableDesc.getRelativePosForRow(0).from;
24
+ if (isLastRow && direction === 'after')
25
+ pos = tableDesc.getRelativePosForRow(tableDesc.rows - 1).to;
26
+ if (pos === -1) {
27
+ if (tableDesc.rows <= rowIndex)
28
+ return false;
29
+ if (tableDesc.isSafeRow(rowIndex)) {
30
+ const rowPos = tableDesc.getRelativePosForRow(rowIndex);
31
+ if (direction === 'before')
32
+ pos = rowPos.from;
33
+ if (direction === 'after')
34
+ pos = rowPos.to;
35
+ }
36
+ else {
37
+ if (direction === 'before' && tableDesc.isSafeRow(rowIndex - 1))
38
+ pos = tableDesc.getRelativePosForRow(rowIndex - 1).to;
39
+ if (direction === 'after' && tableDesc.isSafeRow(rowIndex + 1))
40
+ pos = tableDesc.getRelativePosForRow(rowIndex + 1).from;
41
+ }
21
42
  }
22
- else {
23
- parentRow = (0, prosemirror_utils_1.findChildren)(parentBody.node, __1.isTableRowNode, false).pop();
24
- }
25
- if (!parentRow) {
43
+ if (pos === -1)
26
44
  return false;
27
- }
28
45
  if (dispatch) {
29
- const newCellNodes = [];
30
- parentRow.node.forEach((node) => {
31
- newCellNodes.push(node.type.createAndFill(node.attrs));
32
- });
33
- let position = tablePos + parentRow.pos;
34
- position += direction === 'before' ? 1 : parentRow.node.nodeSize + 1;
35
- dispatch(state.tr.insert(position, parentRow.node.copy(prosemirror_model_1.Fragment.from(newCellNodes))));
46
+ const cells = getNodes(tableDesc.getCellNodeType(), tableDesc.cols);
47
+ dispatch(state.tr.insert(res.pos + pos, tableDesc.getRowNodeType().create(null, cells)));
36
48
  }
37
49
  return true;
38
50
  };
39
51
  exports.appendRow = appendRow;
52
+ function getNodes(type, count) {
53
+ const nodes = [];
54
+ for (let i = 0; i < count; i++)
55
+ nodes.push(type.createAndFill());
56
+ return nodes;
57
+ }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.removeColumn = void 0;
4
- const __1 = require("..");
4
+ const table_desc_1 = require("../table-desc");
5
5
  const utils_1 = require("../utils");
6
6
  const removeColumn = (state, dispatch, _, attrs = {}) => {
7
7
  const { tablePos, columnNumber } = attrs;
@@ -12,30 +12,28 @@ const removeColumn = (state, dispatch, _, attrs = {}) => {
12
12
  if (tablePos < 0 || columnNumber < 0)
13
13
  return false;
14
14
  const tableNode = state.doc.nodeAt(tablePos);
15
- if (!tableNode || tableNode.nodeSize <= 2 || !(0, __1.isTableNode)(tableNode))
15
+ if (!tableNode || tableNode.nodeSize <= 2 || !(0, utils_1.isTableNode)(tableNode))
16
16
  return false;
17
- const tableBodyNode = tableNode.firstChild;
18
- if (!tableBodyNode || tableBodyNode.nodeSize <= 2 || !(0, utils_1.isTableBodyNode)(tableBodyNode))
17
+ const tableDesc = table_desc_1.TableDesc.create(tableNode);
18
+ if (!tableDesc)
19
19
  return false;
20
- // there is one column left
21
- if (tableBodyNode.firstChild && tableBodyNode.firstChild.childCount < 2)
20
+ if (!tableDesc ||
21
+ // there is one column left
22
+ tableDesc.cols < 2 ||
23
+ tableDesc.cols <= columnNumber ||
24
+ !tableDesc.isSafeColumn(columnNumber))
22
25
  return false;
23
26
  if (dispatch) {
24
27
  const { tr } = state;
25
- tableBodyNode.forEach((rowNode, rowOffset) => {
26
- if (!(0, utils_1.isTableRowNode)(rowNode))
27
- return;
28
- rowNode.forEach((cellNode, cellOffset, cellIndex) => {
29
- if (!(0, utils_1.isTableCellNode)(cellNode))
30
- return;
31
- if (cellIndex === columnNumber) {
32
- // table -> tbody -> tr -> td
33
- const from = tablePos + 2 + rowOffset + 1 + cellOffset;
34
- const to = from + cellNode.nodeSize;
35
- tr.delete(tr.mapping.map(from), tr.mapping.map(to));
36
- }
37
- });
38
- });
28
+ const pos = tableDesc.getRelativePosForColumn(columnNumber);
29
+ for (const item of pos) {
30
+ if (item.type === 'real') {
31
+ let { from, to } = item;
32
+ from += tablePos;
33
+ to += tablePos;
34
+ tr.delete(tr.mapping.map(from), tr.mapping.map(to));
35
+ }
36
+ }
39
37
  dispatch(tr);
40
38
  }
41
39
  return true;
@@ -5,7 +5,7 @@ const prosemirror_model_1 = require("prosemirror-model");
5
5
  const prosemirror_utils_1 = require("prosemirror-utils");
6
6
  const __1 = require("..");
7
7
  const core_1 = require("../../core");
8
- const utils_1 = require("../utils");
8
+ const table_desc_1 = require("../table-desc");
9
9
  const removeRow = (state, dispatch, _, attrs = {}) => {
10
10
  var _a;
11
11
  const { tablePos, rowNumber } = attrs;
@@ -14,17 +14,20 @@ const removeRow = (state, dispatch, _, attrs = {}) => {
14
14
  const tableNode = (_a = (0, prosemirror_utils_1.findParentNodeClosestToPos)(state.doc.resolve(tablePos + 1), __1.isTableNode)) === null || _a === void 0 ? void 0 : _a.node;
15
15
  if (!tableNode)
16
16
  return false;
17
- const parentRows = (0, prosemirror_utils_1.findChildren)(tableNode, __1.isTableRowNode);
18
- const parentBody = (0, __1.findChildTableBody)(tableNode)[0];
19
- const parentRow = parentRows[rowNumber];
20
- if (!parentRows.length || !parentBody) {
17
+ const tableDesc = table_desc_1.TableDesc.create(tableNode);
18
+ if (!tableDesc || rowNumber >= tableDesc.rows)
21
19
  return false;
22
- }
23
- if ((0, utils_1.findChildTableRows)(parentBody.node).length < 2) {
24
- // there is one row left
20
+ if (!tableDesc.isSafeRow(rowNumber))
25
21
  return false;
22
+ if (dispatch) {
23
+ let { from, to } = tableDesc.getRelativePosForRow(rowNumber);
24
+ from += tablePos;
25
+ to += tablePos;
26
+ dispatch((0, core_1.trackTransactionMetrics)(state.tr.replaceWith(from, to, prosemirror_model_1.Fragment.empty), 'removeRow', {
27
+ rows: tableDesc.rows,
28
+ cols: tableDesc.cols,
29
+ }));
26
30
  }
27
- dispatch === null || dispatch === void 0 ? void 0 : dispatch((0, core_1.trackTransactionMetrics)(state.tr.replaceWith(tablePos + parentRow.pos, tablePos + parentRow.pos + parentRow.node.nodeSize + 1, prosemirror_model_1.Fragment.empty), 'removeRow', { rows: parentRows.length, cols: parentRow.node.childCount }));
28
31
  return true;
29
32
  };
30
33
  exports.removeRow = removeRow;
@@ -0,0 +1,53 @@
1
+ import type { Node } from 'prosemirror-model';
2
+ declare type TableCellRealDesc = {
3
+ type: 'real';
4
+ offset: number;
5
+ node: Node;
6
+ colspan?: number;
7
+ rowspan?: number;
8
+ };
9
+ declare type TableCellVirtualDesc = {
10
+ type: 'virtual';
11
+ /** Index of real cell, that prodeced this virtual cell */
12
+ colspan?: [number, number];
13
+ /** Index of real cell, that prodeced this virtual cell */
14
+ rowspan?: [number, number];
15
+ };
16
+ declare type Pos = {
17
+ from: number;
18
+ to: number;
19
+ };
20
+ export declare type CellPos = ({
21
+ type: 'real';
22
+ } & Pos) | {
23
+ type: 'virtual';
24
+ closestPos: number;
25
+ };
26
+ declare type TableCellDesc = TableCellRealDesc | TableCellVirtualDesc;
27
+ declare type TableRowDesc = {
28
+ node: Node;
29
+ cells: TableCellDesc[];
30
+ offset: number;
31
+ colspan?: boolean;
32
+ rowspan?: boolean;
33
+ };
34
+ export declare class TableDesc {
35
+ readonly rows: number;
36
+ readonly cols: number;
37
+ readonly rowsDesc: readonly TableRowDesc[];
38
+ readonly baseOffset: number;
39
+ private static __cache;
40
+ static create(table: Node): TableDesc | null;
41
+ private constructor();
42
+ rowHasVirtualCells(rowIndex: number): boolean;
43
+ columnHasVirtualCells(columnIndex: number): boolean;
44
+ isSafeColumn(columnIndex: number): boolean;
45
+ isSafeRow(rowIndex: number): boolean;
46
+ getOffsetForRow(rowIndex: number): number;
47
+ getRelativePosForRow(rowIndex: number): Pos;
48
+ getRelativePosForCell(rowIndex: number, columnIndex: number): CellPos;
49
+ getRelativePosForColumn(columnIndex: number): CellPos[];
50
+ getCellNodeType(): import("prosemirror-model").NodeType;
51
+ getRowNodeType(): import("prosemirror-model").NodeType;
52
+ }
53
+ export {};
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TableDesc = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const is_number_1 = tslib_1.__importDefault(require("is-number"));
6
+ const utils_1 = require("./utils");
7
+ class TableDesc {
8
+ constructor(
9
+ /* eslint-disable @typescript-eslint/parameter-properties */
10
+ rows, cols, rowsDesc, baseOffset) {
11
+ this.rows = rows;
12
+ this.cols = cols;
13
+ this.rowsDesc = rowsDesc;
14
+ this.baseOffset = baseOffset;
15
+ }
16
+ static create(table) {
17
+ if (this.__cache.has(table))
18
+ return this.__cache.get(table);
19
+ if (!(0, utils_1.isTableNode)(table))
20
+ return null;
21
+ const tbody = table.lastChild;
22
+ if (!tbody || !(0, utils_1.isTableBodyNode)(tbody))
23
+ return null;
24
+ // table –> tbody -> ...
25
+ const baseOffset = 2;
26
+ const rows = [];
27
+ tbody.forEach((trow, offset) => {
28
+ rows.push({ node: trow, offset, cells: [] });
29
+ });
30
+ tbody.forEach((trow, _1, trowIndex) => {
31
+ trow.forEach((tcell, offset, tcellRealIndex) => {
32
+ var _a;
33
+ const rowDesc = rows[trowIndex];
34
+ let tcellIndex = tcellRealIndex;
35
+ while (rowDesc.cells[tcellIndex]) {
36
+ tcellIndex++;
37
+ }
38
+ const cellDesc = (rowDesc.cells[tcellIndex] = {
39
+ type: 'real',
40
+ node: tcell,
41
+ offset,
42
+ });
43
+ const map = [trowIndex, tcellIndex];
44
+ if ((0, is_number_1.default)(tcell.attrs['colspan'])) {
45
+ rowDesc.colspan = true;
46
+ const colspan = (cellDesc.colspan = parseInt(tcell.attrs['colspan'], 10));
47
+ for (let i = 1; i < colspan; i++) {
48
+ rowDesc.cells[tcellIndex + i] = {
49
+ type: 'virtual',
50
+ colspan: map,
51
+ };
52
+ }
53
+ }
54
+ if ((0, is_number_1.default)(tcell.attrs['rowspan'])) {
55
+ rowDesc.rowspan = true;
56
+ const rowspan = (cellDesc.rowspan = parseInt(tcell.attrs['rowspan'], 10));
57
+ for (let i = 1; i < rowspan; i++) {
58
+ const colspan = (_a = cellDesc.colspan) !== null && _a !== void 0 ? _a : 1;
59
+ for (let j = 0; j < colspan; j++)
60
+ rows[trowIndex + i].cells[tcellIndex + j] = {
61
+ type: 'virtual',
62
+ rowspan: map,
63
+ };
64
+ }
65
+ }
66
+ });
67
+ });
68
+ const desc = new this(rows.length, rows[0].cells.length, rows, baseOffset);
69
+ this.__cache.set(table, desc);
70
+ return desc;
71
+ }
72
+ rowHasVirtualCells(rowIndex) {
73
+ var _a;
74
+ return (_a = this.rowsDesc[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells.some((cell) => cell.type === 'virtual');
75
+ }
76
+ columnHasVirtualCells(columnIndex) {
77
+ return this.rowsDesc.some((row) => { var _a; return ((_a = row.cells[columnIndex]) === null || _a === void 0 ? void 0 : _a.type) === 'virtual'; });
78
+ }
79
+ isSafeColumn(columnIndex) {
80
+ return this.rowsDesc.every((row) => {
81
+ var _a;
82
+ const cell = row.cells[columnIndex];
83
+ if (cell.type === 'real' && (!cell.colspan || cell.colspan === 1))
84
+ return true;
85
+ if (cell.type === 'virtual' && ((_a = cell.rowspan) === null || _a === void 0 ? void 0 : _a[1]) === columnIndex)
86
+ return true;
87
+ return false;
88
+ });
89
+ }
90
+ isSafeRow(rowIndex) {
91
+ var _a;
92
+ return (_a = this.rowsDesc[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells.every((cell) => {
93
+ var _a;
94
+ if (cell.type === 'real' && (!cell.rowspan || cell.rowspan === 1))
95
+ return true;
96
+ if (cell.type === 'virtual' && ((_a = cell.colspan) === null || _a === void 0 ? void 0 : _a[0]) === rowIndex)
97
+ return true;
98
+ return false;
99
+ });
100
+ }
101
+ getOffsetForRow(rowIndex) {
102
+ var _a;
103
+ return this.baseOffset + ((_a = this.rowsDesc[rowIndex]) === null || _a === void 0 ? void 0 : _a.offset);
104
+ }
105
+ getRelativePosForRow(rowIndex) {
106
+ const from = this.getOffsetForRow(rowIndex);
107
+ const to = from + this.rowsDesc[rowIndex].node.nodeSize;
108
+ return { from, to };
109
+ }
110
+ getRelativePosForCell(rowIndex, columnIndex) {
111
+ var _a;
112
+ const cell = (_a = this.rowsDesc[rowIndex]) === null || _a === void 0 ? void 0 : _a.cells[columnIndex];
113
+ const rowOffset = this.getOffsetForRow(rowIndex);
114
+ if ((cell === null || cell === void 0 ? void 0 : cell.type) === 'real') {
115
+ // 1 – open boundary for row node
116
+ const from = rowOffset + 1 + cell.offset;
117
+ const to = from + cell.node.nodeSize;
118
+ return { type: 'real', from, to };
119
+ }
120
+ if ((cell === null || cell === void 0 ? void 0 : cell.type) === 'virtual') {
121
+ let index = columnIndex;
122
+ while (--index >= 0) {
123
+ const cell = this.rowsDesc[rowIndex].cells[index];
124
+ if (cell.type === 'real') {
125
+ const closest = rowOffset + 1 + cell.offset + cell.node.nodeSize;
126
+ return { type: 'virtual', closestPos: closest };
127
+ }
128
+ }
129
+ return { type: 'virtual', closestPos: rowOffset + 1 };
130
+ }
131
+ throw new Error(`Impossible to calculate offset for cell with position [${rowIndex},${columnIndex}]`);
132
+ }
133
+ getRelativePosForColumn(columnIndex) {
134
+ const ranges = [];
135
+ for (let i = 0; i < this.rows; i++) {
136
+ ranges.push(this.getRelativePosForCell(i, columnIndex));
137
+ }
138
+ return ranges;
139
+ }
140
+ getCellNodeType() {
141
+ const isRealCell = (cell) => cell.type === 'real';
142
+ return this.rowsDesc[0].cells.find(isRealCell).node.type;
143
+ }
144
+ getRowNodeType() {
145
+ return this.rowsDesc[0].node.type;
146
+ }
147
+ }
148
+ exports.TableDesc = TableDesc;
149
+ 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 | Node) => {
28
+ export declare const getTableDimensions: (node: PmNode) => {
29
29
  rows: number;
30
30
  cols: number;
31
31
  };
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.atEndOfCell = exports.getTableDimensions = exports.findChildTableBody = exports.findChildTableCells = exports.findChildTableRows = exports.findParentTableCellFromPos = exports.findParentTableRowFromPos = exports.findParentTableBodyFromPos = exports.findParentTableFromPos = exports.findParentTableCell = exports.findParentTableRow = exports.findParentTableBody = exports.findParentTable = exports.isTableCellNode = exports.isTableRowNode = exports.isTableBodyNode = exports.isTableNode = void 0;
4
- const prosemirror_model_1 = require("prosemirror-model");
4
+ const tslib_1 = require("tslib");
5
+ const is_number_1 = tslib_1.__importDefault(require("is-number"));
5
6
  const prosemirror_utils_1 = require("prosemirror-utils");
6
7
  const selection_1 = require("../utils/selection");
7
8
  const const_1 = require("./const");
@@ -32,17 +33,23 @@ exports.findChildTableCells = findChildTableCells;
32
33
  const findChildTableBody = (node) => (0, prosemirror_utils_1.findChildren)(node, exports.isTableBodyNode);
33
34
  exports.findChildTableBody = findChildTableBody;
34
35
  const getTableDimensions = (node) => {
35
- var _a, _b, _c, _d, _e, _f;
36
- let rows, cols;
37
- if (node instanceof prosemirror_model_1.Node) {
38
- rows = (_a = node.firstChild) === null || _a === void 0 ? void 0 : _a.childCount;
39
- cols = (_c = (_b = node.firstChild) === null || _b === void 0 ? void 0 : _b.firstChild) === null || _c === void 0 ? void 0 : _c.childCount;
40
- }
41
- else {
42
- rows = (_d = node.firstChild) === null || _d === void 0 ? void 0 : _d.childNodes.length;
43
- cols = (_f = (_e = node.firstChild) === null || _e === void 0 ? void 0 : _e.firstChild) === null || _f === void 0 ? void 0 : _f.childNodes.length;
44
- }
45
- return { rows: rows || 1, cols: cols || 1 };
36
+ let rows = 0, cols = 0;
37
+ const tbody = node.firstChild;
38
+ tbody === null || tbody === void 0 ? void 0 : tbody.forEach((trow, _1, trowIndex) => {
39
+ rows++;
40
+ if (trowIndex === 0) {
41
+ trow.forEach((tcell, _2) => {
42
+ const cellAttrs = tcell.attrs;
43
+ if ((0, is_number_1.default)(cellAttrs['colspan'])) {
44
+ cols += parseInt(cellAttrs['colspan'], 10);
45
+ }
46
+ else {
47
+ cols++;
48
+ }
49
+ });
50
+ }
51
+ });
52
+ return { rows, cols };
46
53
  };
47
54
  exports.getTableDimensions = getTableDimensions;
48
55
  function atEndOfCell(view, dir) {
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  /** During build process, the current version will be injected here */
5
- exports.VERSION = typeof '13.17.1' !== 'undefined' ? '13.17.1' : 'unknown';
5
+ exports.VERSION = typeof '13.18.1' !== 'undefined' ? '13.18.1' : 'unknown';
@@ -1,3 +1,3 @@
1
- declare const namesObj: Record<"bold" | "link" | "italic" | "strike" | "underline" | "mark" | "quote" | "mono" | "paragraph" | "anchor" | "table" | "image" | "code_inline" | "code_block" | "file" | "checkbox" | "bulletList" | "orderedList" | "emoji" | "tabs" | "yfm_cut" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "yfm_note" | "undo" | "redo" | "math_inline" | "math_block" | "mermaid" | "liftListItem" | "sinkListItem" | "yfm_block" | "yfm_html_block" | "yfm_layout" | "horizontalrule", string>;
1
+ declare const namesObj: Record<"bold" | "link" | "italic" | "strike" | "underline" | "mark" | "quote" | "mono" | "paragraph" | "anchor" | "table" | "image" | "code_inline" | "code_block" | "file" | "checkbox" | "bulletList" | "orderedList" | "emoji" | "tabs" | "yfm_cut" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "yfm_note" | "gpt" | "undo" | "redo" | "math_inline" | "math_block" | "mermaid" | "liftListItem" | "sinkListItem" | "yfm_block" | "yfm_html_block" | "yfm_layout" | "horizontalrule", string>;
2
2
  export declare const ActionName: Readonly<typeof namesObj>;
3
3
  export {};
@@ -38,6 +38,7 @@ const names = [
38
38
  'math_block',
39
39
  'tabs',
40
40
  'mermaid',
41
+ 'gpt',
41
42
  ];
42
43
  const namesObj = names.reduce((obj, val) => {
43
44
  obj[val] = val;
@@ -1,5 +1,5 @@
1
1
  import { ToolbarIconData } from '../../toolbar/types';
2
- declare type Icon = 'undo' | 'redo' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'mono' | 'mark' | 'textColor' | 'text' | 'headline' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'bulletList' | 'orderedList' | 'sink' | 'lift' | 'cut' | 'note' | 'code' | 'codeBlock' | 'link' | 'image' | 'table' | 'quote' | 'checklist' | 'horizontalRule' | 'file' | 'functionInline' | 'functionBlock' | 'emoji' | 'tabs' | 'mermaid' | 'html' | 'foldingHeading';
2
+ declare type Icon = 'undo' | 'redo' | 'bold' | 'italic' | 'underline' | 'strikethrough' | 'mono' | 'mark' | 'textColor' | 'text' | 'headline' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'bulletList' | 'orderedList' | 'sink' | 'lift' | 'cut' | 'note' | 'code' | 'codeBlock' | 'link' | 'image' | 'table' | 'quote' | 'checklist' | 'horizontalRule' | 'file' | 'functionInline' | 'functionBlock' | 'emoji' | 'tabs' | 'mermaid' | 'html' | 'foldingHeading' | 'gpt';
3
3
  declare type Icons = Record<Icon, ToolbarIconData>;
4
4
  export declare const icons: Icons;
5
5
  export {};
@@ -1,4 +1,5 @@
1
1
  import { BoldIcon, CheckListIcon, CodeBlockIcon, CodeInlineIcon, CutIcon, EmojiIcon, FileIcon, FoldingHeadingIcon, FunctionBlockIcon, FunctionInlineIcon, HRuleIcon, Heading1Icon, Heading2Icon, Heading3Icon, Heading4Icon, Heading5Icon, Heading6Icon, HeadingIcon, HtmlBlockIcon, ImageIcon, ItalicIcon, LiftIcon, LinkIcon, ListBlIcon, ListOlIcon, MarkIcon, MermaidIcon, MonoIcon, NoteIcon, QuoteIcon, RedoIcon, SinkIcon, StrikethroughIcon, TableIcon, TabsIcon, TextColorIcon, TextIcon, UnderlineIcon, UndoIcon, } from '../../icons';
2
+ import GPTIcon from '../../icons/GPT';
2
3
  export const icons = {
3
4
  undo: { data: UndoIcon },
4
5
  redo: { data: RedoIcon },
@@ -39,4 +40,5 @@ export const icons = {
39
40
  tabs: { data: TabsIcon },
40
41
  mermaid: { data: MermaidIcon },
41
42
  foldingHeading: { data: FoldingHeadingIcon },
43
+ gpt: { data: GPTIcon },
42
44
  };
@@ -45,6 +45,7 @@ export declare const wMathBlockItemData: WToolbarSingleItemData;
45
45
  export declare const wMathListConfig: WToolbarListButtonData;
46
46
  export declare const wMathListItem: WToolbarListItemData;
47
47
  export declare const wYfmHtmlBlockItemData: WToolbarSingleItemData;
48
+ export declare const wGptItemData: WToolbarSingleItemData;
48
49
  export declare const wCommandMenuConfig: WToolbarItemData[];
49
50
  export declare const wHiddenData: WToolbarItemData[];
50
51
  /** prepared wysiwyg toolbar config */
@@ -1,4 +1,6 @@
1
1
  import { headingType, pType } from '../../extensions';
2
+ // for typings from Math
3
+ import { gptHotKeys } from '../../extensions/yfm/GPT/constants';
2
4
  import { i18n as i18nHint } from '../../i18n/hints';
3
5
  import { i18n } from '../../i18n/menubar';
4
6
  import { Action as A, formatter as f } from '../../shortcuts';
@@ -400,6 +402,16 @@ export const wYfmHtmlBlockItemData = {
400
402
  isActive: (e) => e.actions.createYfmHtmlBlock.isActive(),
401
403
  isEnable: (e) => e.actions.createYfmHtmlBlock.isEnable(),
402
404
  };
405
+ export const wGptItemData = {
406
+ id: ActionName.gpt,
407
+ type: ToolbarDataType.SingleButton,
408
+ title: i18n.bind(null, 'gpt'),
409
+ hotkey: gptHotKeys.openGptKeyTooltip,
410
+ icon: icons.gpt,
411
+ exec: (e) => e.actions.addGptWidget.run({}),
412
+ isActive: (e) => e.actions.addGptWidget.isActive(),
413
+ isEnable: (e) => e.actions.addGptWidget.isEnable(),
414
+ };
403
415
  export const wCommandMenuConfig = [
404
416
  ...wHeadingListConfig.data,
405
417
  ...wListsListConfig.data,
@@ -89,7 +89,10 @@ export const clipboard = ({ textParser, mdParser, serializer, pasteFileHandler,
89
89
  const codeType = isInsideCode(view.state);
90
90
  if (codeType) {
91
91
  const schema = view.state.schema;
92
- view.dispatch(trackTransactionMetrics(view.state.tr.replaceSelectionWith(schema.text(codeType === 'inline' ? data.trim() : data)), 'paste', { clipboardDataFormat: dataFormat, code: codeType }));
92
+ const insideCodeData = e.clipboardData.getData(DataTransferType.Text);
93
+ view.dispatch(trackTransactionMetrics(view.state.tr.replaceSelectionWith(schema.text(codeType === 'inline'
94
+ ? insideCodeData.trim()
95
+ : insideCodeData)), 'paste', { clipboardDataFormat: DataTransferType.Text, code: codeType }));
93
96
  isPasteHandled = true;
94
97
  }
95
98
  else {
@@ -1,2 +1,2 @@
1
1
  import { ActionSpec } from '../../../../core';
2
- export declare const innerActions: Record<"addRow" | "deleteRow" | "addColumn" | "deleteColumn" | "setCellLeftAlign" | "setCellCenterAlign" | "setCellRightAlign", ActionSpec>;
2
+ export declare const innerActions: Record<"deleteRow" | "deleteColumn" | "setCellLeftAlign" | "setCellCenterAlign" | "setCellRightAlign" | "addRow" | "addColumn", ActionSpec>;
@@ -0,0 +1,18 @@
1
+ .g-md-gpt-dialog-error-screen__content {
2
+ display: flex;
3
+ align-items: center;
4
+ margin-bottom: var(--g-spacing-2);
5
+ }
6
+ .g-md-gpt-dialog-error-screen__icon {
7
+ color: var(--g-color-base-danger-heavy);
8
+ }
9
+ .g-md-gpt-dialog-error-screen__text {
10
+ flex: auto;
11
+ font-size: var(--g-text-body-2-font-size);
12
+ font-weight: 500;
13
+ }
14
+ .g-md-gpt-dialog-error-screen__buttons {
15
+ display: flex;
16
+ align-items: center;
17
+ gap: var(--g-spacing-2);
18
+ }
@@ -0,0 +1,9 @@
1
+ import type { FC } from 'react';
2
+ import './ErrorScreen.css';
3
+ declare type ErrorScreenProps = {
4
+ onRetry: () => void;
5
+ onStartAgain: () => void;
6
+ };
7
+ export declare const cnGptDialogErrorScreen: import("@bem-react/classname").ClassNameFormatter;
8
+ export declare const ErrorScreen: FC<ErrorScreenProps>;
9
+ export {};
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { CircleXmarkFill } from '@gravity-ui/icons';
3
+ import { Button } from '@gravity-ui/uikit';
4
+ import { cn } from '../../../../classname';
5
+ import { i18n } from '../../../../i18n/gpt/errors';
6
+ import { IconRefuge } from '../IconRefuge/IconRefuge';
7
+ import './ErrorScreen.css';
8
+ export const cnGptDialogErrorScreen = cn('gpt-dialog-error-screen');
9
+ export const ErrorScreen = ({ onRetry, onStartAgain }) => {
10
+ return (React.createElement("div", { className: cnGptDialogErrorScreen() },
11
+ React.createElement("div", { className: cnGptDialogErrorScreen('content') },
12
+ React.createElement(IconRefuge, { containerClassName: cnGptDialogErrorScreen('icon'), data: CircleXmarkFill, refugeSize: 28, size: 16 }),
13
+ React.createElement("span", { className: cnGptDialogErrorScreen('text') }, i18n('error-text'))),
14
+ React.createElement("div", { className: cnGptDialogErrorScreen('buttons') },
15
+ React.createElement(Button, { view: "normal", onClick: onStartAgain }, i18n('start-again-button')),
16
+ React.createElement(Button, { view: "normal", onClick: onRetry }, i18n('retry-button')))));
17
+ };
@@ -0,0 +1,14 @@
1
+ export declare type PromptPreset<PromptData extends unknown = unknown> = {
2
+ display: string;
3
+ key: string;
4
+ data?: PromptData;
5
+ hotKey?: string;
6
+ };
7
+ export declare type CommonAnswer = {
8
+ rawText: string;
9
+ };
10
+ export declare type GptRequestData<PromptData extends unknown = unknown> = {
11
+ markup: string;
12
+ customPrompt?: string;
13
+ promptData?: PromptData;
14
+ };
@@ -0,0 +1 @@
1
+ export {};