@atlaskit/editor-plugin-table 7.4.7 → 7.4.9
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 +12 -0
- package/dist/cjs/commands/insert.js +5 -12
- package/dist/cjs/plugin.js +17 -11
- package/dist/cjs/pm-plugins/table-width.js +53 -34
- package/dist/cjs/ui/FloatingContextualMenu/index.js +1 -1
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +13 -3
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +53 -8
- package/dist/cjs/ui/FloatingDragMenu/index.js +9 -5
- package/dist/cjs/ui/consts.js +2 -1
- package/dist/cjs/utils/create.js +28 -0
- package/dist/cjs/utils/index.js +8 -1
- package/dist/es2019/commands/insert.js +7 -14
- package/dist/es2019/plugin.js +16 -10
- package/dist/es2019/pm-plugins/table-width.js +133 -114
- package/dist/es2019/ui/FloatingContextualMenu/index.js +2 -2
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +13 -3
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +42 -8
- package/dist/es2019/ui/FloatingDragMenu/index.js +10 -6
- package/dist/es2019/ui/consts.js +1 -0
- package/dist/es2019/utils/create.js +18 -0
- package/dist/es2019/utils/index.js +2 -1
- package/dist/esm/commands/insert.js +7 -14
- package/dist/esm/plugin.js +16 -10
- package/dist/esm/pm-plugins/table-width.js +53 -34
- package/dist/esm/ui/FloatingContextualMenu/index.js +2 -2
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +13 -3
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +50 -9
- package/dist/esm/ui/FloatingDragMenu/index.js +10 -6
- package/dist/esm/ui/consts.js +1 -0
- package/dist/esm/utils/create.js +21 -0
- package/dist/esm/utils/index.js +2 -1
- package/dist/types/commands/insert.d.ts +3 -3
- package/dist/types/plugin.d.ts +4 -0
- package/dist/types/pm-plugins/table-width.d.ts +2 -1
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +6 -1
- package/dist/types/ui/FloatingDragMenu/DropdownMenu.d.ts +8 -2
- package/dist/types/ui/consts.d.ts +1 -0
- package/dist/types/utils/create.d.ts +6 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types-ts4.5/commands/insert.d.ts +3 -3
- package/dist/types-ts4.5/plugin.d.ts +4 -0
- package/dist/types-ts4.5/pm-plugins/table-width.d.ts +2 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +6 -1
- package/dist/types-ts4.5/ui/FloatingDragMenu/DropdownMenu.d.ts +8 -2
- package/dist/types-ts4.5/ui/consts.d.ts +1 -0
- package/dist/types-ts4.5/utils/create.d.ts +6 -0
- package/dist/types-ts4.5/utils/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/commands/insert.ts +35 -19
- package/src/plugin.tsx +32 -9
- package/src/pm-plugins/table-width.ts +71 -38
- package/src/ui/FloatingContextualMenu/index.tsx +2 -1
- package/src/ui/FloatingDragMenu/DragMenu.tsx +16 -1
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +94 -50
- package/src/ui/FloatingDragMenu/index.tsx +8 -3
- package/src/ui/consts.ts +1 -0
- package/src/utils/create.ts +32 -0
- package/src/utils/index.ts +1 -0
package/dist/esm/plugin.js
CHANGED
|
@@ -9,7 +9,6 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
9
9
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
10
10
|
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
11
11
|
import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
|
|
12
|
-
import { createTable } from '@atlaskit/editor-tables/utils';
|
|
13
12
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
14
13
|
import { insertTableWithSize } from './commands/insert';
|
|
15
14
|
import { pluginConfig } from './create-plugin-config';
|
|
@@ -34,7 +33,7 @@ import FloatingDeleteButton from './ui/FloatingDeleteButton';
|
|
|
34
33
|
import FloatingDragMenu from './ui/FloatingDragMenu';
|
|
35
34
|
import FloatingInsertButton from './ui/FloatingInsertButton';
|
|
36
35
|
import LayoutButton from './ui/LayoutButton';
|
|
37
|
-
import { isLayoutSupported } from './utils';
|
|
36
|
+
import { createTableWithWidth, isLayoutSupported } from './utils';
|
|
38
37
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
39
38
|
return {};
|
|
40
39
|
};
|
|
@@ -59,13 +58,19 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
59
58
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
60
59
|
return {
|
|
61
60
|
name: 'table',
|
|
61
|
+
// Use getSharedState to store fullWidthEnabled and wasFullWidthModeEnabled to guarantee access
|
|
62
|
+
// to most up to date values - passing to createPluginState will not re-initialise the state
|
|
63
|
+
getSharedState: function getSharedState() {
|
|
64
|
+
return {
|
|
65
|
+
isFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.fullWidthEnabled),
|
|
66
|
+
wasFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.wasFullWidthEnabled)
|
|
67
|
+
};
|
|
68
|
+
},
|
|
62
69
|
actions: {
|
|
63
70
|
insertTable: function insertTable(analyticsPayload) {
|
|
64
71
|
return function (state, dispatch) {
|
|
65
72
|
var _api$contentInsertion, _api$contentInsertion2;
|
|
66
|
-
var node =
|
|
67
|
-
schema: state.schema
|
|
68
|
-
});
|
|
73
|
+
var node = createTableWithWidth(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags)(state.schema);
|
|
69
74
|
return (_api$contentInsertion = api === null || api === void 0 || (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 || (_api$contentInsertion2 = _api$contentInsertion2.actions) === null || _api$contentInsertion2 === void 0 ? void 0 : _api$contentInsertion2.insert({
|
|
70
75
|
state: state,
|
|
71
76
|
dispatch: dispatch,
|
|
@@ -79,7 +84,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
79
84
|
}
|
|
80
85
|
},
|
|
81
86
|
commands: {
|
|
82
|
-
insertTableWithSize: insertTableWithSize(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
|
|
87
|
+
insertTableWithSize: insertTableWithSize(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
|
|
83
88
|
},
|
|
84
89
|
nodes: function nodes() {
|
|
85
90
|
var tableNode = options !== null && options !== void 0 && options.tableResizingEnabled ? tableWithCustomWidth : table;
|
|
@@ -201,7 +206,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
201
206
|
var _options$fullWidthEna;
|
|
202
207
|
var dispatchAnalyticsEvent = _ref12.dispatchAnalyticsEvent,
|
|
203
208
|
dispatch = _ref12.dispatch;
|
|
204
|
-
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
|
|
209
|
+
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) : undefined;
|
|
205
210
|
}
|
|
206
211
|
},
|
|
207
212
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
@@ -384,9 +389,10 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
384
389
|
return /*#__PURE__*/React.createElement(IconTable, null);
|
|
385
390
|
},
|
|
386
391
|
action: function action(insert, state) {
|
|
387
|
-
var
|
|
388
|
-
|
|
389
|
-
|
|
392
|
+
var _api$table;
|
|
393
|
+
// see comment on tablesPlugin.getSharedState on usage
|
|
394
|
+
var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
395
|
+
var tr = insert(createTableWithWidth(tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled, options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags)(state.schema));
|
|
390
396
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
391
397
|
action: ACTION.INSERTED,
|
|
392
398
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
@@ -16,8 +16,9 @@ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
|
16
16
|
import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
17
17
|
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
18
18
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
19
|
+
import { TABLE_MAX_WIDTH } from './table-resizing/utils';
|
|
19
20
|
export var pluginKey = new PluginKey('tableWidthPlugin');
|
|
20
|
-
var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullWidthEnabled) {
|
|
21
|
+
var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullWidthEnabled, getEditorFeatureFlags) {
|
|
21
22
|
return new SafePlugin({
|
|
22
23
|
key: pluginKey,
|
|
23
24
|
state: {
|
|
@@ -59,6 +60,7 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
62
|
}
|
|
63
|
+
|
|
62
64
|
// When document first load in Confluence, initially it is an empty document
|
|
63
65
|
// and Collab service triggers a transaction to replace the empty document with the real document that should be rendered.
|
|
64
66
|
// what we need to do is to add width attr to all tables in the real document
|
|
@@ -80,11 +82,15 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
80
82
|
});
|
|
81
83
|
return hasStepReplacingEntireDocument;
|
|
82
84
|
});
|
|
83
|
-
|
|
85
|
+
var referentialityTr = transactions.find(function (tr) {
|
|
86
|
+
return tr.getMeta('referentialityTableInserted');
|
|
87
|
+
});
|
|
88
|
+
var shouldPatchTable = fullWidthEnabled && getEditorFeatureFlags && getEditorFeatureFlags()['tablePreserveWidth'];
|
|
89
|
+
if (!isReplaceDocumentOperation && (!shouldPatchTable || !referentialityTr)) {
|
|
84
90
|
return null;
|
|
85
91
|
}
|
|
86
|
-
var tr = newState.tr;
|
|
87
92
|
var table = newState.schema.nodes.table;
|
|
93
|
+
var tr = newState.tr;
|
|
88
94
|
|
|
89
95
|
/**
|
|
90
96
|
* Select table event
|
|
@@ -102,40 +108,53 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
102
108
|
}
|
|
103
109
|
});
|
|
104
110
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
111
|
+
if (isReplaceDocumentOperation) {
|
|
112
|
+
newState.doc.forEach(function (node, offset) {
|
|
113
|
+
if (node.type === table) {
|
|
114
|
+
var width = node.attrs.width;
|
|
115
|
+
var layout = node.attrs.layout;
|
|
116
|
+
if (!width && layout) {
|
|
117
|
+
var tableWidthCal;
|
|
118
|
+
if (fullWidthEnabled) {
|
|
119
|
+
tableWidthCal = akEditorFullWidthLayoutWidth;
|
|
120
|
+
} else {
|
|
121
|
+
switch (layout) {
|
|
122
|
+
case 'wide':
|
|
123
|
+
tableWidthCal = akEditorWideLayoutWidth;
|
|
124
|
+
break;
|
|
125
|
+
case 'full-width':
|
|
126
|
+
tableWidthCal = akEditorFullWidthLayoutWidth;
|
|
127
|
+
break;
|
|
128
|
+
// when in fix-width appearance, no need to assign value to table width attr
|
|
129
|
+
// as when table is created, width attr is null by default, table rendered using layout attr
|
|
130
|
+
default:
|
|
131
|
+
tableWidthCal = akEditorDefaultLayoutWidth;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
var _node$attrs = node.attrs,
|
|
136
|
+
_width = _node$attrs.width,
|
|
137
|
+
rest = _objectWithoutProperties(_node$attrs, _excluded);
|
|
138
|
+
if (tableWidthCal) {
|
|
139
|
+
tr.step(new SetAttrsStep(offset, _objectSpread({
|
|
140
|
+
width: tableWidthCal
|
|
141
|
+
}, rest)));
|
|
126
142
|
}
|
|
127
|
-
}
|
|
128
|
-
var _node$attrs = node.attrs,
|
|
129
|
-
_width = _node$attrs.width,
|
|
130
|
-
rest = _objectWithoutProperties(_node$attrs, _excluded);
|
|
131
|
-
if (tableWidthCal) {
|
|
132
|
-
tr.step(new SetAttrsStep(offset, _objectSpread({
|
|
133
|
-
width: tableWidthCal
|
|
134
|
-
}, rest)));
|
|
135
143
|
}
|
|
136
144
|
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (referentialityTr) {
|
|
148
|
+
referentialityTr.steps.forEach(function (step) {
|
|
149
|
+
step.getMap().forEach(function (oldStart, oldEnd, newStart, newEnd) {
|
|
150
|
+
newState.doc.nodesBetween(newStart, newEnd, function (node, pos) {
|
|
151
|
+
if (node.type === table && node.attrs.width !== TABLE_MAX_WIDTH) {
|
|
152
|
+
tr.setNodeAttribute(pos, 'width', TABLE_MAX_WIDTH);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}
|
|
139
158
|
return tr;
|
|
140
159
|
}
|
|
141
160
|
});
|
|
@@ -5,7 +5,7 @@ import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
|
5
5
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
|
|
7
7
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
8
|
-
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize } from '../consts';
|
|
8
|
+
import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
|
|
9
9
|
import ContextualMenu from './ContextualMenu';
|
|
10
10
|
import { tablePopupStyles } from './styles';
|
|
11
11
|
var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
@@ -42,7 +42,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
42
42
|
mountTo: mountPoint,
|
|
43
43
|
boundariesElement: boundariesElement,
|
|
44
44
|
scrollableElement: scrollableElement,
|
|
45
|
-
fitHeight:
|
|
45
|
+
fitHeight: tablePopupMenuFitHeight,
|
|
46
46
|
fitWidth: isDragAndDropEnabled ? contextualMenuDropdownWidthDnD : contextualMenuDropdownWidth
|
|
47
47
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
48
48
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
@@ -174,7 +174,12 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
174
174
|
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
175
175
|
editorAnalyticsAPI = _ref.editorAnalyticsAPI,
|
|
176
176
|
pluginConfig = _ref.pluginConfig,
|
|
177
|
-
formatMessage = _ref.intl.formatMessage
|
|
177
|
+
formatMessage = _ref.intl.formatMessage,
|
|
178
|
+
fitHeight = _ref.fitHeight,
|
|
179
|
+
fitWidth = _ref.fitWidth,
|
|
180
|
+
mountPoint = _ref.mountPoint,
|
|
181
|
+
scrollableElement = _ref.scrollableElement,
|
|
182
|
+
boundariesElement = _ref.boundariesElement;
|
|
178
183
|
var state = editorView.state,
|
|
179
184
|
dispatch = editorView.dispatch;
|
|
180
185
|
var selection = state.selection;
|
|
@@ -446,12 +451,17 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
446
451
|
section: {
|
|
447
452
|
hasSeparator: true
|
|
448
453
|
},
|
|
449
|
-
target: target,
|
|
450
454
|
items: menuItems,
|
|
451
455
|
onItemActivated: handleMenuItemActivated,
|
|
452
456
|
onMouseEnter: handleItemMouseEnter,
|
|
453
457
|
onMouseLeave: handleItemMouseLeave,
|
|
454
|
-
handleClose: closeMenu
|
|
458
|
+
handleClose: closeMenu,
|
|
459
|
+
fitHeight: fitHeight,
|
|
460
|
+
fitWidth: fitWidth,
|
|
461
|
+
direction: direction,
|
|
462
|
+
mountPoint: mountPoint,
|
|
463
|
+
boundariesElement: boundariesElement,
|
|
464
|
+
scrollableElement: scrollableElement
|
|
455
465
|
});
|
|
456
466
|
});
|
|
457
467
|
export default injectIntl(DragMenu);
|
|
@@ -1,25 +1,44 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import { DropList, Popup } from '@atlaskit/editor-common/ui';
|
|
3
5
|
import { ArrowKeyNavigationProvider, ArrowKeyNavigationType, DropdownMenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
4
6
|
import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
7
|
+
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
5
8
|
import { MenuGroup, Section } from '@atlaskit/menu';
|
|
6
9
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
10
|
import { dragMenuDropdownWidth } from '../consts';
|
|
8
11
|
var DropListWithOutsideListeners = withReactEditorViewOuterListeners(DropList);
|
|
9
12
|
export var DropdownMenu = function DropdownMenu(_ref) {
|
|
10
|
-
var
|
|
11
|
-
items = _ref.items,
|
|
13
|
+
var items = _ref.items,
|
|
12
14
|
section = _ref.section,
|
|
13
15
|
disableKeyboardHandling = _ref.disableKeyboardHandling,
|
|
14
16
|
onItemActivated = _ref.onItemActivated,
|
|
15
17
|
handleClose = _ref.handleClose,
|
|
16
18
|
onMouseEnter = _ref.onMouseEnter,
|
|
17
|
-
onMouseLeave = _ref.onMouseLeave
|
|
19
|
+
onMouseLeave = _ref.onMouseLeave,
|
|
20
|
+
fitWidth = _ref.fitWidth,
|
|
21
|
+
fitHeight = _ref.fitHeight,
|
|
22
|
+
direction = _ref.direction,
|
|
23
|
+
mountPoint = _ref.mountPoint,
|
|
24
|
+
boundariesElement = _ref.boundariesElement,
|
|
25
|
+
scrollableElement = _ref.scrollableElement;
|
|
26
|
+
var _useState = useState(['bottom', 'left']),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
popupPlacement = _useState2[0],
|
|
29
|
+
setPopupPlacement = _useState2[1];
|
|
30
|
+
var _useState3 = useState(null),
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
targetRefDiv = _useState4[0],
|
|
33
|
+
setTargetRefDiv = _useState4[1];
|
|
34
|
+
var handleRef = function handleRef(ref) {
|
|
35
|
+
setTargetRefDiv(ref);
|
|
36
|
+
};
|
|
18
37
|
var innerMenu = function innerMenu() {
|
|
19
38
|
return /*#__PURE__*/React.createElement(DropListWithOutsideListeners, {
|
|
20
39
|
isOpen: true,
|
|
21
40
|
shouldFitContainer: true,
|
|
22
|
-
position:
|
|
41
|
+
position: popupPlacement.join(' '),
|
|
23
42
|
handleClickOutside: function handleClickOutside() {
|
|
24
43
|
return handleClose('editor');
|
|
25
44
|
},
|
|
@@ -34,7 +53,7 @@ export var DropdownMenu = function DropdownMenu(_ref) {
|
|
|
34
53
|
e.stopPropagation();
|
|
35
54
|
}
|
|
36
55
|
},
|
|
37
|
-
targetRef:
|
|
56
|
+
targetRef: targetRefDiv
|
|
38
57
|
}, /*#__PURE__*/React.createElement("div", {
|
|
39
58
|
style: {
|
|
40
59
|
height: 0,
|
|
@@ -63,7 +82,29 @@ export var DropdownMenu = function DropdownMenu(_ref) {
|
|
|
63
82
|
if (disableKeyboardHandling) {
|
|
64
83
|
return innerMenu();
|
|
65
84
|
}
|
|
66
|
-
|
|
85
|
+
|
|
86
|
+
// more offsets calculation as offsets depend on the direction and updated placement here
|
|
87
|
+
var offsetY = direction === 'row' ? popupPlacement[0] === 'bottom' ? -8 : -34 : 0;
|
|
88
|
+
var offsetX = direction === 'column' ? popupPlacement[1] === 'left' ? 0 : -7 : 0;
|
|
89
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
90
|
+
className: "drag-dropdown-menu-wrapper"
|
|
91
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
92
|
+
className: "drag-dropdown-menu-popup-ref",
|
|
93
|
+
ref: handleRef
|
|
94
|
+
}), /*#__PURE__*/React.createElement(Popup, {
|
|
95
|
+
target: targetRefDiv,
|
|
96
|
+
mountTo: mountPoint,
|
|
97
|
+
boundariesElement: boundariesElement,
|
|
98
|
+
scrollableElement: scrollableElement,
|
|
99
|
+
onPlacementChanged: function onPlacementChanged(placement) {
|
|
100
|
+
setPopupPlacement(placement);
|
|
101
|
+
},
|
|
102
|
+
fitHeight: fitHeight,
|
|
103
|
+
fitWidth: fitWidth,
|
|
104
|
+
zIndex: akEditorFloatingPanelZIndex,
|
|
105
|
+
offset: [offsetX, offsetY],
|
|
106
|
+
allowOutOfBounds: true // required as this popup is child of a parent popup, should be allowed to be out of bound of the parent popup, otherwise horizontal offset is not right
|
|
107
|
+
}, /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, {
|
|
67
108
|
closeOnTab: true,
|
|
68
109
|
type: ArrowKeyNavigationType.MENU,
|
|
69
110
|
onSelection: function onSelection(index) {
|
|
@@ -112,5 +153,5 @@ export var DropdownMenu = function DropdownMenu(_ref) {
|
|
|
112
153
|
});
|
|
113
154
|
}
|
|
114
155
|
}
|
|
115
|
-
}, innerMenu());
|
|
156
|
+
}, innerMenu())));
|
|
116
157
|
};
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
3
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
|
-
import { dragMenuDropdownWidth } from '../consts';
|
|
5
|
+
import { dragMenuDropdownWidth, tablePopupMenuFitHeight } from '../consts';
|
|
6
6
|
import DragMenu from './DragMenu';
|
|
7
7
|
var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
8
8
|
var mountPoint = _ref.mountPoint,
|
|
@@ -23,12 +23,10 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
23
23
|
}
|
|
24
24
|
var inStickyMode = stickyHeaders === null || stickyHeaders === void 0 ? void 0 : stickyHeaders.sticky;
|
|
25
25
|
var targetHandleRef = direction === 'row' ? document.querySelector('#drag-handle-button-row') : document.querySelector('#drag-handle-button-column');
|
|
26
|
-
var offset = direction === 'row' ? [-9,
|
|
26
|
+
var offset = direction === 'row' ? [-9, 0] : [0, -7];
|
|
27
27
|
if (!targetHandleRef || !(editorView.state.selection instanceof CellSelection)) {
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
// TODO: we will need to adjust the alignment and offset values depending on whether this is a row or column menu.
|
|
32
30
|
return /*#__PURE__*/React.createElement(Popup, {
|
|
33
31
|
alignX: direction === 'row' ? 'right' : undefined,
|
|
34
32
|
alignY: direction === 'row' ? 'start' : undefined,
|
|
@@ -36,7 +34,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
36
34
|
mountTo: mountPoint,
|
|
37
35
|
boundariesElement: boundariesElement,
|
|
38
36
|
scrollableElement: scrollableElement,
|
|
39
|
-
fitWidth: dragMenuDropdownWidth
|
|
37
|
+
fitWidth: dragMenuDropdownWidth,
|
|
38
|
+
fitHeight: tablePopupMenuFitHeight
|
|
40
39
|
// z-index value below is to ensure that this menu is above other floating menu
|
|
41
40
|
// in table, but below floating dialogs like typeaheads, pickers, etc.
|
|
42
41
|
// In sticky mode, we want to show the menu above the sticky header
|
|
@@ -55,7 +54,12 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
55
54
|
targetCellPosition: targetCellPosition,
|
|
56
55
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
57
56
|
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
58
|
-
pluginConfig: pluginConfig
|
|
57
|
+
pluginConfig: pluginConfig,
|
|
58
|
+
fitWidth: dragMenuDropdownWidth,
|
|
59
|
+
fitHeight: tablePopupMenuFitHeight,
|
|
60
|
+
mountPoint: mountPoint,
|
|
61
|
+
boundariesElement: boundariesElement,
|
|
62
|
+
scrollableElement: scrollableElement
|
|
59
63
|
}));
|
|
60
64
|
};
|
|
61
65
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -56,6 +56,7 @@ export var stickyRowOffsetTop = 8;
|
|
|
56
56
|
export var stickyHeaderBorderBottomWidth = 1;
|
|
57
57
|
export var tableOverflowShadowWidth = 8;
|
|
58
58
|
export var tableOverflowShadowWidthWide = 32;
|
|
59
|
+
export var tablePopupMenuFitHeight = 188;
|
|
59
60
|
export var dropTargetsZIndex = 14;
|
|
60
61
|
export var TABLE_SNAP_GAP = 9;
|
|
61
62
|
export var TABLE_HIGHLIGHT_GAP = 10;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
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) { _defineProperty(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; }
|
|
4
|
+
import { createTable } from '@atlaskit/editor-tables/utils';
|
|
5
|
+
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
|
|
6
|
+
export var createTableWithWidth = function createTableWithWidth(isFullWidthModeEnabled, getEditorFeatureFlags, createTableProps) {
|
|
7
|
+
return function (schema) {
|
|
8
|
+
var _ref = getEditorFeatureFlags ? getEditorFeatureFlags() : {},
|
|
9
|
+
_ref$tablePreserveWid = _ref.tablePreserveWidth,
|
|
10
|
+
tablePreserveWidth = _ref$tablePreserveWid === void 0 ? false : _ref$tablePreserveWid;
|
|
11
|
+
if (tablePreserveWidth && isFullWidthModeEnabled) {
|
|
12
|
+
return createTable(_objectSpread({
|
|
13
|
+
schema: schema,
|
|
14
|
+
tableWidth: TABLE_MAX_WIDTH
|
|
15
|
+
}, createTableProps));
|
|
16
|
+
}
|
|
17
|
+
return createTable(_objectSpread({
|
|
18
|
+
schema: schema
|
|
19
|
+
}, createTableProps));
|
|
20
|
+
};
|
|
21
|
+
};
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -8,4 +8,5 @@ export { getRowHeights, isRowDeleteButtonVisible, getRowDeleteButtonParams, getR
|
|
|
8
8
|
export { getSelectedTableInfo, getSelectedCellInfo } from './analytics';
|
|
9
9
|
export { getMergedCellsPositions } from './table';
|
|
10
10
|
export { updatePluginStateDecorations } from './update-plugin-state-decorations';
|
|
11
|
-
export { hasMergedCellsInColumn, hasMergedCellsInRow, hasMergedCellsInBetween, hasMergedCellsInSelection, findDuplicatePosition, checkEdgeHasMergedCells } from './merged-cells';
|
|
11
|
+
export { hasMergedCellsInColumn, hasMergedCellsInRow, hasMergedCellsInBetween, hasMergedCellsInSelection, findDuplicatePosition, checkEdgeHasMergedCells } from './merged-cells';
|
|
12
|
+
export { createTableWithWidth } from './create';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Command, EditorCommand, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Command, EditorCommand, GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
export declare function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
@@ -7,5 +7,5 @@ export declare const addColumnBefore: (getEditorContainerWidth: GetEditorContain
|
|
|
7
7
|
export declare const addColumnAfter: (getEditorContainerWidth: GetEditorContainerWidth) => Command;
|
|
8
8
|
export declare const insertColumn: (getEditorContainerWidth: GetEditorContainerWidth) => (column: number) => Command;
|
|
9
9
|
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
|
|
10
|
-
export declare const createTable: () => Command;
|
|
11
|
-
export declare const insertTableWithSize: (editorAnalyticsAPI
|
|
10
|
+
export declare const createTable: (isFullWidthModeEnabled?: boolean, getEditorFeatureFlags?: GetEditorFeatureFlags) => Command;
|
|
11
|
+
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, getEditorFeatureFlags?: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -23,6 +23,10 @@ export type TablePlugin = NextEditorPlugin<'table', {
|
|
|
23
23
|
actions: {
|
|
24
24
|
insertTable: InsertTableAction;
|
|
25
25
|
};
|
|
26
|
+
sharedState: {
|
|
27
|
+
isFullWidthModeEnabled: boolean;
|
|
28
|
+
wasFullWidthModeEnabled: boolean;
|
|
29
|
+
};
|
|
26
30
|
commands: {
|
|
27
31
|
insertTableWithSize: (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
28
32
|
};
|
|
@@ -6,12 +6,13 @@
|
|
|
6
6
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
8
8
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
9
|
+
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
9
10
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
10
11
|
type TableWidthPluginState = {
|
|
11
12
|
resizing: boolean;
|
|
12
13
|
};
|
|
13
14
|
export declare const pluginKey: PluginKey<TableWidthPluginState>;
|
|
14
|
-
declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, fullWidthEnabled: boolean) => SafePlugin<{
|
|
15
|
+
declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, fullWidthEnabled: boolean, getEditorFeatureFlags?: GetEditorFeatureFlags) => SafePlugin<{
|
|
15
16
|
resizing: boolean;
|
|
16
17
|
}>;
|
|
17
18
|
export { createPlugin };
|
|
@@ -19,8 +19,13 @@ type DragMenuProps = {
|
|
|
19
19
|
pluginConfig?: PluginConfig;
|
|
20
20
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
21
21
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
22
|
+
fitWidth?: number;
|
|
23
|
+
fitHeight?: number;
|
|
24
|
+
mountPoint?: HTMLElement;
|
|
25
|
+
boundariesElement?: HTMLElement;
|
|
26
|
+
scrollableElement?: HTMLElement;
|
|
22
27
|
};
|
|
23
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
28
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
24
29
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps<"intl">>> & {
|
|
25
30
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps<"intl">>;
|
|
26
31
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
3
3
|
type DropdownMenuProps = {
|
|
4
|
-
target?: HTMLElement;
|
|
5
4
|
items: Array<{
|
|
6
5
|
items: MenuItem[];
|
|
7
6
|
}>;
|
|
@@ -25,6 +24,13 @@ type DropdownMenuProps = {
|
|
|
25
24
|
onMouseLeave: (attrs: {
|
|
26
25
|
item: MenuItem;
|
|
27
26
|
}) => void;
|
|
27
|
+
fitWidth?: number;
|
|
28
|
+
fitHeight?: number;
|
|
29
|
+
direction?: string;
|
|
30
|
+
offset?: Array<number>;
|
|
31
|
+
mountPoint?: HTMLElement;
|
|
32
|
+
boundariesElement?: HTMLElement;
|
|
33
|
+
scrollableElement?: HTMLElement;
|
|
28
34
|
};
|
|
29
|
-
export declare const DropdownMenu: ({
|
|
35
|
+
export declare const DropdownMenu: ({ items, section, disableKeyboardHandling, onItemActivated, handleClose, onMouseEnter, onMouseLeave, fitWidth, fitHeight, direction, mountPoint, boundariesElement, scrollableElement, }: DropdownMenuProps) => JSX.Element;
|
|
30
36
|
export {};
|
|
@@ -47,6 +47,7 @@ export declare const stickyRowOffsetTop = 8;
|
|
|
47
47
|
export declare const stickyHeaderBorderBottomWidth = 1;
|
|
48
48
|
export declare const tableOverflowShadowWidth = 8;
|
|
49
49
|
export declare const tableOverflowShadowWidthWide = 32;
|
|
50
|
+
export declare const tablePopupMenuFitHeight = 188;
|
|
50
51
|
export declare const dropTargetsZIndex = 14;
|
|
51
52
|
export declare const TABLE_SNAP_GAP = 9;
|
|
52
53
|
export declare const TABLE_HIGHLIGHT_GAP = 10;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
+
export declare const createTableWithWidth: (isFullWidthModeEnabled?: boolean, getEditorFeatureFlags?: GetEditorFeatureFlags, createTableProps?: {
|
|
4
|
+
rowsCount?: number;
|
|
5
|
+
colsCount?: number;
|
|
6
|
+
}) => (schema: Schema) => import("prosemirror-model").Node;
|
|
@@ -10,3 +10,4 @@ export { getSelectedTableInfo, getSelectedCellInfo } from './analytics';
|
|
|
10
10
|
export { getMergedCellsPositions } from './table';
|
|
11
11
|
export { updatePluginStateDecorations } from './update-plugin-state-decorations';
|
|
12
12
|
export { hasMergedCellsInColumn, hasMergedCellsInRow, hasMergedCellsInBetween, hasMergedCellsInSelection, findDuplicatePosition, checkEdgeHasMergedCells, } from './merged-cells';
|
|
13
|
+
export { createTableWithWidth } from './create';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
import type { Command, EditorCommand, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Command, EditorCommand, GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
5
|
export declare function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
@@ -7,5 +7,5 @@ export declare const addColumnBefore: (getEditorContainerWidth: GetEditorContain
|
|
|
7
7
|
export declare const addColumnAfter: (getEditorContainerWidth: GetEditorContainerWidth) => Command;
|
|
8
8
|
export declare const insertColumn: (getEditorContainerWidth: GetEditorContainerWidth) => (column: number) => Command;
|
|
9
9
|
export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) => Command;
|
|
10
|
-
export declare const createTable: () => Command;
|
|
11
|
-
export declare const insertTableWithSize: (editorAnalyticsAPI
|
|
10
|
+
export declare const createTable: (isFullWidthModeEnabled?: boolean, getEditorFeatureFlags?: GetEditorFeatureFlags) => Command;
|
|
11
|
+
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, getEditorFeatureFlags?: GetEditorFeatureFlags, editorAnalyticsAPI?: EditorAnalyticsAPI) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
@@ -23,6 +23,10 @@ export type TablePlugin = NextEditorPlugin<'table', {
|
|
|
23
23
|
actions: {
|
|
24
24
|
insertTable: InsertTableAction;
|
|
25
25
|
};
|
|
26
|
+
sharedState: {
|
|
27
|
+
isFullWidthModeEnabled: boolean;
|
|
28
|
+
wasFullWidthModeEnabled: boolean;
|
|
29
|
+
};
|
|
26
30
|
commands: {
|
|
27
31
|
insertTableWithSize: (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
28
32
|
};
|
|
@@ -6,12 +6,13 @@
|
|
|
6
6
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
8
8
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
9
|
+
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
9
10
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
10
11
|
type TableWidthPluginState = {
|
|
11
12
|
resizing: boolean;
|
|
12
13
|
};
|
|
13
14
|
export declare const pluginKey: PluginKey<TableWidthPluginState>;
|
|
14
|
-
declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, fullWidthEnabled: boolean) => SafePlugin<{
|
|
15
|
+
declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, fullWidthEnabled: boolean, getEditorFeatureFlags?: GetEditorFeatureFlags) => SafePlugin<{
|
|
15
16
|
resizing: boolean;
|
|
16
17
|
}>;
|
|
17
18
|
export { createPlugin };
|
|
@@ -19,8 +19,13 @@ type DragMenuProps = {
|
|
|
19
19
|
pluginConfig?: PluginConfig;
|
|
20
20
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
21
21
|
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
22
|
+
fitWidth?: number;
|
|
23
|
+
fitHeight?: number;
|
|
24
|
+
mountPoint?: HTMLElement;
|
|
25
|
+
boundariesElement?: HTMLElement;
|
|
26
|
+
scrollableElement?: HTMLElement;
|
|
22
27
|
};
|
|
23
|
-
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
28
|
+
export declare const DragMenu: React.MemoExoticComponent<({ direction, index, target, isOpen, editorView, tableNode, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, fitHeight, fitWidth, mountPoint, scrollableElement, boundariesElement, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null>;
|
|
24
29
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps<"intl">>> & {
|
|
25
30
|
WrappedComponent: React.ComponentType<DragMenuProps & WrappedComponentProps<"intl">>;
|
|
26
31
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
3
3
|
type DropdownMenuProps = {
|
|
4
|
-
target?: HTMLElement;
|
|
5
4
|
items: Array<{
|
|
6
5
|
items: MenuItem[];
|
|
7
6
|
}>;
|
|
@@ -25,6 +24,13 @@ type DropdownMenuProps = {
|
|
|
25
24
|
onMouseLeave: (attrs: {
|
|
26
25
|
item: MenuItem;
|
|
27
26
|
}) => void;
|
|
27
|
+
fitWidth?: number;
|
|
28
|
+
fitHeight?: number;
|
|
29
|
+
direction?: string;
|
|
30
|
+
offset?: Array<number>;
|
|
31
|
+
mountPoint?: HTMLElement;
|
|
32
|
+
boundariesElement?: HTMLElement;
|
|
33
|
+
scrollableElement?: HTMLElement;
|
|
28
34
|
};
|
|
29
|
-
export declare const DropdownMenu: ({
|
|
35
|
+
export declare const DropdownMenu: ({ items, section, disableKeyboardHandling, onItemActivated, handleClose, onMouseEnter, onMouseLeave, fitWidth, fitHeight, direction, mountPoint, boundariesElement, scrollableElement, }: DropdownMenuProps) => JSX.Element;
|
|
30
36
|
export {};
|
|
@@ -47,6 +47,7 @@ export declare const stickyRowOffsetTop = 8;
|
|
|
47
47
|
export declare const stickyHeaderBorderBottomWidth = 1;
|
|
48
48
|
export declare const tableOverflowShadowWidth = 8;
|
|
49
49
|
export declare const tableOverflowShadowWidthWide = 32;
|
|
50
|
+
export declare const tablePopupMenuFitHeight = 188;
|
|
50
51
|
export declare const dropTargetsZIndex = 14;
|
|
51
52
|
export declare const TABLE_SNAP_GAP = 9;
|
|
52
53
|
export declare const TABLE_HIGHLIGHT_GAP = 10;
|