@atlaskit/editor-plugin-table 15.4.10 → 15.4.11
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 +8 -0
- package/dist/cjs/pm-plugins/analytics/plugin.js +0 -8
- package/dist/cjs/pm-plugins/decorations/plugin.js +0 -6
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +0 -9
- package/dist/cjs/pm-plugins/handlers.js +1 -8
- package/dist/cjs/pm-plugins/main.js +0 -23
- package/dist/cjs/pm-plugins/safari-delete-composition-text-issue-workaround.js +0 -8
- package/dist/cjs/pm-plugins/table-analytics.js +0 -7
- package/dist/cjs/pm-plugins/table-local-id.js +0 -17
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +0 -4
- package/dist/cjs/pm-plugins/table-size-selector.js +0 -4
- package/dist/cjs/pm-plugins/table-width-in-comment-fix.js +0 -7
- package/dist/cjs/pm-plugins/table-width.js +0 -17
- package/dist/cjs/pm-plugins/view-mode-sort/index.js +0 -40
- package/dist/cjs/tablePlugin.js +0 -2
- package/dist/es2019/pm-plugins/analytics/plugin.js +0 -8
- package/dist/es2019/pm-plugins/decorations/plugin.js +0 -6
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +0 -9
- package/dist/es2019/pm-plugins/handlers.js +1 -8
- package/dist/es2019/pm-plugins/main.js +0 -24
- package/dist/es2019/pm-plugins/safari-delete-composition-text-issue-workaround.js +0 -8
- package/dist/es2019/pm-plugins/table-analytics.js +0 -9
- package/dist/es2019/pm-plugins/table-local-id.js +0 -20
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +0 -6
- package/dist/es2019/pm-plugins/table-size-selector.js +0 -4
- package/dist/es2019/pm-plugins/table-width-in-comment-fix.js +0 -10
- package/dist/es2019/pm-plugins/table-width.js +0 -19
- package/dist/es2019/pm-plugins/view-mode-sort/index.js +0 -42
- package/dist/es2019/tablePlugin.js +0 -2
- package/dist/esm/pm-plugins/analytics/plugin.js +0 -8
- package/dist/esm/pm-plugins/decorations/plugin.js +0 -6
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +0 -9
- package/dist/esm/pm-plugins/handlers.js +1 -8
- package/dist/esm/pm-plugins/main.js +0 -23
- package/dist/esm/pm-plugins/safari-delete-composition-text-issue-workaround.js +0 -8
- package/dist/esm/pm-plugins/table-analytics.js +0 -7
- package/dist/esm/pm-plugins/table-local-id.js +0 -17
- package/dist/esm/pm-plugins/table-resizing/plugin.js +0 -4
- package/dist/esm/pm-plugins/table-size-selector.js +0 -4
- package/dist/esm/pm-plugins/table-width-in-comment-fix.js +0 -7
- package/dist/esm/pm-plugins/table-width.js +0 -17
- package/dist/esm/pm-plugins/view-mode-sort/index.js +0 -40
- package/dist/esm/tablePlugin.js +0 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 15.4.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`55920a92e882a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/55920a92e882a) -
|
|
8
|
+
tsignores added for help-center local consumpton removed
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 15.4.10
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -15,11 +15,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
15
15
|
return new _safePlugin.SafePlugin({
|
|
16
16
|
key: _pluginKey.pluginKey,
|
|
17
17
|
state: (0, _pluginFactory.createPluginState)(dispatch, _types.defaultState),
|
|
18
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
19
|
-
|
|
20
18
|
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
21
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
22
|
-
|
|
23
19
|
var tr = transactions.find(function (tr) {
|
|
24
20
|
var _tr$getMeta;
|
|
25
21
|
return (_tr$getMeta = tr.getMeta(_pluginKey.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');
|
|
@@ -41,8 +37,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
41
37
|
return undefined;
|
|
42
38
|
},
|
|
43
39
|
props: {
|
|
44
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
45
|
-
|
|
46
40
|
handlePaste: function handlePaste(_ref, event, slice) {
|
|
47
41
|
var state = _ref.state,
|
|
48
42
|
dispatch = _ref.dispatch;
|
|
@@ -59,8 +53,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
59
53
|
type: type
|
|
60
54
|
}, 'pasted')(state, dispatch);
|
|
61
55
|
},
|
|
62
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
63
|
-
|
|
64
56
|
transformCopied: function transformCopied(slice, _ref2) {
|
|
65
57
|
var state = _ref2.state,
|
|
66
58
|
dispatch = _ref2.dispatch;
|
|
@@ -67,8 +67,6 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
67
67
|
init: function init() {
|
|
68
68
|
return _view.DecorationSet.empty;
|
|
69
69
|
},
|
|
70
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
71
|
-
|
|
72
70
|
apply: function apply(tr, decorationSet, oldState, newState) {
|
|
73
71
|
var pluginState = decorationSet;
|
|
74
72
|
// main table plugin --->
|
|
@@ -77,8 +75,6 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
77
75
|
pluginState = meta.data.decorationSet;
|
|
78
76
|
}
|
|
79
77
|
if (tr.docChanged || tr.selectionSet || tr.getMeta(_tableWidth.pluginKey)) {
|
|
80
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
81
|
-
|
|
82
78
|
pluginState = pluginState.map(tr.mapping, tr.doc);
|
|
83
79
|
return handleDocOrSelectionChanged(tr, pluginState, oldState, newState);
|
|
84
80
|
}
|
|
@@ -87,8 +83,6 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
87
83
|
},
|
|
88
84
|
key: pluginKey,
|
|
89
85
|
props: {
|
|
90
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
91
|
-
|
|
92
86
|
decorations: function decorations(state) {
|
|
93
87
|
return getDecorations(state);
|
|
94
88
|
}
|
|
@@ -238,8 +238,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
|
|
|
238
238
|
};
|
|
239
239
|
}),
|
|
240
240
|
key: _pluginKey2.pluginKey,
|
|
241
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
242
|
-
|
|
243
241
|
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
244
242
|
var _getTablePluginState4 = (0, _pluginFactory.getPluginState)(oldState),
|
|
245
243
|
oldTargetCellPosition = _getTablePluginState4.targetCellPosition;
|
|
@@ -249,9 +247,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
|
|
|
249
247
|
_getPluginState$isDra = _getPluginState.isDragMenuOpen,
|
|
250
248
|
isDragMenuOpen = _getPluginState$isDra === void 0 ? false : _getPluginState$isDra,
|
|
251
249
|
dragMenuIndex = _getPluginState.dragMenuIndex;
|
|
252
|
-
|
|
253
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
254
|
-
|
|
255
250
|
transactions.forEach(function (transaction) {
|
|
256
251
|
if (transaction.getMeta('selectedRowViaKeyboard')) {
|
|
257
252
|
var button = document.querySelector('#drag-handle-button-row');
|
|
@@ -302,15 +297,11 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, editor
|
|
|
302
297
|
};
|
|
303
298
|
},
|
|
304
299
|
props: {
|
|
305
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
306
|
-
|
|
307
300
|
decorations: function decorations(state) {
|
|
308
301
|
var _getPluginState2 = (0, _pluginFactory2.getPluginState)(state),
|
|
309
302
|
decorationSet = _getPluginState2.decorationSet;
|
|
310
303
|
return decorationSet;
|
|
311
304
|
},
|
|
312
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
313
|
-
|
|
314
305
|
handleKeyDown: function handleKeyDown(view, event) {
|
|
315
306
|
var _ref8;
|
|
316
307
|
var tr = view.state.tr;
|
|
@@ -18,12 +18,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
18
18
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } // #region Imports
|
|
19
19
|
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
20
20
|
var nextTableSorting = function nextTableSorting(tr, table) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var tableSortStep = tr.steps.find(
|
|
24
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
25
|
-
|
|
26
|
-
function (step) {
|
|
21
|
+
var tableSortStep = tr.steps.find(function (step) {
|
|
27
22
|
return step instanceof _customSteps.TableSortStep;
|
|
28
23
|
});
|
|
29
24
|
return tableSortStep && table && table.pos === tableSortStep.pos ? tableSortStep.next : undefined;
|
|
@@ -117,8 +112,6 @@ var buildPluginState = function buildPluginState(builders) {
|
|
|
117
112
|
targetCellPosition: undefined
|
|
118
113
|
}) : pluginState;
|
|
119
114
|
}
|
|
120
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
121
|
-
|
|
122
115
|
return builders.reduce(function (_pluginState, transform) {
|
|
123
116
|
return transform(props)(_pluginState);
|
|
124
117
|
}, pluginState);
|
|
@@ -93,14 +93,10 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
93
93
|
state: state,
|
|
94
94
|
key: _pluginKey.pluginKey,
|
|
95
95
|
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
96
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
97
|
-
|
|
98
96
|
var tr = transactions.find(function (tr) {
|
|
99
97
|
return tr.getMeta('uiEvent') === 'cut';
|
|
100
98
|
});
|
|
101
99
|
function reportInvalidTableCellSpanAttrs(invalidNodeAttr) {
|
|
102
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
103
|
-
|
|
104
100
|
if (invalidTableIds.find(function (id) {
|
|
105
101
|
return id === invalidNodeAttr.tableLocalId;
|
|
106
102
|
})) {
|
|
@@ -127,8 +123,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
127
123
|
var updatedTr = (0, _eventHandlers.handleCut)(tr, oldState, newState, pluginInjectionApi, editorAnalyticsAPI, editorViewRef || undefined, isTableScalingEnabled, tableWithFixedColumnWidthsOption, shouldUseIncreasedScalingPercent);
|
|
128
124
|
return (0, _fixTables.fixTables)(updatedTr) || updatedTr;
|
|
129
125
|
}
|
|
130
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
131
|
-
|
|
132
126
|
if (transactions.find(function (tr) {
|
|
133
127
|
return tr.docChanged;
|
|
134
128
|
})) {
|
|
@@ -200,7 +194,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
200
194
|
};
|
|
201
195
|
},
|
|
202
196
|
props: {
|
|
203
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
204
197
|
transformPasted: function transformPasted(slice) {
|
|
205
198
|
var editorState = getCurrentEditorState();
|
|
206
199
|
if (!editorState) {
|
|
@@ -258,8 +251,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
258
251
|
}
|
|
259
252
|
return slice;
|
|
260
253
|
},
|
|
261
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
262
|
-
|
|
263
254
|
handleClick: function handleClick(_ref2, _pos, event) {
|
|
264
255
|
var state = _ref2.state,
|
|
265
256
|
dispatch = _ref2.dispatch;
|
|
@@ -290,8 +281,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
290
281
|
var maybeTr = (0, _utils.closestElement)(domRef, 'tr');
|
|
291
282
|
return maybeTr ? maybeTr.classList.contains('sticky') : false;
|
|
292
283
|
},
|
|
293
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
294
|
-
|
|
295
284
|
handleTextInput: function handleTextInput(view, _from, _to, text) {
|
|
296
285
|
var state = view.state,
|
|
297
286
|
dispatch = view.dispatch;
|
|
@@ -312,26 +301,14 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
312
301
|
return false;
|
|
313
302
|
},
|
|
314
303
|
nodeViews: nodeViews,
|
|
315
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
316
|
-
|
|
317
304
|
handleDOMEvents: {
|
|
318
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
319
|
-
|
|
320
305
|
focus: _eventHandlers.handleFocus,
|
|
321
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
322
|
-
|
|
323
306
|
blur: _eventHandlers.handleBlur,
|
|
324
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
325
|
-
|
|
326
307
|
mousedown: (0, _eventHandlers.withCellTracking)(_eventHandlers.handleMouseDown),
|
|
327
308
|
mouseleave: _eventHandlers.handleMouseLeave,
|
|
328
309
|
mousemove: (0, _eventHandlers.whenTableInFocus)((0, _eventHandlers.handleMouseMove)(nodeViewPortalProviderAPI), pluginInjectionApi),
|
|
329
310
|
mouseenter: _eventHandlers.handleMouseEnter,
|
|
330
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
331
|
-
|
|
332
311
|
mouseup: (0, _eventHandlers.whenTableInFocus)(_eventHandlers.handleMouseUp),
|
|
333
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
334
|
-
|
|
335
312
|
click: (0, _eventHandlers.withCellTracking)((0, _eventHandlers.whenTableInFocus)(_eventHandlers.handleClick))
|
|
336
313
|
},
|
|
337
314
|
handleTripleClick: _eventHandlers.handleTripleClick
|
|
@@ -24,8 +24,6 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
24
24
|
decorations: _view.DecorationSet.empty
|
|
25
25
|
};
|
|
26
26
|
},
|
|
27
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
28
|
-
|
|
29
27
|
apply: function apply(tr, value) {
|
|
30
28
|
var renderSpan = tr.getMeta(tableSafariDeleteCompositionTextIssueWorkaroundKey);
|
|
31
29
|
if (typeof renderSpan === 'undefined') {
|
|
@@ -51,17 +49,11 @@ var createPlugin = exports.createPlugin = function createPlugin() {
|
|
|
51
49
|
}
|
|
52
50
|
},
|
|
53
51
|
props: {
|
|
54
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
55
|
-
|
|
56
52
|
decorations: function decorations(state) {
|
|
57
53
|
var _tableSafariDeleteCom;
|
|
58
54
|
return (_tableSafariDeleteCom = tableSafariDeleteCompositionTextIssueWorkaroundKey.getState(state)) === null || _tableSafariDeleteCom === void 0 ? void 0 : _tableSafariDeleteCom.decorations;
|
|
59
55
|
},
|
|
60
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
61
|
-
|
|
62
56
|
handleDOMEvents: {
|
|
63
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
64
|
-
|
|
65
57
|
beforeinput: function beforeinput(view, event) {
|
|
66
58
|
if ((event === null || event === void 0 ? void 0 : event.inputType) !== 'deleteCompositionText') {
|
|
67
59
|
return false;
|
|
@@ -22,13 +22,11 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
22
22
|
return new _safePlugin.SafePlugin({
|
|
23
23
|
key: pluginKey,
|
|
24
24
|
state: {
|
|
25
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
26
25
|
init: function init() {
|
|
27
26
|
return {
|
|
28
27
|
lastTrigger: undefined
|
|
29
28
|
};
|
|
30
29
|
},
|
|
31
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
32
30
|
apply: function apply(tr, pluginState) {
|
|
33
31
|
var meta = tr.getMeta(META_KEYS.OVERFLOW_TRIGGER);
|
|
34
32
|
var newState = _objectSpread({}, pluginState);
|
|
@@ -40,8 +38,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
40
38
|
return pluginState;
|
|
41
39
|
}
|
|
42
40
|
},
|
|
43
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
44
|
-
|
|
45
41
|
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
46
42
|
var _newPluginState$lastT;
|
|
47
43
|
var newPluginState = pluginKey.getState(newState);
|
|
@@ -53,9 +49,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
53
49
|
// However, since there is still a chance that there are other triggers we didn't think of,
|
|
54
50
|
// all these unknown triggers and viwport width change trigger are captured as EXTERNAL.
|
|
55
51
|
_analytics.TABLE_OVERFLOW_CHANGE_TRIGGER.EXTERNAL;
|
|
56
|
-
|
|
57
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
58
|
-
|
|
59
52
|
transactions.forEach(function (tr) {
|
|
60
53
|
var payload = tr.getMeta(META_KEYS.OVERFLOW_STATE_CHANGED);
|
|
61
54
|
if (payload) {
|
|
@@ -39,19 +39,15 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch) {
|
|
|
39
39
|
return new _safePlugin.SafePlugin({
|
|
40
40
|
key: pluginKey,
|
|
41
41
|
state: {
|
|
42
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
43
42
|
init: function init() {
|
|
44
43
|
return {
|
|
45
44
|
parsedForLocalIds: false
|
|
46
45
|
};
|
|
47
46
|
},
|
|
48
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
49
47
|
apply: function apply(tr, pluginState) {
|
|
50
48
|
var meta = tr.getMeta(pluginKey);
|
|
51
49
|
if (meta) {
|
|
52
50
|
var keys = Object.keys(meta);
|
|
53
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
54
|
-
|
|
55
51
|
var changed = keys.some(function (key) {
|
|
56
52
|
return pluginState[key] !== meta[key];
|
|
57
53
|
});
|
|
@@ -83,7 +79,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch) {
|
|
|
83
79
|
* add/dedupe the necessary IDs. But general usage of the editor
|
|
84
80
|
* without collab should still solve for IDs.
|
|
85
81
|
*/
|
|
86
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
87
82
|
update: function update(editorView) {
|
|
88
83
|
var state = editorView.state;
|
|
89
84
|
var pluginState = getPluginState(state);
|
|
@@ -98,8 +93,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch) {
|
|
|
98
93
|
(0, _rafSchd.default)(function () {
|
|
99
94
|
var tr = editorView.state.tr;
|
|
100
95
|
var tableIdWasAdded = false;
|
|
101
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
102
|
-
|
|
103
96
|
editorView.state.doc.descendants(function (node, pos) {
|
|
104
97
|
var isTable = node.type === table;
|
|
105
98
|
var localId = node.attrs.localId;
|
|
@@ -127,8 +120,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch) {
|
|
|
127
120
|
}
|
|
128
121
|
};
|
|
129
122
|
},
|
|
130
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
131
|
-
|
|
132
123
|
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
133
124
|
var modified = false;
|
|
134
125
|
var tr = newState.tr;
|
|
@@ -136,9 +127,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch) {
|
|
|
136
127
|
var addedTableNodes = new Set();
|
|
137
128
|
var addedTableNodePos = new Map();
|
|
138
129
|
var localIds = new Set();
|
|
139
|
-
|
|
140
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
141
|
-
|
|
142
130
|
transactions.forEach(function (transaction) {
|
|
143
131
|
if (!transaction.docChanged) {
|
|
144
132
|
return;
|
|
@@ -160,9 +148,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch) {
|
|
|
160
148
|
if (!(0, _utils.stepHasSlice)(step)) {
|
|
161
149
|
continue;
|
|
162
150
|
}
|
|
163
|
-
|
|
164
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
165
|
-
|
|
166
151
|
step.slice.content.descendants(function (node) {
|
|
167
152
|
if (node.type === table) {
|
|
168
153
|
addedTableNodes.add(node);
|
|
@@ -181,8 +166,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch) {
|
|
|
181
166
|
}
|
|
182
167
|
|
|
183
168
|
// Get the existing localIds on the page
|
|
184
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
185
|
-
|
|
186
169
|
newState.doc.descendants(function (node, pos) {
|
|
187
170
|
// Skip if this is position of added table
|
|
188
171
|
if (addedTableNodes.has(node)) {
|
|
@@ -27,17 +27,13 @@ function createPlugin(dispatch, _ref, getEditorContainerWidth, getEditorFeatureF
|
|
|
27
27
|
lastClick: null
|
|
28
28
|
}),
|
|
29
29
|
props: {
|
|
30
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
31
30
|
attributes: function attributes(state) {
|
|
32
31
|
var pluginState = (0, _pluginFactory2.getPluginState)(state);
|
|
33
32
|
return {
|
|
34
33
|
class: (0, _classnames2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _types.TableCssClassName.RESIZE_CURSOR, pluginState.resizeHandlePos !== null), _types.TableCssClassName.IS_RESIZING, !!pluginState.dragging))
|
|
35
34
|
};
|
|
36
35
|
},
|
|
37
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
38
|
-
|
|
39
36
|
handleDOMEvents: {
|
|
40
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
41
37
|
mousedown: function mousedown(view, event) {
|
|
42
38
|
var state = view.state;
|
|
43
39
|
var resizeHandlePos =
|
|
@@ -20,14 +20,10 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch) {
|
|
|
20
20
|
isSelectorOpen: false
|
|
21
21
|
};
|
|
22
22
|
},
|
|
23
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
24
|
-
|
|
25
23
|
apply: function apply(tr, currentPluginState) {
|
|
26
24
|
var meta = tr.getMeta(pluginKey);
|
|
27
25
|
if (meta) {
|
|
28
26
|
var keys = Object.keys(meta);
|
|
29
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
30
|
-
|
|
31
27
|
var changed = keys.some(function (key) {
|
|
32
28
|
return currentPluginState[key] !== meta[key];
|
|
33
29
|
});
|
|
@@ -32,19 +32,15 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, isTabl
|
|
|
32
32
|
return new _safePlugin.SafePlugin({
|
|
33
33
|
key: pluginKey,
|
|
34
34
|
state: {
|
|
35
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
36
35
|
init: function init() {
|
|
37
36
|
return {
|
|
38
37
|
documentHasLoadedOnce: false
|
|
39
38
|
};
|
|
40
39
|
},
|
|
41
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
42
40
|
apply: function apply(tr, pluginState) {
|
|
43
41
|
var meta = tr.getMeta(pluginKey);
|
|
44
42
|
if (meta) {
|
|
45
43
|
var keys = Object.keys(meta);
|
|
46
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
47
|
-
|
|
48
44
|
var changed = keys.some(function (key) {
|
|
49
45
|
return pluginState[key] !== meta[key];
|
|
50
46
|
});
|
|
@@ -59,7 +55,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, isTabl
|
|
|
59
55
|
},
|
|
60
56
|
view: function view() {
|
|
61
57
|
return {
|
|
62
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
63
58
|
update: function update(editorView) {
|
|
64
59
|
var state = editorView.state;
|
|
65
60
|
var pluginState = getPluginState(state);
|
|
@@ -74,8 +69,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, isTabl
|
|
|
74
69
|
(0, _rafSchd.default)(function () {
|
|
75
70
|
var tr = editorView.state.tr;
|
|
76
71
|
var tableWidthAndLayoutUpdated = false;
|
|
77
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
78
|
-
|
|
79
72
|
editorView.state.doc.descendants(function (node, pos) {
|
|
80
73
|
var isTable = node.type === table;
|
|
81
74
|
var width = node.attrs.width;
|
|
@@ -27,7 +27,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
27
27
|
return new _safePlugin.SafePlugin({
|
|
28
28
|
key: pluginKey,
|
|
29
29
|
state: {
|
|
30
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
31
30
|
init: function init() {
|
|
32
31
|
return {
|
|
33
32
|
resizing: false,
|
|
@@ -35,13 +34,10 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
35
34
|
tableRef: null
|
|
36
35
|
};
|
|
37
36
|
},
|
|
38
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
39
37
|
apply: function apply(tr, pluginState) {
|
|
40
38
|
var meta = tr.getMeta(pluginKey);
|
|
41
39
|
if (meta) {
|
|
42
40
|
var keys = Object.keys(meta);
|
|
43
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
44
|
-
|
|
45
41
|
var changed = keys.some(function (key) {
|
|
46
42
|
return pluginState[key] !== meta[key];
|
|
47
43
|
});
|
|
@@ -54,17 +50,12 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
54
50
|
return pluginState;
|
|
55
51
|
}
|
|
56
52
|
},
|
|
57
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
58
|
-
|
|
59
53
|
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
60
54
|
// When document first load in Confluence, initially it is an empty document
|
|
61
55
|
// and Collab service triggers a transaction to replace the empty document with the real document that should be rendered.
|
|
62
56
|
// what we need to do is to add width attr to all tables in the real document
|
|
63
57
|
// isReplaceDocumentOperation is checking if the transaction is the one that replace the empty document with the real document
|
|
64
58
|
var isReplaceDocumentOperation = (0, _document.isReplaceDocOperation)(transactions, oldState);
|
|
65
|
-
|
|
66
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
67
|
-
|
|
68
59
|
var referentialityTr = transactions.find(function (tr) {
|
|
69
60
|
return tr.getMeta('referentialityTableInserted');
|
|
70
61
|
});
|
|
@@ -76,8 +67,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
76
67
|
var table = newState.schema.nodes.table;
|
|
77
68
|
var tr = newState.tr;
|
|
78
69
|
if (isReplaceDocumentOperation && !isCommentEditor) {
|
|
79
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
80
|
-
|
|
81
70
|
newState.doc.forEach(function (node, offset) {
|
|
82
71
|
if (node.type === table) {
|
|
83
72
|
var width = node.attrs.width;
|
|
@@ -116,14 +105,8 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
116
105
|
});
|
|
117
106
|
}
|
|
118
107
|
if (referentialityTr) {
|
|
119
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
120
|
-
|
|
121
108
|
referentialityTr.steps.forEach(function (step) {
|
|
122
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
123
|
-
|
|
124
109
|
step.getMap().forEach(function (_, __, newStart, newEnd) {
|
|
125
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
126
|
-
|
|
127
110
|
newState.doc.nodesBetween(newStart, newEnd, function (node, pos) {
|
|
128
111
|
if (node.type === table) {
|
|
129
112
|
if (shouldPatchTableWidth && node.attrs.width !== (0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) ? _consts.TABLE_MAX_WIDTH : _consts.TABLE_FULL_WIDTH) {
|
|
@@ -39,7 +39,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
39
39
|
allTables: []
|
|
40
40
|
};
|
|
41
41
|
},
|
|
42
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
43
42
|
apply: function apply(tr, pluginState, oldState) {
|
|
44
43
|
var _api$editorViewMode;
|
|
45
44
|
// TODO: ED-26961 - move this mode check to plugin creation if possible. Right now it's here because the initial state
|
|
@@ -48,8 +47,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
48
47
|
mode = _ref.mode;
|
|
49
48
|
if (mode !== 'view') {
|
|
50
49
|
var _pluginState$decorati, _pluginState$decorati2;
|
|
51
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
52
|
-
|
|
53
50
|
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) {
|
|
54
51
|
return (s === null || s === void 0 ? void 0 : s.type) === 'sorting-decoration';
|
|
55
52
|
});
|
|
@@ -67,8 +64,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
67
64
|
|
|
68
65
|
// Remove the table from the state
|
|
69
66
|
if (removeTableMeta) {
|
|
70
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
71
|
-
|
|
72
67
|
allTables = allTables.filter(function (_ref2) {
|
|
73
68
|
var _ref3 = (0, _slicedToArray2.default)(_ref2, 1),
|
|
74
69
|
id = _ref3[0];
|
|
@@ -78,9 +73,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
78
73
|
tableId = hoverTableMeta === null || hoverTableMeta === void 0 ? void 0 : hoverTableMeta[0];
|
|
79
74
|
}
|
|
80
75
|
sort = _objectSpread(_objectSpread({}, sort), sortMeta);
|
|
81
|
-
|
|
82
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
83
|
-
|
|
84
76
|
var isTableInState = allTables.some(function (_ref4) {
|
|
85
77
|
var _ref5 = (0, _slicedToArray2.default)(_ref4, 1),
|
|
86
78
|
id = _ref5[0];
|
|
@@ -89,8 +81,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
89
81
|
|
|
90
82
|
// Update the table in the state
|
|
91
83
|
if (hoverTableMeta) {
|
|
92
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
93
|
-
|
|
94
84
|
allTables = allTables.filter(function (_ref6) {
|
|
95
85
|
var _ref7 = (0, _slicedToArray2.default)(_ref6, 1),
|
|
96
86
|
id = _ref7[0];
|
|
@@ -103,32 +93,23 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
103
93
|
* Create decorations for the sorting icons
|
|
104
94
|
*/
|
|
105
95
|
var decs = [];
|
|
106
|
-
|
|
107
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
108
|
-
|
|
109
96
|
var sortingDecorations = pluginState.decorations.find(undefined, undefined, function (spec) {
|
|
110
97
|
return spec.tableId === tableId && spec.type === 'sorting-decoration';
|
|
111
98
|
});
|
|
112
99
|
|
|
113
100
|
// TODO: ED-26961 - add support for keyboard only users
|
|
114
101
|
if (hoverTableMeta && !isTableInState || sortMeta || isTableInState && !sortingDecorations.length) {
|
|
115
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
116
|
-
|
|
117
102
|
allTables.forEach(function (table) {
|
|
118
103
|
var _table = (0, _slicedToArray2.default)(table, 3),
|
|
119
104
|
tableId = _table[0],
|
|
120
105
|
_node = _table[1],
|
|
121
106
|
pos = _table[2];
|
|
122
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
123
|
-
|
|
124
107
|
var tableNode = tr.doc.nodeAt(tr.mapping.map(pos));
|
|
125
108
|
if (!tableNode || tableNode.type.name !== 'table') {
|
|
126
109
|
return pluginState;
|
|
127
110
|
}
|
|
128
111
|
var map = _tableMap.TableMap.get(tableNode);
|
|
129
112
|
var hasMergedCells = new Set(map.map).size !== map.map.length;
|
|
130
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
131
|
-
|
|
132
113
|
map.mapByRow[0].forEach(function (cell, index) {
|
|
133
114
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
134
115
|
var decorationRenderKey = (0, _v.default)();
|
|
@@ -177,14 +158,8 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
177
158
|
* Map the decorations to the new document if there are changes
|
|
178
159
|
*/
|
|
179
160
|
if (tr.docChanged) {
|
|
180
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
181
|
-
|
|
182
161
|
decorations = decorations.map(tr.mapping, tr.doc);
|
|
183
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
184
|
-
|
|
185
162
|
allTables = allTables.map(function (table) {
|
|
186
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
187
|
-
|
|
188
163
|
return [table[0], table[1], tr.mapping.map(table[2])];
|
|
189
164
|
});
|
|
190
165
|
}
|
|
@@ -196,8 +171,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
196
171
|
}
|
|
197
172
|
},
|
|
198
173
|
key: _pluginKey.tableViewModeSortPluginKey,
|
|
199
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
200
|
-
|
|
201
174
|
appendTransaction: function appendTransaction(trs, oldState, newState) {
|
|
202
175
|
var _api$editorViewMode2, _key$getState;
|
|
203
176
|
// return newState.tr;
|
|
@@ -219,8 +192,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
219
192
|
var tr = _step.value;
|
|
220
193
|
var hoverTableMeta = tr.getMeta('mouseEnterTable');
|
|
221
194
|
if (hoverTableMeta) {
|
|
222
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
223
|
-
|
|
224
195
|
allTables = allTables.filter(function (_ref9) {
|
|
225
196
|
var _ref0 = (0, _slicedToArray2.default)(_ref9, 1),
|
|
226
197
|
id = _ref0[0];
|
|
@@ -271,8 +242,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
271
242
|
var sortedOrder = (0, _toConsumableArray2.default)(oldOrder).sort(function (a, b) {
|
|
272
243
|
return a.value - b.value;
|
|
273
244
|
});
|
|
274
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
275
|
-
|
|
276
245
|
sortedOrder.forEach(function (index, i) {
|
|
277
246
|
tbody.appendChild(rows[index.index + 1]);
|
|
278
247
|
});
|
|
@@ -299,8 +268,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
299
268
|
_rows = _getTableElements2.rows,
|
|
300
269
|
_tbody = _getTableElements2.tbody;
|
|
301
270
|
if (_rows && newOrder) {
|
|
302
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
303
|
-
|
|
304
271
|
newOrder.forEach(function (index, i) {
|
|
305
272
|
_tbody === null || _tbody === void 0 || _tbody.appendChild(_rows[index.value + 1]);
|
|
306
273
|
});
|
|
@@ -332,11 +299,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
332
299
|
return newState.tr;
|
|
333
300
|
},
|
|
334
301
|
props: {
|
|
335
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
336
|
-
|
|
337
302
|
handleDOMEvents: {
|
|
338
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
339
|
-
|
|
340
303
|
keydown: function keydown(view, event) {
|
|
341
304
|
// TODO: ED-26961 - fix the focus issue here, where toggling sort with a keypress loses focus
|
|
342
305
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
@@ -345,15 +308,12 @@ var createPlugin = exports.createPlugin = function createPlugin(api, nodeViewPor
|
|
|
345
308
|
(0, _utils.toggleSort)(view, event, pluginState);
|
|
346
309
|
}
|
|
347
310
|
},
|
|
348
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
349
|
-
|
|
350
311
|
click: function click(view, event) {
|
|
351
312
|
var _key$getState3;
|
|
352
313
|
var pluginState = ((_key$getState3 = _pluginKey.tableViewModeSortPluginKey.getState(view.state)) === null || _key$getState3 === void 0 ? void 0 : _key$getState3.sort) || {};
|
|
353
314
|
(0, _utils.toggleSort)(view, event, pluginState);
|
|
354
315
|
}
|
|
355
316
|
},
|
|
356
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
357
317
|
decorations: function decorations(state) {
|
|
358
318
|
var _key$getState4;
|
|
359
319
|
var decs = ((_key$getState4 = _pluginKey.tableViewModeSortPluginKey.getState(state)) === null || _key$getState4 === void 0 ? void 0 : _key$getState4.decorations) || _view.DecorationSet.empty;
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -423,8 +423,6 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
423
423
|
plugin: function plugin(_ref17) {
|
|
424
424
|
var dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
425
425
|
return new _safePlugin.SafePlugin({
|
|
426
|
-
// @ts-ignore - Workaround for help-center local consumption
|
|
427
|
-
|
|
428
426
|
view: function view(editorView) {
|
|
429
427
|
editorViewRef.current = editorView;
|
|
430
428
|
var setTimeoutID;
|