@atlaskit/editor-plugin-table 15.2.2 → 15.3.0
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 +20 -0
- package/dist/cjs/nodeviews/TableComponentLegacy.js +5 -1
- package/dist/cjs/nodeviews/TableComponentNext.js +5 -2
- package/dist/cjs/nodeviews/TableResizer.js +4 -2
- package/dist/cjs/pm-plugins/drag-and-drop/utils/getDragBehaviour.js +3 -1
- package/dist/cjs/pm-plugins/keymap.js +2 -3
- package/dist/cjs/pm-plugins/main.js +4 -1
- package/dist/cjs/tablePlugin.js +7 -6
- package/dist/cjs/ui/DragHandle/index.js +4 -2
- package/dist/cjs/ui/TableFloatingControls/index.js +5 -2
- package/dist/cjs/ui/common-styles.js +2 -1
- package/dist/es2019/nodeviews/TableComponentLegacy.js +6 -2
- package/dist/es2019/nodeviews/TableComponentNext.js +6 -3
- package/dist/es2019/nodeviews/TableResizer.js +3 -1
- package/dist/es2019/pm-plugins/drag-and-drop/utils/getDragBehaviour.js +3 -1
- package/dist/es2019/pm-plugins/keymap.js +3 -4
- package/dist/es2019/pm-plugins/main.js +4 -1
- package/dist/es2019/tablePlugin.js +8 -7
- package/dist/es2019/ui/DragHandle/index.js +3 -1
- package/dist/es2019/ui/TableFloatingControls/index.js +4 -1
- package/dist/es2019/ui/common-styles.js +2 -1
- package/dist/esm/nodeviews/TableComponentLegacy.js +6 -2
- package/dist/esm/nodeviews/TableComponentNext.js +6 -3
- package/dist/esm/nodeviews/TableResizer.js +3 -1
- package/dist/esm/pm-plugins/drag-and-drop/utils/getDragBehaviour.js +3 -1
- package/dist/esm/pm-plugins/keymap.js +3 -4
- package/dist/esm/pm-plugins/main.js +4 -1
- package/dist/esm/tablePlugin.js +8 -7
- package/dist/esm/ui/DragHandle/index.js +3 -1
- package/dist/esm/ui/TableFloatingControls/index.js +4 -1
- package/dist/esm/ui/common-styles.js +2 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 15.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`0ec7ab64eb92d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0ec7ab64eb92d) -
|
|
8
|
+
Remove remaining usages of `platform_editor_use_nested_table_pm_nodes` which are safe to remove.
|
|
9
|
+
Additional usages will be replaced with a helper function in followup releases
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 15.2.3
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`14a03e6be917d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/14a03e6be917d) -
|
|
20
|
+
upgrade use of browser util
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 15.2.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -18,6 +18,7 @@ var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
|
18
18
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
19
19
|
var _reactIntlNext = require("react-intl-next");
|
|
20
20
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
21
|
+
var _browser = require("@atlaskit/editor-common/browser");
|
|
21
22
|
var _collab = require("@atlaskit/editor-common/collab");
|
|
22
23
|
var _nesting = require("@atlaskit/editor-common/nesting");
|
|
23
24
|
var _nodeVisibility = require("@atlaskit/editor-common/node-visibility");
|
|
@@ -58,7 +59,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
58
59
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
59
60
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // Ignored via go/ees005
|
|
60
61
|
// eslint-disable-next-line import/no-named-as-default
|
|
61
|
-
var isIE11 = _utils.browser.ie_version === 11;
|
|
62
62
|
// When table is inserted via paste, keyboard shortcut or quickInsert,
|
|
63
63
|
// componentDidUpdate is called multiple times. The isOverflowing value is correct only on the last update.
|
|
64
64
|
// To make sure we capture the last update, we use setTimeout.
|
|
@@ -464,6 +464,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
464
464
|
eventDispatcher = _this$props7.eventDispatcher,
|
|
465
465
|
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
|
|
466
466
|
getNode = _this$props7.getNode;
|
|
467
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
468
|
+
var isIE11 = browser.ie_version === 11;
|
|
467
469
|
|
|
468
470
|
// Ignored via go/ees005
|
|
469
471
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -546,6 +548,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
546
548
|
isDragAndDropEnabled = _this$props8.isDragAndDropEnabled,
|
|
547
549
|
view = _this$props8.view,
|
|
548
550
|
isInDanger = _this$props8.isInDanger;
|
|
551
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
552
|
+
var isIE11 = browser.ie_version === 11;
|
|
549
553
|
if (this.wrapper && !isIE11) {
|
|
550
554
|
// Ignored via go/ees005
|
|
551
555
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -16,6 +16,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
16
16
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
17
17
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
18
18
|
var _reactIntlNext = require("react-intl-next");
|
|
19
|
+
var _browser = require("@atlaskit/editor-common/browser");
|
|
19
20
|
var _collab = require("@atlaskit/editor-common/collab");
|
|
20
21
|
var _nesting = require("@atlaskit/editor-common/nesting");
|
|
21
22
|
var _nodeVisibility = require("@atlaskit/editor-common/node-visibility");
|
|
@@ -53,8 +54,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
53
54
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
54
55
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // Ignored via go/ees005
|
|
55
56
|
// eslint-disable-next-line import/no-named-as-default
|
|
56
|
-
var isIE11 = _utils.browser.ie_version === 11;
|
|
57
|
-
|
|
58
57
|
// Prevent unnecessary parentWidth updates when table is nested inside of a node that is nested itself.
|
|
59
58
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
60
59
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
@@ -406,6 +405,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
406
405
|
eventDispatcher = _this$props6.eventDispatcher,
|
|
407
406
|
isDragAndDropEnabled = _this$props6.isDragAndDropEnabled,
|
|
408
407
|
getNode = _this$props6.getNode;
|
|
408
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
409
|
+
var isIE11 = browser.ie_version === 11;
|
|
409
410
|
|
|
410
411
|
// Ignored via go/ees005
|
|
411
412
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -484,6 +485,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
484
485
|
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
|
|
485
486
|
view = _this$props7.view,
|
|
486
487
|
isInDanger = _this$props7.isInDanger;
|
|
488
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
489
|
+
var isIE11 = browser.ie_version === 11;
|
|
487
490
|
if (this.wrapper && !isIE11) {
|
|
488
491
|
// Ignored via go/ees005
|
|
489
492
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -436,7 +436,8 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
436
436
|
}, [editorView]);
|
|
437
437
|
var handleKeyDown = (0, _react.useCallback)(function (event) {
|
|
438
438
|
var isBracketKey = event.code === 'BracketRight' || event.code === 'BracketLeft';
|
|
439
|
-
var
|
|
439
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
440
|
+
var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
440
441
|
if (event.altKey || metaKey || event.shiftKey) {
|
|
441
442
|
areResizeMetaKeysPressed.current = true;
|
|
442
443
|
}
|
|
@@ -461,7 +462,8 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
461
462
|
}
|
|
462
463
|
var resizeHandleThumbEl = resizerRef.current.getResizerThumbEl();
|
|
463
464
|
var globalKeyDownHandler = function globalKeyDownHandler(event) {
|
|
464
|
-
var
|
|
465
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
466
|
+
var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
465
467
|
if (!isTableSelected) {
|
|
466
468
|
return;
|
|
467
469
|
}
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getDragBehaviour = void 0;
|
|
7
7
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
8
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
9
|
var getDragBehaviour = exports.getDragBehaviour = function getDragBehaviour(_ref) {
|
|
9
10
|
var altKey = _ref.altKey,
|
|
10
11
|
ctrlKey = _ref.ctrlKey;
|
|
11
|
-
var
|
|
12
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
13
|
+
var isCloneModifierKeyPressed = browser.mac ? altKey : ctrlKey;
|
|
12
14
|
return isCloneModifierKeyPressed ? 'clone' : 'move';
|
|
13
15
|
};
|
|
@@ -10,7 +10,6 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
10
10
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
11
11
|
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
12
12
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _commandsWithAnalytics = require("../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
15
14
|
var _commands2 = require("./commands");
|
|
16
15
|
var _columnResize = require("./commands/column-resize");
|
|
@@ -42,7 +41,7 @@ function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, e
|
|
|
42
41
|
(0, _keymaps.bindKeymapWithCommand)(
|
|
43
42
|
// Ignored via go/ees005
|
|
44
43
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
45
|
-
_keymaps.toggleTable.common, (0,
|
|
44
|
+
_keymaps.toggleTable.common, (0, _preset.editorCommandToPMCommand)((0, _insert.insertTableWithNestingSupport)({
|
|
46
45
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
47
46
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
48
47
|
isFullWidthModeEnabled: !!isFullWidthEnabled,
|
|
@@ -57,7 +56,7 @@ function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, e
|
|
|
57
56
|
inputMethod: _analytics.INPUT_METHOD.SHORTCUT
|
|
58
57
|
},
|
|
59
58
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
60
|
-
}))
|
|
59
|
+
})), list);
|
|
61
60
|
(0, _keymaps.bindKeymapWithCommand)(
|
|
62
61
|
// Ignored via go/ees005
|
|
63
62
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createPlugin = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
+
var _browser = require("@atlaskit/editor-common/browser");
|
|
10
11
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
11
12
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
12
13
|
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
@@ -15,6 +16,7 @@ var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
|
15
16
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
16
17
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
17
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
20
|
var _tableNodeViews = require("../nodeviews/table-node-views");
|
|
19
21
|
var _plugin = require("../pm-plugins/decorations/plugin");
|
|
20
22
|
var _types = require("../types");
|
|
@@ -252,6 +254,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
252
254
|
var state = _ref2.state,
|
|
253
255
|
dispatch = _ref2.dispatch;
|
|
254
256
|
var decorationSet = _plugin.pluginKey.getState(state);
|
|
257
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
255
258
|
if ((0, _decoration.findControlsHoverDecoration)(decorationSet).length) {
|
|
256
259
|
(0, _commands.clearHoverSelection)()(state, dispatch);
|
|
257
260
|
}
|
|
@@ -259,7 +262,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
259
262
|
// ED-6069: workaround for Chrome given a regression introduced in prosemirror-view@1.6.8
|
|
260
263
|
// Returning true prevents that updateSelection() is getting called in the commit below:
|
|
261
264
|
// @see https://github.com/ProseMirror/prosemirror-view/commit/33fe4a8b01584f6b4103c279033dcd33e8047b95
|
|
262
|
-
if (
|
|
265
|
+
if (browser.chrome && event.target) {
|
|
263
266
|
// Ignored via go/ees005
|
|
264
267
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
265
268
|
var targetClassList = event.target.classList;
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -65,7 +65,7 @@ var TABLE_WIDTH_INFO_TIMEOUT = 10000;
|
|
|
65
65
|
* from `@atlaskit/editor-core`.
|
|
66
66
|
*/
|
|
67
67
|
var tablePlugin = function tablePlugin(_ref) {
|
|
68
|
-
var _api$analytics, _options$getEditorFea, _options$getEditorFea2
|
|
68
|
+
var _api$analytics, _options$getEditorFea, _options$getEditorFea2;
|
|
69
69
|
var options = _ref.config,
|
|
70
70
|
api = _ref.api;
|
|
71
71
|
var editorViewRef = {
|
|
@@ -145,7 +145,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
145
145
|
insertTable: function insertTable(analyticsPayload) {
|
|
146
146
|
return function (state, dispatch) {
|
|
147
147
|
var _options$tableOptions;
|
|
148
|
-
if (options !== null && options !== void 0 && (_options$tableOptions = options.tableOptions) !== null && _options$tableOptions !== void 0 && _options$tableOptions.allowNestedTables
|
|
148
|
+
if (options !== null && options !== void 0 && (_options$tableOptions = options.tableOptions) !== null && _options$tableOptions !== void 0 && _options$tableOptions.allowNestedTables) {
|
|
149
149
|
return (0, _preset.editorCommandToPMCommand)((0, _insert.insertTableWithNestingSupport)({
|
|
150
150
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
151
151
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
@@ -182,7 +182,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
182
182
|
}
|
|
183
183
|
},
|
|
184
184
|
commands: {
|
|
185
|
-
insertTableWithSize:
|
|
185
|
+
insertTableWithSize: function insertTableWithSize(rowsCount, colsCount, inputMethod) {
|
|
186
186
|
return (0, _insert.insertTableWithNestingSupport)({
|
|
187
187
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
188
188
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
@@ -205,7 +205,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
205
205
|
},
|
|
206
206
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
207
207
|
});
|
|
208
|
-
}
|
|
208
|
+
}
|
|
209
209
|
},
|
|
210
210
|
nodes: function nodes() {
|
|
211
211
|
var _options$tableOptions2, _options$getEditorFea3;
|
|
@@ -469,10 +469,11 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
469
469
|
return isTableSelectorEnabled ? (0, _tableSizeSelector.createPlugin)(dispatch) : undefined;
|
|
470
470
|
}
|
|
471
471
|
}];
|
|
472
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
472
473
|
|
|
473
474
|
// Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
|
|
474
475
|
// https://github.com/ProseMirror/prosemirror/issues/934
|
|
475
|
-
if (
|
|
476
|
+
if (browser.safari) {
|
|
476
477
|
plugins.push({
|
|
477
478
|
name: 'tableSafariDeleteCompositionTextIssueWorkaround',
|
|
478
479
|
plugin: function plugin() {
|
|
@@ -537,7 +538,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
537
538
|
var tableNode = (0, _create.createTableWithWidth)(tableNodeProps)(state.schema);
|
|
538
539
|
var tr = state.tr;
|
|
539
540
|
// If the cursor is inside a table
|
|
540
|
-
if ((0, _utils.hasParentNodeOfType)(state.schema.nodes.table)(state.selection) && options !== null && options !== void 0 && (_options$tableOptions6 = options.tableOptions) !== null && _options$tableOptions6 !== void 0 && _options$tableOptions6.allowNestedTables
|
|
541
|
+
if ((0, _utils.hasParentNodeOfType)(state.schema.nodes.table)(state.selection) && options !== null && options !== void 0 && (_options$tableOptions6 = options.tableOptions) !== null && _options$tableOptions6 !== void 0 && _options$tableOptions6.allowNestedTables) {
|
|
541
542
|
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
542
543
|
if ((0, _experiments.editorExperiment)('nested-tables-in-tables', false, {
|
|
543
544
|
exposure: true
|
|
@@ -118,6 +118,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
118
118
|
};
|
|
119
119
|
(0, _react.useEffect)(function () {
|
|
120
120
|
var dragHandleDivRefCurrent = dragHandleDivRef.current;
|
|
121
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
121
122
|
if (dragHandleDivRefCurrent) {
|
|
122
123
|
return (0, _adapter.draggable)({
|
|
123
124
|
element: dragHandleDivRefCurrent,
|
|
@@ -137,7 +138,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
137
138
|
getOffset: function getOffset(_ref3) {
|
|
138
139
|
var container = _ref3.container;
|
|
139
140
|
var rect = container.getBoundingClientRect();
|
|
140
|
-
if (
|
|
141
|
+
if (browser.safari) {
|
|
141
142
|
// See: https://product-fabric.atlassian.net/browse/ED-21442
|
|
142
143
|
// We need to ensure that the preview is not overlaying screen content when the snapshot is taken, otherwise
|
|
143
144
|
// safari will composite the screen text elements into the bitmap snapshot. The container is a wrapper which is already
|
|
@@ -172,6 +173,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
172
173
|
}
|
|
173
174
|
}, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells]);
|
|
174
175
|
var showDragMenuAnchorId = isRow ? 'drag-handle-button-row' : 'drag-handle-button-column';
|
|
176
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
175
177
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
|
|
176
178
|
type: "button"
|
|
177
179
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -248,7 +250,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
248
250
|
}
|
|
249
251
|
}, appearance !== 'placeholder' ?
|
|
250
252
|
// cannot block pointer events in Firefox as it breaks Dragging functionality
|
|
251
|
-
|
|
253
|
+
browser.gecko ?
|
|
252
254
|
/*#__PURE__*/
|
|
253
255
|
// Ignored via go/ees005
|
|
254
256
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
@@ -10,6 +10,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
10
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
11
11
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
12
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
14
|
var _commands = require("../../pm-plugins/commands");
|
|
14
15
|
var _nodes = require("../../pm-plugins/utils/nodes");
|
|
15
16
|
var _types = require("../../types");
|
|
@@ -42,7 +43,8 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
42
43
|
var _selectRow = (0, _react.useCallback)(function (row, expand) {
|
|
43
44
|
var state = editorView.state,
|
|
44
45
|
dispatch = editorView.dispatch;
|
|
45
|
-
|
|
46
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
47
|
+
if (browser.ie_version === 11) {
|
|
46
48
|
// Ignored via go/ees005
|
|
47
49
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
48
50
|
editorView.dom.blur();
|
|
@@ -52,7 +54,8 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
52
54
|
var _selectRows = (0, _react.useCallback)(function (rowIndexes) {
|
|
53
55
|
var state = editorView.state,
|
|
54
56
|
dispatch = editorView.dispatch;
|
|
55
|
-
|
|
57
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
58
|
+
if (browser.ie_version === 11) {
|
|
56
59
|
// Ignored via go/ees005
|
|
57
60
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
58
61
|
editorView.dom.blur();
|
|
@@ -56,12 +56,13 @@ var tableStickyHeaderColumnControlsDecorationsStyle = function tableStickyHeader
|
|
|
56
56
|
return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n\t\t.", " .", " {\n\t\t\tz-index: 0;\n\t\t\tleft: -1px;\n\t\t}\n\n\t\t.", " .", "::after {\n\t\t\tborder-left: 1px solid ", ";\n\t\t}\n\n\t\t.", " tr:first-of-type th.", " {\n\t\t\t&.", ", &.", " {\n\t\t\t\t.", "::after {\n\t\t\t\t\tleft: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t"])), _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _consts2.tableBorderColor, _types.TableCssClassName.TABLE_STICKY, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_COLUMN, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS);
|
|
57
57
|
};
|
|
58
58
|
var tableStickyHeaderFirefoxFixStyle = function tableStickyHeaderFirefoxFixStyle() {
|
|
59
|
+
var browser = (0, _expValEquals.expValEquals)('platform_editor_hydratable_ui', 'isEnabled', true) ? (0, _browser.getBrowserInfo)() : _browser.browser;
|
|
59
60
|
/*
|
|
60
61
|
This is MAGIC!
|
|
61
62
|
This fixes a bug which occurs in firefox when the first row becomes sticky.
|
|
62
63
|
see https://product-fabric.atlassian.net/browse/ED-19177
|
|
63
64
|
*/
|
|
64
|
-
if (
|
|
65
|
+
if (browser.gecko) {
|
|
65
66
|
return (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\t.", " > tbody::before {\n\t\t\t\tcontent: '';\n\t\t\t}\n\t\t"])), _types.TableCssClassName.TABLE_STICKY);
|
|
66
67
|
}
|
|
67
68
|
};
|
|
@@ -5,12 +5,13 @@ import memoizeOne from 'memoize-one';
|
|
|
5
5
|
import rafSchedule from 'raf-schd';
|
|
6
6
|
import { injectIntl } from 'react-intl-next';
|
|
7
7
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
8
9
|
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
9
10
|
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
10
11
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
11
12
|
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
12
13
|
import { tableMarginSides } from '@atlaskit/editor-common/styles';
|
|
13
|
-
import {
|
|
14
|
+
import { isValidPosition } from '@atlaskit/editor-common/utils';
|
|
14
15
|
import { akEditorTableNumberColumnWidth, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
15
16
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
16
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -39,7 +40,6 @@ import { ExternalDropTargets } from './ExternalDropTargets';
|
|
|
39
40
|
import { OverflowShadowsObserver } from './OverflowShadowsObserver';
|
|
40
41
|
import { TableContainer } from './TableContainer';
|
|
41
42
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
42
|
-
const isIE11 = browser.ie_version === 11;
|
|
43
43
|
// When table is inserted via paste, keyboard shortcut or quickInsert,
|
|
44
44
|
// componentDidUpdate is called multiple times. The isOverflowing value is correct only on the last update.
|
|
45
45
|
// To make sure we capture the last update, we use setTimeout.
|
|
@@ -448,6 +448,8 @@ class TableComponent extends React.Component {
|
|
|
448
448
|
isDragAndDropEnabled,
|
|
449
449
|
getNode
|
|
450
450
|
} = this.props;
|
|
451
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
452
|
+
const isIE11 = browser.ie_version === 11;
|
|
451
453
|
|
|
452
454
|
// Ignored via go/ees005
|
|
453
455
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -520,6 +522,8 @@ class TableComponent extends React.Component {
|
|
|
520
522
|
view,
|
|
521
523
|
isInDanger
|
|
522
524
|
} = this.props;
|
|
525
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
526
|
+
const isIE11 = browser.ie_version === 11;
|
|
523
527
|
if (this.wrapper && !isIE11) {
|
|
524
528
|
// Ignored via go/ees005
|
|
525
529
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -3,11 +3,12 @@ import React from 'react';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import rafSchedule from 'raf-schd';
|
|
5
5
|
import { injectIntl } from 'react-intl-next';
|
|
6
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
6
7
|
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
7
8
|
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
8
9
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
9
10
|
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
10
|
-
import {
|
|
11
|
+
import { isValidPosition } from '@atlaskit/editor-common/utils';
|
|
11
12
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
12
13
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
13
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -34,8 +35,6 @@ import TableFloatingControls from '../ui/TableFloatingControls';
|
|
|
34
35
|
import { ExternalDropTargets } from './ExternalDropTargets';
|
|
35
36
|
import { TableContainer } from './TableContainer';
|
|
36
37
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
37
|
-
const isIE11 = browser.ie_version === 11;
|
|
38
|
-
|
|
39
38
|
// Prevent unnecessary parentWidth updates when table is nested inside of a node that is nested itself.
|
|
40
39
|
const NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
41
40
|
const NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
@@ -380,6 +379,8 @@ class TableComponent extends React.Component {
|
|
|
380
379
|
isDragAndDropEnabled,
|
|
381
380
|
getNode
|
|
382
381
|
} = this.props;
|
|
382
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
383
|
+
const isIE11 = browser.ie_version === 11;
|
|
383
384
|
|
|
384
385
|
// Ignored via go/ees005
|
|
385
386
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -448,6 +449,8 @@ class TableComponent extends React.Component {
|
|
|
448
449
|
view,
|
|
449
450
|
isInDanger
|
|
450
451
|
} = this.props;
|
|
452
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
453
|
+
const isIE11 = browser.ie_version === 11;
|
|
451
454
|
if (this.wrapper && !isIE11) {
|
|
452
455
|
// Ignored via go/ees005
|
|
453
456
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -2,7 +2,7 @@ import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useSta
|
|
|
2
2
|
import rafSchd from 'raf-schd';
|
|
3
3
|
import { useIntl } from 'react-intl-next';
|
|
4
4
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
5
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
6
6
|
import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
|
|
7
7
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
8
8
|
import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
@@ -432,6 +432,7 @@ export const TableResizer = ({
|
|
|
432
432
|
}, [editorView]);
|
|
433
433
|
const handleKeyDown = useCallback(event => {
|
|
434
434
|
const isBracketKey = event.code === 'BracketRight' || event.code === 'BracketLeft';
|
|
435
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
435
436
|
const metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
436
437
|
if (event.altKey || metaKey || event.shiftKey) {
|
|
437
438
|
areResizeMetaKeysPressed.current = true;
|
|
@@ -457,6 +458,7 @@ export const TableResizer = ({
|
|
|
457
458
|
}
|
|
458
459
|
const resizeHandleThumbEl = resizerRef.current.getResizerThumbEl();
|
|
459
460
|
const globalKeyDownHandler = event => {
|
|
461
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
460
462
|
const metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
461
463
|
if (!isTableSelected) {
|
|
462
464
|
return;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
1
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
3
|
export const getDragBehaviour = ({
|
|
3
4
|
altKey,
|
|
4
5
|
ctrlKey
|
|
5
6
|
}) => {
|
|
7
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
6
8
|
const isCloneModifierKeyPressed = browser.mac ? altKey : ctrlKey;
|
|
7
9
|
return isCloneModifierKeyPressed ? 'clone' : 'move';
|
|
8
10
|
};
|
|
@@ -3,13 +3,12 @@ import { addColumnAfter, addColumnAfterVO, addColumnBefore, addColumnBeforeVO, a
|
|
|
3
3
|
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
4
4
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
5
5
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
8
7
|
import { goToNextCell, moveCursorBackward, setFocusToCellMenu } from './commands';
|
|
9
8
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from './commands/column-resize';
|
|
10
9
|
import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from './commands/commands-with-analytics';
|
|
11
10
|
import { goToNextCellVertical } from './commands/go-to-next-cell';
|
|
12
|
-
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand,
|
|
11
|
+
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, insertTableWithNestingSupport } from './commands/insert';
|
|
13
12
|
export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, isTableResizingEnabled) {
|
|
14
13
|
var _pluginInjectionApi$a;
|
|
15
14
|
const list = {};
|
|
@@ -25,7 +24,7 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
25
24
|
bindKeymapWithCommand(
|
|
26
25
|
// Ignored via go/ees005
|
|
27
26
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
28
|
-
toggleTable.common,
|
|
27
|
+
toggleTable.common, editorCommandToPMCommand(insertTableWithNestingSupport({
|
|
29
28
|
isTableScalingEnabled,
|
|
30
29
|
isTableAlignmentEnabled,
|
|
31
30
|
isFullWidthModeEnabled: !!isFullWidthEnabled,
|
|
@@ -40,7 +39,7 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
40
39
|
inputMethod: INPUT_METHOD.SHORTCUT
|
|
41
40
|
},
|
|
42
41
|
eventType: EVENT_TYPE.TRACK
|
|
43
|
-
}))
|
|
42
|
+
})), list);
|
|
44
43
|
bindKeymapWithCommand(
|
|
45
44
|
// Ignored via go/ees005
|
|
46
45
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
2
3
|
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
3
4
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
5
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
5
|
-
import {
|
|
6
|
+
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
6
7
|
import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
8
|
import { TableMap } from '@atlaskit/editor-tables';
|
|
8
9
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
9
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
12
|
import { tableCellView, tableHeaderView, tableRowView, tableView } from '../nodeviews/table-node-views';
|
|
11
13
|
import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
|
|
12
14
|
import { TableCssClassName as ClassName } from '../types';
|
|
@@ -245,6 +247,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
245
247
|
dispatch
|
|
246
248
|
}, _pos, event) => {
|
|
247
249
|
const decorationSet = decorationsPluginKey.getState(state);
|
|
250
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
248
251
|
if (findControlsHoverDecoration(decorationSet).length) {
|
|
249
252
|
clearHoverSelection()(state, dispatch);
|
|
250
253
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { tableCell, tableCellWithNestedTable, tableHeader, tableHeaderWithLocalId, tableHeaderWithNestedTable, tableRow, tableRowWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableCellWithNestedTableWithLocalId, tableRowWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
4
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
5
5
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
6
6
|
import { IconTable } from '@atlaskit/editor-common/icons';
|
|
7
7
|
import { toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
@@ -16,7 +16,7 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
|
16
16
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
17
17
|
import { tableNodeSpecWithFixedToDOM } from './nodeviews/toDOM';
|
|
18
18
|
import { createPlugin as createTableAnalyticsPlugin } from './pm-plugins/analytics/plugin';
|
|
19
|
-
import { insertTableWithNestingSupport
|
|
19
|
+
import { insertTableWithNestingSupport } from './pm-plugins/commands/insert';
|
|
20
20
|
import { pluginConfig } from './pm-plugins/create-plugin-config';
|
|
21
21
|
import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
|
|
22
22
|
import { createPlugin as createDragAndDropPlugin } from './pm-plugins/drag-and-drop/plugin';
|
|
@@ -54,7 +54,7 @@ const tablePlugin = ({
|
|
|
54
54
|
config: options,
|
|
55
55
|
api
|
|
56
56
|
}) => {
|
|
57
|
-
var _api$analytics, _options$getEditorFea, _options$getEditorFea2
|
|
57
|
+
var _api$analytics, _options$getEditorFea, _options$getEditorFea2;
|
|
58
58
|
const editorViewRef = {
|
|
59
59
|
current: null
|
|
60
60
|
};
|
|
@@ -131,7 +131,7 @@ const tablePlugin = ({
|
|
|
131
131
|
actions: {
|
|
132
132
|
insertTable: analyticsPayload => (state, dispatch) => {
|
|
133
133
|
var _options$tableOptions;
|
|
134
|
-
if (options !== null && options !== void 0 && (_options$tableOptions = options.tableOptions) !== null && _options$tableOptions !== void 0 && _options$tableOptions.allowNestedTables
|
|
134
|
+
if (options !== null && options !== void 0 && (_options$tableOptions = options.tableOptions) !== null && _options$tableOptions !== void 0 && _options$tableOptions.allowNestedTables) {
|
|
135
135
|
return editorCommandToPMCommand(insertTableWithNestingSupport({
|
|
136
136
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
137
137
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
@@ -169,7 +169,7 @@ const tablePlugin = ({
|
|
|
169
169
|
}
|
|
170
170
|
},
|
|
171
171
|
commands: {
|
|
172
|
-
insertTableWithSize:
|
|
172
|
+
insertTableWithSize: (rowsCount, colsCount, inputMethod) => insertTableWithNestingSupport({
|
|
173
173
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
174
174
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
175
175
|
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
@@ -190,7 +190,7 @@ const tablePlugin = ({
|
|
|
190
190
|
totalColumnCount: colsCount
|
|
191
191
|
},
|
|
192
192
|
eventType: EVENT_TYPE.TRACK
|
|
193
|
-
})
|
|
193
|
+
})
|
|
194
194
|
},
|
|
195
195
|
nodes() {
|
|
196
196
|
var _options$tableOptions2, _options$getEditorFea3;
|
|
@@ -457,6 +457,7 @@ const tablePlugin = ({
|
|
|
457
457
|
dispatch
|
|
458
458
|
}) => isTableSelectorEnabled ? createSizeSelectorPlugin(dispatch) : undefined
|
|
459
459
|
}];
|
|
460
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
460
461
|
|
|
461
462
|
// Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
|
|
462
463
|
// https://github.com/ProseMirror/prosemirror/issues/934
|
|
@@ -526,7 +527,7 @@ const tablePlugin = ({
|
|
|
526
527
|
tr
|
|
527
528
|
} = state;
|
|
528
529
|
// If the cursor is inside a table
|
|
529
|
-
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && options !== null && options !== void 0 && (_options$tableOptions6 = options.tableOptions) !== null && _options$tableOptions6 !== void 0 && _options$tableOptions6.allowNestedTables
|
|
530
|
+
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && options !== null && options !== void 0 && (_options$tableOptions6 = options.tableOptions) !== null && _options$tableOptions6 !== void 0 && _options$tableOptions6.allowNestedTables) {
|
|
530
531
|
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
531
532
|
if (editorExperiment('nested-tables-in-tables', false, {
|
|
532
533
|
exposure: true
|
|
@@ -4,7 +4,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import ReactDOM from 'react-dom';
|
|
6
6
|
import { injectIntl } from 'react-intl-next';
|
|
7
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
7
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
8
8
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
9
9
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
10
10
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -106,6 +106,7 @@ const DragHandleComponent = ({
|
|
|
106
106
|
};
|
|
107
107
|
useEffect(() => {
|
|
108
108
|
const dragHandleDivRefCurrent = dragHandleDivRef.current;
|
|
109
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
109
110
|
if (dragHandleDivRefCurrent) {
|
|
110
111
|
return draggable({
|
|
111
112
|
element: dragHandleDivRefCurrent,
|
|
@@ -161,6 +162,7 @@ const DragHandleComponent = ({
|
|
|
161
162
|
}
|
|
162
163
|
}, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells]);
|
|
163
164
|
const showDragMenuAnchorId = isRow ? 'drag-handle-button-row' : 'drag-handle-button-column';
|
|
165
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
164
166
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
165
167
|
type: "button"
|
|
166
168
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
2
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
6
|
import { hoverCell, hoverRows, selectRow, selectRows } from '../../pm-plugins/commands';
|
|
6
7
|
import { isTableNested } from '../../pm-plugins/utils/nodes';
|
|
7
8
|
import { TableCssClassName as ClassName } from '../../types';
|
|
@@ -36,6 +37,7 @@ export const TableFloatingControls = ({
|
|
|
36
37
|
state,
|
|
37
38
|
dispatch
|
|
38
39
|
} = editorView;
|
|
40
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
39
41
|
if (browser.ie_version === 11) {
|
|
40
42
|
// Ignored via go/ees005
|
|
41
43
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -48,6 +50,7 @@ export const TableFloatingControls = ({
|
|
|
48
50
|
state,
|
|
49
51
|
dispatch
|
|
50
52
|
} = editorView;
|
|
53
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
51
54
|
if (browser.ie_version === 11) {
|
|
52
55
|
// Ignored via go/ees005
|
|
53
56
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
7
|
import { css } from '@emotion/react';
|
|
8
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
8
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
9
9
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
10
10
|
import { SORTABLE_COLUMN_ICON_CLASSNAME } from '@atlaskit/editor-common/table';
|
|
11
11
|
import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT, SelectionStyle, relativeSizeToBaseFontSize, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
@@ -189,6 +189,7 @@ const tableStickyHeaderColumnControlsDecorationsStyle = () => {
|
|
|
189
189
|
`;
|
|
190
190
|
};
|
|
191
191
|
const tableStickyHeaderFirefoxFixStyle = () => {
|
|
192
|
+
const browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
192
193
|
/*
|
|
193
194
|
This is MAGIC!
|
|
194
195
|
This fixes a bug which occurs in firefox when the first row becomes sticky.
|
|
@@ -18,12 +18,13 @@ import memoizeOne from 'memoize-one';
|
|
|
18
18
|
import rafSchedule from 'raf-schd';
|
|
19
19
|
import { injectIntl } from 'react-intl-next';
|
|
20
20
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
21
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
21
22
|
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
22
23
|
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
23
24
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
24
25
|
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
25
26
|
import { tableMarginSides } from '@atlaskit/editor-common/styles';
|
|
26
|
-
import {
|
|
27
|
+
import { isValidPosition } from '@atlaskit/editor-common/utils';
|
|
27
28
|
import { akEditorTableNumberColumnWidth, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
28
29
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
29
30
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -52,7 +53,6 @@ import { ExternalDropTargets } from './ExternalDropTargets';
|
|
|
52
53
|
import { OverflowShadowsObserver } from './OverflowShadowsObserver';
|
|
53
54
|
import { TableContainer } from './TableContainer';
|
|
54
55
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
55
|
-
var isIE11 = browser.ie_version === 11;
|
|
56
56
|
// When table is inserted via paste, keyboard shortcut or quickInsert,
|
|
57
57
|
// componentDidUpdate is called multiple times. The isOverflowing value is correct only on the last update.
|
|
58
58
|
// To make sure we capture the last update, we use setTimeout.
|
|
@@ -458,6 +458,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
458
458
|
eventDispatcher = _this$props7.eventDispatcher,
|
|
459
459
|
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
|
|
460
460
|
getNode = _this$props7.getNode;
|
|
461
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
462
|
+
var isIE11 = browser.ie_version === 11;
|
|
461
463
|
|
|
462
464
|
// Ignored via go/ees005
|
|
463
465
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -540,6 +542,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
540
542
|
isDragAndDropEnabled = _this$props8.isDragAndDropEnabled,
|
|
541
543
|
view = _this$props8.view,
|
|
542
544
|
isInDanger = _this$props8.isInDanger;
|
|
545
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
546
|
+
var isIE11 = browser.ie_version === 11;
|
|
543
547
|
if (this.wrapper && !isIE11) {
|
|
544
548
|
// Ignored via go/ees005
|
|
545
549
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -16,11 +16,12 @@ import React from 'react';
|
|
|
16
16
|
import classnames from 'classnames';
|
|
17
17
|
import rafSchedule from 'raf-schd';
|
|
18
18
|
import { injectIntl } from 'react-intl-next';
|
|
19
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
19
20
|
import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
20
21
|
import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
21
22
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
22
23
|
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
23
|
-
import {
|
|
24
|
+
import { isValidPosition } from '@atlaskit/editor-common/utils';
|
|
24
25
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
25
26
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
26
27
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -47,8 +48,6 @@ import TableFloatingControls from '../ui/TableFloatingControls';
|
|
|
47
48
|
import { ExternalDropTargets } from './ExternalDropTargets';
|
|
48
49
|
import { TableContainer } from './TableContainer';
|
|
49
50
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
50
|
-
var isIE11 = browser.ie_version === 11;
|
|
51
|
-
|
|
52
51
|
// Prevent unnecessary parentWidth updates when table is nested inside of a node that is nested itself.
|
|
53
52
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
54
53
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
@@ -400,6 +399,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
400
399
|
eventDispatcher = _this$props6.eventDispatcher,
|
|
401
400
|
isDragAndDropEnabled = _this$props6.isDragAndDropEnabled,
|
|
402
401
|
getNode = _this$props6.getNode;
|
|
402
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
403
|
+
var isIE11 = browser.ie_version === 11;
|
|
403
404
|
|
|
404
405
|
// Ignored via go/ees005
|
|
405
406
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -478,6 +479,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
478
479
|
isDragAndDropEnabled = _this$props7.isDragAndDropEnabled,
|
|
479
480
|
view = _this$props7.view,
|
|
480
481
|
isInDanger = _this$props7.isInDanger;
|
|
482
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
483
|
+
var isIE11 = browser.ie_version === 11;
|
|
481
484
|
if (this.wrapper && !isIE11) {
|
|
482
485
|
// Ignored via go/ees005
|
|
483
486
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -6,7 +6,7 @@ import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useSta
|
|
|
6
6
|
import rafSchd from 'raf-schd';
|
|
7
7
|
import { useIntl } from 'react-intl-next';
|
|
8
8
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
9
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
9
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
10
10
|
import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
|
|
11
11
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
12
12
|
import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
@@ -427,6 +427,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
427
427
|
}, [editorView]);
|
|
428
428
|
var handleKeyDown = useCallback(function (event) {
|
|
429
429
|
var isBracketKey = event.code === 'BracketRight' || event.code === 'BracketLeft';
|
|
430
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
430
431
|
var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
431
432
|
if (event.altKey || metaKey || event.shiftKey) {
|
|
432
433
|
areResizeMetaKeysPressed.current = true;
|
|
@@ -452,6 +453,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
452
453
|
}
|
|
453
454
|
var resizeHandleThumbEl = resizerRef.current.getResizerThumbEl();
|
|
454
455
|
var globalKeyDownHandler = function globalKeyDownHandler(event) {
|
|
456
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
455
457
|
var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
456
458
|
if (!isTableSelected) {
|
|
457
459
|
return;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
1
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
3
|
export var getDragBehaviour = function getDragBehaviour(_ref) {
|
|
3
4
|
var altKey = _ref.altKey,
|
|
4
5
|
ctrlKey = _ref.ctrlKey;
|
|
6
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
5
7
|
var isCloneModifierKeyPressed = browser.mac ? altKey : ctrlKey;
|
|
6
8
|
return isCloneModifierKeyPressed ? 'clone' : 'move';
|
|
7
9
|
};
|
|
@@ -3,13 +3,12 @@ import { addColumnAfter, addColumnAfterVO, addColumnBefore, addColumnBeforeVO, a
|
|
|
3
3
|
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
4
4
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
5
5
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
8
7
|
import { goToNextCell, moveCursorBackward, setFocusToCellMenu } from './commands';
|
|
9
8
|
import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from './commands/column-resize';
|
|
10
9
|
import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from './commands/commands-with-analytics';
|
|
11
10
|
import { goToNextCellVertical } from './commands/go-to-next-cell';
|
|
12
|
-
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand,
|
|
11
|
+
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, insertTableWithNestingSupport } from './commands/insert';
|
|
13
12
|
export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled) {
|
|
14
13
|
var _pluginInjectionApi$a;
|
|
15
14
|
var isTableScalingEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
@@ -35,7 +34,7 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
35
34
|
bindKeymapWithCommand(
|
|
36
35
|
// Ignored via go/ees005
|
|
37
36
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
38
|
-
toggleTable.common,
|
|
37
|
+
toggleTable.common, editorCommandToPMCommand(insertTableWithNestingSupport({
|
|
39
38
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
40
39
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
41
40
|
isFullWidthModeEnabled: !!isFullWidthEnabled,
|
|
@@ -50,7 +49,7 @@ export function keymapPlugin(getEditorContainerWidth, api, nodeViewPortalProvide
|
|
|
50
49
|
inputMethod: INPUT_METHOD.SHORTCUT
|
|
51
50
|
},
|
|
52
51
|
eventType: EVENT_TYPE.TRACK
|
|
53
|
-
}))
|
|
52
|
+
})), list);
|
|
54
53
|
bindKeymapWithCommand(
|
|
55
54
|
// Ignored via go/ees005
|
|
56
55
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -2,14 +2,16 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
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
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
4
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
5
6
|
import { insideTable } from '@atlaskit/editor-common/core-utils';
|
|
6
7
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
7
8
|
import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension, transformSliceToRemoveOpenNestedExpand } from '@atlaskit/editor-common/transforms';
|
|
8
|
-
import {
|
|
9
|
+
import { closestElement } from '@atlaskit/editor-common/utils';
|
|
9
10
|
import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
10
11
|
import { TableMap } from '@atlaskit/editor-tables';
|
|
11
12
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
12
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
13
15
|
import { tableCellView, tableHeaderView, tableRowView, tableView } from '../nodeviews/table-node-views';
|
|
14
16
|
import { pluginKey as decorationsPluginKey } from '../pm-plugins/decorations/plugin';
|
|
15
17
|
import { TableCssClassName as ClassName } from '../types';
|
|
@@ -245,6 +247,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
245
247
|
var state = _ref2.state,
|
|
246
248
|
dispatch = _ref2.dispatch;
|
|
247
249
|
var decorationSet = decorationsPluginKey.getState(state);
|
|
250
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
248
251
|
if (findControlsHoverDecoration(decorationSet).length) {
|
|
249
252
|
clearHoverSelection()(state, dispatch);
|
|
250
253
|
}
|
package/dist/esm/tablePlugin.js
CHANGED
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import React, { useEffect } from 'react';
|
|
5
5
|
import { tableCell, tableCellWithNestedTable, tableHeader, tableHeaderWithLocalId, tableHeaderWithNestedTable, tableRow, tableRowWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableCellWithNestedTableWithLocalId, tableRowWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from '@atlaskit/adf-schema';
|
|
6
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
7
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
7
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
8
8
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
9
9
|
import { IconTable } from '@atlaskit/editor-common/icons';
|
|
10
10
|
import { toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
@@ -19,7 +19,7 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
|
19
19
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
20
20
|
import { tableNodeSpecWithFixedToDOM } from './nodeviews/toDOM';
|
|
21
21
|
import { createPlugin as createTableAnalyticsPlugin } from './pm-plugins/analytics/plugin';
|
|
22
|
-
import { insertTableWithNestingSupport
|
|
22
|
+
import { insertTableWithNestingSupport } from './pm-plugins/commands/insert';
|
|
23
23
|
import { pluginConfig } from './pm-plugins/create-plugin-config';
|
|
24
24
|
import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
|
|
25
25
|
import { createPlugin as createDragAndDropPlugin } from './pm-plugins/drag-and-drop/plugin';
|
|
@@ -56,7 +56,7 @@ var TABLE_WIDTH_INFO_TIMEOUT = 10000;
|
|
|
56
56
|
* from `@atlaskit/editor-core`.
|
|
57
57
|
*/
|
|
58
58
|
var tablePlugin = function tablePlugin(_ref) {
|
|
59
|
-
var _api$analytics, _options$getEditorFea, _options$getEditorFea2
|
|
59
|
+
var _api$analytics, _options$getEditorFea, _options$getEditorFea2;
|
|
60
60
|
var options = _ref.config,
|
|
61
61
|
api = _ref.api;
|
|
62
62
|
var editorViewRef = {
|
|
@@ -136,7 +136,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
136
136
|
insertTable: function insertTable(analyticsPayload) {
|
|
137
137
|
return function (state, dispatch) {
|
|
138
138
|
var _options$tableOptions;
|
|
139
|
-
if (options !== null && options !== void 0 && (_options$tableOptions = options.tableOptions) !== null && _options$tableOptions !== void 0 && _options$tableOptions.allowNestedTables
|
|
139
|
+
if (options !== null && options !== void 0 && (_options$tableOptions = options.tableOptions) !== null && _options$tableOptions !== void 0 && _options$tableOptions.allowNestedTables) {
|
|
140
140
|
return editorCommandToPMCommand(insertTableWithNestingSupport({
|
|
141
141
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
142
142
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
@@ -173,7 +173,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
175
|
commands: {
|
|
176
|
-
insertTableWithSize:
|
|
176
|
+
insertTableWithSize: function insertTableWithSize(rowsCount, colsCount, inputMethod) {
|
|
177
177
|
return insertTableWithNestingSupport({
|
|
178
178
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
179
179
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
@@ -196,7 +196,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
196
196
|
},
|
|
197
197
|
eventType: EVENT_TYPE.TRACK
|
|
198
198
|
});
|
|
199
|
-
}
|
|
199
|
+
}
|
|
200
200
|
},
|
|
201
201
|
nodes: function nodes() {
|
|
202
202
|
var _options$tableOptions2, _options$getEditorFea3;
|
|
@@ -460,6 +460,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
460
460
|
return isTableSelectorEnabled ? createSizeSelectorPlugin(dispatch) : undefined;
|
|
461
461
|
}
|
|
462
462
|
}];
|
|
463
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
463
464
|
|
|
464
465
|
// Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
|
|
465
466
|
// https://github.com/ProseMirror/prosemirror/issues/934
|
|
@@ -528,7 +529,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
528
529
|
var tableNode = createTableWithWidth(tableNodeProps)(state.schema);
|
|
529
530
|
var tr = state.tr;
|
|
530
531
|
// If the cursor is inside a table
|
|
531
|
-
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && options !== null && options !== void 0 && (_options$tableOptions6 = options.tableOptions) !== null && _options$tableOptions6 !== void 0 && _options$tableOptions6.allowNestedTables
|
|
532
|
+
if (hasParentNodeOfType(state.schema.nodes.table)(state.selection) && options !== null && options !== void 0 && (_options$tableOptions6 = options.tableOptions) !== null && _options$tableOptions6 !== void 0 && _options$tableOptions6.allowNestedTables) {
|
|
532
533
|
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
533
534
|
if (editorExperiment('nested-tables-in-tables', false, {
|
|
534
535
|
exposure: true
|
|
@@ -6,7 +6,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
|
6
6
|
import classnames from 'classnames';
|
|
7
7
|
import ReactDOM from 'react-dom';
|
|
8
8
|
import { injectIntl } from 'react-intl-next';
|
|
9
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
9
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
10
10
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
12
12
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -109,6 +109,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
109
109
|
};
|
|
110
110
|
useEffect(function () {
|
|
111
111
|
var dragHandleDivRefCurrent = dragHandleDivRef.current;
|
|
112
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
112
113
|
if (dragHandleDivRefCurrent) {
|
|
113
114
|
return draggable({
|
|
114
115
|
element: dragHandleDivRefCurrent,
|
|
@@ -163,6 +164,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
163
164
|
}
|
|
164
165
|
}, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells]);
|
|
165
166
|
var showDragMenuAnchorId = isRow ? 'drag-handle-button-row' : 'drag-handle-button-column';
|
|
167
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
166
168
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
167
169
|
type: "button"
|
|
168
170
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
2
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
6
|
import { hoverCell, hoverRows, selectRow, selectRows } from '../../pm-plugins/commands';
|
|
6
7
|
import { isTableNested } from '../../pm-plugins/utils/nodes';
|
|
7
8
|
import { TableCssClassName as ClassName } from '../../types';
|
|
@@ -33,6 +34,7 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
33
34
|
var _selectRow = useCallback(function (row, expand) {
|
|
34
35
|
var state = editorView.state,
|
|
35
36
|
dispatch = editorView.dispatch;
|
|
37
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
36
38
|
if (browser.ie_version === 11) {
|
|
37
39
|
// Ignored via go/ees005
|
|
38
40
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -43,6 +45,7 @@ export var TableFloatingControls = function TableFloatingControls(_ref) {
|
|
|
43
45
|
var _selectRows = useCallback(function (rowIndexes) {
|
|
44
46
|
var state = editorView.state,
|
|
45
47
|
dispatch = editorView.dispatch;
|
|
48
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
46
49
|
if (browser.ie_version === 11) {
|
|
47
50
|
// Ignored via go/ees005
|
|
48
51
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -7,7 +7,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { css } from '@emotion/react';
|
|
10
|
-
import { browser } from '@atlaskit/editor-common/browser';
|
|
10
|
+
import { browser as browserLegacy, getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
11
11
|
import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
|
|
12
12
|
import { SORTABLE_COLUMN_ICON_CLASSNAME } from '@atlaskit/editor-common/table';
|
|
13
13
|
import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT, SelectionStyle, relativeSizeToBaseFontSize, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
|
|
@@ -51,6 +51,7 @@ var tableStickyHeaderColumnControlsDecorationsStyle = function tableStickyHeader
|
|
|
51
51
|
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n\t\t.", " .", " {\n\t\t\tz-index: 0;\n\t\t\tleft: -1px;\n\t\t}\n\n\t\t.", " .", "::after {\n\t\t\tborder-left: 1px solid ", ";\n\t\t}\n\n\t\t.", " tr:first-of-type th.", " {\n\t\t\t&.", ", &.", " {\n\t\t\t\t.", "::after {\n\t\t\t\t\tleft: 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t"])), ClassName.TABLE_STICKY, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_STICKY, ClassName.COLUMN_CONTROLS_DECORATIONS, tableBorderColor, ClassName.TABLE_STICKY, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_COLUMN, ClassName.COLUMN_CONTROLS_DECORATIONS);
|
|
52
52
|
};
|
|
53
53
|
var tableStickyHeaderFirefoxFixStyle = function tableStickyHeaderFirefoxFixStyle() {
|
|
54
|
+
var browser = expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) ? getBrowserInfo() : browserLegacy;
|
|
54
55
|
/*
|
|
55
56
|
This is MAGIC!
|
|
56
57
|
This fixes a bug which occurs in firefox when the first row becomes sticky.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.3.0",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@atlaskit/primitives": "^16.0.0",
|
|
60
60
|
"@atlaskit/react-ufo": "^4.12.0",
|
|
61
61
|
"@atlaskit/theme": "^21.0.0",
|
|
62
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
62
|
+
"@atlaskit/tmp-editor-statsig": "^13.18.0",
|
|
63
63
|
"@atlaskit/toggle": "^15.1.0",
|
|
64
64
|
"@atlaskit/tokens": "^7.0.0",
|
|
65
65
|
"@atlaskit/tooltip": "^20.6.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"uuid": "^3.1.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@atlaskit/editor-common": "^110.
|
|
75
|
+
"@atlaskit/editor-common": "^110.16.0",
|
|
76
76
|
"react": "^18.2.0",
|
|
77
77
|
"react-dom": "^18.2.0",
|
|
78
78
|
"react-intl-next": "npm:react-intl@^5.18.1"
|