@atlaskit/editor-plugin-table 15.4.2 → 15.4.4

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 (44) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/pm-plugins/analytics/plugin.js +8 -0
  3. package/dist/cjs/pm-plugins/decorations/plugin.js +6 -0
  4. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +9 -0
  5. package/dist/cjs/pm-plugins/handlers.js +8 -1
  6. package/dist/cjs/pm-plugins/main.js +23 -0
  7. package/dist/cjs/pm-plugins/safari-delete-composition-text-issue-workaround.js +8 -0
  8. package/dist/cjs/pm-plugins/table-analytics.js +7 -0
  9. package/dist/cjs/pm-plugins/table-local-id.js +17 -0
  10. package/dist/cjs/pm-plugins/table-resizing/plugin.js +4 -0
  11. package/dist/cjs/pm-plugins/table-size-selector.js +4 -0
  12. package/dist/cjs/pm-plugins/table-width-in-comment-fix.js +7 -0
  13. package/dist/cjs/pm-plugins/table-width.js +17 -0
  14. package/dist/cjs/pm-plugins/view-mode-sort/index.js +40 -0
  15. package/dist/cjs/tablePlugin.js +2 -0
  16. package/dist/es2019/pm-plugins/analytics/plugin.js +8 -0
  17. package/dist/es2019/pm-plugins/decorations/plugin.js +6 -0
  18. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +9 -0
  19. package/dist/es2019/pm-plugins/handlers.js +8 -1
  20. package/dist/es2019/pm-plugins/main.js +24 -0
  21. package/dist/es2019/pm-plugins/safari-delete-composition-text-issue-workaround.js +8 -0
  22. package/dist/es2019/pm-plugins/table-analytics.js +9 -0
  23. package/dist/es2019/pm-plugins/table-local-id.js +20 -0
  24. package/dist/es2019/pm-plugins/table-resizing/plugin.js +6 -0
  25. package/dist/es2019/pm-plugins/table-size-selector.js +4 -0
  26. package/dist/es2019/pm-plugins/table-width-in-comment-fix.js +10 -0
  27. package/dist/es2019/pm-plugins/table-width.js +19 -0
  28. package/dist/es2019/pm-plugins/view-mode-sort/index.js +42 -0
  29. package/dist/es2019/tablePlugin.js +2 -0
  30. package/dist/esm/pm-plugins/analytics/plugin.js +8 -0
  31. package/dist/esm/pm-plugins/decorations/plugin.js +6 -0
  32. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +9 -0
  33. package/dist/esm/pm-plugins/handlers.js +8 -1
  34. package/dist/esm/pm-plugins/main.js +23 -0
  35. package/dist/esm/pm-plugins/safari-delete-composition-text-issue-workaround.js +8 -0
  36. package/dist/esm/pm-plugins/table-analytics.js +7 -0
  37. package/dist/esm/pm-plugins/table-local-id.js +17 -0
  38. package/dist/esm/pm-plugins/table-resizing/plugin.js +4 -0
  39. package/dist/esm/pm-plugins/table-size-selector.js +4 -0
  40. package/dist/esm/pm-plugins/table-width-in-comment-fix.js +7 -0
  41. package/dist/esm/pm-plugins/table-width.js +17 -0
  42. package/dist/esm/pm-plugins/view-mode-sort/index.js +40 -0
  43. package/dist/esm/tablePlugin.js +2 -0
  44. package/package.json +6 -6
@@ -8,7 +8,11 @@ import { defaultState } from './types';
8
8
  export const createPlugin = (dispatch, dispatchAnalyticsEvent) => new SafePlugin({
9
9
  key: pluginKey,
10
10
  state: createPluginState(dispatch, defaultState),
11
+ // @ts-ignore - Workaround for help-center local consumption
12
+
11
13
  appendTransaction: (transactions, oldState, newState) => {
14
+ // @ts-ignore - Workaround for help-center local consumption
15
+
12
16
  const tr = transactions.find(tr => {
13
17
  var _tr$getMeta, _tr$getMeta$data, _tr$getMeta$data$curr;
14
18
  return (_tr$getMeta = tr.getMeta(pluginKey)) === null || _tr$getMeta === void 0 ? void 0 : (_tr$getMeta$data = _tr$getMeta.data) === null || _tr$getMeta$data === void 0 ? void 0 : (_tr$getMeta$data$curr = _tr$getMeta$data.currentActions) === null || _tr$getMeta$data$curr === void 0 ? void 0 : _tr$getMeta$data$curr.includes('pasted');
@@ -30,6 +34,8 @@ export const createPlugin = (dispatch, dispatchAnalyticsEvent) => new SafePlugin
30
34
  return undefined;
31
35
  },
32
36
  props: {
37
+ // @ts-ignore - Workaround for help-center local consumption
38
+
33
39
  handlePaste: ({
34
40
  state,
35
41
  dispatch
@@ -49,6 +55,8 @@ export const createPlugin = (dispatch, dispatchAnalyticsEvent) => new SafePlugin
49
55
  type
50
56
  }, 'pasted')(state, dispatch);
51
57
  },
58
+ // @ts-ignore - Workaround for help-center local consumption
59
+
52
60
  transformCopied: (slice, {
53
61
  state,
54
62
  dispatch
@@ -57,6 +57,8 @@ export const createPlugin = () => {
57
57
  return new SafePlugin({
58
58
  state: {
59
59
  init: () => DecorationSet.empty,
60
+ // @ts-ignore - Workaround for help-center local consumption
61
+
60
62
  apply: (tr, decorationSet, oldState, newState) => {
61
63
  let pluginState = decorationSet;
62
64
  // main table plugin --->
@@ -65,6 +67,8 @@ export const createPlugin = () => {
65
67
  pluginState = meta.data.decorationSet;
66
68
  }
67
69
  if (tr.docChanged || tr.selectionSet || tr.getMeta(tableWidthPluginKey)) {
70
+ // @ts-ignore - Workaround for help-center local consumption
71
+
68
72
  pluginState = pluginState.map(tr.mapping, tr.doc);
69
73
  return handleDocOrSelectionChanged(tr, pluginState, oldState, newState);
70
74
  }
@@ -73,6 +77,8 @@ export const createPlugin = () => {
73
77
  },
74
78
  key: pluginKey,
75
79
  props: {
80
+ // @ts-ignore - Workaround for help-center local consumption
81
+
76
82
  decorations: state => getDecorations(state)
77
83
  }
78
84
  });
@@ -240,6 +240,8 @@ export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled
240
240
  isKeyboardModeActive: false
241
241
  })),
242
242
  key: pluginKey,
243
+ // @ts-ignore - Workaround for help-center local consumption
244
+
243
245
  appendTransaction: (transactions, oldState, newState) => {
244
246
  const {
245
247
  targetCellPosition: oldTargetCellPosition
@@ -251,6 +253,9 @@ export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled
251
253
  isDragMenuOpen = false,
252
254
  dragMenuIndex
253
255
  } = getPluginState(newState);
256
+
257
+ // @ts-ignore - Workaround for help-center local consumption
258
+
254
259
  transactions.forEach(transaction => {
255
260
  if (transaction.getMeta('selectedRowViaKeyboard')) {
256
261
  const button = document.querySelector('#drag-handle-button-row');
@@ -301,12 +306,16 @@ export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled
301
306
  };
302
307
  },
303
308
  props: {
309
+ // @ts-ignore - Workaround for help-center local consumption
310
+
304
311
  decorations: state => {
305
312
  const {
306
313
  decorationSet
307
314
  } = getPluginState(state);
308
315
  return decorationSet;
309
316
  },
317
+ // @ts-ignore - Workaround for help-center local consumption
318
+
310
319
  handleKeyDown: (view, event) => {
311
320
  var _ref;
312
321
  const {
@@ -11,7 +11,12 @@ import { pluginKey as tableResizingPluginKey } from './table-resizing/plugin-key
11
11
  import { isTableCollapsible } from './utils/collapse';
12
12
  import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled } from './utils/nodes';
13
13
  const nextTableSorting = (tr, table) => {
14
- const tableSortStep = tr.steps.find(step => step instanceof TableSortStep);
14
+ // @ts-ignore - Workaround for help-center local consumption
15
+
16
+ const tableSortStep = tr.steps.find(
17
+ // @ts-ignore - Workaround for help-center local consumption
18
+
19
+ step => step instanceof TableSortStep);
15
20
  return tableSortStep && table && table.pos === tableSortStep.pos ? tableSortStep.next : undefined;
16
21
  };
17
22
  const nextResizeHandleColumnIndex = (tr, resizeHandleColumnIndex) => {
@@ -105,6 +110,8 @@ const buildPluginState = builders => props => pluginState => {
105
110
  targetCellPosition: undefined
106
111
  } : pluginState;
107
112
  }
113
+ // @ts-ignore - Workaround for help-center local consumption
114
+
108
115
  return builders.reduce((_pluginState, transform) => transform(props)(_pluginState), pluginState);
109
116
  };
110
117
  export const handleDocOrSelectionChanged = (tr, pluginState) => buildPluginState([updateTargetCellPosition, updateTableNodePluginState, updateCollapseHandler])({
@@ -84,8 +84,12 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
84
84
  state: state,
85
85
  key: pluginKey,
86
86
  appendTransaction: (transactions, oldState, newState) => {
87
+ // @ts-ignore - Workaround for help-center local consumption
88
+
87
89
  const tr = transactions.find(tr => tr.getMeta('uiEvent') === 'cut');
88
90
  function reportInvalidTableCellSpanAttrs(invalidNodeAttr) {
91
+ // @ts-ignore - Workaround for help-center local consumption
92
+
89
93
  if (invalidTableIds.find(id => id === invalidNodeAttr.tableLocalId)) {
90
94
  return;
91
95
  }
@@ -110,6 +114,8 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
110
114
  const updatedTr = handleCut(tr, oldState, newState, pluginInjectionApi, editorAnalyticsAPI, editorViewRef || undefined, isTableScalingEnabled, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent);
111
115
  return fixTables(updatedTr) || updatedTr;
112
116
  }
117
+ // @ts-ignore - Workaround for help-center local consumption
118
+
113
119
  if (transactions.find(tr => tr.docChanged)) {
114
120
  return fixTables(newState.tr, reportInvalidTableCellSpanAttrs);
115
121
  }
@@ -184,6 +190,8 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
184
190
  };
185
191
  },
186
192
  props: {
193
+ // @ts-ignore - Workaround for help-center local consumption
194
+
187
195
  transformPasted(slice) {
188
196
  const editorState = getCurrentEditorState();
189
197
  if (!editorState) {
@@ -243,6 +251,8 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
243
251
  }
244
252
  return slice;
245
253
  },
254
+ // @ts-ignore - Workaround for help-center local consumption
255
+
246
256
  handleClick: ({
247
257
  state,
248
258
  dispatch
@@ -276,6 +286,8 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
276
286
  const maybeTr = closestElement(domRef, 'tr');
277
287
  return maybeTr ? maybeTr.classList.contains('sticky') : false;
278
288
  },
289
+ // @ts-ignore - Workaround for help-center local consumption
290
+
279
291
  handleTextInput: (view, _from, _to, text) => {
280
292
  const {
281
293
  state,
@@ -299,14 +311,26 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
299
311
  return false;
300
312
  },
301
313
  nodeViews,
314
+ // @ts-ignore - Workaround for help-center local consumption
315
+
302
316
  handleDOMEvents: {
317
+ // @ts-ignore - Workaround for help-center local consumption
318
+
303
319
  focus: handleFocus,
320
+ // @ts-ignore - Workaround for help-center local consumption
321
+
304
322
  blur: handleBlur,
323
+ // @ts-ignore - Workaround for help-center local consumption
324
+
305
325
  mousedown: withCellTracking(handleMouseDown),
306
326
  mouseleave: handleMouseLeave,
307
327
  mousemove: whenTableInFocus(handleMouseMove(nodeViewPortalProviderAPI), pluginInjectionApi),
308
328
  mouseenter: handleMouseEnter,
329
+ // @ts-ignore - Workaround for help-center local consumption
330
+
309
331
  mouseup: whenTableInFocus(handleMouseUp),
332
+ // @ts-ignore - Workaround for help-center local consumption
333
+
310
334
  click: withCellTracking(whenTableInFocus(handleClick))
311
335
  },
312
336
  handleTripleClick
@@ -15,6 +15,8 @@ export const createPlugin = () => {
15
15
  renderSpan: false,
16
16
  decorations: DecorationSet.empty
17
17
  }),
18
+ // @ts-ignore - Workaround for help-center local consumption
19
+
18
20
  apply: (tr, value) => {
19
21
  const renderSpan = tr.getMeta(tableSafariDeleteCompositionTextIssueWorkaroundKey);
20
22
  if (typeof renderSpan === 'undefined') {
@@ -42,11 +44,17 @@ export const createPlugin = () => {
42
44
  }
43
45
  },
44
46
  props: {
47
+ // @ts-ignore - Workaround for help-center local consumption
48
+
45
49
  decorations: state => {
46
50
  var _tableSafariDeleteCom;
47
51
  return (_tableSafariDeleteCom = tableSafariDeleteCompositionTextIssueWorkaroundKey.getState(state)) === null || _tableSafariDeleteCom === void 0 ? void 0 : _tableSafariDeleteCom.decorations;
48
52
  },
53
+ // @ts-ignore - Workaround for help-center local consumption
54
+
49
55
  handleDOMEvents: {
56
+ // @ts-ignore - Workaround for help-center local consumption
57
+
50
58
  beforeinput: (view, event) => {
51
59
  if ((event === null || event === void 0 ? void 0 : event.inputType) !== 'deleteCompositionText') {
52
60
  return false;
@@ -12,11 +12,15 @@ export const META_KEYS = {
12
12
  const createPlugin = (dispatch, dispatchAnalyticsEvent, tableResizingEnabled) => new SafePlugin({
13
13
  key: pluginKey,
14
14
  state: {
15
+ // @ts-ignore - Workaround for help-center local consumption
16
+
15
17
  init() {
16
18
  return {
17
19
  lastTrigger: undefined
18
20
  };
19
21
  },
22
+ // @ts-ignore - Workaround for help-center local consumption
23
+
20
24
  apply(tr, pluginState) {
21
25
  const meta = tr.getMeta(META_KEYS.OVERFLOW_TRIGGER);
22
26
  const newState = {
@@ -32,6 +36,8 @@ const createPlugin = (dispatch, dispatchAnalyticsEvent, tableResizingEnabled) =>
32
36
  return pluginState;
33
37
  }
34
38
  },
39
+ // @ts-ignore - Workaround for help-center local consumption
40
+
35
41
  appendTransaction: (transactions, oldState, newState) => {
36
42
  var _newPluginState$lastT;
37
43
  const newPluginState = pluginKey.getState(newState);
@@ -43,6 +49,9 @@ const createPlugin = (dispatch, dispatchAnalyticsEvent, tableResizingEnabled) =>
43
49
  // However, since there is still a chance that there are other triggers we didn't think of,
44
50
  // all these unknown triggers and viwport width change trigger are captured as EXTERNAL.
45
51
  TABLE_OVERFLOW_CHANGE_TRIGGER.EXTERNAL;
52
+
53
+ // @ts-ignore - Workaround for help-center local consumption
54
+
46
55
  transactions.forEach(tr => {
47
56
  const payload = tr.getMeta(META_KEYS.OVERFLOW_STATE_CHANGED);
48
57
  if (payload) {
@@ -24,15 +24,21 @@ const getPluginState = state => state && pluginKey.getState(state);
24
24
  const createPlugin = dispatch => new SafePlugin({
25
25
  key: pluginKey,
26
26
  state: {
27
+ // @ts-ignore - Workaround for help-center local consumption
28
+
27
29
  init() {
28
30
  return {
29
31
  parsedForLocalIds: false
30
32
  };
31
33
  },
34
+ // @ts-ignore - Workaround for help-center local consumption
35
+
32
36
  apply(tr, pluginState) {
33
37
  const meta = tr.getMeta(pluginKey);
34
38
  if (meta) {
35
39
  const keys = Object.keys(meta);
40
+ // @ts-ignore - Workaround for help-center local consumption
41
+
36
42
  const changed = keys.some(key => {
37
43
  return pluginState[key] !== meta[key];
38
44
  });
@@ -67,6 +73,8 @@ const createPlugin = dispatch => new SafePlugin({
67
73
  * add/dedupe the necessary IDs. But general usage of the editor
68
74
  * without collab should still solve for IDs.
69
75
  */
76
+ // @ts-ignore - Workaround for help-center local consumption
77
+
70
78
  update(editorView) {
71
79
  const {
72
80
  state
@@ -85,6 +93,8 @@ const createPlugin = dispatch => new SafePlugin({
85
93
  rafSchedule(() => {
86
94
  const tr = editorView.state.tr;
87
95
  let tableIdWasAdded = false;
96
+ // @ts-ignore - Workaround for help-center local consumption
97
+
88
98
  editorView.state.doc.descendants((node, pos) => {
89
99
  const isTable = node.type === table;
90
100
  const localId = node.attrs.localId;
@@ -113,6 +123,8 @@ const createPlugin = dispatch => new SafePlugin({
113
123
  }
114
124
  };
115
125
  },
126
+ // @ts-ignore - Workaround for help-center local consumption
127
+
116
128
  appendTransaction: (transactions, _oldState, newState) => {
117
129
  let modified = false;
118
130
  const tr = newState.tr;
@@ -122,6 +134,9 @@ const createPlugin = dispatch => new SafePlugin({
122
134
  const addedTableNodes = new Set();
123
135
  const addedTableNodePos = new Map();
124
136
  const localIds = new Set();
137
+
138
+ // @ts-ignore - Workaround for help-center local consumption
139
+
125
140
  transactions.forEach(transaction => {
126
141
  if (!transaction.docChanged) {
127
142
  return;
@@ -139,6 +154,9 @@ const createPlugin = dispatch => new SafePlugin({
139
154
  if (!stepHasSlice(step)) {
140
155
  continue;
141
156
  }
157
+
158
+ // @ts-ignore - Workaround for help-center local consumption
159
+
142
160
  step.slice.content.descendants(node => {
143
161
  if (node.type === table) {
144
162
  addedTableNodes.add(node);
@@ -152,6 +170,8 @@ const createPlugin = dispatch => new SafePlugin({
152
170
  }
153
171
 
154
172
  // Get the existing localIds on the page
173
+ // @ts-ignore - Workaround for help-center local consumption
174
+
155
175
  newState.doc.descendants((node, pos) => {
156
176
  // Skip if this is position of added table
157
177
  if (addedTableNodes.has(node)) {
@@ -19,6 +19,8 @@ export function createPlugin(dispatch, {
19
19
  lastClick: null
20
20
  }),
21
21
  props: {
22
+ // @ts-ignore - Workaround for help-center local consumption
23
+
22
24
  attributes(state) {
23
25
  const pluginState = getPluginState(state);
24
26
  return {
@@ -28,7 +30,11 @@ export function createPlugin(dispatch, {
28
30
  })
29
31
  };
30
32
  },
33
+ // @ts-ignore - Workaround for help-center local consumption
34
+
31
35
  handleDOMEvents: {
36
+ // @ts-ignore - Workaround for help-center local consumption
37
+
32
38
  mousedown(view, event) {
33
39
  const {
34
40
  state
@@ -8,10 +8,14 @@ export const createPlugin = dispatch => {
8
8
  init: () => ({
9
9
  isSelectorOpen: false
10
10
  }),
11
+ // @ts-ignore - Workaround for help-center local consumption
12
+
11
13
  apply: (tr, currentPluginState) => {
12
14
  const meta = tr.getMeta(pluginKey);
13
15
  if (meta) {
14
16
  const keys = Object.keys(meta);
17
+ // @ts-ignore - Workaround for help-center local consumption
18
+
15
19
  const changed = keys.some(key => {
16
20
  return currentPluginState[key] !== meta[key];
17
21
  });
@@ -22,15 +22,21 @@ const createPlugin = (dispatch, isTableAlignmentEnabled) => {
22
22
  return new SafePlugin({
23
23
  key: pluginKey,
24
24
  state: {
25
+ // @ts-ignore - Workaround for help-center local consumption
26
+
25
27
  init() {
26
28
  return {
27
29
  documentHasLoadedOnce: false
28
30
  };
29
31
  },
32
+ // @ts-ignore - Workaround for help-center local consumption
33
+
30
34
  apply(tr, pluginState) {
31
35
  const meta = tr.getMeta(pluginKey);
32
36
  if (meta) {
33
37
  const keys = Object.keys(meta);
38
+ // @ts-ignore - Workaround for help-center local consumption
39
+
34
40
  const changed = keys.some(key => {
35
41
  return pluginState[key] !== meta[key];
36
42
  });
@@ -48,6 +54,8 @@ const createPlugin = (dispatch, isTableAlignmentEnabled) => {
48
54
  },
49
55
  view: () => {
50
56
  return {
57
+ // @ts-ignore - Workaround for help-center local consumption
58
+
51
59
  update(editorView) {
52
60
  const {
53
61
  state
@@ -68,6 +76,8 @@ const createPlugin = (dispatch, isTableAlignmentEnabled) => {
68
76
  rafSchedule(() => {
69
77
  const tr = editorView.state.tr;
70
78
  let tableWidthAndLayoutUpdated = false;
79
+ // @ts-ignore - Workaround for help-center local consumption
80
+
71
81
  editorView.state.doc.descendants((node, pos) => {
72
82
  const isTable = node.type === table;
73
83
  const width = node.attrs.width;
@@ -17,6 +17,8 @@ const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, maxWid
17
17
  return new SafePlugin({
18
18
  key: pluginKey,
19
19
  state: {
20
+ // @ts-ignore - Workaround for help-center local consumption
21
+
20
22
  init() {
21
23
  return {
22
24
  resizing: false,
@@ -24,10 +26,14 @@ const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, maxWid
24
26
  tableRef: null
25
27
  };
26
28
  },
29
+ // @ts-ignore - Workaround for help-center local consumption
30
+
27
31
  apply(tr, pluginState) {
28
32
  const meta = tr.getMeta(pluginKey);
29
33
  if (meta) {
30
34
  const keys = Object.keys(meta);
35
+ // @ts-ignore - Workaround for help-center local consumption
36
+
31
37
  const changed = keys.some(key => {
32
38
  return pluginState[key] !== meta[key];
33
39
  });
@@ -43,12 +49,17 @@ const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, maxWid
43
49
  return pluginState;
44
50
  }
45
51
  },
52
+ // @ts-ignore - Workaround for help-center local consumption
53
+
46
54
  appendTransaction: (transactions, oldState, newState) => {
47
55
  // When document first load in Confluence, initially it is an empty document
48
56
  // and Collab service triggers a transaction to replace the empty document with the real document that should be rendered.
49
57
  // what we need to do is to add width attr to all tables in the real document
50
58
  // isReplaceDocumentOperation is checking if the transaction is the one that replace the empty document with the real document
51
59
  const isReplaceDocumentOperation = isReplaceDocOperation(transactions, oldState);
60
+
61
+ // @ts-ignore - Workaround for help-center local consumption
62
+
52
63
  const referentialityTr = transactions.find(tr => tr.getMeta('referentialityTableInserted'));
53
64
  const shouldPatchTableWidth = fullWidthEnabled && isTableScalingEnabled;
54
65
  const shouldPatchTableAlignment = fullWidthEnabled && isTableAlignmentEnabled;
@@ -60,6 +71,8 @@ const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, maxWid
60
71
  } = newState.schema.nodes;
61
72
  const tr = newState.tr;
62
73
  if (isReplaceDocumentOperation && !isCommentEditor) {
74
+ // @ts-ignore - Workaround for help-center local consumption
75
+
63
76
  newState.doc.forEach((node, offset) => {
64
77
  if (node.type === table) {
65
78
  const width = node.attrs.width;
@@ -100,8 +113,14 @@ const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, maxWid
100
113
  });
101
114
  }
102
115
  if (referentialityTr) {
116
+ // @ts-ignore - Workaround for help-center local consumption
117
+
103
118
  referentialityTr.steps.forEach(step => {
119
+ // @ts-ignore - Workaround for help-center local consumption
120
+
104
121
  step.getMap().forEach((_, __, newStart, newEnd) => {
122
+ // @ts-ignore - Workaround for help-center local consumption
123
+
105
124
  newState.doc.nodesBetween(newStart, newEnd, (node, pos) => {
106
125
  if (node.type === table) {
107
126
  if (shouldPatchTableWidth && node.attrs.width !== expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH) {
@@ -25,6 +25,8 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
25
25
  sort: {},
26
26
  allTables: []
27
27
  }),
28
+ // @ts-ignore - Workaround for help-center local consumption
29
+
28
30
  apply(tr, pluginState, oldState) {
29
31
  var _api$editorViewMode;
30
32
  // TODO: ED-26961 - move this mode check to plugin creation if possible. Right now it's here because the initial state
@@ -34,6 +36,8 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
34
36
  } = ((_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.sharedState.currentState()) || {};
35
37
  if (mode !== 'view') {
36
38
  var _pluginState$decorati, _pluginState$decorati2;
39
+ // @ts-ignore - Workaround for help-center local consumption
40
+
37
41
  const sortingDecorations = pluginState === null || pluginState === void 0 ? void 0 : (_pluginState$decorati = pluginState.decorations) === null || _pluginState$decorati === void 0 ? void 0 : _pluginState$decorati.find(undefined, undefined, s => (s === null || s === void 0 ? void 0 : s.type) === 'sorting-decoration');
38
42
  return {
39
43
  ...pluginState,
@@ -52,6 +56,8 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
52
56
 
53
57
  // Remove the table from the state
54
58
  if (removeTableMeta) {
59
+ // @ts-ignore - Workaround for help-center local consumption
60
+
55
61
  allTables = allTables.filter(([id]) => id !== removeTableMeta);
56
62
  } else {
57
63
  tableId = hoverTableMeta === null || hoverTableMeta === void 0 ? void 0 : hoverTableMeta[0];
@@ -60,10 +66,15 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
60
66
  ...sort,
61
67
  ...sortMeta
62
68
  };
69
+
70
+ // @ts-ignore - Workaround for help-center local consumption
71
+
63
72
  const isTableInState = allTables.some(([id]) => id === tableId);
64
73
 
65
74
  // Update the table in the state
66
75
  if (hoverTableMeta) {
76
+ // @ts-ignore - Workaround for help-center local consumption
77
+
67
78
  allTables = allTables.filter(([id]) => id !== hoverTableMeta[0]);
68
79
  allTables.push(hoverTableMeta);
69
80
  }
@@ -72,18 +83,27 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
72
83
  * Create decorations for the sorting icons
73
84
  */
74
85
  const decs = [];
86
+
87
+ // @ts-ignore - Workaround for help-center local consumption
88
+
75
89
  const sortingDecorations = pluginState.decorations.find(undefined, undefined, spec => spec.tableId === tableId && spec.type === 'sorting-decoration');
76
90
 
77
91
  // TODO: ED-26961 - add support for keyboard only users
78
92
  if (hoverTableMeta && !isTableInState || sortMeta || isTableInState && !sortingDecorations.length) {
93
+ // @ts-ignore - Workaround for help-center local consumption
94
+
79
95
  allTables.forEach(table => {
80
96
  const [tableId, _node, pos] = table;
97
+ // @ts-ignore - Workaround for help-center local consumption
98
+
81
99
  const tableNode = tr.doc.nodeAt(tr.mapping.map(pos));
82
100
  if (!tableNode || tableNode.type.name !== 'table') {
83
101
  return pluginState;
84
102
  }
85
103
  const map = TableMap.get(tableNode);
86
104
  const hasMergedCells = new Set(map.map).size !== map.map.length;
105
+ // @ts-ignore - Workaround for help-center local consumption
106
+
87
107
  map.mapByRow[0].forEach((cell, index) => {
88
108
  // eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
89
109
  const decorationRenderKey = uuid();
@@ -131,8 +151,14 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
131
151
  * Map the decorations to the new document if there are changes
132
152
  */
133
153
  if (tr.docChanged) {
154
+ // @ts-ignore - Workaround for help-center local consumption
155
+
134
156
  decorations = decorations.map(tr.mapping, tr.doc);
157
+ // @ts-ignore - Workaround for help-center local consumption
158
+
135
159
  allTables = allTables.map(table => {
160
+ // @ts-ignore - Workaround for help-center local consumption
161
+
136
162
  return [table[0], table[1], tr.mapping.map(table[2])];
137
163
  });
138
164
  }
@@ -144,6 +170,8 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
144
170
  }
145
171
  },
146
172
  key,
173
+ // @ts-ignore - Workaround for help-center local consumption
174
+
147
175
  appendTransaction: (trs, oldState, newState) => {
148
176
  var _api$editorViewMode2, _key$getState;
149
177
  // return newState.tr;
@@ -162,6 +190,8 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
162
190
  for (const tr of trs) {
163
191
  const hoverTableMeta = tr.getMeta('mouseEnterTable');
164
192
  if (hoverTableMeta) {
193
+ // @ts-ignore - Workaround for help-center local consumption
194
+
165
195
  allTables = allTables.filter(([id]) => id !== hoverTableMeta[0]);
166
196
  allTables.push(hoverTableMeta);
167
197
  }
@@ -199,6 +229,8 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
199
229
  return newtr;
200
230
  }
201
231
  const sortedOrder = [...oldOrder].sort((a, b) => a.value - b.value);
232
+ // @ts-ignore - Workaround for help-center local consumption
233
+
202
234
  sortedOrder.forEach((index, i) => {
203
235
  tbody.appendChild(rows[index.index + 1]);
204
236
  });
@@ -223,6 +255,8 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
223
255
  tbody
224
256
  } = getTableElements(tableId);
225
257
  if (rows && newOrder) {
258
+ // @ts-ignore - Workaround for help-center local consumption
259
+
226
260
  newOrder.forEach((index, i) => {
227
261
  tbody === null || tbody === void 0 ? void 0 : tbody.appendChild(rows[index.value + 1]);
228
262
  });
@@ -234,7 +268,11 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
234
268
  return newState.tr;
235
269
  },
236
270
  props: {
271
+ // @ts-ignore - Workaround for help-center local consumption
272
+
237
273
  handleDOMEvents: {
274
+ // @ts-ignore - Workaround for help-center local consumption
275
+
238
276
  keydown: (view, event) => {
239
277
  // TODO: ED-26961 - fix the focus issue here, where toggling sort with a keypress loses focus
240
278
  if (event.key === 'Enter' || event.key === ' ') {
@@ -243,12 +281,16 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
243
281
  toggleSort(view, event, pluginState);
244
282
  }
245
283
  },
284
+ // @ts-ignore - Workaround for help-center local consumption
285
+
246
286
  click: (view, event) => {
247
287
  var _key$getState3;
248
288
  const pluginState = ((_key$getState3 = key.getState(view.state)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.sort) || {};
249
289
  toggleSort(view, event, pluginState);
250
290
  }
251
291
  },
292
+ // @ts-ignore - Workaround for help-center local consumption
293
+
252
294
  decorations(state) {
253
295
  var _key$getState4;
254
296
  const decs = ((_key$getState4 = key.getState(state)) === null || _key$getState4 === void 0 ? void 0 : _key$getState4.decorations) || DecorationSet.empty;
@@ -412,6 +412,8 @@ const tablePlugin = ({
412
412
  dispatchAnalyticsEvent
413
413
  }) => {
414
414
  return new SafePlugin({
415
+ // @ts-ignore - Workaround for help-center local consumption
416
+
415
417
  view: editorView => {
416
418
  editorViewRef.current = editorView;
417
419
  let setTimeoutID;
@@ -9,7 +9,11 @@ export var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent
9
9
  return new SafePlugin({
10
10
  key: pluginKey,
11
11
  state: createPluginState(dispatch, defaultState),
12
+ // @ts-ignore - Workaround for help-center local consumption
13
+
12
14
  appendTransaction: function appendTransaction(transactions, oldState, newState) {
15
+ // @ts-ignore - Workaround for help-center local consumption
16
+
13
17
  var tr = transactions.find(function (tr) {
14
18
  var _tr$getMeta;
15
19
  return (_tr$getMeta = tr.getMeta(pluginKey)) === null || _tr$getMeta === void 0 || (_tr$getMeta = _tr$getMeta.data) === null || _tr$getMeta === void 0 || (_tr$getMeta = _tr$getMeta.currentActions) === null || _tr$getMeta === void 0 ? void 0 : _tr$getMeta.includes('pasted');
@@ -31,6 +35,8 @@ export var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent
31
35
  return undefined;
32
36
  },
33
37
  props: {
38
+ // @ts-ignore - Workaround for help-center local consumption
39
+
34
40
  handlePaste: function handlePaste(_ref, event, slice) {
35
41
  var state = _ref.state,
36
42
  dispatch = _ref.dispatch;
@@ -47,6 +53,8 @@ export var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent
47
53
  type: type
48
54
  }, 'pasted')(state, dispatch);
49
55
  },
56
+ // @ts-ignore - Workaround for help-center local consumption
57
+
50
58
  transformCopied: function transformCopied(slice, _ref2) {
51
59
  var state = _ref2.state,
52
60
  dispatch = _ref2.dispatch;