@seafile/seafile-editor 0.3.76

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 (156) hide show
  1. package/README.md +119 -0
  2. package/TODO.md +55 -0
  3. package/dist/components/add-formula-dialog.js +135 -0
  4. package/dist/components/add-image-dialog.js +78 -0
  5. package/dist/components/add-link-dialog.js +148 -0
  6. package/dist/components/comment-dialog.js +107 -0
  7. package/dist/components/comment-panel.js +452 -0
  8. package/dist/components/context-menu.js +112 -0
  9. package/dist/components/detail-list-view.js +119 -0
  10. package/dist/components/generate-share-link.js +412 -0
  11. package/dist/components/internal-link-dialog.js +96 -0
  12. package/dist/components/loading.js +32 -0
  13. package/dist/components/markdown-lint.js +87 -0
  14. package/dist/components/modal-portal.js +46 -0
  15. package/dist/components/outline.js +130 -0
  16. package/dist/components/participants-list.js +126 -0
  17. package/dist/components/related-files-list.js +75 -0
  18. package/dist/components/shortcut-dialog.js +167 -0
  19. package/dist/components/side-panel.js +175 -0
  20. package/dist/components/toast/alert.js +150 -0
  21. package/dist/components/toast/index.js +3 -0
  22. package/dist/components/toast/toast.js +179 -0
  23. package/dist/components/toast/toastManager.js +158 -0
  24. package/dist/components/toast/toaster.js +76 -0
  25. package/dist/components/toolbar.js +235 -0
  26. package/dist/components/topbar-component/button-group.js +31 -0
  27. package/dist/components/topbar-component/editor-toolbar.js +545 -0
  28. package/dist/components/topbar-component/file-info.js +65 -0
  29. package/dist/components/topbar-component/header-list.js +128 -0
  30. package/dist/components/topbar-component/icon-button.js +99 -0
  31. package/dist/components/topbar-component/insert-file.js +67 -0
  32. package/dist/components/topbar-component/table-toolbar.js +175 -0
  33. package/dist/components/topbar-component/upload-img.js +122 -0
  34. package/dist/components/user-help.js +205 -0
  35. package/dist/css/diff-viewer.css +105 -0
  36. package/dist/css/history-viewer.css +104 -0
  37. package/dist/css/keyboard-shortcuts.css +59 -0
  38. package/dist/css/layout.css +110 -0
  39. package/dist/css/markdown-viewer-slate/file-tags-list.css +76 -0
  40. package/dist/css/markdown-viewer.css +69 -0
  41. package/dist/css/plaineditor/markdown-editor.css +12 -0
  42. package/dist/css/react-mentions-default-style.js +72 -0
  43. package/dist/css/related-files-list.css +56 -0
  44. package/dist/css/richeditor/comments-list.css +184 -0
  45. package/dist/css/richeditor/detail-list-view.css +114 -0
  46. package/dist/css/richeditor/document-info.css +57 -0
  47. package/dist/css/richeditor/formula.css +19 -0
  48. package/dist/css/richeditor/image.css +141 -0
  49. package/dist/css/richeditor/link.css +7 -0
  50. package/dist/css/richeditor/navbar-imgbutton.css +79 -0
  51. package/dist/css/richeditor/participants-list.css +22 -0
  52. package/dist/css/richeditor/rich-editor-main.css +42 -0
  53. package/dist/css/richeditor/right-panel.css +84 -0
  54. package/dist/css/richeditor/side-panel.css +190 -0
  55. package/dist/css/richeditor/table.css +57 -0
  56. package/dist/css/richeditor/textlink-hovermenu.css +47 -0
  57. package/dist/css/richeditor/tree-view.css +67 -0
  58. package/dist/css/topbar.css +400 -0
  59. package/dist/editor/code-highlight-package.js +27 -0
  60. package/dist/editor/controller/block-element-controller.js +376 -0
  61. package/dist/editor/controller/inline-element-controller.js +129 -0
  62. package/dist/editor/controller/normalize-controller.js +107 -0
  63. package/dist/editor/controller/shortcut-controller.js +394 -0
  64. package/dist/editor/controller/void-element-controller.js +12 -0
  65. package/dist/editor/custom/custom.js +17 -0
  66. package/dist/editor/custom/get-event-transfer.js +34 -0
  67. package/dist/editor/custom/getNodesByTypeAtRange.js +69 -0
  68. package/dist/editor/custom/insertNodes.js +140 -0
  69. package/dist/editor/custom/is-empty-paragraph.js +13 -0
  70. package/dist/editor/custom/set-event-transfer.js +31 -0
  71. package/dist/editor/custom/split-nodes-at-point.js +162 -0
  72. package/dist/editor/custom/unwrap-node-by-type-at-range.js +81 -0
  73. package/dist/editor/editor-component/check-list-item.js +64 -0
  74. package/dist/editor/editor-component/code-block.js +150 -0
  75. package/dist/editor/editor-component/formula.js +79 -0
  76. package/dist/editor/editor-component/image.js +215 -0
  77. package/dist/editor/editor-component/link.js +11 -0
  78. package/dist/editor/editor-component/table.js +172 -0
  79. package/dist/editor/editor-component/textlink-hovermenu.js +136 -0
  80. package/dist/editor/editor-plugin.js +249 -0
  81. package/dist/editor/editor-utils/block-element-utils/blockquote-utils.js +96 -0
  82. package/dist/editor/editor-utils/block-element-utils/code-utils.js +162 -0
  83. package/dist/editor/editor-utils/block-element-utils/formula-utils.js +58 -0
  84. package/dist/editor/editor-utils/block-element-utils/index.js +38 -0
  85. package/dist/editor/editor-utils/block-element-utils/list-utils.js +398 -0
  86. package/dist/editor/editor-utils/block-element-utils/table-utils.js +418 -0
  87. package/dist/editor/editor-utils/common-editor-utils.js +587 -0
  88. package/dist/editor/editor-utils/inline-element-utils/index.js +95 -0
  89. package/dist/editor/editor-utils/mark-utils.js +25 -0
  90. package/dist/editor/editor-utils/range-utils.js +9 -0
  91. package/dist/editor/editor-utils/selection-utils.js +33 -0
  92. package/dist/editor/editor-utils/text-utils.js +130 -0
  93. package/dist/editor/editor.js +66 -0
  94. package/dist/editor/element-model/blockquote.js +16 -0
  95. package/dist/editor/element-model/image.js +19 -0
  96. package/dist/editor/element-model/link.js +19 -0
  97. package/dist/editor/element-model/table.js +50 -0
  98. package/dist/editor/element-model/text.js +13 -0
  99. package/dist/editor/load-script.js +83 -0
  100. package/dist/editor/plain-markdown-editor.js +324 -0
  101. package/dist/editor/rich-markdown-editor.js +580 -0
  102. package/dist/editor/seafile-editor.js +326 -0
  103. package/dist/editor/simple-editor.js +245 -0
  104. package/dist/editor-api.js +261 -0
  105. package/dist/index.css +97 -0
  106. package/dist/lib/slate-hyperscript/creators.js +263 -0
  107. package/dist/lib/slate-hyperscript/hyperscript.js +92 -0
  108. package/dist/lib/slate-hyperscript/index.js +3 -0
  109. package/dist/lib/slate-hyperscript/tokens.js +102 -0
  110. package/dist/lib/unified/index.js +470 -0
  111. package/dist/lib/vfile/core.js +172 -0
  112. package/dist/lib/vfile/index.js +48 -0
  113. package/dist/seafile-editor-chooser.js +45 -0
  114. package/dist/seafile-markdown-editor.js +301 -0
  115. package/dist/seafile-markdown-viewer.js +79 -0
  116. package/dist/seafile-simple-editor.js +56 -0
  117. package/dist/utils/copy-to-clipboard.js +47 -0
  118. package/dist/utils/deserialize-html.js +282 -0
  119. package/dist/utils/diff/compare-strings.js +46 -0
  120. package/dist/utils/diff/diff.js +855 -0
  121. package/dist/utils/diff/index.js +2 -0
  122. package/dist/utils/render-slate.js +219 -0
  123. package/dist/utils/seafile-markdown2html.js +62 -0
  124. package/dist/utils/slate2markdown/deserialize.js +689 -0
  125. package/dist/utils/slate2markdown/index.js +3 -0
  126. package/dist/utils/slate2markdown/serialize.js +407 -0
  127. package/dist/utils/utils.js +28 -0
  128. package/dist/viewer/diff-viewer.js +98 -0
  129. package/dist/viewer/markdown-viewer.js +139 -0
  130. package/dist/viewer/slate-viewer.js +73 -0
  131. package/dist/viewer/viewer-formula.js +67 -0
  132. package/dist/viewer/viewer-image.js +93 -0
  133. package/dist/viewer/viewer-outline.js +118 -0
  134. package/package.json +215 -0
  135. package/public/favicon.ico +0 -0
  136. package/public/index.html +45 -0
  137. package/public/locales/cs/seafile-editor.json +169 -0
  138. package/public/locales/de/seafile-editor.json +169 -0
  139. package/public/locales/en/seafile-editor.json +222 -0
  140. package/public/locales/es/seafile-editor.json +169 -0
  141. package/public/locales/es-AR/seafile-editor.json +169 -0
  142. package/public/locales/es-MX/seafile-editor.json +169 -0
  143. package/public/locales/fr/seafile-editor.json +169 -0
  144. package/public/locales/it/seafile-editor.json +169 -0
  145. package/public/locales/ru/seafile-editor.json +169 -0
  146. package/public/locales/zh-CN/seafile-editor.json +219 -0
  147. package/public/manifest.json +15 -0
  148. package/public/media/scripts/mathjax/tex-svg.js +1 -0
  149. package/public/media/seafile-editor-font/iconfont.eot +0 -0
  150. package/public/media/seafile-editor-font/iconfont.svg +164 -0
  151. package/public/media/seafile-editor-font/iconfont.ttf +0 -0
  152. package/public/media/seafile-editor-font/iconfont.woff +0 -0
  153. package/public/media/seafile-editor-font/iconfont.woff2 +0 -0
  154. package/public/media/seafile-editor-font.css +201 -0
  155. package/public/media/seafile-logo.png +0 -0
  156. package/public/media/seafile-ui.css +11169 -0
@@ -0,0 +1,418 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import { SfEditor } from '../../custom/custom';
5
+ import { Node } from 'slate';
6
+ import { generateTable, generateTableRow, generateTableCell } from '../../element-model/table';
7
+ import getEventTransfer from '../../custom/get-event-transfer';
8
+ import { htmlDeserializer } from '../../../utils/deserialize-html';
9
+
10
+ var TableUtils = function TableUtils(_editor) {
11
+ var _this = this;
12
+
13
+ _classCallCheck(this, TableUtils);
14
+
15
+ this.isInTable = function () {
16
+ var editor = _this.editor;
17
+ var selection = editor.selection;
18
+ if (!selection) return false;
19
+ var block = SfEditor.match(editor, editor.selection.anchor, 'block');
20
+ var parent = Node.parent(editor, block[1]);
21
+ var focusPath = selection.focus.path;
22
+ var anchorPath = selection.anchor.path;
23
+
24
+ if (parent && parent.type && parent.type.includes('table')) {
25
+ if (focusPath[0] === anchorPath[0]) return true;
26
+ }
27
+
28
+ return false;
29
+ };
30
+
31
+ this.insertTable = function () {
32
+ var tableElement = generateTable();
33
+ SfEditor.insertNodes(_this.editor, tableElement); // get the first cell path of the table and move selection to it;
34
+
35
+ var table = SfEditor.match(_this.editor, _this.editor.selection, {
36
+ type: 'table'
37
+ });
38
+ var tablePath = table[1];
39
+ var targetPath = [].concat(_toConsumableArray(tablePath), [0, 0]);
40
+ SfEditor.select(_this.editor, targetPath);
41
+ };
42
+
43
+ this.getSelectedTableCells = function () {
44
+ var node = SfEditor.match(_this.editor, _this.editor.selection, {
45
+ type: 'table'
46
+ });
47
+ var tableNode = node[0];
48
+ var selectedCells = document.querySelectorAll('.selected-cell');
49
+
50
+ if (selectedCells.length === 0) {
51
+ return null;
52
+ }
53
+
54
+ var cellIndexs = [];
55
+ var rowIndexs = [];
56
+ selectedCells.forEach(function (cell, index) {
57
+ var cellIndex = cell.cellIndex;
58
+ var rowDom = cell.parentNode;
59
+ var rowIndex = rowDom.rowIndex;
60
+ cellIndexs.push(cellIndex);
61
+ rowIndexs.push(rowIndex);
62
+ });
63
+ var rowRange = {
64
+ min: Math.min.apply(null, rowIndexs),
65
+ max: Math.max.apply(null, rowIndexs)
66
+ };
67
+ var columnRange = {
68
+ min: Math.min.apply(null, cellIndexs),
69
+ max: Math.max.apply(null, cellIndexs)
70
+ };
71
+ var tableRows = tableNode.children;
72
+ var rowNodes = [];
73
+ tableRows.forEach(function (row, rowIndex) {
74
+ var cellNodes = [];
75
+
76
+ if (rowIndex >= rowRange.min && rowIndex <= rowRange.max) {
77
+ row.children.forEach(function (cell, cellIndex) {
78
+ if (cellIndex >= columnRange.min && cellIndex <= columnRange.max) {
79
+ cellNodes.push(Object.assign({}, {}, cell));
80
+ }
81
+ });
82
+ rowNodes.push(generateTableRow({
83
+ children: cellNodes
84
+ }));
85
+ }
86
+ });
87
+ return [generateTable({
88
+ children: rowNodes
89
+ })];
90
+ };
91
+
92
+ this.pasteContentInTable = function (command) {
93
+ var data = command.data;
94
+
95
+ var _getEventTransfer = getEventTransfer(data),
96
+ fragment = _getEventTransfer.fragment,
97
+ text = _getEventTransfer.text,
98
+ type = _getEventTransfer.type,
99
+ html = _getEventTransfer.html;
100
+
101
+ var newtext = text.replace(/\r\n|\n/g, ' ');
102
+
103
+ if (!fragment && type === 'text') {
104
+ SfEditor.insertText(_this.editor, newtext);
105
+ return;
106
+ }
107
+
108
+ if (type === 'html') {
109
+ fragment = htmlDeserializer(html);
110
+ }
111
+
112
+ if (fragment.length === 1) {
113
+ if (fragment[0].type === 'table') {
114
+ var tableNode = fragment[0];
115
+
116
+ var _SfEditor$match = SfEditor.match(_this.editor, _this.editor.selection, {
117
+ type: 'table_row'
118
+ }),
119
+ _SfEditor$match2 = _slicedToArray(_SfEditor$match, 2),
120
+ row = _SfEditor$match2[0],
121
+ rowPath = _SfEditor$match2[1];
122
+
123
+ var _SfEditor$match3 = SfEditor.match(_this.editor, _this.editor.selection, {
124
+ type: 'table'
125
+ }),
126
+ _SfEditor$match4 = _slicedToArray(_SfEditor$match3, 2),
127
+ table = _SfEditor$match4[0],
128
+ tablePath = _SfEditor$match4[1];
129
+
130
+ var cellPath = SfEditor.match(_this.editor, _this.editor.selection, {
131
+ type: 'table_cell'
132
+ })[1];
133
+ var currentRowIndex = rowPath[rowPath.length - 1];
134
+ var currentCellIndex = cellPath[cellPath.length - 1];
135
+ var tableWidth = row.children.length;
136
+ var tableHeight = table.children.length;
137
+ tableNode.children.some(function (row, rowIndex) {
138
+ var rowPath = [].concat(_toConsumableArray(tablePath), [currentRowIndex + rowIndex]);
139
+
140
+ if (currentRowIndex + rowIndex > tableHeight - 1) {
141
+ return true;
142
+ }
143
+
144
+ row.children.some(function (cell, cellIndex) {
145
+ if (currentCellIndex + cellIndex > tableWidth - 1) {
146
+ return true;
147
+ }
148
+
149
+ var currentCellPath = [].concat(_toConsumableArray(rowPath), [currentCellIndex + cellIndex]);
150
+ SfEditor.removeNodes(_this.editor, {
151
+ at: [].concat(_toConsumableArray(currentCellPath), [0])
152
+ });
153
+
154
+ if (cell.children.type !== 'paragraph') {
155
+ var _text = Node.text(cell);
156
+
157
+ SfEditor.insertNodes(_this.editor, {
158
+ type: 'paragraph',
159
+ children: [{
160
+ text: _text
161
+ }]
162
+ }, {
163
+ at: [].concat(_toConsumableArray(currentCellPath), [0])
164
+ });
165
+ } else {
166
+ SfEditor.insertNodes(_this.editor, cell.children, {
167
+ at: [].concat(_toConsumableArray(currentCellPath), [0])
168
+ });
169
+ }
170
+
171
+ return false;
172
+ });
173
+ return false;
174
+ });
175
+ } else if (fragment[0].type === 'paragraph') {
176
+ SfEditor.insertFragment(_this.editor, fragment);
177
+ } else {
178
+ SfEditor.insertText(_this.editor, text.replace(/\r\n|\n/g, ' '));
179
+ }
180
+ } else {
181
+ fragment.forEach(function (node) {
182
+ if (node.type === 'paragraph') {
183
+ SfEditor.insertFragment(_this.editor, [node]); // if the element is node a paragraph, insert the text if the node is not 0
184
+ } else {
185
+ var nodeText = Node.text(node);
186
+
187
+ if (nodeText.length > 0) {
188
+ SfEditor.insertText(_this.editor, nodeText.replace(/\r\n|\n/g, ' '));
189
+ }
190
+ }
191
+ });
192
+ }
193
+ };
194
+
195
+ this.removeTable = function () {
196
+ var tableNode = SfEditor.match(_this.editor, _this.editor.selection, {
197
+ type: 'table'
198
+ });
199
+ var tablePath = tableNode[1];
200
+ var tableIndex = tablePath[tablePath.length - 1];
201
+ var tableParentPath = tablePath.slice(0, tablePath.length - 1);
202
+ var targetNodeIndex = tableIndex >= 1 ? tableIndex - 1 : 1;
203
+ var targteNodePath = [].concat(_toConsumableArray(tableParentPath), [targetNodeIndex]);
204
+ SfEditor.removeNodes(_this.editor, {
205
+ match: {
206
+ type: 'table'
207
+ }
208
+ }); // move selection to previous sibling or next sibling and collapse the selection
209
+
210
+ SfEditor.select(_this.editor, targteNodePath);
211
+ SfEditor.collapse(_this.editor, {
212
+ edge: 'end'
213
+ });
214
+ };
215
+
216
+ this.getTablePosition = function () {
217
+ var currentCell = SfEditor.match(_this.editor, _this.editor.selection, {
218
+ type: 'table_cell'
219
+ });
220
+ var currentCellPath = currentCell[1];
221
+ var currentTable = SfEditor.match(_this.editor, _this.editor.selection, {
222
+ type: 'table'
223
+ });
224
+ var tablePath = currentTable[1];
225
+ var rowPath = currentCellPath.slice(0, currentCellPath.length - 1);
226
+ var row = Node.get(_this.editor, rowPath);
227
+ var cell = currentCell[0];
228
+ var table = Node.get(_this.editor, tablePath);
229
+ return {
230
+ rowIndex: currentCellPath[currentCellPath.length - 2],
231
+ cellIndex: currentCellPath[currentCellPath.length - 1],
232
+ cellPath: currentCellPath,
233
+ rowPath: rowPath,
234
+ tablePath: tablePath,
235
+ row: row,
236
+ cell: cell,
237
+ table: table
238
+ };
239
+ };
240
+
241
+ this.insertRow = function () {
242
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'after';
243
+
244
+ var position = _this.getTablePosition();
245
+
246
+ var tablePath = position.tablePath;
247
+ var rowIndex = position.rowIndex;
248
+ var targetPath;
249
+
250
+ if (type === 'after') {
251
+ targetPath = [].concat(_toConsumableArray(tablePath), [rowIndex + 1]);
252
+ }
253
+
254
+ if (type === 'before') {
255
+ targetPath = [].concat(_toConsumableArray(tablePath), [rowIndex]);
256
+ }
257
+
258
+ var rowChildren = position.row.children.map(function (cell) {
259
+ return generateTableCell({
260
+ data: {
261
+ align: cell.data.align
262
+ }
263
+ });
264
+ });
265
+ SfEditor.insertNodes(_this.editor, generateTableRow({
266
+ children: rowChildren
267
+ }), {
268
+ at: targetPath
269
+ });
270
+ var focusPath = [].concat(_toConsumableArray(targetPath), [0]);
271
+ SfEditor.select(_this.editor, focusPath);
272
+ SfEditor.collapse(_this.editor, {
273
+ edge: 'end'
274
+ });
275
+ };
276
+
277
+ this.removeRow = function () {
278
+ var position = _this.getTablePosition();
279
+
280
+ var rowPath = position.rowPath,
281
+ table = position.table,
282
+ rowIndex = position.rowIndex,
283
+ tablePath = position.tablePath;
284
+ var targetPath;
285
+
286
+ if (table.children.length > 1) {
287
+ if (rowIndex === table.children.length - 1) {
288
+ targetPath = [].concat(_toConsumableArray(tablePath), [rowIndex - 1, 0, 0]);
289
+ } else {
290
+ targetPath = [].concat(_toConsumableArray(tablePath), [rowIndex, 0, 0]);
291
+ }
292
+
293
+ SfEditor.removeNodes(_this.editor, {
294
+ at: rowPath
295
+ });
296
+ SfEditor.select(_this.editor, targetPath);
297
+ SfEditor.collapse({
298
+ at: 'end'
299
+ });
300
+ } else {
301
+ _this.removeTable();
302
+ }
303
+ };
304
+
305
+ this.insertColumn = function () {
306
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'after';
307
+
308
+ var position = _this.getTablePosition();
309
+
310
+ var focusPath;
311
+ var table = position.table,
312
+ tablePath = position.tablePath,
313
+ cellIndex = position.cellIndex;
314
+
315
+ if (type === 'after') {
316
+ for (var index = 0; index < table.children.length; index++) {
317
+ var newCellPath = [].concat(_toConsumableArray(tablePath), [index, cellIndex + 1]);
318
+ SfEditor.insertNodes(_this.editor, generateTableCell({
319
+ data: {
320
+ align: 'left'
321
+ }
322
+ }), {
323
+ at: newCellPath
324
+ });
325
+ }
326
+
327
+ focusPath = [].concat(_toConsumableArray(tablePath), [0, cellIndex + 1]);
328
+ } else {
329
+ for (var _index = 0; _index < table.children.length; _index++) {
330
+ var _newCellPath = [].concat(_toConsumableArray(tablePath), [_index, cellIndex]);
331
+
332
+ SfEditor.insertNodes(_this.editor, generateTableCell({
333
+ data: {
334
+ align: 'left'
335
+ }
336
+ }), {
337
+ at: _newCellPath
338
+ });
339
+ }
340
+
341
+ focusPath = [].concat(_toConsumableArray(tablePath), [0, cellIndex]);
342
+ }
343
+
344
+ SfEditor.select(_this.editor, focusPath);
345
+ SfEditor.collapse(_this.editor, {
346
+ edge: 'end'
347
+ });
348
+ };
349
+
350
+ this.removeColumn = function () {
351
+ var position = _this.getTablePosition();
352
+
353
+ var table = position.table,
354
+ tablePath = position.tablePath,
355
+ cellIndex = position.cellIndex,
356
+ row = position.row;
357
+
358
+ if (row.children.length === 1) {
359
+ _this.removeTable();
360
+
361
+ return;
362
+ }
363
+
364
+ for (var index = 0; index < table.children.length; index++) {
365
+ var cellPath = [].concat(_toConsumableArray(tablePath), [index, cellIndex]);
366
+ SfEditor.removeNodes(_this.editor, {
367
+ at: cellPath
368
+ });
369
+ }
370
+
371
+ return;
372
+ };
373
+
374
+ this.setAlign = function (align) {
375
+ var position = _this.getTablePosition();
376
+
377
+ var table = position.table,
378
+ tablePath = position.tablePath,
379
+ cellIndex = position.cellIndex;
380
+
381
+ for (var index = 0; index < table.children.length; index++) {
382
+ var cellPath = [].concat(_toConsumableArray(tablePath), [index, cellIndex]);
383
+ SfEditor.setNodes(_this.editor, {
384
+ data: {
385
+ align: align
386
+ }
387
+ }, {
388
+ at: cellPath
389
+ });
390
+ }
391
+ };
392
+
393
+ this.exitTable = function () {
394
+ var tableNode = SfEditor.match(_this.editor, _this.editor.selection, {
395
+ type: 'table'
396
+ });
397
+ var tablePath = tableNode[1];
398
+ var tableIndex = tablePath[tablePath.length - 1];
399
+ var tableParentPath = tablePath.slice(0, tablePath.length - 1);
400
+ var newPath = [].concat(_toConsumableArray(tableParentPath), [tableIndex + 1]);
401
+ SfEditor.insertNodes(_this.editor, {
402
+ type: 'paragraph',
403
+ children: [{
404
+ text: ''
405
+ }]
406
+ }, {
407
+ at: newPath
408
+ });
409
+ SfEditor.select(_this.editor, newPath);
410
+ SfEditor.collapse({
411
+ at: 'end'
412
+ });
413
+ };
414
+
415
+ this.editor = _editor;
416
+ };
417
+
418
+ export default TableUtils;