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