@atlaskit/editor-plugin-table 5.8.4 → 5.8.6
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 +13 -0
- package/dist/cjs/plugin.js +2 -2
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +28 -12
- package/dist/cjs/ui/FloatingContextualMenu/styles.js +4 -3
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +6 -6
- package/dist/cjs/ui/FloatingDragMenu/styles.js +5 -4
- package/dist/es2019/plugin.js +2 -2
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +29 -13
- package/dist/es2019/ui/FloatingContextualMenu/styles.js +4 -0
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +7 -7
- package/dist/es2019/ui/FloatingDragMenu/styles.js +4 -0
- package/dist/esm/plugin.js +2 -2
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +29 -13
- package/dist/esm/ui/FloatingContextualMenu/styles.js +3 -2
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +7 -7
- package/dist/esm/ui/FloatingDragMenu/styles.js +4 -3
- package/dist/types/ui/FloatingContextualMenu/styles.d.ts +1 -0
- package/dist/types/ui/FloatingDragMenu/styles.d.ts +1 -0
- package/dist/types-ts4.5/ui/FloatingContextualMenu/styles.d.ts +1 -0
- package/dist/types-ts4.5/ui/FloatingDragMenu/styles.d.ts +1 -0
- package/package.json +2 -2
- package/src/plugin.tsx +1 -1
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +40 -24
- package/src/ui/FloatingContextualMenu/styles.ts +5 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +9 -10
- package/src/ui/FloatingDragMenu/styles.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 5.8.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#67239](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67239) [`4b543688dfcb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4b543688dfcb) - [ux] ED-21242: Fixed some menu item not full visible on drag menu"
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 5.8.5
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#67238](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/67238) [`40533849b2ec`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/40533849b2ec) - [ED-21835] Change EditorAPI type to always union with undefined
|
|
15
|
+
|
|
3
16
|
## 5.8.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -57,11 +57,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
57
57
|
current: null
|
|
58
58
|
};
|
|
59
59
|
var defaultGetEditorContainerWidth = function defaultGetEditorContainerWidth() {
|
|
60
|
-
var _document$body$offset, _document, _api$width$sharedStat;
|
|
60
|
+
var _document$body$offset, _document, _api$width$sharedStat, _api$width;
|
|
61
61
|
var defaultState = {
|
|
62
62
|
width: (_document$body$offset = (_document = document) === null || _document === void 0 || (_document = _document.body) === null || _document === void 0 ? void 0 : _document.offsetWidth) !== null && _document$body$offset !== void 0 ? _document$body$offset : 500
|
|
63
63
|
};
|
|
64
|
-
return (_api$width$sharedStat = api === null || api === void 0 ? void 0 :
|
|
64
|
+
return (_api$width$sharedStat = api === null || api === void 0 || (_api$width = api.width) === null || _api$width === void 0 ? void 0 : _api$width.sharedState.currentState()) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : defaultState;
|
|
65
65
|
};
|
|
66
66
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
67
67
|
return {
|
|
@@ -89,10 +89,12 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
89
89
|
value: {
|
|
90
90
|
name: 'background'
|
|
91
91
|
},
|
|
92
|
-
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)(
|
|
92
|
+
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
|
|
93
|
+
css: _styles2.elementBeforeIconStyles
|
|
94
|
+
}, (0, _react2.jsx)(_backgroundColor.default, {
|
|
93
95
|
label: formatMessage(_messages.tableMessages.backgroundColor),
|
|
94
96
|
size: "medium"
|
|
95
|
-
}) : undefined,
|
|
97
|
+
})) : undefined,
|
|
96
98
|
elemAfter: (0, _react2.jsx)("div", {
|
|
97
99
|
className: _styles.DropdownMenuSharedCssClassName.SUBMENU
|
|
98
100
|
}, (0, _react2.jsx)("div", {
|
|
@@ -129,14 +131,18 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
129
131
|
name: 'merge'
|
|
130
132
|
},
|
|
131
133
|
isDisabled: !(0, _transforms.canMergeCells)(state.tr),
|
|
132
|
-
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)(
|
|
134
|
+
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
|
|
135
|
+
css: _styles2.elementBeforeIconStyles
|
|
136
|
+
}, (0, _react2.jsx)(_icons.MergeCellsIcon, null)) : undefined
|
|
133
137
|
}, {
|
|
134
138
|
content: formatMessage(_messages.tableMessages.splitCell),
|
|
135
139
|
value: {
|
|
136
140
|
name: 'split'
|
|
137
141
|
},
|
|
138
142
|
isDisabled: !(0, _utils2.splitCell)(state),
|
|
139
|
-
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)(
|
|
143
|
+
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
|
|
144
|
+
css: _styles2.elementBeforeIconStyles
|
|
145
|
+
}, (0, _react2.jsx)(_icons.SplitCellIcon, null)) : undefined
|
|
140
146
|
}];
|
|
141
147
|
}
|
|
142
148
|
return [];
|
|
@@ -155,7 +161,9 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
155
161
|
elemAfter: (0, _react2.jsx)("div", {
|
|
156
162
|
css: _shortcut.shortcutStyle
|
|
157
163
|
}, (0, _keymaps.tooltip)(_keymaps.addColumnAfter)),
|
|
158
|
-
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)(
|
|
164
|
+
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
|
|
165
|
+
css: _styles2.elementBeforeIconStyles
|
|
166
|
+
}, (0, _react2.jsx)(_icons.AddColRightIcon, null)) : undefined
|
|
159
167
|
};
|
|
160
168
|
});
|
|
161
169
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createInsertRowItem", function () {
|
|
@@ -172,7 +180,9 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
172
180
|
elemAfter: (0, _react2.jsx)("div", {
|
|
173
181
|
css: _shortcut.shortcutStyle
|
|
174
182
|
}, (0, _keymaps.tooltip)(_keymaps.addRowAfter)),
|
|
175
|
-
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)(
|
|
183
|
+
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
|
|
184
|
+
css: _styles2.elementBeforeIconStyles
|
|
185
|
+
}, (0, _react2.jsx)(_icons.AddRowBelowIcon, null)) : undefined
|
|
176
186
|
};
|
|
177
187
|
});
|
|
178
188
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createClearCellsItem", function () {
|
|
@@ -198,11 +208,13 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
198
208
|
elemAfter: (0, _react2.jsx)("div", {
|
|
199
209
|
css: _shortcut.shortcutStyle
|
|
200
210
|
}, (0, _keymaps.tooltip)(_keymaps.backspace)),
|
|
201
|
-
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)(
|
|
211
|
+
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
|
|
212
|
+
css: _styles2.elementBeforeIconStyles
|
|
213
|
+
}, (0, _react2.jsx)(_crossCircle.default, {
|
|
202
214
|
label: formatMessage(_messages.tableMessages.clearCells, {
|
|
203
215
|
0: Math.max(noOfColumns, noOfRows)
|
|
204
216
|
})
|
|
205
|
-
}) : undefined
|
|
217
|
+
})) : undefined
|
|
206
218
|
};
|
|
207
219
|
});
|
|
208
220
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createDeleteColumnItem", function () {
|
|
@@ -222,11 +234,13 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
222
234
|
value: {
|
|
223
235
|
name: 'delete_column'
|
|
224
236
|
},
|
|
225
|
-
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)(
|
|
237
|
+
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
|
|
238
|
+
css: _styles2.elementBeforeIconStyles
|
|
239
|
+
}, (0, _react2.jsx)(_remove.default, {
|
|
226
240
|
label: formatMessage(_messages.tableMessages.removeColumns, {
|
|
227
241
|
0: noOfColumns
|
|
228
242
|
})
|
|
229
|
-
}) : undefined
|
|
243
|
+
})) : undefined
|
|
230
244
|
};
|
|
231
245
|
});
|
|
232
246
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createDeleteRowItem", function () {
|
|
@@ -246,11 +260,13 @@ var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component)
|
|
|
246
260
|
value: {
|
|
247
261
|
name: 'delete_row'
|
|
248
262
|
},
|
|
249
|
-
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)(
|
|
263
|
+
elemBefore: isDragAndDropEnabled && (0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.new-cell-context-menu-styling') ? (0, _react2.jsx)("span", {
|
|
264
|
+
css: _styles2.elementBeforeIconStyles
|
|
265
|
+
}, (0, _react2.jsx)(_remove.default, {
|
|
250
266
|
label: formatMessage(_messages.tableMessages.removeRows, {
|
|
251
267
|
0: noOfRows
|
|
252
268
|
})
|
|
253
|
-
}) : undefined
|
|
269
|
+
})) : undefined
|
|
254
270
|
};
|
|
255
271
|
});
|
|
256
272
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "createDistributeColumnsItem", function () {
|
|
@@ -4,18 +4,19 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.tablePopupStyles = exports.cellColourPreviewStyles = void 0;
|
|
7
|
+
exports.tablePopupStyles = exports.elementBeforeIconStyles = exports.cellColourPreviewStyles = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
12
|
var _types = require("../../types");
|
|
13
13
|
var _consts = require("../consts");
|
|
14
|
-
var _templateObject, _templateObject2;
|
|
14
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
15
15
|
var cellColourPreviewStyles = exports.cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
|
|
16
16
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &::before {\n background: ", ";\n }\n"])), selectedColor);
|
|
17
17
|
};
|
|
18
|
+
var elementBeforeIconStyles = exports.elementBeforeIconStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin-right: ", ";\n display: flex;\n"])), "var(--ds-space-negative-075, -6px)");
|
|
18
19
|
|
|
19
20
|
// TODO Delete this comment after verifying space token -> previous value `padding: 8px`
|
|
20
21
|
// TODO Delete this comment after verifying space token -> previous value `margin-left: 4px`
|
|
21
|
-
var tablePopupStyles = exports.tablePopupStyles = (0, _react.css)(
|
|
22
|
+
var tablePopupStyles = exports.tablePopupStyles = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n display: block;\n position: absolute;\n top: 0;\n left: ", "px;\n padding: ", ";\n\n > div {\n padding: 0;\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", ";\n width: 20px;\n height: 20px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 20px;\n color: ", ";\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", ";\n width: 14px;\n height: 14px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 14px;\n color: ", ";\n }\n }\n"])), _types.TableCssClassName.CONTEXTUAL_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N60A, ", 0 0 1px ").concat(_colors.N60A), ")"), _consts.contextualMenuDropdownWidth, "var(--ds-space-100, 8px)", _types.TableCssClassName.CONTEXTUAL_MENU_ICON, _adfSchema.tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(_colors.N90, ")"), _types.TableCssClassName.CONTEXTUAL_MENU_ICON_SMALL, _adfSchema.tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(_colors.N90, ")"));
|
|
@@ -143,10 +143,8 @@ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, for
|
|
|
143
143
|
name: item.id
|
|
144
144
|
},
|
|
145
145
|
isDisabled: item.disabled,
|
|
146
|
-
elemBefore: item.icon ? (0, _react2.jsx)("
|
|
147
|
-
|
|
148
|
-
display: 'flex'
|
|
149
|
-
}
|
|
146
|
+
elemBefore: item.icon ? (0, _react2.jsx)("span", {
|
|
147
|
+
css: _styles2.elementBeforeIconStyles
|
|
150
148
|
}, (0, _react2.jsx)(item.icon, {
|
|
151
149
|
label: formatMessage(MapDragMenuOptionIdToMessage[item.id].message, options)
|
|
152
150
|
})) : undefined,
|
|
@@ -232,10 +230,12 @@ var DragMenu = exports.DragMenu = function DragMenu(_ref) {
|
|
|
232
230
|
value: {
|
|
233
231
|
name: 'background'
|
|
234
232
|
},
|
|
235
|
-
elemBefore: (0, _react2.jsx)(
|
|
233
|
+
elemBefore: (0, _react2.jsx)("span", {
|
|
234
|
+
css: _styles2.elementBeforeIconStyles
|
|
235
|
+
}, (0, _react2.jsx)(_backgroundColor.default, {
|
|
236
236
|
label: formatMessage(_messages.tableMessages.backgroundColor),
|
|
237
237
|
size: "medium"
|
|
238
|
-
}),
|
|
238
|
+
})),
|
|
239
239
|
elemAfter: (0, _react2.jsx)("div", {
|
|
240
240
|
className: _styles.DropdownMenuSharedCssClassName.SUBMENU,
|
|
241
241
|
css: _styles2.dragMenuBackgroundColorStyles
|
|
@@ -4,16 +4,17 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.toggleStyles = exports.dragMenuBackgroundColorStyles = exports.cellColourPreviewStyles = void 0;
|
|
7
|
+
exports.toggleStyles = exports.elementBeforeIconStyles = exports.dragMenuBackgroundColorStyles = exports.cellColourPreviewStyles = void 0;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
12
|
var _types = require("../../types");
|
|
13
13
|
var _consts = require("../consts");
|
|
14
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
14
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
15
15
|
var cellColourPreviewStyles = exports.cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
|
|
16
16
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &::before {\n background: ", ";\n }\n"])), selectedColor);
|
|
17
17
|
};
|
|
18
|
-
var
|
|
19
|
-
var
|
|
18
|
+
var elementBeforeIconStyles = exports.elementBeforeIconStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin-right: ", ";\n display: flex;\n"])), "var(--ds-space-negative-075, -6px)");
|
|
19
|
+
var dragMenuBackgroundColorStyles = exports.dragMenuBackgroundColorStyles = (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n display: block;\n position: absolute;\n top: 0;\n left: ", "px;\n padding: ", ";\n\n > div {\n padding: 0;\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", ";\n width: 14px;\n height: 14px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 14px;\n color: ", ";\n }\n }\n"])), _types.TableCssClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N60A, ", 0 0 1px ").concat(_colors.N60A), ")"), _consts.dragMenuDropdownWidth, "var(--ds-space-100, 8px)", _types.TableCssClassName.DRAG_SUBMENU_ICON, _adfSchema.tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(_colors.N90, ")"));
|
|
20
|
+
var toggleStyles = exports.toggleStyles = (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n input[type='checkbox'] {\n width: 30px;\n height: 14px;\n pointer-events: initial;\n cursor: pointer;\n }\n > label {\n margin: 0px;\n pointer-events: none;\n > span {\n pointer-events: none;\n }\n }\n"])));
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -49,11 +49,11 @@ const tablesPlugin = ({
|
|
|
49
49
|
current: null
|
|
50
50
|
};
|
|
51
51
|
const defaultGetEditorContainerWidth = () => {
|
|
52
|
-
var _document$body$offset, _document, _document$body, _api$width$sharedStat;
|
|
52
|
+
var _document$body$offset, _document, _document$body, _api$width$sharedStat, _api$width;
|
|
53
53
|
const defaultState = {
|
|
54
54
|
width: (_document$body$offset = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) !== null && _document$body$offset !== void 0 ? _document$body$offset : 500
|
|
55
55
|
};
|
|
56
|
-
return (_api$width$sharedStat = api === null || api === void 0 ? void 0 : api.width.sharedState.currentState()) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : defaultState;
|
|
56
|
+
return (_api$width$sharedStat = api === null || api === void 0 ? void 0 : (_api$width = api.width) === null || _api$width === void 0 ? void 0 : _api$width.sharedState.currentState()) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : defaultState;
|
|
57
57
|
};
|
|
58
58
|
const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
59
59
|
return {
|
|
@@ -28,7 +28,7 @@ import { TableCssClassName as ClassName } from '../../types';
|
|
|
28
28
|
import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes } from '../../utils';
|
|
29
29
|
import { contextualMenuDropdownWidth } from '../consts';
|
|
30
30
|
import { AddColRightIcon, AddRowBelowIcon, MergeCellsIcon, SplitCellIcon } from '../icons';
|
|
31
|
-
import { cellColourPreviewStyles } from './styles';
|
|
31
|
+
import { cellColourPreviewStyles, elementBeforeIconStyles } from './styles';
|
|
32
32
|
export class ContextualMenu extends Component {
|
|
33
33
|
constructor(...args) {
|
|
34
34
|
super(...args);
|
|
@@ -74,10 +74,12 @@ export class ContextualMenu extends Component {
|
|
|
74
74
|
value: {
|
|
75
75
|
name: 'background'
|
|
76
76
|
},
|
|
77
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
77
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
78
|
+
css: elementBeforeIconStyles
|
|
79
|
+
}, jsx(EditorBackgroundColorIcon, {
|
|
78
80
|
label: formatMessage(messages.backgroundColor),
|
|
79
81
|
size: "medium"
|
|
80
|
-
}) : undefined,
|
|
82
|
+
})) : undefined,
|
|
81
83
|
elemAfter: jsx("div", {
|
|
82
84
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
83
85
|
}, jsx("div", {
|
|
@@ -120,14 +122,18 @@ export class ContextualMenu extends Component {
|
|
|
120
122
|
name: 'merge'
|
|
121
123
|
},
|
|
122
124
|
isDisabled: !canMergeCells(state.tr),
|
|
123
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
125
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
126
|
+
css: elementBeforeIconStyles
|
|
127
|
+
}, jsx(MergeCellsIcon, null)) : undefined
|
|
124
128
|
}, {
|
|
125
129
|
content: formatMessage(messages.splitCell),
|
|
126
130
|
value: {
|
|
127
131
|
name: 'split'
|
|
128
132
|
},
|
|
129
133
|
isDisabled: !splitCell(state),
|
|
130
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
134
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
135
|
+
css: elementBeforeIconStyles
|
|
136
|
+
}, jsx(SplitCellIcon, null)) : undefined
|
|
131
137
|
}];
|
|
132
138
|
}
|
|
133
139
|
return [];
|
|
@@ -150,7 +156,9 @@ export class ContextualMenu extends Component {
|
|
|
150
156
|
elemAfter: jsx("div", {
|
|
151
157
|
css: shortcutStyle
|
|
152
158
|
}, tooltip(addColumnAfter)),
|
|
153
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
159
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
160
|
+
css: elementBeforeIconStyles
|
|
161
|
+
}, jsx(AddColRightIcon, null)) : undefined
|
|
154
162
|
};
|
|
155
163
|
});
|
|
156
164
|
_defineProperty(this, "createInsertRowItem", () => {
|
|
@@ -171,7 +179,9 @@ export class ContextualMenu extends Component {
|
|
|
171
179
|
elemAfter: jsx("div", {
|
|
172
180
|
css: shortcutStyle
|
|
173
181
|
}, tooltip(addRowAfter)),
|
|
174
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
182
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
183
|
+
css: elementBeforeIconStyles
|
|
184
|
+
}, jsx(AddRowBelowIcon, null)) : undefined
|
|
175
185
|
};
|
|
176
186
|
});
|
|
177
187
|
_defineProperty(this, "createClearCellsItem", () => {
|
|
@@ -203,11 +213,13 @@ export class ContextualMenu extends Component {
|
|
|
203
213
|
elemAfter: jsx("div", {
|
|
204
214
|
css: shortcutStyle
|
|
205
215
|
}, tooltip(backspace)),
|
|
206
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
216
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
217
|
+
css: elementBeforeIconStyles
|
|
218
|
+
}, jsx(CrossCircleIcon, {
|
|
207
219
|
label: formatMessage(messages.clearCells, {
|
|
208
220
|
0: Math.max(noOfColumns, noOfRows)
|
|
209
221
|
})
|
|
210
|
-
}) : undefined
|
|
222
|
+
})) : undefined
|
|
211
223
|
};
|
|
212
224
|
});
|
|
213
225
|
_defineProperty(this, "createDeleteColumnItem", () => {
|
|
@@ -233,11 +245,13 @@ export class ContextualMenu extends Component {
|
|
|
233
245
|
value: {
|
|
234
246
|
name: 'delete_column'
|
|
235
247
|
},
|
|
236
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
248
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
249
|
+
css: elementBeforeIconStyles
|
|
250
|
+
}, jsx(RemoveIcon, {
|
|
237
251
|
label: formatMessage(messages.removeColumns, {
|
|
238
252
|
0: noOfColumns
|
|
239
253
|
})
|
|
240
|
-
}) : undefined
|
|
254
|
+
})) : undefined
|
|
241
255
|
};
|
|
242
256
|
});
|
|
243
257
|
_defineProperty(this, "createDeleteRowItem", () => {
|
|
@@ -263,11 +277,13 @@ export class ContextualMenu extends Component {
|
|
|
263
277
|
value: {
|
|
264
278
|
name: 'delete_row'
|
|
265
279
|
},
|
|
266
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
280
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
281
|
+
css: elementBeforeIconStyles
|
|
282
|
+
}, jsx(RemoveIcon, {
|
|
267
283
|
label: formatMessage(messages.removeRows, {
|
|
268
284
|
0: noOfRows
|
|
269
285
|
})
|
|
270
|
-
}) : undefined
|
|
286
|
+
})) : undefined
|
|
271
287
|
};
|
|
272
288
|
});
|
|
273
289
|
_defineProperty(this, "createDistributeColumnsItem", () => {
|
|
@@ -8,6 +8,10 @@ export const cellColourPreviewStyles = selectedColor => css`
|
|
|
8
8
|
background: ${selectedColor};
|
|
9
9
|
}
|
|
10
10
|
`;
|
|
11
|
+
export const elementBeforeIconStyles = css`
|
|
12
|
+
margin-right: ${"var(--ds-space-negative-075, -6px)"};
|
|
13
|
+
display: flex;
|
|
14
|
+
`;
|
|
11
15
|
|
|
12
16
|
// TODO Delete this comment after verifying space token -> previous value `padding: 8px`
|
|
13
17
|
// TODO Delete this comment after verifying space token -> previous value `margin-left: 4px`
|
|
@@ -25,7 +25,7 @@ import { TableCssClassName as ClassName } from '../../types';
|
|
|
25
25
|
import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes, hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
|
|
26
26
|
import { getDragMenuConfig } from '../../utils/drag-menu';
|
|
27
27
|
import { dragMenuDropdownWidth } from '../consts';
|
|
28
|
-
import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, toggleStyles } from './styles';
|
|
28
|
+
import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, elementBeforeIconStyles, toggleStyles } from './styles';
|
|
29
29
|
const MapDragMenuOptionIdToMessage = {
|
|
30
30
|
add_row_above: {
|
|
31
31
|
message: messages.addRowAbove,
|
|
@@ -131,10 +131,8 @@ const convertToDropdownItems = (dragMenuConfig, formatMessage, selectionRect) =>
|
|
|
131
131
|
name: item.id
|
|
132
132
|
},
|
|
133
133
|
isDisabled: item.disabled,
|
|
134
|
-
elemBefore: item.icon ? jsx("
|
|
135
|
-
|
|
136
|
-
display: 'flex'
|
|
137
|
-
}
|
|
134
|
+
elemBefore: item.icon ? jsx("span", {
|
|
135
|
+
css: elementBeforeIconStyles
|
|
138
136
|
}, jsx(item.icon, {
|
|
139
137
|
label: formatMessage(MapDragMenuOptionIdToMessage[item.id].message, options)
|
|
140
138
|
})) : undefined,
|
|
@@ -228,10 +226,12 @@ export const DragMenu = ({
|
|
|
228
226
|
value: {
|
|
229
227
|
name: 'background'
|
|
230
228
|
},
|
|
231
|
-
elemBefore: jsx(
|
|
229
|
+
elemBefore: jsx("span", {
|
|
230
|
+
css: elementBeforeIconStyles
|
|
231
|
+
}, jsx(EditorBackgroundColorIcon, {
|
|
232
232
|
label: formatMessage(messages.backgroundColor),
|
|
233
233
|
size: "medium"
|
|
234
|
-
}),
|
|
234
|
+
})),
|
|
235
235
|
elemAfter: jsx("div", {
|
|
236
236
|
className: DropdownMenuSharedCssClassName.SUBMENU,
|
|
237
237
|
css: dragMenuBackgroundColorStyles
|
|
@@ -8,6 +8,10 @@ export const cellColourPreviewStyles = selectedColor => css`
|
|
|
8
8
|
background: ${selectedColor};
|
|
9
9
|
}
|
|
10
10
|
`;
|
|
11
|
+
export const elementBeforeIconStyles = css`
|
|
12
|
+
margin-right: ${"var(--ds-space-negative-075, -6px)"};
|
|
13
|
+
display: flex;
|
|
14
|
+
`;
|
|
11
15
|
export const dragMenuBackgroundColorStyles = css`
|
|
12
16
|
.${ClassName.DRAG_SUBMENU} {
|
|
13
17
|
border-radius: ${"var(--ds-border-radius, 3px)"};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -50,11 +50,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
50
50
|
current: null
|
|
51
51
|
};
|
|
52
52
|
var defaultGetEditorContainerWidth = function defaultGetEditorContainerWidth() {
|
|
53
|
-
var _document$body$offset, _document, _api$width$sharedStat;
|
|
53
|
+
var _document$body$offset, _document, _api$width$sharedStat, _api$width;
|
|
54
54
|
var defaultState = {
|
|
55
55
|
width: (_document$body$offset = (_document = document) === null || _document === void 0 || (_document = _document.body) === null || _document === void 0 ? void 0 : _document.offsetWidth) !== null && _document$body$offset !== void 0 ? _document$body$offset : 500
|
|
56
56
|
};
|
|
57
|
-
return (_api$width$sharedStat = api === null || api === void 0 ? void 0 :
|
|
57
|
+
return (_api$width$sharedStat = api === null || api === void 0 || (_api$width = api.width) === null || _api$width === void 0 ? void 0 : _api$width.sharedState.currentState()) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : defaultState;
|
|
58
58
|
};
|
|
59
59
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
60
60
|
return {
|
|
@@ -39,7 +39,7 @@ import { TableCssClassName as ClassName } from '../../types';
|
|
|
39
39
|
import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes } from '../../utils';
|
|
40
40
|
import { contextualMenuDropdownWidth } from '../consts';
|
|
41
41
|
import { AddColRightIcon, AddRowBelowIcon, MergeCellsIcon, SplitCellIcon } from '../icons';
|
|
42
|
-
import { cellColourPreviewStyles } from './styles';
|
|
42
|
+
import { cellColourPreviewStyles, elementBeforeIconStyles } from './styles';
|
|
43
43
|
export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
44
44
|
_inherits(ContextualMenu, _Component);
|
|
45
45
|
var _super = _createSuper(ContextualMenu);
|
|
@@ -84,10 +84,12 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
84
84
|
value: {
|
|
85
85
|
name: 'background'
|
|
86
86
|
},
|
|
87
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
87
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
88
|
+
css: elementBeforeIconStyles
|
|
89
|
+
}, jsx(EditorBackgroundColorIcon, {
|
|
88
90
|
label: formatMessage(messages.backgroundColor),
|
|
89
91
|
size: "medium"
|
|
90
|
-
}) : undefined,
|
|
92
|
+
})) : undefined,
|
|
91
93
|
elemAfter: jsx("div", {
|
|
92
94
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
93
95
|
}, jsx("div", {
|
|
@@ -124,14 +126,18 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
124
126
|
name: 'merge'
|
|
125
127
|
},
|
|
126
128
|
isDisabled: !canMergeCells(state.tr),
|
|
127
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
129
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
130
|
+
css: elementBeforeIconStyles
|
|
131
|
+
}, jsx(MergeCellsIcon, null)) : undefined
|
|
128
132
|
}, {
|
|
129
133
|
content: formatMessage(messages.splitCell),
|
|
130
134
|
value: {
|
|
131
135
|
name: 'split'
|
|
132
136
|
},
|
|
133
137
|
isDisabled: !splitCell(state),
|
|
134
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
138
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
139
|
+
css: elementBeforeIconStyles
|
|
140
|
+
}, jsx(SplitCellIcon, null)) : undefined
|
|
135
141
|
}];
|
|
136
142
|
}
|
|
137
143
|
return [];
|
|
@@ -150,7 +156,9 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
150
156
|
elemAfter: jsx("div", {
|
|
151
157
|
css: shortcutStyle
|
|
152
158
|
}, tooltip(addColumnAfter)),
|
|
153
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
159
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
160
|
+
css: elementBeforeIconStyles
|
|
161
|
+
}, jsx(AddColRightIcon, null)) : undefined
|
|
154
162
|
};
|
|
155
163
|
});
|
|
156
164
|
_defineProperty(_assertThisInitialized(_this), "createInsertRowItem", function () {
|
|
@@ -167,7 +175,9 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
167
175
|
elemAfter: jsx("div", {
|
|
168
176
|
css: shortcutStyle
|
|
169
177
|
}, tooltip(addRowAfter)),
|
|
170
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
178
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
179
|
+
css: elementBeforeIconStyles
|
|
180
|
+
}, jsx(AddRowBelowIcon, null)) : undefined
|
|
171
181
|
};
|
|
172
182
|
});
|
|
173
183
|
_defineProperty(_assertThisInitialized(_this), "createClearCellsItem", function () {
|
|
@@ -193,11 +203,13 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
193
203
|
elemAfter: jsx("div", {
|
|
194
204
|
css: shortcutStyle
|
|
195
205
|
}, tooltip(backspace)),
|
|
196
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
206
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
207
|
+
css: elementBeforeIconStyles
|
|
208
|
+
}, jsx(CrossCircleIcon, {
|
|
197
209
|
label: formatMessage(messages.clearCells, {
|
|
198
210
|
0: Math.max(noOfColumns, noOfRows)
|
|
199
211
|
})
|
|
200
|
-
}) : undefined
|
|
212
|
+
})) : undefined
|
|
201
213
|
};
|
|
202
214
|
});
|
|
203
215
|
_defineProperty(_assertThisInitialized(_this), "createDeleteColumnItem", function () {
|
|
@@ -217,11 +229,13 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
217
229
|
value: {
|
|
218
230
|
name: 'delete_column'
|
|
219
231
|
},
|
|
220
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
232
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
233
|
+
css: elementBeforeIconStyles
|
|
234
|
+
}, jsx(RemoveIcon, {
|
|
221
235
|
label: formatMessage(messages.removeColumns, {
|
|
222
236
|
0: noOfColumns
|
|
223
237
|
})
|
|
224
|
-
}) : undefined
|
|
238
|
+
})) : undefined
|
|
225
239
|
};
|
|
226
240
|
});
|
|
227
241
|
_defineProperty(_assertThisInitialized(_this), "createDeleteRowItem", function () {
|
|
@@ -241,11 +255,13 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
241
255
|
value: {
|
|
242
256
|
name: 'delete_row'
|
|
243
257
|
},
|
|
244
|
-
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx(
|
|
258
|
+
elemBefore: isDragAndDropEnabled && getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? jsx("span", {
|
|
259
|
+
css: elementBeforeIconStyles
|
|
260
|
+
}, jsx(RemoveIcon, {
|
|
245
261
|
label: formatMessage(messages.removeRows, {
|
|
246
262
|
0: noOfRows
|
|
247
263
|
})
|
|
248
|
-
}) : undefined
|
|
264
|
+
})) : undefined
|
|
249
265
|
};
|
|
250
266
|
});
|
|
251
267
|
_defineProperty(_assertThisInitialized(_this), "createDistributeColumnsItem", function () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
5
5
|
import { N60A, N90 } from '@atlaskit/theme/colors';
|
|
@@ -8,7 +8,8 @@ import { contextualMenuDropdownWidth } from '../consts';
|
|
|
8
8
|
export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
|
|
9
9
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &::before {\n background: ", ";\n }\n"])), selectedColor);
|
|
10
10
|
};
|
|
11
|
+
export var elementBeforeIconStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: ", ";\n display: flex;\n"])), "var(--ds-space-negative-075, -6px)");
|
|
11
12
|
|
|
12
13
|
// TODO Delete this comment after verifying space token -> previous value `padding: 8px`
|
|
13
14
|
// TODO Delete this comment after verifying space token -> previous value `margin-left: 4px`
|
|
14
|
-
export var tablePopupStyles = css(
|
|
15
|
+
export var tablePopupStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", " {\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n display: block;\n position: absolute;\n top: 0;\n left: ", "px;\n padding: ", ";\n\n > div {\n padding: 0;\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", ";\n width: 20px;\n height: 20px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 20px;\n color: ", ";\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", ";\n width: 14px;\n height: 14px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 14px;\n color: ", ";\n }\n }\n"])), ClassName.CONTEXTUAL_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), contextualMenuDropdownWidth, "var(--ds-space-100, 8px)", ClassName.CONTEXTUAL_MENU_ICON, tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"), ClassName.CONTEXTUAL_MENU_ICON_SMALL, tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"));
|
|
@@ -27,7 +27,7 @@ import { TableCssClassName as ClassName } from '../../types';
|
|
|
27
27
|
import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes, hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils';
|
|
28
28
|
import { getDragMenuConfig } from '../../utils/drag-menu';
|
|
29
29
|
import { dragMenuDropdownWidth } from '../consts';
|
|
30
|
-
import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, toggleStyles } from './styles';
|
|
30
|
+
import { cellColourPreviewStyles, dragMenuBackgroundColorStyles, elementBeforeIconStyles, toggleStyles } from './styles';
|
|
31
31
|
var MapDragMenuOptionIdToMessage = {
|
|
32
32
|
add_row_above: {
|
|
33
33
|
message: messages.addRowAbove,
|
|
@@ -135,10 +135,8 @@ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig, for
|
|
|
135
135
|
name: item.id
|
|
136
136
|
},
|
|
137
137
|
isDisabled: item.disabled,
|
|
138
|
-
elemBefore: item.icon ? jsx("
|
|
139
|
-
|
|
140
|
-
display: 'flex'
|
|
141
|
-
}
|
|
138
|
+
elemBefore: item.icon ? jsx("span", {
|
|
139
|
+
css: elementBeforeIconStyles
|
|
142
140
|
}, jsx(item.icon, {
|
|
143
141
|
label: formatMessage(MapDragMenuOptionIdToMessage[item.id].message, options)
|
|
144
142
|
})) : undefined,
|
|
@@ -224,10 +222,12 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
224
222
|
value: {
|
|
225
223
|
name: 'background'
|
|
226
224
|
},
|
|
227
|
-
elemBefore: jsx(
|
|
225
|
+
elemBefore: jsx("span", {
|
|
226
|
+
css: elementBeforeIconStyles
|
|
227
|
+
}, jsx(EditorBackgroundColorIcon, {
|
|
228
228
|
label: formatMessage(messages.backgroundColor),
|
|
229
229
|
size: "medium"
|
|
230
|
-
}),
|
|
230
|
+
})),
|
|
231
231
|
elemAfter: jsx("div", {
|
|
232
232
|
className: DropdownMenuSharedCssClassName.SUBMENU,
|
|
233
233
|
css: dragMenuBackgroundColorStyles
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { tableBackgroundBorderColor } from '@atlaskit/adf-schema';
|
|
5
5
|
import { N60A, N90 } from '@atlaskit/theme/colors';
|
|
@@ -8,5 +8,6 @@ import { dragMenuDropdownWidth } from '../consts';
|
|
|
8
8
|
export var cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
|
|
9
9
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &::before {\n background: ", ";\n }\n"])), selectedColor);
|
|
10
10
|
};
|
|
11
|
-
export var
|
|
12
|
-
export var
|
|
11
|
+
export var elementBeforeIconStyles = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-right: ", ";\n display: flex;\n"])), "var(--ds-space-negative-075, -6px)");
|
|
12
|
+
export var dragMenuBackgroundColorStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .", " {\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n display: block;\n position: absolute;\n top: 0;\n left: ", "px;\n padding: ", ";\n\n > div {\n padding: 0;\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", ";\n width: 14px;\n height: 14px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 14px;\n color: ", ";\n }\n }\n"])), ClassName.DRAG_SUBMENU, "var(--ds-border-radius, 3px)", "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(N60A, ", 0 0 1px ").concat(N60A), ")"), dragMenuDropdownWidth, "var(--ds-space-100, 8px)", ClassName.DRAG_SUBMENU_ICON, tableBackgroundBorderColor, "var(--ds-border-radius, 3px)", "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(N90, ")"));
|
|
13
|
+
export var toggleStyles = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n input[type='checkbox'] {\n width: 30px;\n height: 14px;\n pointer-events: initial;\n cursor: pointer;\n }\n > label {\n margin: 0px;\n pointer-events: none;\n > span {\n pointer-events: none;\n }\n }\n"])));
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
|
|
2
|
+
export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
|
|
2
3
|
export declare const tablePopupStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
|
|
2
|
+
export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
|
|
2
3
|
export declare const dragMenuBackgroundColorStyles: import("@emotion/react").SerializedStyles;
|
|
3
4
|
export declare const toggleStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
|
|
2
|
+
export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
|
|
2
3
|
export declare const tablePopupStyles: import("@emotion/react").SerializedStyles;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
|
|
2
|
+
export declare const elementBeforeIconStyles: import("@emotion/react").SerializedStyles;
|
|
2
3
|
export declare const dragMenuBackgroundColorStyles: import("@emotion/react").SerializedStyles;
|
|
3
4
|
export declare const toggleStyles: import("@emotion/react").SerializedStyles;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "5.8.
|
|
3
|
+
"version": "5.8.6",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^35.3.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.0.11",
|
|
33
|
-
"@atlaskit/editor-common": "^76.
|
|
33
|
+
"@atlaskit/editor-common": "^76.40.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.5.2",
|
|
35
35
|
"@atlaskit/editor-plugin-analytics": "^0.4.0",
|
|
36
36
|
"@atlaskit/editor-plugin-content-insertion": "^0.1.0",
|
package/src/plugin.tsx
CHANGED
|
@@ -136,7 +136,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
136
136
|
const defaultState = {
|
|
137
137
|
width: document?.body?.offsetWidth ?? 500,
|
|
138
138
|
};
|
|
139
|
-
return api?.width
|
|
139
|
+
return api?.width?.sharedState.currentState() ?? defaultState;
|
|
140
140
|
};
|
|
141
141
|
const editorAnalyticsAPI = api?.analytics?.actions;
|
|
142
142
|
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
SplitCellIcon,
|
|
82
82
|
} from '../icons';
|
|
83
83
|
|
|
84
|
-
import { cellColourPreviewStyles } from './styles';
|
|
84
|
+
import { cellColourPreviewStyles, elementBeforeIconStyles } from './styles';
|
|
85
85
|
|
|
86
86
|
export interface Props {
|
|
87
87
|
editorView: EditorView;
|
|
@@ -210,10 +210,12 @@ export class ContextualMenu extends Component<
|
|
|
210
210
|
getBooleanFF(
|
|
211
211
|
'platform.editor.table.new-cell-context-menu-styling',
|
|
212
212
|
) ? (
|
|
213
|
-
<
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
<span css={elementBeforeIconStyles}>
|
|
214
|
+
<EditorBackgroundColorIcon
|
|
215
|
+
label={formatMessage(messages.backgroundColor)}
|
|
216
|
+
size="medium"
|
|
217
|
+
/>
|
|
218
|
+
</span>
|
|
217
219
|
) : undefined,
|
|
218
220
|
elemAfter: (
|
|
219
221
|
<div className={DropdownMenuSharedCssClassName.SUBMENU}>
|
|
@@ -272,7 +274,9 @@ export class ContextualMenu extends Component<
|
|
|
272
274
|
getBooleanFF(
|
|
273
275
|
'platform.editor.table.new-cell-context-menu-styling',
|
|
274
276
|
) ? (
|
|
275
|
-
<
|
|
277
|
+
<span css={elementBeforeIconStyles}>
|
|
278
|
+
<MergeCellsIcon />
|
|
279
|
+
</span>
|
|
276
280
|
) : undefined,
|
|
277
281
|
},
|
|
278
282
|
{
|
|
@@ -284,7 +288,9 @@ export class ContextualMenu extends Component<
|
|
|
284
288
|
getBooleanFF(
|
|
285
289
|
'platform.editor.table.new-cell-context-menu-styling',
|
|
286
290
|
) ? (
|
|
287
|
-
<
|
|
291
|
+
<span css={elementBeforeIconStyles}>
|
|
292
|
+
<SplitCellIcon />
|
|
293
|
+
</span>
|
|
288
294
|
) : undefined,
|
|
289
295
|
},
|
|
290
296
|
] as MenuItem[];
|
|
@@ -311,7 +317,9 @@ export class ContextualMenu extends Component<
|
|
|
311
317
|
elemBefore:
|
|
312
318
|
isDragAndDropEnabled &&
|
|
313
319
|
getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? (
|
|
314
|
-
<
|
|
320
|
+
<span css={elementBeforeIconStyles}>
|
|
321
|
+
<AddColRightIcon />
|
|
322
|
+
</span>
|
|
315
323
|
) : undefined,
|
|
316
324
|
} as MenuItem;
|
|
317
325
|
};
|
|
@@ -335,7 +343,9 @@ export class ContextualMenu extends Component<
|
|
|
335
343
|
elemBefore:
|
|
336
344
|
isDragAndDropEnabled &&
|
|
337
345
|
getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? (
|
|
338
|
-
<
|
|
346
|
+
<span css={elementBeforeIconStyles}>
|
|
347
|
+
<AddRowBelowIcon />
|
|
348
|
+
</span>
|
|
339
349
|
) : undefined,
|
|
340
350
|
} as MenuItem;
|
|
341
351
|
};
|
|
@@ -360,11 +370,13 @@ export class ContextualMenu extends Component<
|
|
|
360
370
|
elemBefore:
|
|
361
371
|
isDragAndDropEnabled &&
|
|
362
372
|
getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? (
|
|
363
|
-
<
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
373
|
+
<span css={elementBeforeIconStyles}>
|
|
374
|
+
<CrossCircleIcon
|
|
375
|
+
label={formatMessage(messages.clearCells, {
|
|
376
|
+
0: Math.max(noOfColumns, noOfRows),
|
|
377
|
+
})}
|
|
378
|
+
/>
|
|
379
|
+
</span>
|
|
368
380
|
) : undefined,
|
|
369
381
|
} as MenuItem;
|
|
370
382
|
};
|
|
@@ -388,11 +400,13 @@ export class ContextualMenu extends Component<
|
|
|
388
400
|
elemBefore:
|
|
389
401
|
isDragAndDropEnabled &&
|
|
390
402
|
getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? (
|
|
391
|
-
<
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
403
|
+
<span css={elementBeforeIconStyles}>
|
|
404
|
+
<RemoveIcon
|
|
405
|
+
label={formatMessage(messages.removeColumns, {
|
|
406
|
+
0: noOfColumns,
|
|
407
|
+
})}
|
|
408
|
+
/>
|
|
409
|
+
</span>
|
|
396
410
|
) : undefined,
|
|
397
411
|
} as MenuItem;
|
|
398
412
|
};
|
|
@@ -416,11 +430,13 @@ export class ContextualMenu extends Component<
|
|
|
416
430
|
elemBefore:
|
|
417
431
|
isDragAndDropEnabled &&
|
|
418
432
|
getBooleanFF('platform.editor.table.new-cell-context-menu-styling') ? (
|
|
419
|
-
<
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
433
|
+
<span css={elementBeforeIconStyles}>
|
|
434
|
+
<RemoveIcon
|
|
435
|
+
label={formatMessage(messages.removeRows, {
|
|
436
|
+
0: noOfRows,
|
|
437
|
+
})}
|
|
438
|
+
/>
|
|
439
|
+
</span>
|
|
424
440
|
) : undefined,
|
|
425
441
|
} as MenuItem;
|
|
426
442
|
};
|
|
@@ -13,6 +13,11 @@ export const cellColourPreviewStyles = (selectedColor: string) => css`
|
|
|
13
13
|
}
|
|
14
14
|
`;
|
|
15
15
|
|
|
16
|
+
export const elementBeforeIconStyles = css`
|
|
17
|
+
margin-right: ${token('space.negative.075', '-6px')};
|
|
18
|
+
display: flex;
|
|
19
|
+
`;
|
|
20
|
+
|
|
16
21
|
// TODO Delete this comment after verifying space token -> previous value `padding: 8px`
|
|
17
22
|
// TODO Delete this comment after verifying space token -> previous value `margin-left: 4px`
|
|
18
23
|
export const tablePopupStyles = css`
|
|
@@ -77,6 +77,7 @@ import { dragMenuDropdownWidth } from '../consts';
|
|
|
77
77
|
import {
|
|
78
78
|
cellColourPreviewStyles,
|
|
79
79
|
dragMenuBackgroundColorStyles,
|
|
80
|
+
elementBeforeIconStyles,
|
|
80
81
|
toggleStyles,
|
|
81
82
|
} from './styles';
|
|
82
83
|
|
|
@@ -230,18 +231,14 @@ const convertToDropdownItems = (
|
|
|
230
231
|
value: { name: item.id },
|
|
231
232
|
isDisabled: item.disabled,
|
|
232
233
|
elemBefore: item.icon ? (
|
|
233
|
-
<
|
|
234
|
-
style={{
|
|
235
|
-
display: 'flex',
|
|
236
|
-
}}
|
|
237
|
-
>
|
|
234
|
+
<span css={elementBeforeIconStyles}>
|
|
238
235
|
<item.icon
|
|
239
236
|
label={formatMessage(
|
|
240
237
|
MapDragMenuOptionIdToMessage[item.id].message,
|
|
241
238
|
options,
|
|
242
239
|
)}
|
|
243
240
|
/>
|
|
244
|
-
</
|
|
241
|
+
</span>
|
|
245
242
|
) : undefined,
|
|
246
243
|
elemAfter: item.keymap ? (
|
|
247
244
|
<div css={shortcutStyle}>{item.keymap}</div>
|
|
@@ -349,10 +346,12 @@ export const DragMenu = ({
|
|
|
349
346
|
content: formatMessage(messages.backgroundColor),
|
|
350
347
|
value: { name: 'background' },
|
|
351
348
|
elemBefore: (
|
|
352
|
-
<
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
349
|
+
<span css={elementBeforeIconStyles}>
|
|
350
|
+
<EditorBackgroundColorIcon
|
|
351
|
+
label={formatMessage(messages.backgroundColor)}
|
|
352
|
+
size="medium"
|
|
353
|
+
/>
|
|
354
|
+
</span>
|
|
356
355
|
),
|
|
357
356
|
elemAfter: (
|
|
358
357
|
<div
|
|
@@ -13,6 +13,11 @@ export const cellColourPreviewStyles = (selectedColor: string) => css`
|
|
|
13
13
|
}
|
|
14
14
|
`;
|
|
15
15
|
|
|
16
|
+
export const elementBeforeIconStyles = css`
|
|
17
|
+
margin-right: ${token('space.negative.075', '-6px')};
|
|
18
|
+
display: flex;
|
|
19
|
+
`;
|
|
20
|
+
|
|
16
21
|
export const dragMenuBackgroundColorStyles = css`
|
|
17
22
|
.${ClassName.DRAG_SUBMENU} {
|
|
18
23
|
border-radius: ${token('border.radius', '3px')};
|