@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.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/pm-plugins/analytics/plugin.js +8 -0
- package/dist/cjs/pm-plugins/decorations/plugin.js +6 -0
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +9 -0
- package/dist/cjs/pm-plugins/handlers.js +8 -1
- package/dist/cjs/pm-plugins/main.js +23 -0
- package/dist/cjs/pm-plugins/safari-delete-composition-text-issue-workaround.js +8 -0
- package/dist/cjs/pm-plugins/table-analytics.js +7 -0
- package/dist/cjs/pm-plugins/table-local-id.js +17 -0
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +4 -0
- package/dist/cjs/pm-plugins/table-size-selector.js +4 -0
- package/dist/cjs/pm-plugins/table-width-in-comment-fix.js +7 -0
- package/dist/cjs/pm-plugins/table-width.js +17 -0
- package/dist/cjs/pm-plugins/view-mode-sort/index.js +40 -0
- package/dist/cjs/tablePlugin.js +2 -0
- package/dist/es2019/pm-plugins/analytics/plugin.js +8 -0
- package/dist/es2019/pm-plugins/decorations/plugin.js +6 -0
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +9 -0
- package/dist/es2019/pm-plugins/handlers.js +8 -1
- package/dist/es2019/pm-plugins/main.js +24 -0
- package/dist/es2019/pm-plugins/safari-delete-composition-text-issue-workaround.js +8 -0
- package/dist/es2019/pm-plugins/table-analytics.js +9 -0
- package/dist/es2019/pm-plugins/table-local-id.js +20 -0
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +6 -0
- package/dist/es2019/pm-plugins/table-size-selector.js +4 -0
- package/dist/es2019/pm-plugins/table-width-in-comment-fix.js +10 -0
- package/dist/es2019/pm-plugins/table-width.js +19 -0
- package/dist/es2019/pm-plugins/view-mode-sort/index.js +42 -0
- package/dist/es2019/tablePlugin.js +2 -0
- package/dist/esm/pm-plugins/analytics/plugin.js +8 -0
- package/dist/esm/pm-plugins/decorations/plugin.js +6 -0
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +9 -0
- package/dist/esm/pm-plugins/handlers.js +8 -1
- package/dist/esm/pm-plugins/main.js +23 -0
- package/dist/esm/pm-plugins/safari-delete-composition-text-issue-workaround.js +8 -0
- package/dist/esm/pm-plugins/table-analytics.js +7 -0
- package/dist/esm/pm-plugins/table-local-id.js +17 -0
- package/dist/esm/pm-plugins/table-resizing/plugin.js +4 -0
- package/dist/esm/pm-plugins/table-size-selector.js +4 -0
- package/dist/esm/pm-plugins/table-width-in-comment-fix.js +7 -0
- package/dist/esm/pm-plugins/table-width.js +17 -0
- package/dist/esm/pm-plugins/view-mode-sort/index.js +40 -0
- package/dist/esm/tablePlugin.js +2 -0
- package/package.json +6 -6
|
@@ -61,6 +61,8 @@ export var createPlugin = function createPlugin() {
|
|
|
61
61
|
init: function init() {
|
|
62
62
|
return DecorationSet.empty;
|
|
63
63
|
},
|
|
64
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
65
|
+
|
|
64
66
|
apply: function apply(tr, decorationSet, oldState, newState) {
|
|
65
67
|
var pluginState = decorationSet;
|
|
66
68
|
// main table plugin --->
|
|
@@ -69,6 +71,8 @@ export var createPlugin = function createPlugin() {
|
|
|
69
71
|
pluginState = meta.data.decorationSet;
|
|
70
72
|
}
|
|
71
73
|
if (tr.docChanged || tr.selectionSet || tr.getMeta(tableWidthPluginKey)) {
|
|
74
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
75
|
+
|
|
72
76
|
pluginState = pluginState.map(tr.mapping, tr.doc);
|
|
73
77
|
return handleDocOrSelectionChanged(tr, pluginState, oldState, newState);
|
|
74
78
|
}
|
|
@@ -77,6 +81,8 @@ export var createPlugin = function createPlugin() {
|
|
|
77
81
|
},
|
|
78
82
|
key: pluginKey,
|
|
79
83
|
props: {
|
|
84
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
85
|
+
|
|
80
86
|
decorations: function decorations(state) {
|
|
81
87
|
return getDecorations(state);
|
|
82
88
|
}
|
|
@@ -232,6 +232,8 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
|
|
|
232
232
|
};
|
|
233
233
|
}),
|
|
234
234
|
key: pluginKey,
|
|
235
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
236
|
+
|
|
235
237
|
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
236
238
|
var _getTablePluginState4 = getTablePluginState(oldState),
|
|
237
239
|
oldTargetCellPosition = _getTablePluginState4.targetCellPosition;
|
|
@@ -241,6 +243,9 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
|
|
|
241
243
|
_getPluginState$isDra = _getPluginState.isDragMenuOpen,
|
|
242
244
|
isDragMenuOpen = _getPluginState$isDra === void 0 ? false : _getPluginState$isDra,
|
|
243
245
|
dragMenuIndex = _getPluginState.dragMenuIndex;
|
|
246
|
+
|
|
247
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
248
|
+
|
|
244
249
|
transactions.forEach(function (transaction) {
|
|
245
250
|
if (transaction.getMeta('selectedRowViaKeyboard')) {
|
|
246
251
|
var button = document.querySelector('#drag-handle-button-row');
|
|
@@ -291,11 +296,15 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
|
|
|
291
296
|
};
|
|
292
297
|
},
|
|
293
298
|
props: {
|
|
299
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
300
|
+
|
|
294
301
|
decorations: function decorations(state) {
|
|
295
302
|
var _getPluginState2 = getPluginState(state),
|
|
296
303
|
decorationSet = _getPluginState2.decorationSet;
|
|
297
304
|
return decorationSet;
|
|
298
305
|
},
|
|
306
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
307
|
+
|
|
299
308
|
handleKeyDown: function handleKeyDown(view, event) {
|
|
300
309
|
var _ref8;
|
|
301
310
|
var tr = view.state.tr;
|
|
@@ -14,7 +14,12 @@ import { pluginKey as tableResizingPluginKey } from './table-resizing/plugin-key
|
|
|
14
14
|
import { isTableCollapsible } from './utils/collapse';
|
|
15
15
|
import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled } from './utils/nodes';
|
|
16
16
|
var nextTableSorting = function nextTableSorting(tr, table) {
|
|
17
|
-
|
|
17
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
18
|
+
|
|
19
|
+
var tableSortStep = tr.steps.find(
|
|
20
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
21
|
+
|
|
22
|
+
function (step) {
|
|
18
23
|
return step instanceof TableSortStep;
|
|
19
24
|
});
|
|
20
25
|
return tableSortStep && table && table.pos === tableSortStep.pos ? tableSortStep.next : undefined;
|
|
@@ -108,6 +113,8 @@ var buildPluginState = function buildPluginState(builders) {
|
|
|
108
113
|
targetCellPosition: undefined
|
|
109
114
|
}) : pluginState;
|
|
110
115
|
}
|
|
116
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
117
|
+
|
|
111
118
|
return builders.reduce(function (_pluginState, transform) {
|
|
112
119
|
return transform(props)(_pluginState);
|
|
113
120
|
}, pluginState);
|
|
@@ -86,10 +86,14 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
86
86
|
state: state,
|
|
87
87
|
key: pluginKey,
|
|
88
88
|
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
89
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
90
|
+
|
|
89
91
|
var tr = transactions.find(function (tr) {
|
|
90
92
|
return tr.getMeta('uiEvent') === 'cut';
|
|
91
93
|
});
|
|
92
94
|
function reportInvalidTableCellSpanAttrs(invalidNodeAttr) {
|
|
95
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
96
|
+
|
|
93
97
|
if (invalidTableIds.find(function (id) {
|
|
94
98
|
return id === invalidNodeAttr.tableLocalId;
|
|
95
99
|
})) {
|
|
@@ -116,6 +120,8 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
116
120
|
var updatedTr = handleCut(tr, oldState, newState, pluginInjectionApi, editorAnalyticsAPI, editorViewRef || undefined, isTableScalingEnabled, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent);
|
|
117
121
|
return fixTables(updatedTr) || updatedTr;
|
|
118
122
|
}
|
|
123
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
124
|
+
|
|
119
125
|
if (transactions.find(function (tr) {
|
|
120
126
|
return tr.docChanged;
|
|
121
127
|
})) {
|
|
@@ -187,6 +193,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
187
193
|
};
|
|
188
194
|
},
|
|
189
195
|
props: {
|
|
196
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
190
197
|
transformPasted: function transformPasted(slice) {
|
|
191
198
|
var editorState = getCurrentEditorState();
|
|
192
199
|
if (!editorState) {
|
|
@@ -244,6 +251,8 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
244
251
|
}
|
|
245
252
|
return slice;
|
|
246
253
|
},
|
|
254
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
255
|
+
|
|
247
256
|
handleClick: function handleClick(_ref2, _pos, event) {
|
|
248
257
|
var state = _ref2.state,
|
|
249
258
|
dispatch = _ref2.dispatch;
|
|
@@ -274,6 +283,8 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
274
283
|
var maybeTr = closestElement(domRef, 'tr');
|
|
275
284
|
return maybeTr ? maybeTr.classList.contains('sticky') : false;
|
|
276
285
|
},
|
|
286
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
287
|
+
|
|
277
288
|
handleTextInput: function handleTextInput(view, _from, _to, text) {
|
|
278
289
|
var state = view.state,
|
|
279
290
|
dispatch = view.dispatch;
|
|
@@ -294,14 +305,26 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
294
305
|
return false;
|
|
295
306
|
},
|
|
296
307
|
nodeViews: nodeViews,
|
|
308
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
309
|
+
|
|
297
310
|
handleDOMEvents: {
|
|
311
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
312
|
+
|
|
298
313
|
focus: handleFocus,
|
|
314
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
315
|
+
|
|
299
316
|
blur: handleBlur,
|
|
317
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
318
|
+
|
|
300
319
|
mousedown: withCellTracking(handleMouseDown),
|
|
301
320
|
mouseleave: handleMouseLeave,
|
|
302
321
|
mousemove: whenTableInFocus(handleMouseMove(nodeViewPortalProviderAPI), pluginInjectionApi),
|
|
303
322
|
mouseenter: handleMouseEnter,
|
|
323
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
324
|
+
|
|
304
325
|
mouseup: whenTableInFocus(handleMouseUp),
|
|
326
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
327
|
+
|
|
305
328
|
click: withCellTracking(whenTableInFocus(handleClick))
|
|
306
329
|
},
|
|
307
330
|
handleTripleClick: handleTripleClick
|
|
@@ -17,6 +17,8 @@ export var createPlugin = function createPlugin() {
|
|
|
17
17
|
decorations: DecorationSet.empty
|
|
18
18
|
};
|
|
19
19
|
},
|
|
20
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
21
|
+
|
|
20
22
|
apply: function apply(tr, value) {
|
|
21
23
|
var renderSpan = tr.getMeta(tableSafariDeleteCompositionTextIssueWorkaroundKey);
|
|
22
24
|
if (typeof renderSpan === 'undefined') {
|
|
@@ -42,11 +44,17 @@ export var createPlugin = function createPlugin() {
|
|
|
42
44
|
}
|
|
43
45
|
},
|
|
44
46
|
props: {
|
|
47
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
48
|
+
|
|
45
49
|
decorations: function 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: function beforeinput(view, event) {
|
|
51
59
|
if ((event === null || event === void 0 ? void 0 : event.inputType) !== 'deleteCompositionText') {
|
|
52
60
|
return false;
|
|
@@ -16,11 +16,13 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, table
|
|
|
16
16
|
return new SafePlugin({
|
|
17
17
|
key: pluginKey,
|
|
18
18
|
state: {
|
|
19
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
19
20
|
init: function init() {
|
|
20
21
|
return {
|
|
21
22
|
lastTrigger: undefined
|
|
22
23
|
};
|
|
23
24
|
},
|
|
25
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
24
26
|
apply: function apply(tr, pluginState) {
|
|
25
27
|
var meta = tr.getMeta(META_KEYS.OVERFLOW_TRIGGER);
|
|
26
28
|
var newState = _objectSpread({}, pluginState);
|
|
@@ -32,6 +34,8 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, table
|
|
|
32
34
|
return pluginState;
|
|
33
35
|
}
|
|
34
36
|
},
|
|
37
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
38
|
+
|
|
35
39
|
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
36
40
|
var _newPluginState$lastT;
|
|
37
41
|
var newPluginState = pluginKey.getState(newState);
|
|
@@ -43,6 +47,9 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, table
|
|
|
43
47
|
// However, since there is still a chance that there are other triggers we didn't think of,
|
|
44
48
|
// all these unknown triggers and viwport width change trigger are captured as EXTERNAL.
|
|
45
49
|
TABLE_OVERFLOW_CHANGE_TRIGGER.EXTERNAL;
|
|
50
|
+
|
|
51
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
52
|
+
|
|
46
53
|
transactions.forEach(function (tr) {
|
|
47
54
|
var payload = tr.getMeta(META_KEYS.OVERFLOW_STATE_CHANGED);
|
|
48
55
|
if (payload) {
|
|
@@ -33,15 +33,19 @@ var createPlugin = function createPlugin(dispatch) {
|
|
|
33
33
|
return new SafePlugin({
|
|
34
34
|
key: pluginKey,
|
|
35
35
|
state: {
|
|
36
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
36
37
|
init: function init() {
|
|
37
38
|
return {
|
|
38
39
|
parsedForLocalIds: false
|
|
39
40
|
};
|
|
40
41
|
},
|
|
42
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
41
43
|
apply: function apply(tr, pluginState) {
|
|
42
44
|
var meta = tr.getMeta(pluginKey);
|
|
43
45
|
if (meta) {
|
|
44
46
|
var keys = Object.keys(meta);
|
|
47
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
48
|
+
|
|
45
49
|
var changed = keys.some(function (key) {
|
|
46
50
|
return pluginState[key] !== meta[key];
|
|
47
51
|
});
|
|
@@ -73,6 +77,7 @@ var createPlugin = function createPlugin(dispatch) {
|
|
|
73
77
|
* add/dedupe the necessary IDs. But general usage of the editor
|
|
74
78
|
* without collab should still solve for IDs.
|
|
75
79
|
*/
|
|
80
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
76
81
|
update: function update(editorView) {
|
|
77
82
|
var state = editorView.state;
|
|
78
83
|
var pluginState = getPluginState(state);
|
|
@@ -87,6 +92,8 @@ var createPlugin = function createPlugin(dispatch) {
|
|
|
87
92
|
rafSchedule(function () {
|
|
88
93
|
var tr = editorView.state.tr;
|
|
89
94
|
var tableIdWasAdded = false;
|
|
95
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
96
|
+
|
|
90
97
|
editorView.state.doc.descendants(function (node, pos) {
|
|
91
98
|
var isTable = node.type === table;
|
|
92
99
|
var localId = node.attrs.localId;
|
|
@@ -114,6 +121,8 @@ var createPlugin = function createPlugin(dispatch) {
|
|
|
114
121
|
}
|
|
115
122
|
};
|
|
116
123
|
},
|
|
124
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
125
|
+
|
|
117
126
|
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
118
127
|
var modified = false;
|
|
119
128
|
var tr = newState.tr;
|
|
@@ -121,6 +130,9 @@ var createPlugin = function createPlugin(dispatch) {
|
|
|
121
130
|
var addedTableNodes = new Set();
|
|
122
131
|
var addedTableNodePos = new Map();
|
|
123
132
|
var localIds = new Set();
|
|
133
|
+
|
|
134
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
135
|
+
|
|
124
136
|
transactions.forEach(function (transaction) {
|
|
125
137
|
if (!transaction.docChanged) {
|
|
126
138
|
return;
|
|
@@ -142,6 +154,9 @@ var createPlugin = function createPlugin(dispatch) {
|
|
|
142
154
|
if (!stepHasSlice(step)) {
|
|
143
155
|
continue;
|
|
144
156
|
}
|
|
157
|
+
|
|
158
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
159
|
+
|
|
145
160
|
step.slice.content.descendants(function (node) {
|
|
146
161
|
if (node.type === table) {
|
|
147
162
|
addedTableNodes.add(node);
|
|
@@ -160,6 +175,8 @@ var createPlugin = function createPlugin(dispatch) {
|
|
|
160
175
|
}
|
|
161
176
|
|
|
162
177
|
// Get the existing localIds on the page
|
|
178
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
179
|
+
|
|
163
180
|
newState.doc.descendants(function (node, pos) {
|
|
164
181
|
// Skip if this is position of added table
|
|
165
182
|
if (addedTableNodes.has(node)) {
|
|
@@ -20,13 +20,17 @@ export function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorF
|
|
|
20
20
|
lastClick: null
|
|
21
21
|
}),
|
|
22
22
|
props: {
|
|
23
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
23
24
|
attributes: function attributes(state) {
|
|
24
25
|
var pluginState = getPluginState(state);
|
|
25
26
|
return {
|
|
26
27
|
class: classnames(_defineProperty(_defineProperty({}, ClassName.RESIZE_CURSOR, pluginState.resizeHandlePos !== null), ClassName.IS_RESIZING, !!pluginState.dragging))
|
|
27
28
|
};
|
|
28
29
|
},
|
|
30
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
31
|
+
|
|
29
32
|
handleDOMEvents: {
|
|
33
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
30
34
|
mousedown: function mousedown(view, event) {
|
|
31
35
|
var state = view.state;
|
|
32
36
|
var resizeHandlePos =
|
|
@@ -13,10 +13,14 @@ export var createPlugin = function createPlugin(dispatch) {
|
|
|
13
13
|
isSelectorOpen: false
|
|
14
14
|
};
|
|
15
15
|
},
|
|
16
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
17
|
+
|
|
16
18
|
apply: function apply(tr, currentPluginState) {
|
|
17
19
|
var meta = tr.getMeta(pluginKey);
|
|
18
20
|
if (meta) {
|
|
19
21
|
var keys = Object.keys(meta);
|
|
22
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
23
|
+
|
|
20
24
|
var changed = keys.some(function (key) {
|
|
21
25
|
return currentPluginState[key] !== meta[key];
|
|
22
26
|
});
|
|
@@ -27,15 +27,19 @@ var createPlugin = function createPlugin(dispatch, isTableAlignmentEnabled) {
|
|
|
27
27
|
return new SafePlugin({
|
|
28
28
|
key: pluginKey,
|
|
29
29
|
state: {
|
|
30
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
30
31
|
init: function init() {
|
|
31
32
|
return {
|
|
32
33
|
documentHasLoadedOnce: false
|
|
33
34
|
};
|
|
34
35
|
},
|
|
36
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
35
37
|
apply: function apply(tr, pluginState) {
|
|
36
38
|
var meta = tr.getMeta(pluginKey);
|
|
37
39
|
if (meta) {
|
|
38
40
|
var keys = Object.keys(meta);
|
|
41
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
42
|
+
|
|
39
43
|
var changed = keys.some(function (key) {
|
|
40
44
|
return pluginState[key] !== meta[key];
|
|
41
45
|
});
|
|
@@ -50,6 +54,7 @@ var createPlugin = function createPlugin(dispatch, isTableAlignmentEnabled) {
|
|
|
50
54
|
},
|
|
51
55
|
view: function view() {
|
|
52
56
|
return {
|
|
57
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
53
58
|
update: function update(editorView) {
|
|
54
59
|
var state = editorView.state;
|
|
55
60
|
var pluginState = getPluginState(state);
|
|
@@ -64,6 +69,8 @@ var createPlugin = function createPlugin(dispatch, isTableAlignmentEnabled) {
|
|
|
64
69
|
rafSchedule(function () {
|
|
65
70
|
var tr = editorView.state.tr;
|
|
66
71
|
var tableWidthAndLayoutUpdated = false;
|
|
72
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
73
|
+
|
|
67
74
|
editorView.state.doc.descendants(function (node, pos) {
|
|
68
75
|
var isTable = node.type === table;
|
|
69
76
|
var width = node.attrs.width;
|
|
@@ -22,6 +22,7 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
22
22
|
return new SafePlugin({
|
|
23
23
|
key: pluginKey,
|
|
24
24
|
state: {
|
|
25
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
25
26
|
init: function init() {
|
|
26
27
|
return {
|
|
27
28
|
resizing: false,
|
|
@@ -29,10 +30,13 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
29
30
|
tableRef: null
|
|
30
31
|
};
|
|
31
32
|
},
|
|
33
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
32
34
|
apply: function apply(tr, pluginState) {
|
|
33
35
|
var meta = tr.getMeta(pluginKey);
|
|
34
36
|
if (meta) {
|
|
35
37
|
var keys = Object.keys(meta);
|
|
38
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
39
|
+
|
|
36
40
|
var changed = keys.some(function (key) {
|
|
37
41
|
return pluginState[key] !== meta[key];
|
|
38
42
|
});
|
|
@@ -45,12 +49,17 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
45
49
|
return pluginState;
|
|
46
50
|
}
|
|
47
51
|
},
|
|
52
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
53
|
+
|
|
48
54
|
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
49
55
|
// When document first load in Confluence, initially it is an empty document
|
|
50
56
|
// and Collab service triggers a transaction to replace the empty document with the real document that should be rendered.
|
|
51
57
|
// what we need to do is to add width attr to all tables in the real document
|
|
52
58
|
// isReplaceDocumentOperation is checking if the transaction is the one that replace the empty document with the real document
|
|
53
59
|
var isReplaceDocumentOperation = isReplaceDocOperation(transactions, oldState);
|
|
60
|
+
|
|
61
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
62
|
+
|
|
54
63
|
var referentialityTr = transactions.find(function (tr) {
|
|
55
64
|
return tr.getMeta('referentialityTableInserted');
|
|
56
65
|
});
|
|
@@ -62,6 +71,8 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
62
71
|
var table = newState.schema.nodes.table;
|
|
63
72
|
var tr = newState.tr;
|
|
64
73
|
if (isReplaceDocumentOperation && !isCommentEditor) {
|
|
74
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
75
|
+
|
|
65
76
|
newState.doc.forEach(function (node, offset) {
|
|
66
77
|
if (node.type === table) {
|
|
67
78
|
var width = node.attrs.width;
|
|
@@ -100,8 +111,14 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
100
111
|
});
|
|
101
112
|
}
|
|
102
113
|
if (referentialityTr) {
|
|
114
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
115
|
+
|
|
103
116
|
referentialityTr.steps.forEach(function (step) {
|
|
117
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
118
|
+
|
|
104
119
|
step.getMap().forEach(function (_, __, newStart, newEnd) {
|
|
120
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
121
|
+
|
|
105
122
|
newState.doc.nodesBetween(newStart, newEnd, function (node, pos) {
|
|
106
123
|
if (node.type === table) {
|
|
107
124
|
if (shouldPatchTableWidth && node.attrs.width !== expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH) {
|
|
@@ -35,6 +35,7 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
35
35
|
allTables: []
|
|
36
36
|
};
|
|
37
37
|
},
|
|
38
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
38
39
|
apply: function apply(tr, pluginState, oldState) {
|
|
39
40
|
var _api$editorViewMode;
|
|
40
41
|
// TODO: ED-26961 - move this mode check to plugin creation if possible. Right now it's here because the initial state
|
|
@@ -43,6 +44,8 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
43
44
|
mode = _ref.mode;
|
|
44
45
|
if (mode !== 'view') {
|
|
45
46
|
var _pluginState$decorati, _pluginState$decorati2;
|
|
47
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
48
|
+
|
|
46
49
|
var _sortingDecorations = pluginState === null || pluginState === void 0 || (_pluginState$decorati = pluginState.decorations) === null || _pluginState$decorati === void 0 ? void 0 : _pluginState$decorati.find(undefined, undefined, function (s) {
|
|
47
50
|
return (s === null || s === void 0 ? void 0 : s.type) === 'sorting-decoration';
|
|
48
51
|
});
|
|
@@ -60,6 +63,8 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
60
63
|
|
|
61
64
|
// Remove the table from the state
|
|
62
65
|
if (removeTableMeta) {
|
|
66
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
67
|
+
|
|
63
68
|
allTables = allTables.filter(function (_ref2) {
|
|
64
69
|
var _ref3 = _slicedToArray(_ref2, 1),
|
|
65
70
|
id = _ref3[0];
|
|
@@ -69,6 +74,9 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
69
74
|
tableId = hoverTableMeta === null || hoverTableMeta === void 0 ? void 0 : hoverTableMeta[0];
|
|
70
75
|
}
|
|
71
76
|
sort = _objectSpread(_objectSpread({}, sort), sortMeta);
|
|
77
|
+
|
|
78
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
79
|
+
|
|
72
80
|
var isTableInState = allTables.some(function (_ref4) {
|
|
73
81
|
var _ref5 = _slicedToArray(_ref4, 1),
|
|
74
82
|
id = _ref5[0];
|
|
@@ -77,6 +85,8 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
77
85
|
|
|
78
86
|
// Update the table in the state
|
|
79
87
|
if (hoverTableMeta) {
|
|
88
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
89
|
+
|
|
80
90
|
allTables = allTables.filter(function (_ref6) {
|
|
81
91
|
var _ref7 = _slicedToArray(_ref6, 1),
|
|
82
92
|
id = _ref7[0];
|
|
@@ -89,23 +99,32 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
89
99
|
* Create decorations for the sorting icons
|
|
90
100
|
*/
|
|
91
101
|
var decs = [];
|
|
102
|
+
|
|
103
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
104
|
+
|
|
92
105
|
var sortingDecorations = pluginState.decorations.find(undefined, undefined, function (spec) {
|
|
93
106
|
return spec.tableId === tableId && spec.type === 'sorting-decoration';
|
|
94
107
|
});
|
|
95
108
|
|
|
96
109
|
// TODO: ED-26961 - add support for keyboard only users
|
|
97
110
|
if (hoverTableMeta && !isTableInState || sortMeta || isTableInState && !sortingDecorations.length) {
|
|
111
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
112
|
+
|
|
98
113
|
allTables.forEach(function (table) {
|
|
99
114
|
var _table = _slicedToArray(table, 3),
|
|
100
115
|
tableId = _table[0],
|
|
101
116
|
_node = _table[1],
|
|
102
117
|
pos = _table[2];
|
|
118
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
119
|
+
|
|
103
120
|
var tableNode = tr.doc.nodeAt(tr.mapping.map(pos));
|
|
104
121
|
if (!tableNode || tableNode.type.name !== 'table') {
|
|
105
122
|
return pluginState;
|
|
106
123
|
}
|
|
107
124
|
var map = TableMap.get(tableNode);
|
|
108
125
|
var hasMergedCells = new Set(map.map).size !== map.map.length;
|
|
126
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
127
|
+
|
|
109
128
|
map.mapByRow[0].forEach(function (cell, index) {
|
|
110
129
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
111
130
|
var decorationRenderKey = uuid();
|
|
@@ -154,8 +173,14 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
154
173
|
* Map the decorations to the new document if there are changes
|
|
155
174
|
*/
|
|
156
175
|
if (tr.docChanged) {
|
|
176
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
177
|
+
|
|
157
178
|
decorations = decorations.map(tr.mapping, tr.doc);
|
|
179
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
180
|
+
|
|
158
181
|
allTables = allTables.map(function (table) {
|
|
182
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
183
|
+
|
|
159
184
|
return [table[0], table[1], tr.mapping.map(table[2])];
|
|
160
185
|
});
|
|
161
186
|
}
|
|
@@ -167,6 +192,8 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
167
192
|
}
|
|
168
193
|
},
|
|
169
194
|
key: key,
|
|
195
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
196
|
+
|
|
170
197
|
appendTransaction: function appendTransaction(trs, oldState, newState) {
|
|
171
198
|
var _api$editorViewMode2, _key$getState;
|
|
172
199
|
// return newState.tr;
|
|
@@ -188,6 +215,8 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
188
215
|
var tr = _step.value;
|
|
189
216
|
var hoverTableMeta = tr.getMeta('mouseEnterTable');
|
|
190
217
|
if (hoverTableMeta) {
|
|
218
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
219
|
+
|
|
191
220
|
allTables = allTables.filter(function (_ref9) {
|
|
192
221
|
var _ref0 = _slicedToArray(_ref9, 1),
|
|
193
222
|
id = _ref0[0];
|
|
@@ -238,6 +267,8 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
238
267
|
var sortedOrder = _toConsumableArray(oldOrder).sort(function (a, b) {
|
|
239
268
|
return a.value - b.value;
|
|
240
269
|
});
|
|
270
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
271
|
+
|
|
241
272
|
sortedOrder.forEach(function (index, i) {
|
|
242
273
|
tbody.appendChild(rows[index.index + 1]);
|
|
243
274
|
});
|
|
@@ -264,6 +295,8 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
264
295
|
_rows = _getTableElements2.rows,
|
|
265
296
|
_tbody = _getTableElements2.tbody;
|
|
266
297
|
if (_rows && newOrder) {
|
|
298
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
299
|
+
|
|
267
300
|
newOrder.forEach(function (index, i) {
|
|
268
301
|
_tbody === null || _tbody === void 0 || _tbody.appendChild(_rows[index.value + 1]);
|
|
269
302
|
});
|
|
@@ -295,7 +328,11 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
295
328
|
return newState.tr;
|
|
296
329
|
},
|
|
297
330
|
props: {
|
|
331
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
332
|
+
|
|
298
333
|
handleDOMEvents: {
|
|
334
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
335
|
+
|
|
299
336
|
keydown: function keydown(view, event) {
|
|
300
337
|
// TODO: ED-26961 - fix the focus issue here, where toggling sort with a keypress loses focus
|
|
301
338
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
@@ -304,12 +341,15 @@ export var createPlugin = function createPlugin(api, nodeViewPortalProviderAPI)
|
|
|
304
341
|
toggleSort(view, event, pluginState);
|
|
305
342
|
}
|
|
306
343
|
},
|
|
344
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
345
|
+
|
|
307
346
|
click: function click(view, event) {
|
|
308
347
|
var _key$getState3;
|
|
309
348
|
var pluginState = ((_key$getState3 = key.getState(view.state)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.sort) || {};
|
|
310
349
|
toggleSort(view, event, pluginState);
|
|
311
350
|
}
|
|
312
351
|
},
|
|
352
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
313
353
|
decorations: function decorations(state) {
|
|
314
354
|
var _key$getState4;
|
|
315
355
|
var decs = ((_key$getState4 = key.getState(state)) === null || _key$getState4 === void 0 ? void 0 : _key$getState4.decorations) || DecorationSet.empty;
|
package/dist/esm/tablePlugin.js
CHANGED
|
@@ -414,6 +414,8 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
414
414
|
plugin: function plugin(_ref17) {
|
|
415
415
|
var dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
416
416
|
return new SafePlugin({
|
|
417
|
+
// @ts-ignore - Workaround for help-center local consumption
|
|
418
|
+
|
|
417
419
|
view: function view(editorView) {
|
|
418
420
|
editorViewRef.current = editorView;
|
|
419
421
|
var setTimeoutID;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "15.4.
|
|
3
|
+
"version": "15.4.4",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@atlaskit/editor-plugin-batch-attribute-updates": "^6.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-content-insertion": "^6.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^8.0.0",
|
|
40
|
-
"@atlaskit/editor-plugin-extension": "9.2.
|
|
40
|
+
"@atlaskit/editor-plugin-extension": "9.2.6",
|
|
41
41
|
"@atlaskit/editor-plugin-guideline": "^6.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-interaction": "^10.0.0",
|
|
43
43
|
"@atlaskit/editor-plugin-limited-mode": "^3.1.0",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
57
57
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
58
58
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
59
|
-
"@atlaskit/primitives": "^16.
|
|
59
|
+
"@atlaskit/primitives": "^16.3.0",
|
|
60
60
|
"@atlaskit/react-ufo": "^4.15.0",
|
|
61
61
|
"@atlaskit/theme": "^21.0.0",
|
|
62
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
62
|
+
"@atlaskit/tmp-editor-statsig": "^13.42.0",
|
|
63
63
|
"@atlaskit/toggle": "^15.1.0",
|
|
64
|
-
"@atlaskit/tokens": "^8.
|
|
64
|
+
"@atlaskit/tokens": "^8.3.0",
|
|
65
65
|
"@atlaskit/tooltip": "^20.10.0",
|
|
66
66
|
"@babel/runtime": "^7.0.0",
|
|
67
67
|
"@emotion/react": "^11.7.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"uuid": "^3.1.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@atlaskit/editor-common": "^110.
|
|
75
|
+
"@atlaskit/editor-common": "^110.34.0",
|
|
76
76
|
"react": "^18.2.0",
|
|
77
77
|
"react-dom": "^18.2.0",
|
|
78
78
|
"react-intl-next": "npm:react-intl@^5.18.1"
|