@atlaskit/editor-plugin-table 7.30.2 → 7.31.1
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 +25 -0
- package/dist/cjs/commands/column-resize.js +10 -8
- package/dist/cjs/commands/misc.js +4 -4
- package/dist/cjs/event-handlers.js +69 -65
- package/dist/cjs/plugin.js +94 -53
- package/dist/cjs/pm-plugins/decorations/utils/column-resizing.js +2 -2
- package/dist/cjs/pm-plugins/keymap.js +18 -15
- package/dist/cjs/pm-plugins/main.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +2 -2
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/cjs/pm-plugins/view-mode-sort/index.js +35 -10
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +1 -1
- package/dist/cjs/ui/common-styles.js +8 -18
- package/dist/cjs/utils/decoration.js +28 -8
- package/dist/es2019/commands/column-resize.js +10 -8
- package/dist/es2019/commands/misc.js +4 -4
- package/dist/es2019/event-handlers.js +4 -4
- package/dist/es2019/plugin.js +53 -9
- package/dist/es2019/pm-plugins/decorations/utils/column-resizing.js +2 -2
- package/dist/es2019/pm-plugins/keymap.js +7 -4
- package/dist/es2019/pm-plugins/main.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +2 -2
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/es2019/pm-plugins/view-mode-sort/index.js +33 -10
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +1 -1
- package/dist/es2019/ui/common-styles.js +0 -15
- package/dist/es2019/utils/decoration.js +26 -9
- package/dist/esm/commands/column-resize.js +10 -8
- package/dist/esm/commands/misc.js +4 -4
- package/dist/esm/event-handlers.js +69 -65
- package/dist/esm/plugin.js +91 -50
- package/dist/esm/pm-plugins/decorations/utils/column-resizing.js +2 -2
- package/dist/esm/pm-plugins/keymap.js +18 -15
- package/dist/esm/pm-plugins/main.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +2 -2
- package/dist/esm/pm-plugins/table-resizing/plugin.js +2 -2
- package/dist/esm/pm-plugins/view-mode-sort/index.js +35 -10
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +1 -1
- package/dist/esm/ui/common-styles.js +8 -18
- package/dist/esm/utils/decoration.js +28 -8
- package/dist/types/commands/column-resize.d.ts +5 -2
- package/dist/types/commands/misc.d.ts +3 -2
- package/dist/types/commands/toggle.d.ts +1 -1
- package/dist/types/commands-with-analytics.d.ts +2 -2
- package/dist/types/event-handlers.d.ts +2 -1
- package/dist/types/pm-plugins/decorations/utils/column-resizing.d.ts +2 -1
- package/dist/types/pm-plugins/keymap.d.ts +2 -1
- package/dist/types/pm-plugins/main.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/event-handlers.d.ts +2 -1
- package/dist/types/pm-plugins/table-resizing/plugin.d.ts +2 -1
- package/dist/types/pm-plugins/view-mode-sort/index.d.ts +2 -1
- package/dist/types/toDOM.d.ts +1 -1
- package/dist/types/utils/decoration.d.ts +2 -1
- package/dist/types-ts4.5/commands/column-resize.d.ts +5 -2
- package/dist/types-ts4.5/commands/misc.d.ts +3 -2
- package/dist/types-ts4.5/commands/toggle.d.ts +1 -1
- package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -2
- package/dist/types-ts4.5/event-handlers.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/decorations/utils/column-resizing.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/event-handlers.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/plugin.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/view-mode-sort/index.d.ts +2 -1
- package/dist/types-ts4.5/toDOM.d.ts +1 -1
- package/dist/types-ts4.5/utils/decoration.d.ts +2 -1
- package/package.json +11 -7
- package/src/commands/column-resize.ts +18 -1
- package/src/commands/misc.ts +5 -0
- package/src/commands-with-analytics.ts +2 -2
- package/src/event-handlers.ts +22 -20
- package/src/plugin.tsx +63 -6
- package/src/pm-plugins/decorations/utils/column-resizing.ts +3 -0
- package/src/pm-plugins/keymap.ts +5 -0
- package/src/pm-plugins/main.ts +2 -1
- package/src/pm-plugins/table-resizing/event-handlers.ts +8 -1
- package/src/pm-plugins/table-resizing/plugin.ts +3 -0
- package/src/pm-plugins/view-mode-sort/index.ts +73 -34
- package/src/toDOM.ts +1 -1
- package/src/toolbar.tsx +1 -1
- package/src/ui/FloatingContextualButton/FixedButton.tsx +1 -1
- package/src/ui/common-styles.ts +0 -17
- package/src/utils/decoration.ts +39 -13
|
@@ -257,7 +257,7 @@ export const handleMouseLeave = (view, event) => {
|
|
|
257
257
|
|
|
258
258
|
// IMPORTANT: The mouse move handler has been setup with RAF schedule to avoid Reflows which will occur as some methods
|
|
259
259
|
// need to access the mouse event offset position and also the target clientWidth vallue.
|
|
260
|
-
const handleMouseMoveDebounce = rafSchedule((view, event, offsetX) => {
|
|
260
|
+
const handleMouseMoveDebounce = nodeViewPortalProviderAPI => rafSchedule((view, event, offsetX) => {
|
|
261
261
|
if (!(event.target instanceof HTMLElement)) {
|
|
262
262
|
return false;
|
|
263
263
|
}
|
|
@@ -313,14 +313,14 @@ const handleMouseMoveDebounce = rafSchedule((view, event, offsetX) => {
|
|
|
313
313
|
columnEndIndexTarget
|
|
314
314
|
})) && !isKeyboardResize // if initiated by keyboard don't need to react on hover for other resize sliders
|
|
315
315
|
) {
|
|
316
|
-
return addResizeHandleDecorations(rowIndexTarget, columnEndIndexTarget, true)(state, dispatch);
|
|
316
|
+
return addResizeHandleDecorations(rowIndexTarget, columnEndIndexTarget, true, nodeViewPortalProviderAPI)(state, dispatch);
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
return false;
|
|
322
322
|
});
|
|
323
|
-
export const handleMouseMove = (view, event) => {
|
|
323
|
+
export const handleMouseMove = nodeViewPortalProviderAPI => (view, event) => {
|
|
324
324
|
if (!(event.target instanceof HTMLElement)) {
|
|
325
325
|
return false;
|
|
326
326
|
}
|
|
@@ -330,7 +330,7 @@ export const handleMouseMove = (view, event) => {
|
|
|
330
330
|
// a reflow. So for now this will just grab the offsetX value immediately for gecko and chrome will calculate later
|
|
331
331
|
// in the deferred callback handler.
|
|
332
332
|
// Bug Tracking: https://bugzilla.mozilla.org/show_bug.cgi?id=1882903
|
|
333
|
-
handleMouseMoveDebounce(view, event, browser.gecko ? event.offsetX : NaN);
|
|
333
|
+
handleMouseMoveDebounce(nodeViewPortalProviderAPI)(view, event, browser.gecko ? event.offsetX : NaN);
|
|
334
334
|
return false;
|
|
335
335
|
};
|
|
336
336
|
export function handleTripleClick(view, pos) {
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -6,11 +6,15 @@ import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
|
6
6
|
import { IconTable } from '@atlaskit/editor-common/icons';
|
|
7
7
|
import { toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
8
8
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
|
+
import { getParentOfTypeCount, getPositionAfterTopParentNodeOfType } from '@atlaskit/editor-common/nesting';
|
|
9
10
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
10
11
|
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
12
|
+
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
13
|
+
import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
11
14
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
12
15
|
import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
|
|
13
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
18
|
import { insertTableWithSize } from './commands/insert';
|
|
15
19
|
import { pluginConfig } from './create-plugin-config';
|
|
16
20
|
import { createPlugin as createTableAnalyticsPlugin } from './pm-plugins/analytics/plugin';
|
|
@@ -110,6 +114,21 @@ const tablesPlugin = ({
|
|
|
110
114
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
111
115
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
112
116
|
})(state.schema);
|
|
117
|
+
|
|
118
|
+
// If the cursor is inside a table
|
|
119
|
+
let insertAt;
|
|
120
|
+
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
121
|
+
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
122
|
+
if (editorExperiment('nested-tables-in-tables', false, {
|
|
123
|
+
exposure: true
|
|
124
|
+
}) || getParentOfTypeCount(state.schema.nodes.table)(state.selection) > 1) {
|
|
125
|
+
const positionAfterTopTable = getPositionAfterTopParentNodeOfType(state.schema.nodes.table)(state.selection);
|
|
126
|
+
if (!positionAfterTopTable) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
insertAt = TextSelection.create(state.doc, positionAfterTopTable);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
113
132
|
return (_api$contentInsertion = api === null || api === void 0 ? void 0 : (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 ? void 0 : (_api$contentInsertion3 = _api$contentInsertion2.actions) === null || _api$contentInsertion3 === void 0 ? void 0 : _api$contentInsertion3.insert({
|
|
114
133
|
state,
|
|
115
134
|
dispatch,
|
|
@@ -122,7 +141,8 @@ const tablesPlugin = ({
|
|
|
122
141
|
...analyticsPayload.attributes,
|
|
123
142
|
localId: node.attrs.localId
|
|
124
143
|
}
|
|
125
|
-
}
|
|
144
|
+
},
|
|
145
|
+
insertAt
|
|
126
146
|
}
|
|
127
147
|
})) !== null && _api$contentInsertion !== void 0 ? _api$contentInsertion : false;
|
|
128
148
|
}
|
|
@@ -178,6 +198,7 @@ const tablesPlugin = ({
|
|
|
178
198
|
dispatchAnalyticsEvent,
|
|
179
199
|
dispatch,
|
|
180
200
|
portalProviderAPI,
|
|
201
|
+
nodeViewPortalProviderAPI,
|
|
181
202
|
eventDispatcher,
|
|
182
203
|
getIntl
|
|
183
204
|
}) => {
|
|
@@ -193,12 +214,13 @@ const tablesPlugin = ({
|
|
|
193
214
|
isCommentEditor,
|
|
194
215
|
isChromelessEditor
|
|
195
216
|
} = options || {};
|
|
196
|
-
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor);
|
|
217
|
+
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor);
|
|
197
218
|
}
|
|
198
219
|
}, {
|
|
199
220
|
name: 'tablePMColResizing',
|
|
200
221
|
plugin: ({
|
|
201
|
-
dispatch
|
|
222
|
+
dispatch,
|
|
223
|
+
nodeViewPortalProviderAPI
|
|
202
224
|
}) => {
|
|
203
225
|
const {
|
|
204
226
|
fullWidthEnabled,
|
|
@@ -213,7 +235,7 @@ const tablesPlugin = ({
|
|
|
213
235
|
} = pluginConfig(tableOptions);
|
|
214
236
|
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
215
237
|
lastColumnResizable: !fullWidthEnabled
|
|
216
|
-
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, isTableAlignmentEnabled, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
|
|
238
|
+
}, defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled || false, isNewColumnResizingEnabled, isTableAlignmentEnabled, !!(options !== null && options !== void 0 && options.isCommentEditor)) : undefined;
|
|
217
239
|
}
|
|
218
240
|
}, {
|
|
219
241
|
name: 'tableEditing',
|
|
@@ -224,7 +246,8 @@ const tablesPlugin = ({
|
|
|
224
246
|
{
|
|
225
247
|
name: 'tableKeymap',
|
|
226
248
|
plugin: ({
|
|
227
|
-
getIntl
|
|
249
|
+
getIntl,
|
|
250
|
+
nodeViewPortalProviderAPI
|
|
228
251
|
}) => {
|
|
229
252
|
const {
|
|
230
253
|
dragAndDropEnabled,
|
|
@@ -235,7 +258,7 @@ const tablesPlugin = ({
|
|
|
235
258
|
isChromelessEditor = false,
|
|
236
259
|
tableResizingEnabled = false
|
|
237
260
|
} = options || {};
|
|
238
|
-
return keymapPlugin(defaultGetEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
|
|
261
|
+
return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
|
|
239
262
|
}
|
|
240
263
|
}, {
|
|
241
264
|
name: 'tableSelectionKeymap',
|
|
@@ -281,8 +304,10 @@ const tablesPlugin = ({
|
|
|
281
304
|
}
|
|
282
305
|
}, {
|
|
283
306
|
name: 'tableViewModeSort',
|
|
284
|
-
plugin: (
|
|
285
|
-
|
|
307
|
+
plugin: ({
|
|
308
|
+
nodeViewPortalProviderAPI
|
|
309
|
+
}) => {
|
|
310
|
+
return api !== null && api !== void 0 && api.editorViewMode ? createViewModeSortPlugin(api, nodeViewPortalProviderAPI) : undefined;
|
|
286
311
|
}
|
|
287
312
|
}, {
|
|
288
313
|
name: 'tableLocalId',
|
|
@@ -518,7 +543,26 @@ const tablesPlugin = ({
|
|
|
518
543
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
519
544
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
|
|
520
545
|
})(state.schema);
|
|
521
|
-
|
|
546
|
+
let {
|
|
547
|
+
tr
|
|
548
|
+
} = state;
|
|
549
|
+
// If the cursor is inside a table
|
|
550
|
+
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && fg('platform_editor_use_nested_table_pm_nodes')) {
|
|
551
|
+
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
552
|
+
if (editorExperiment('nested-tables-in-tables', false, {
|
|
553
|
+
exposure: true
|
|
554
|
+
}) || getParentOfTypeCount(state.schema.nodes.table)(state.selection) > 1) {
|
|
555
|
+
// Nesting is too deep insert table after the top parent table
|
|
556
|
+
const positionAfterTopTable = getPositionAfterTopParentNodeOfType(state.schema.nodes.table)(state.selection);
|
|
557
|
+
tr = safeInsert(tableNode, positionAfterTopTable)(tr);
|
|
558
|
+
tr.scrollIntoView();
|
|
559
|
+
} else {
|
|
560
|
+
// Table can be nested in parent table
|
|
561
|
+
tr = insert(tableNode);
|
|
562
|
+
}
|
|
563
|
+
} else {
|
|
564
|
+
tr = insert(tableNode);
|
|
565
|
+
}
|
|
522
566
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
523
567
|
action: ACTION.INSERTED,
|
|
524
568
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
@@ -10,13 +10,13 @@ const updateLastCellElement = lastCellElementsDecorations => ({
|
|
|
10
10
|
decorationSet,
|
|
11
11
|
tr
|
|
12
12
|
}) => updateDecorations(tr.doc, decorationSet, lastCellElementsDecorations, TableDecorations.LAST_CELL_ELEMENT);
|
|
13
|
-
export const buildColumnResizingDecorations = (rowEndIndex, columnEndIndex, includeTooltip, getIntl) => ({
|
|
13
|
+
export const buildColumnResizingDecorations = (rowEndIndex, columnEndIndex, includeTooltip, getIntl, nodeViewPortalProviderAPI) => ({
|
|
14
14
|
tr,
|
|
15
15
|
decorationSet
|
|
16
16
|
}) => {
|
|
17
17
|
const [columnResizesDecorations, lastCellElementsDecorations] = columnEndIndex < 0 ? emptyDecorations : createResizeHandleDecoration(tr, rowEndIndex, {
|
|
18
18
|
right: columnEndIndex
|
|
19
|
-
}, includeTooltip, getIntl);
|
|
19
|
+
}, includeTooltip, getIntl, nodeViewPortalProviderAPI);
|
|
20
20
|
return composeDecorations([updateColumnResizeHandle(columnResizesDecorations), updateLastCellElement(lastCellElementsDecorations)])({
|
|
21
21
|
decorationSet,
|
|
22
22
|
tr
|
|
@@ -7,7 +7,7 @@ import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSele
|
|
|
7
7
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
|
|
8
8
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, createTable } from '../commands/insert';
|
|
9
9
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
10
|
-
export function keymapPlugin(getEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isCellBackgroundDuplicated = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, isTableResizingEnabled) {
|
|
10
|
+
export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isCellBackgroundDuplicated = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, isTableResizingEnabled) {
|
|
11
11
|
var _pluginInjectionApi$a;
|
|
12
12
|
const list = {};
|
|
13
13
|
const ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
|
|
@@ -46,17 +46,20 @@ export function keymapPlugin(getEditorContainerWidth, api, editorAnalyticsAPI, d
|
|
|
46
46
|
}
|
|
47
47
|
bindKeymapWithCommand(startColumnResizing.common, initiateKeyboardColumnResizing({
|
|
48
48
|
ariaNotify: ariaNotifyPlugin,
|
|
49
|
-
getIntl: getIntl
|
|
49
|
+
getIntl: getIntl,
|
|
50
|
+
nodeViewPortalProviderAPI
|
|
50
51
|
}), list);
|
|
51
52
|
bindKeymapWithCommand(moveRight.common, activateNextResizeArea({
|
|
52
53
|
direction: 1,
|
|
53
54
|
ariaNotify: ariaNotifyPlugin,
|
|
54
|
-
getIntl: getIntl
|
|
55
|
+
getIntl: getIntl,
|
|
56
|
+
nodeViewPortalProviderAPI
|
|
55
57
|
}), list);
|
|
56
58
|
bindKeymapWithCommand(moveLeft.common, activateNextResizeArea({
|
|
57
59
|
direction: -1,
|
|
58
60
|
ariaNotify: ariaNotifyPlugin,
|
|
59
|
-
getIntl: getIntl
|
|
61
|
+
getIntl: getIntl,
|
|
62
|
+
nodeViewPortalProviderAPI
|
|
60
63
|
}), list);
|
|
61
64
|
bindKeymapWithCommand(decreaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api)(-10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, !!isCommentEditor, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
62
65
|
bindKeymapWithCommand(increaseMediaSize.common, changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api)(10, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, !!isCommentEditor, INPUT_METHOD.SHORTCUT, ariaNotifyPlugin, getIntl), list);
|
|
@@ -19,7 +19,7 @@ import { isHeaderRowRequired, transformSliceTableLayoutDefaultToCenter } from '.
|
|
|
19
19
|
import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
|
|
20
20
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
21
21
|
import { pluginKey } from './plugin-key';
|
|
22
|
-
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor) => {
|
|
22
|
+
export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, isTableAlignmentEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor) => {
|
|
23
23
|
var _accessibilityUtils;
|
|
24
24
|
const state = createPluginState(dispatch, {
|
|
25
25
|
pluginConfig,
|
|
@@ -283,7 +283,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
283
283
|
blur: handleBlur,
|
|
284
284
|
mousedown: withCellTracking(handleMouseDown),
|
|
285
285
|
mouseleave: handleMouseLeave,
|
|
286
|
-
mousemove: whenTableInFocus(handleMouseMove),
|
|
286
|
+
mousemove: whenTableInFocus(handleMouseMove(nodeViewPortalProviderAPI)),
|
|
287
287
|
mouseenter: handleMouseEnter,
|
|
288
288
|
mouseup: whenTableInFocus(handleMouseUp),
|
|
289
289
|
click: withCellTracking(whenTableInFocus(handleClick))
|
|
@@ -15,7 +15,7 @@ import { currentColWidth, getResizeState, getTableMaxWidth, pointsAtCell, resize
|
|
|
15
15
|
import { TABLE_OFFSET_IN_COMMENT_EDITOR } from './utils/consts';
|
|
16
16
|
import { getScalingPercentForTableWithoutWidth, getTableScalingPercent } from './utils/misc';
|
|
17
17
|
import { scaleResizeState } from './utils/resize-column';
|
|
18
|
-
export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) => {
|
|
18
|
+
export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) => {
|
|
19
19
|
var _originalTable$attrs;
|
|
20
20
|
const {
|
|
21
21
|
state,
|
|
@@ -104,7 +104,7 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
|
|
|
104
104
|
|
|
105
105
|
// When we start resizing a column we need to ensure the underlying tooltip is removed from the decoration to avoid
|
|
106
106
|
// unnecessary tooltips being displayed during drag.
|
|
107
|
-
updateResizeHandleDecorations(undefined, undefined, false)(state, dispatch);
|
|
107
|
+
updateResizeHandleDecorations(nodeViewPortalProviderAPI, undefined, undefined, false)(state, dispatch);
|
|
108
108
|
|
|
109
109
|
// for new column resizing, take the current scaled version of table widths and use those as the basis for resizing
|
|
110
110
|
// implication: the scaled version of the table becomes the source of truth
|
|
@@ -9,7 +9,7 @@ import { pluginKey } from './plugin-key';
|
|
|
9
9
|
import { getResizeCellPos } from './utils';
|
|
10
10
|
export function createPlugin(dispatch, {
|
|
11
11
|
lastColumnResizable = true
|
|
12
|
-
}, getEditorContainerWidth, getEditorFeatureFlags, api, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
12
|
+
}, getEditorContainerWidth, getEditorFeatureFlags, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
13
13
|
return new SafePlugin({
|
|
14
14
|
key: pluginKey,
|
|
15
15
|
state: createPluginState(dispatch, {
|
|
@@ -51,7 +51,7 @@ export function createPlugin(dispatch, {
|
|
|
51
51
|
isColumnKeyboardResizeStarted = isKeyboardResize;
|
|
52
52
|
}
|
|
53
53
|
if (resizeHandlePos !== null && (!dragging || isColumnKeyboardResizeStarted)) {
|
|
54
|
-
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, api, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor)) {
|
|
54
|
+
if (handleMouseDown(view, event, resizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, isTableScalingEnabled || false, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isNewColumnResizingEnabled, isTableAlignmentEnabled, isCommentEditor)) {
|
|
55
55
|
const {
|
|
56
56
|
state,
|
|
57
57
|
dispatch
|
|
@@ -7,16 +7,18 @@
|
|
|
7
7
|
import { createElement } from 'react';
|
|
8
8
|
import ReactDOM from 'react-dom';
|
|
9
9
|
import { RawIntlProvider } from 'react-intl-next';
|
|
10
|
+
import uuid from 'uuid/v4';
|
|
10
11
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
11
12
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
12
13
|
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
13
14
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
16
|
import { SortingIconWrapper } from '../../ui/icons/SortingIconWrapper';
|
|
15
17
|
import { getPluginState } from '../plugin-factory';
|
|
16
18
|
import { IS_DISABLED_CLASS_NAME, SORT_INDEX_DATA_ATTRIBUTE, SORTING_ICON_CLASS_NAME } from './consts';
|
|
17
19
|
import { tableViewModeSortPluginKey as key } from './plugin-key';
|
|
18
20
|
import { getTableElements, toggleSort } from './utils';
|
|
19
|
-
export const createPlugin = api => {
|
|
21
|
+
export const createPlugin = (api, nodeViewPortalProviderAPI) => {
|
|
20
22
|
return new SafePlugin({
|
|
21
23
|
state: {
|
|
22
24
|
init: () => ({
|
|
@@ -78,6 +80,7 @@ export const createPlugin = api => {
|
|
|
78
80
|
const map = TableMap.get(tableNode);
|
|
79
81
|
const hasMergedCells = new Set(map.map).size !== map.map.length;
|
|
80
82
|
map.mapByRow[0].forEach((cell, index) => {
|
|
83
|
+
const decorationRenderKey = uuid();
|
|
81
84
|
decs.push(Decoration.widget(cell + pos + 2, () => {
|
|
82
85
|
var _sort$tableId;
|
|
83
86
|
const element = document.createElement('div');
|
|
@@ -96,16 +99,36 @@ export const createPlugin = api => {
|
|
|
96
99
|
const {
|
|
97
100
|
getIntl
|
|
98
101
|
} = getPluginState(oldState);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
103
|
+
nodeViewPortalProviderAPI.render(() => /*#__PURE__*/createElement(RawIntlProvider, {
|
|
104
|
+
value: getIntl()
|
|
105
|
+
}, /*#__PURE__*/createElement(SortingIconWrapper, {
|
|
106
|
+
isSortingAllowed: !hasMergedCells,
|
|
107
|
+
sortOrdered,
|
|
108
|
+
onClick: () => {},
|
|
109
|
+
onKeyDown: () => {},
|
|
110
|
+
api
|
|
111
|
+
})), element, decorationRenderKey);
|
|
112
|
+
} else {
|
|
113
|
+
ReactDOM.render( /*#__PURE__*/createElement(RawIntlProvider, {
|
|
114
|
+
value: getIntl()
|
|
115
|
+
}, /*#__PURE__*/createElement(SortingIconWrapper, {
|
|
116
|
+
isSortingAllowed: !hasMergedCells,
|
|
117
|
+
sortOrdered,
|
|
118
|
+
onClick: () => {},
|
|
119
|
+
onKeyDown: () => {},
|
|
120
|
+
api
|
|
121
|
+
})), element);
|
|
122
|
+
}
|
|
108
123
|
return element;
|
|
124
|
+
}, {
|
|
125
|
+
destroy: node => {
|
|
126
|
+
if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
127
|
+
nodeViewPortalProviderAPI.remove(decorationRenderKey);
|
|
128
|
+
} else {
|
|
129
|
+
ReactDOM.unmountComponentAtNode(node);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
109
132
|
}));
|
|
110
133
|
});
|
|
111
134
|
});
|
|
@@ -86,7 +86,7 @@ export const FixedButton = ({
|
|
|
86
86
|
if (!fg('platform_editor_breakout_use_css')) {
|
|
87
87
|
return 0;
|
|
88
88
|
}
|
|
89
|
-
const container = targetCellRef.closest('[data-
|
|
89
|
+
const container = targetCellRef.closest('[data-editor-container="true"]');
|
|
90
90
|
return (container === null || container === void 0 ? void 0 : container.getBoundingClientRect().left) || 0;
|
|
91
91
|
}, [targetCellRef]);
|
|
92
92
|
const left = useMemo(() => {
|
|
@@ -7,7 +7,6 @@ import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles
|
|
|
7
7
|
import { SORTABLE_COLUMN_ICON_CLASSNAME } from '@atlaskit/editor-common/table';
|
|
8
8
|
import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT, relativeFontSizeToBase16, SelectionStyle } from '@atlaskit/editor-shared-styles';
|
|
9
9
|
import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { N0, N40A, R500 } from '@atlaskit/theme/colors';
|
|
12
11
|
import { fontSize } from '@atlaskit/theme/constants';
|
|
13
12
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -122,17 +121,6 @@ const breakoutWidthStyling = () => {
|
|
|
122
121
|
}
|
|
123
122
|
`;
|
|
124
123
|
};
|
|
125
|
-
const stickyHeaderMarginTop = () => {
|
|
126
|
-
// Exceptional case: can't add this FF to package.json as a new ratcheting rule was added to prevent new LD flags.
|
|
127
|
-
// This LD flag existed in other packages before the rule was introduced.
|
|
128
|
-
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-registration
|
|
129
|
-
if (!fg('platform.confluence.frontend.narrow-full-page-editor-toolbar')) {
|
|
130
|
-
return css`
|
|
131
|
-
margin-top: 2px;
|
|
132
|
-
`;
|
|
133
|
-
}
|
|
134
|
-
return css``;
|
|
135
|
-
};
|
|
136
124
|
const viewModeSortStyles = () => {
|
|
137
125
|
return css`
|
|
138
126
|
th {
|
|
@@ -329,9 +317,6 @@ export const baseTableStyles = props => {
|
|
|
329
317
|
/* background for where controls apply */
|
|
330
318
|
background: ${"var(--ds-surface, white)"};
|
|
331
319
|
box-sizing: content-box;
|
|
332
|
-
|
|
333
|
-
${stickyHeaderMarginTop()}
|
|
334
|
-
|
|
335
320
|
box-shadow: 0 6px 4px -4px ${`var(--ds-shadow-overflow-perimeter, ${N40A})`};
|
|
336
321
|
margin-left: -1px;
|
|
337
322
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createElement } from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
3
|
import { RawIntlProvider } from 'react-intl-next';
|
|
4
|
+
import uuid from 'uuid/v4';
|
|
4
5
|
import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
5
6
|
|
|
6
7
|
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
@@ -8,6 +9,7 @@ import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
|
8
9
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
9
10
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
10
11
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
13
|
import { TableCssClassName as ClassName, TableDecorations } from '../types';
|
|
12
14
|
import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
|
|
13
15
|
const filterDecorationByKey = (key, decorationSet) => decorationSet.find(undefined, undefined, spec => spec.key.indexOf(key) > -1);
|
|
@@ -221,7 +223,7 @@ const makeArray = n => Array.from(Array(n).keys());
|
|
|
221
223
|
* we will add a new class on the last item for each cell,
|
|
222
224
|
* hence the second media will receive this class `ClassName.LAST_ITEM_IN_CELL`
|
|
223
225
|
*/
|
|
224
|
-
export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexTarget, includeTooltip = false, getIntl) => {
|
|
226
|
+
export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexTarget, includeTooltip = false, getIntl, nodeViewPortalProviderAPI) => {
|
|
225
227
|
const emptyResult = [[], []];
|
|
226
228
|
const table = findTable(tr.selection);
|
|
227
229
|
if (!table || !table.node) {
|
|
@@ -232,21 +234,36 @@ export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexT
|
|
|
232
234
|
return emptyResult;
|
|
233
235
|
}
|
|
234
236
|
const createResizerHandleDecoration = (cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode) => {
|
|
237
|
+
const decorationRenderKey = uuid();
|
|
235
238
|
const position = cellPos + cellNode.nodeSize - 1;
|
|
236
239
|
return Decoration.widget(position, () => {
|
|
237
240
|
const element = document.createElement('div');
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
241
|
+
if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
242
|
+
nodeViewPortalProviderAPI.render(() => /*#__PURE__*/createElement(RawIntlProvider, {
|
|
243
|
+
value: getIntl()
|
|
244
|
+
}, /*#__PURE__*/createElement(ColumnResizeWidget, {
|
|
245
|
+
startIndex: cellColumnPositioning.left,
|
|
246
|
+
endIndex: cellColumnPositioning.right,
|
|
247
|
+
includeTooltip
|
|
248
|
+
})), element, decorationRenderKey);
|
|
249
|
+
} else {
|
|
250
|
+
ReactDOM.render( /*#__PURE__*/createElement(RawIntlProvider, {
|
|
251
|
+
value: getIntl()
|
|
252
|
+
}, /*#__PURE__*/createElement(ColumnResizeWidget, {
|
|
253
|
+
startIndex: cellColumnPositioning.left,
|
|
254
|
+
endIndex: cellColumnPositioning.right,
|
|
255
|
+
includeTooltip
|
|
256
|
+
})), element);
|
|
257
|
+
}
|
|
245
258
|
return element;
|
|
246
259
|
}, {
|
|
247
260
|
key: `${TableDecorations.COLUMN_RESIZING_HANDLE_WIDGET}_${rowIndex}_${columnIndex}_${includeTooltip ? 'with' : 'no'}-tooltip`,
|
|
248
261
|
destroy: node => {
|
|
249
|
-
|
|
262
|
+
if (fg('platform_editor_react18_plugin_portalprovider')) {
|
|
263
|
+
nodeViewPortalProviderAPI.remove(decorationRenderKey);
|
|
264
|
+
} else {
|
|
265
|
+
ReactDOM.unmountComponentAtNode(node);
|
|
266
|
+
}
|
|
250
267
|
}
|
|
251
268
|
});
|
|
252
269
|
};
|
|
@@ -19,7 +19,7 @@ var getTablePluginCommand = function getTablePluginCommand(actionPayload, origin
|
|
|
19
19
|
return (originalTr || tr).setMeta('addToHistory', false);
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
|
-
var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosition(rowIndex, columnIndex, nextResizeHandlePos) {
|
|
22
|
+
var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosition(rowIndex, columnIndex, nextResizeHandlePos, nodeViewPortalProviderAPI) {
|
|
23
23
|
return function (state, dispatch) {
|
|
24
24
|
var customTr = state.tr;
|
|
25
25
|
var _getPluginState = getPluginState(state),
|
|
@@ -31,7 +31,7 @@ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosi
|
|
|
31
31
|
if (!allowColumnResizing) {
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
|
-
var decorationsWithWidget = buildColumnResizingDecorations(rowIndex, columnIndex, true, getIntl)({
|
|
34
|
+
var decorationsWithWidget = buildColumnResizingDecorations(rowIndex, columnIndex, true, getIntl, nodeViewPortalProviderAPI)({
|
|
35
35
|
tr: customTr,
|
|
36
36
|
decorationSet: getDecorations(state)
|
|
37
37
|
});
|
|
@@ -63,7 +63,8 @@ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosi
|
|
|
63
63
|
};
|
|
64
64
|
export var initiateKeyboardColumnResizing = function initiateKeyboardColumnResizing(_ref) {
|
|
65
65
|
var ariaNotify = _ref.ariaNotify,
|
|
66
|
-
getIntl = _ref.getIntl
|
|
66
|
+
getIntl = _ref.getIntl,
|
|
67
|
+
nodeViewPortalProviderAPI = _ref.nodeViewPortalProviderAPI;
|
|
67
68
|
return function (state, dispatch, view) {
|
|
68
69
|
var selection = state.selection;
|
|
69
70
|
var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
@@ -74,7 +75,7 @@ export var initiateKeyboardColumnResizing = function initiateKeyboardColumnResiz
|
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
if (selectionRect && cell && view) {
|
|
77
|
-
return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
|
|
78
|
+
return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos, nodeViewPortalProviderAPI)(state, dispatch);
|
|
78
79
|
}
|
|
79
80
|
return false;
|
|
80
81
|
};
|
|
@@ -82,7 +83,8 @@ export var initiateKeyboardColumnResizing = function initiateKeyboardColumnResiz
|
|
|
82
83
|
export var activateNextResizeArea = function activateNextResizeArea(_ref2) {
|
|
83
84
|
var direction = _ref2.direction,
|
|
84
85
|
ariaNotify = _ref2.ariaNotify,
|
|
85
|
-
getIntl = _ref2.getIntl
|
|
86
|
+
getIntl = _ref2.getIntl,
|
|
87
|
+
nodeViewPortalProviderAPI = _ref2.nodeViewPortalProviderAPI;
|
|
86
88
|
return function (state, dispatch, view) {
|
|
87
89
|
var _ref3 = getTableResizingPluginState(state) || {},
|
|
88
90
|
resizeHandlePos = _ref3.resizeHandlePos;
|
|
@@ -128,17 +130,17 @@ export var activateNextResizeArea = function activateNextResizeArea(_ref2) {
|
|
|
128
130
|
// we are somewhere in between the side columns of the table
|
|
129
131
|
var offset = $nextCell.pos - $nextCell.start(-1);
|
|
130
132
|
var rectForNextCell = tableMap.findCell(offset);
|
|
131
|
-
return updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos)(state, dispatch, view);
|
|
133
|
+
return updateResizeHandleAndStatePosition(rectForNextCell.top, rectForNextCell.right, $nextCell.pos, nodeViewPortalProviderAPI)(state, dispatch, view);
|
|
132
134
|
} else {
|
|
133
135
|
// current position is in the one of the side columns of the table(left or right)
|
|
134
136
|
if (currentCellRect.left === 0) {
|
|
135
137
|
var lastCellInCurrentRow = tableMap.positionAt(currentCellRect.top, tableMap.width - 1, tableNode) + closestTable.start;
|
|
136
138
|
var $lastCell = state.doc.resolve(lastCellInCurrentRow);
|
|
137
|
-
return updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos)(state, dispatch, view);
|
|
139
|
+
return updateResizeHandleAndStatePosition(currentCellRect.top, tableMap.width, $lastCell.pos, nodeViewPortalProviderAPI)(state, dispatch, view);
|
|
138
140
|
} else if (tableMap.width === currentCellRect.right) {
|
|
139
141
|
var firsCellInCurrentRow = tableMap.positionAt(currentCellRect.top, 0, tableNode) + closestTable.start;
|
|
140
142
|
var _$nextCell = state.doc.resolve(firsCellInCurrentRow);
|
|
141
|
-
return updateResizeHandleAndStatePosition(currentCellRect.top, 1, _$nextCell.pos)(state, dispatch);
|
|
143
|
+
return updateResizeHandleAndStatePosition(currentCellRect.top, 1, _$nextCell.pos, nodeViewPortalProviderAPI)(state, dispatch);
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
146
|
return false;
|
|
@@ -462,7 +462,7 @@ export var hideInsertColumnOrRowButton = function hideInsertColumnOrRowButton()
|
|
|
462
462
|
return tr.setMeta('addToHistory', false);
|
|
463
463
|
});
|
|
464
464
|
};
|
|
465
|
-
export var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip, isKeyboardResize) {
|
|
465
|
+
export var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip, nodeViewPortalProviderAPI, isKeyboardResize) {
|
|
466
466
|
return createCommand(function (state) {
|
|
467
467
|
var tableNode = findTable(state.selection);
|
|
468
468
|
var _getPluginState3 = getPluginState(state),
|
|
@@ -474,7 +474,7 @@ export var addResizeHandleDecorations = function addResizeHandleDecorations(rowI
|
|
|
474
474
|
return {
|
|
475
475
|
type: 'ADD_RESIZE_HANDLE_DECORATIONS',
|
|
476
476
|
data: {
|
|
477
|
-
decorationSet: buildColumnResizingDecorations(rowIndex, columnIndex, includeTooltip, getIntl)({
|
|
477
|
+
decorationSet: buildColumnResizingDecorations(rowIndex, columnIndex, includeTooltip, getIntl, nodeViewPortalProviderAPI)({
|
|
478
478
|
tr: state.tr,
|
|
479
479
|
decorationSet: getDecorations(state)
|
|
480
480
|
}),
|
|
@@ -488,7 +488,7 @@ export var addResizeHandleDecorations = function addResizeHandleDecorations(rowI
|
|
|
488
488
|
return tr.setMeta('addToHistory', false);
|
|
489
489
|
});
|
|
490
490
|
};
|
|
491
|
-
export var updateResizeHandleDecorations = function updateResizeHandleDecorations(rowIndex, columnIndex, includeTooltip) {
|
|
491
|
+
export var updateResizeHandleDecorations = function updateResizeHandleDecorations(nodeViewPortalProviderAPI, rowIndex, columnIndex, includeTooltip) {
|
|
492
492
|
return createCommand(function (state) {
|
|
493
493
|
var tableNode = findTable(state.selection);
|
|
494
494
|
var _getPluginState4 = getPluginState(state),
|
|
@@ -509,7 +509,7 @@ export var updateResizeHandleDecorations = function updateResizeHandleDecoration
|
|
|
509
509
|
return {
|
|
510
510
|
type: 'UPDATE_RESIZE_HANDLE_DECORATIONS',
|
|
511
511
|
data: {
|
|
512
|
-
decorationSet: buildColumnResizingDecorations(resolvedRowIndex, resolvedColumnIndex, resolvedIncludeTooltip, getIntl)({
|
|
512
|
+
decorationSet: buildColumnResizingDecorations(resolvedRowIndex, resolvedColumnIndex, resolvedIncludeTooltip, getIntl, nodeViewPortalProviderAPI)({
|
|
513
513
|
tr: state.tr,
|
|
514
514
|
decorationSet: getDecorations(state)
|
|
515
515
|
}),
|