@atlaskit/editor-plugin-table 9.2.0 → 9.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 +18 -0
- package/dist/cjs/nodeviews/TableCell.js +0 -2
- package/dist/cjs/nodeviews/TableContainer.js +13 -2
- package/dist/cjs/nodeviews/TableNodeViewBase.js +0 -2
- package/dist/cjs/nodeviews/TableResizer.js +5 -10
- package/dist/cjs/nodeviews/TableRow.js +0 -2
- package/dist/cjs/nodeviews/lazy-node-views.js +4 -16
- package/dist/cjs/nodeviews/table.js +2 -8
- package/dist/cjs/pm-plugins/commands/column-resize.js +1 -4
- package/dist/cjs/pm-plugins/commands/commands-with-analytics.js +4 -16
- package/dist/cjs/pm-plugins/commands/insert.js +4 -19
- package/dist/cjs/pm-plugins/commands/misc.js +3 -12
- package/dist/cjs/pm-plugins/decorations/plugin.js +1 -6
- package/dist/cjs/pm-plugins/decorations/utils/column-resizing.js +1 -4
- package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -12
- package/dist/cjs/pm-plugins/drag-and-drop/commands.js +3 -12
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +1 -4
- package/dist/cjs/pm-plugins/keymap.js +0 -2
- package/dist/cjs/pm-plugins/main.js +1 -6
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +1 -4
- package/dist/cjs/pm-plugins/table-resizing/plugin.js +0 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +1 -7
- package/dist/cjs/pm-plugins/table-resizing/utils/column-state.js +1 -4
- package/dist/cjs/pm-plugins/table-resizing/utils/content-width.js +0 -8
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-logic.js +2 -10
- package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +1 -4
- package/dist/cjs/pm-plugins/table-width.js +1 -6
- package/dist/cjs/pm-plugins/transforms/column-width.js +1 -4
- package/dist/cjs/pm-plugins/transforms/fix-tables.js +3 -15
- package/dist/cjs/pm-plugins/transforms/replace-table.js +1 -4
- package/dist/cjs/pm-plugins/transforms/split.js +0 -2
- package/dist/cjs/pm-plugins/utils/alignment.js +1 -4
- package/dist/cjs/pm-plugins/utils/decoration.js +4 -16
- package/dist/cjs/pm-plugins/utils/drag-menu.js +1 -4
- package/dist/cjs/pm-plugins/utils/nodes.js +0 -3
- package/dist/cjs/pm-plugins/utils/paste.js +4 -0
- package/dist/cjs/pm-plugins/utils/row-controls.js +1 -4
- package/dist/cjs/tablePlugin.js +12 -10
- package/dist/cjs/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -4
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +1 -4
- package/dist/cjs/ui/TableFloatingControls/index.js +1 -4
- package/dist/cjs/ui/toolbar.js +3 -12
- package/dist/es2019/nodeviews/TableCell.js +0 -2
- package/dist/es2019/nodeviews/TableContainer.js +13 -2
- package/dist/es2019/nodeviews/TableNodeViewBase.js +0 -2
- package/dist/es2019/nodeviews/TableResizer.js +5 -10
- package/dist/es2019/nodeviews/TableRow.js +0 -2
- package/dist/es2019/nodeviews/lazy-node-views.js +4 -16
- package/dist/es2019/nodeviews/table.js +2 -8
- package/dist/es2019/pm-plugins/commands/column-resize.js +1 -4
- package/dist/es2019/pm-plugins/commands/commands-with-analytics.js +6 -24
- package/dist/es2019/pm-plugins/commands/delete.js +1 -4
- package/dist/es2019/pm-plugins/commands/insert.js +5 -23
- package/dist/es2019/pm-plugins/commands/misc.js +3 -12
- package/dist/es2019/pm-plugins/decorations/plugin.js +1 -6
- package/dist/es2019/pm-plugins/decorations/utils/column-resizing.js +1 -4
- package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -12
- package/dist/es2019/pm-plugins/drag-and-drop/commands.js +4 -16
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +2 -8
- package/dist/es2019/pm-plugins/keymap.js +0 -3
- package/dist/es2019/pm-plugins/main.js +1 -6
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +1 -4
- package/dist/es2019/pm-plugins/table-resizing/plugin.js +0 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +2 -11
- package/dist/es2019/pm-plugins/table-resizing/utils/column-state.js +1 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/content-width.js +0 -8
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +1 -4
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-logic.js +2 -10
- package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +2 -8
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +4 -16
- package/dist/es2019/pm-plugins/table-width.js +1 -6
- package/dist/es2019/pm-plugins/transforms/column-width.js +2 -8
- package/dist/es2019/pm-plugins/transforms/delete-columns.js +1 -4
- package/dist/es2019/pm-plugins/transforms/fix-tables.js +3 -15
- package/dist/es2019/pm-plugins/transforms/replace-table.js +1 -4
- package/dist/es2019/pm-plugins/transforms/split.js +0 -2
- package/dist/es2019/pm-plugins/utils/alignment.js +1 -4
- package/dist/es2019/pm-plugins/utils/decoration.js +4 -16
- package/dist/es2019/pm-plugins/utils/drag-menu.js +2 -8
- package/dist/es2019/pm-plugins/utils/nodes.js +0 -3
- package/dist/es2019/pm-plugins/utils/paste.js +5 -4
- package/dist/es2019/pm-plugins/utils/row-controls.js +1 -4
- package/dist/es2019/pm-plugins/utils/snapping.js +1 -4
- package/dist/es2019/tablePlugin.js +12 -10
- package/dist/es2019/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -4
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +1 -4
- package/dist/es2019/ui/TableFloatingControls/index.js +1 -5
- package/dist/es2019/ui/event-handlers.js +1 -4
- package/dist/es2019/ui/toolbar.js +9 -36
- package/dist/esm/nodeviews/TableCell.js +0 -2
- package/dist/esm/nodeviews/TableContainer.js +13 -2
- package/dist/esm/nodeviews/TableNodeViewBase.js +0 -2
- package/dist/esm/nodeviews/TableResizer.js +5 -10
- package/dist/esm/nodeviews/TableRow.js +0 -2
- package/dist/esm/nodeviews/lazy-node-views.js +4 -16
- package/dist/esm/nodeviews/table.js +2 -8
- package/dist/esm/pm-plugins/commands/column-resize.js +1 -4
- package/dist/esm/pm-plugins/commands/commands-with-analytics.js +4 -16
- package/dist/esm/pm-plugins/commands/insert.js +4 -19
- package/dist/esm/pm-plugins/commands/misc.js +3 -12
- package/dist/esm/pm-plugins/decorations/plugin.js +1 -6
- package/dist/esm/pm-plugins/decorations/utils/column-resizing.js +1 -4
- package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +3 -12
- package/dist/esm/pm-plugins/drag-and-drop/commands.js +3 -12
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +1 -4
- package/dist/esm/pm-plugins/keymap.js +0 -3
- package/dist/esm/pm-plugins/main.js +1 -6
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +1 -4
- package/dist/esm/pm-plugins/table-resizing/plugin.js +0 -3
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +1 -7
- package/dist/esm/pm-plugins/table-resizing/utils/column-state.js +1 -4
- package/dist/esm/pm-plugins/table-resizing/utils/content-width.js +0 -8
- package/dist/esm/pm-plugins/table-resizing/utils/resize-logic.js +2 -10
- package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +1 -4
- package/dist/esm/pm-plugins/table-width.js +1 -6
- package/dist/esm/pm-plugins/transforms/column-width.js +1 -4
- package/dist/esm/pm-plugins/transforms/fix-tables.js +3 -15
- package/dist/esm/pm-plugins/transforms/replace-table.js +1 -4
- package/dist/esm/pm-plugins/transforms/split.js +0 -2
- package/dist/esm/pm-plugins/utils/alignment.js +1 -4
- package/dist/esm/pm-plugins/utils/decoration.js +4 -16
- package/dist/esm/pm-plugins/utils/drag-menu.js +1 -4
- package/dist/esm/pm-plugins/utils/nodes.js +0 -3
- package/dist/esm/pm-plugins/utils/paste.js +4 -0
- package/dist/esm/pm-plugins/utils/row-controls.js +1 -4
- package/dist/esm/tablePlugin.js +12 -10
- package/dist/esm/ui/FloatingInsertButton/getPopupOptions.js +0 -6
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -4
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +1 -4
- package/dist/esm/ui/TableFloatingControls/index.js +1 -4
- package/dist/esm/ui/toolbar.js +3 -12
- package/dist/types/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
- package/package.json +11 -5
- package/src/nodeviews/TableCell.ts +0 -2
- package/src/nodeviews/TableComponent.tsx +1 -1
- package/src/nodeviews/TableContainer.tsx +12 -1
- package/src/nodeviews/TableNodeViewBase.ts +0 -2
- package/src/nodeviews/TableResizer.tsx +9 -5
- package/src/nodeviews/TableRow.ts +0 -2
- package/src/nodeviews/lazy-node-views.ts +0 -8
- package/src/nodeviews/table.tsx +0 -4
- package/src/pm-plugins/commands/column-resize.ts +0 -2
- package/src/pm-plugins/commands/commands-with-analytics.ts +0 -12
- package/src/pm-plugins/commands/delete.ts +0 -2
- package/src/pm-plugins/commands/insert.ts +0 -12
- package/src/pm-plugins/commands/misc.ts +0 -6
- package/src/pm-plugins/decorations/plugin.ts +0 -4
- package/src/pm-plugins/decorations/utils/column-resizing.ts +0 -2
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +0 -6
- package/src/pm-plugins/drag-and-drop/commands.ts +0 -8
- package/src/pm-plugins/drag-and-drop/plugin.ts +0 -4
- package/src/pm-plugins/keymap.ts +0 -2
- package/src/pm-plugins/main.ts +0 -4
- package/src/pm-plugins/table-resizing/event-handlers.ts +0 -2
- package/src/pm-plugins/table-resizing/plugin.ts +0 -2
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +0 -6
- package/src/pm-plugins/table-resizing/utils/column-state.ts +0 -2
- package/src/pm-plugins/table-resizing/utils/content-width.ts +0 -6
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +0 -2
- package/src/pm-plugins/table-resizing/utils/resize-logic.ts +0 -6
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +0 -4
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +0 -8
- package/src/pm-plugins/table-width.ts +0 -4
- package/src/pm-plugins/transforms/column-width.ts +0 -4
- package/src/pm-plugins/transforms/delete-columns.ts +0 -2
- package/src/pm-plugins/transforms/fix-tables.ts +0 -8
- package/src/pm-plugins/transforms/replace-table.ts +0 -2
- package/src/pm-plugins/transforms/split.ts +0 -2
- package/src/pm-plugins/utils/alignment.ts +0 -2
- package/src/pm-plugins/utils/decoration.ts +0 -8
- package/src/pm-plugins/utils/drag-menu.ts +0 -4
- package/src/pm-plugins/utils/nodes.ts +0 -2
- package/src/pm-plugins/utils/paste.ts +4 -2
- package/src/pm-plugins/utils/row-controls.ts +0 -2
- package/src/pm-plugins/utils/snapping.ts +0 -2
- package/src/tablePlugin.tsx +7 -2
- package/src/ui/FloatingInsertButton/getPopupOptions.ts +0 -4
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -3
- package/src/ui/TableFloatingColumnControls/index.tsx +1 -1
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +0 -2
- package/src/ui/TableFloatingControls/index.tsx +1 -5
- package/src/ui/event-handlers.ts +0 -2
- package/src/ui/toolbar.tsx +0 -18
|
@@ -14,10 +14,7 @@ var _columnState = require("./column-state");
|
|
|
14
14
|
var _resizeState = require("./resize-state");
|
|
15
15
|
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; }
|
|
16
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
-
var growColumn = exports.growColumn = function growColumn(state, colIndex, amount, selectedColumns
|
|
18
|
-
// Ignored via go/ees005
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
20
|
-
) {
|
|
17
|
+
var growColumn = exports.growColumn = function growColumn(state, colIndex, amount, selectedColumns) {
|
|
21
18
|
// can't grow if columns don't exist or it's the last column
|
|
22
19
|
if (!state.cols[colIndex] || !state.cols[colIndex + 1]) {
|
|
23
20
|
return state;
|
|
@@ -33,10 +30,7 @@ var growColumn = exports.growColumn = function growColumn(state, colIndex, amoun
|
|
|
33
30
|
}
|
|
34
31
|
return newState;
|
|
35
32
|
};
|
|
36
|
-
var shrinkColumn = exports.shrinkColumn = function shrinkColumn(state, colIndex, amount, selectedColumns
|
|
37
|
-
// Ignored via go/ees005
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
39
|
-
) {
|
|
33
|
+
var shrinkColumn = exports.shrinkColumn = function shrinkColumn(state, colIndex, amount, selectedColumns) {
|
|
40
34
|
// can't shrink if columns don't exist
|
|
41
35
|
if (!state.cols[colIndex]) {
|
|
42
36
|
return state;
|
|
@@ -109,8 +103,6 @@ var ColType = /*#__PURE__*/function (ColType) {
|
|
|
109
103
|
return ColType;
|
|
110
104
|
}(ColType || {}); // TODO: should handle when destIdx:
|
|
111
105
|
// - is beyond the range, and then not give it back
|
|
112
|
-
// Ignored via go/ees005
|
|
113
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
114
106
|
function moveSpaceFrom(state, srcIdx, destIdx, amount) {
|
|
115
107
|
var useFreeSpace = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
116
108
|
var srcCol = state.cols[srcIdx];
|
|
@@ -100,10 +100,7 @@ var getResizeState = exports.getResizeState = function getResizeState(_ref) {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
// updates Colgroup DOM node with new widths
|
|
103
|
-
var updateColgroup = exports.updateColgroup = function updateColgroup(state, tableRef, tableNode, isTableScalingEnabled, scalePercent
|
|
104
|
-
// Ignored via go/ees005
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
106
|
-
) {
|
|
103
|
+
var updateColgroup = exports.updateColgroup = function updateColgroup(state, tableRef, tableNode, isTableScalingEnabled, scalePercent) {
|
|
107
104
|
var cols = tableRef === null || tableRef === void 0 ? void 0 : tableRef.querySelectorAll('col');
|
|
108
105
|
var columnsCount = cols === null || cols === void 0 ? void 0 : cols.length;
|
|
109
106
|
/**
|
|
@@ -22,10 +22,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
22
22
|
* Also holds resizing state to hide / show table controls
|
|
23
23
|
*/
|
|
24
24
|
var pluginKey = exports.pluginKey = new _state.PluginKey('tableWidthPlugin');
|
|
25
|
-
var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor
|
|
26
|
-
// Ignored via go/ees005
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
28
|
-
) {
|
|
25
|
+
var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
29
26
|
return new _safePlugin.SafePlugin({
|
|
30
27
|
key: pluginKey,
|
|
31
28
|
state: {
|
|
@@ -122,8 +119,6 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, dispat
|
|
|
122
119
|
}
|
|
123
120
|
if (referentialityTr) {
|
|
124
121
|
referentialityTr.steps.forEach(function (step) {
|
|
125
|
-
// Ignored via go/ees005
|
|
126
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
127
122
|
step.getMap().forEach(function (_, __, newStart, newEnd) {
|
|
128
123
|
newState.doc.nodesBetween(newStart, newEnd, function (node, pos) {
|
|
129
124
|
if (node.type === table) {
|
|
@@ -23,10 +23,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
23
23
|
* @param start
|
|
24
24
|
* @returns
|
|
25
25
|
*/
|
|
26
|
-
var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidths(resizeState, table, start, api
|
|
27
|
-
// Ignored via go/ees005
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
29
|
-
) {
|
|
26
|
+
var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidths(resizeState, table, start, api) {
|
|
30
27
|
return function (tr) {
|
|
31
28
|
var map = _tableMap.TableMap.get(table);
|
|
32
29
|
var updatedCellsAttrs = {};
|
|
@@ -45,10 +45,7 @@ var validateTableCellNodeAttrs = function validateTableCellNodeAttrs(_ref, repor
|
|
|
45
45
|
//
|
|
46
46
|
// This row only spans two columns, yet it contains widths for 3.
|
|
47
47
|
// We remove the third width here, assumed duplicate content.
|
|
48
|
-
var removeExtraneousColumnWidths = exports.removeExtraneousColumnWidths = function removeExtraneousColumnWidths(node, basePos, tr, reportInvalidTableCellSpanAttrs
|
|
49
|
-
// Ignored via go/ees005
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
51
|
-
) {
|
|
48
|
+
var removeExtraneousColumnWidths = exports.removeExtraneousColumnWidths = function removeExtraneousColumnWidths(node, basePos, tr, reportInvalidTableCellSpanAttrs) {
|
|
52
49
|
var hasProblems = false;
|
|
53
50
|
tr = replaceCells(tr, node, basePos, function (cell) {
|
|
54
51
|
var _cell$attrs = cell.attrs,
|
|
@@ -99,10 +96,7 @@ var fixTables = exports.fixTables = function fixTables(tr, reportInvalidTableCel
|
|
|
99
96
|
//
|
|
100
97
|
// We use this when migrating TinyMCE tables for Confluence, for example:
|
|
101
98
|
// https://pug.jira-dev.com/wiki/spaces/AEC/pages/3362882215/How+do+we+map+TinyMCE+tables+to+Fabric+tables
|
|
102
|
-
var fixAutoSizedTable = exports.fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, tablePos, opts
|
|
103
|
-
// Ignored via go/ees005
|
|
104
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
105
|
-
) {
|
|
99
|
+
var fixAutoSizedTable = exports.fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, tablePos, opts) {
|
|
106
100
|
var tr = view.state.tr;
|
|
107
101
|
var domAtPos = view.domAtPos.bind(view);
|
|
108
102
|
var tableStart = tablePos + 1;
|
|
@@ -145,9 +139,6 @@ var getLayoutBasedOnWidth = function getLayoutBasedOnWidth(totalWidth) {
|
|
|
145
139
|
return 'default';
|
|
146
140
|
}
|
|
147
141
|
};
|
|
148
|
-
|
|
149
|
-
// Ignored via go/ees005
|
|
150
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
151
142
|
function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
|
|
152
143
|
var row = tableRef.querySelector('tr');
|
|
153
144
|
if (!row) {
|
|
@@ -172,10 +163,7 @@ function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
|
|
|
172
163
|
}
|
|
173
164
|
|
|
174
165
|
// TODO: move to prosemirror-utils
|
|
175
|
-
var replaceCells = function replaceCells(tr, table, tablePos, modifyCell
|
|
176
|
-
// Ignored via go/ees005
|
|
177
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
178
|
-
) {
|
|
166
|
+
var replaceCells = function replaceCells(tr, table, tablePos, modifyCell) {
|
|
179
167
|
var rows = [];
|
|
180
168
|
var modifiedCells = 0;
|
|
181
169
|
for (var rowIndex = 0; rowIndex < table.childCount; rowIndex++) {
|
|
@@ -9,10 +9,7 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
9
9
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
10
10
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
11
11
|
var _analytics2 = require("../utils/analytics");
|
|
12
|
-
var replaceSelectedTable = exports.replaceSelectedTable = function replaceSelectedTable(state, content, inputMethod, editorAnalyticsAPI
|
|
13
|
-
// Ignored via go/ees005
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
15
|
-
) {
|
|
12
|
+
var replaceSelectedTable = exports.replaceSelectedTable = function replaceSelectedTable(state, content, inputMethod, editorAnalyticsAPI) {
|
|
16
13
|
if ((0, _utils.isTableSelected)(state.selection)) {
|
|
17
14
|
var table = (0, _utils.findTable)(state.selection);
|
|
18
15
|
if (table) {
|
|
@@ -16,8 +16,6 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
16
16
|
* @param columnStart - Start of the rect included (rect.left)
|
|
17
17
|
* @param columnEnd - End of the rect not included (rect.right)
|
|
18
18
|
*/
|
|
19
|
-
// Ignored via go/ees005
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
21
19
|
function splitCellsInColumns(tr, tablePos, columnStart, columnEnd) {
|
|
22
20
|
var mapStart = tr.mapping.maps.length;
|
|
23
21
|
var table = tr.doc.nodeAt(tablePos);
|
|
@@ -19,9 +19,6 @@ var normaliseAlignment = exports.normaliseAlignment = function normaliseAlignmen
|
|
|
19
19
|
/**
|
|
20
20
|
* We don't want to switch alignment in Full-width editor
|
|
21
21
|
*/
|
|
22
|
-
var shouldChangeAlignmentToCenterResized = exports.shouldChangeAlignmentToCenterResized = function shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, tableNode, lineLength, updatedTableWidth
|
|
23
|
-
// Ignored via go/ees005
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
25
|
-
) {
|
|
22
|
+
var shouldChangeAlignmentToCenterResized = exports.shouldChangeAlignmentToCenterResized = function shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, tableNode, lineLength, updatedTableWidth) {
|
|
26
23
|
return Boolean(isTableAlignmentEnabled && tableNode && tableNode.attrs.layout === ALIGN_START && lineLength && updatedTableWidth > lineLength && lineLength < _consts.FULL_WIDTH_EDITOR_CONTENT_WIDTH);
|
|
27
24
|
};
|
|
@@ -39,10 +39,7 @@ var createCellHoverDecoration = exports.createCellHoverDecoration = function cre
|
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
|
-
var createControlsHoverDecoration = exports.createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected
|
|
43
|
-
// Ignored via go/ees005
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
45
|
-
) {
|
|
42
|
+
var createControlsHoverDecoration = exports.createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected) {
|
|
46
43
|
var table = (0, _utils2.findTable)(tr.selection);
|
|
47
44
|
if (!table) {
|
|
48
45
|
return [];
|
|
@@ -171,10 +168,7 @@ var createColumnControlsDecoration = exports.createColumnControlsDecoration = fu
|
|
|
171
168
|
});
|
|
172
169
|
});
|
|
173
170
|
};
|
|
174
|
-
var updateDecorations = exports.updateDecorations = function updateDecorations(node, decorationSet, decorations, key
|
|
175
|
-
// Ignored via go/ees005
|
|
176
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
177
|
-
) {
|
|
171
|
+
var updateDecorations = exports.updateDecorations = function updateDecorations(node, decorationSet, decorations, key) {
|
|
178
172
|
var filteredDecorations = filterDecorationByKey(key, decorationSet);
|
|
179
173
|
var decorationSetFiltered = decorationSet.remove(filteredDecorations);
|
|
180
174
|
return decorationSetFiltered.add(node, decorations);
|
|
@@ -265,10 +259,7 @@ var makeArray = function makeArray(n) {
|
|
|
265
259
|
var createResizeHandleDecoration = exports.createResizeHandleDecoration = function createResizeHandleDecoration(tr, rowIndexTarget, columnEndIndexTarget) {
|
|
266
260
|
var includeTooltip = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
267
261
|
var getIntl = arguments.length > 4 ? arguments[4] : undefined;
|
|
268
|
-
var nodeViewPortalProviderAPI
|
|
269
|
-
// Ignored via go/ees005
|
|
270
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
271
|
-
= arguments.length > 5 ? arguments[5] : undefined;
|
|
262
|
+
var nodeViewPortalProviderAPI = arguments.length > 5 ? arguments[5] : undefined;
|
|
272
263
|
var emptyResult = [[], []];
|
|
273
264
|
var table = (0, _utils2.findTable)(tr.selection);
|
|
274
265
|
if (!table || !table.node) {
|
|
@@ -278,10 +269,7 @@ var createResizeHandleDecoration = exports.createResizeHandleDecoration = functi
|
|
|
278
269
|
if (!map.width) {
|
|
279
270
|
return emptyResult;
|
|
280
271
|
}
|
|
281
|
-
var createResizerHandleDecoration = function createResizerHandleDecoration(cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode
|
|
282
|
-
// Ignored via go/ees005
|
|
283
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
284
|
-
) {
|
|
272
|
+
var createResizerHandleDecoration = function createResizerHandleDecoration(cellColumnPositioning, columnIndex, rowIndex, cellPos, cellNode) {
|
|
285
273
|
var decorationRenderKey = (0, _v.default)();
|
|
286
274
|
var position = cellPos + cellNode.nodeSize - 1;
|
|
287
275
|
return _view.Decoration.widget(position, function () {
|
|
@@ -46,10 +46,7 @@ var _selection = require("./selection");
|
|
|
46
46
|
var getTargetIndex = exports.getTargetIndex = function getTargetIndex(selectedIndexes, direction) {
|
|
47
47
|
return Math[direction < 0 ? 'min' : 'max'].apply(Math, (0, _toConsumableArray2.default)(selectedIndexes)) + direction;
|
|
48
48
|
};
|
|
49
|
-
var canMove = exports.canMove = function canMove(sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect
|
|
50
|
-
// Ignored via go/ees005
|
|
51
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
52
|
-
) {
|
|
49
|
+
var canMove = exports.canMove = function canMove(sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect) {
|
|
53
50
|
if (!selectionRect) {
|
|
54
51
|
return false;
|
|
55
52
|
}
|
|
@@ -80,9 +80,6 @@ var tablesHaveDifferentNoOfRows = exports.tablesHaveDifferentNoOfRows = function
|
|
|
80
80
|
var currentMap = _tableMap.TableMap.get(currentTable);
|
|
81
81
|
return prevMap.height !== currentMap.height;
|
|
82
82
|
};
|
|
83
|
-
|
|
84
|
-
// Ignored via go/ees005
|
|
85
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
86
83
|
function filterNearSelection(selection, findNode, predicate, defaultValue) {
|
|
87
84
|
var found = findNode(selection);
|
|
88
85
|
if (!found) {
|
|
@@ -12,6 +12,7 @@ var _nesting = require("@atlaskit/editor-common/nesting");
|
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
14
14
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
16
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
16
17
|
var _pluginFactory = require("../plugin-factory");
|
|
17
18
|
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; }
|
|
@@ -29,6 +30,9 @@ var unwrapContentFromTable = exports.unwrapContentFromTable = function unwrapCon
|
|
|
29
30
|
content.push.apply(content, (0, _toConsumableArray2.default)((0, _utils2.flatten)(maybeCell, false).map(function (child) {
|
|
30
31
|
return child.node;
|
|
31
32
|
})));
|
|
33
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_nested_tables_paste_dupe_fix')) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
32
36
|
}
|
|
33
37
|
return true;
|
|
34
38
|
});
|
|
@@ -88,10 +88,7 @@ var getRowsParams = exports.getRowsParams = function getRowsParams(rowsHeights)
|
|
|
88
88
|
var getRowClassNames = exports.getRowClassNames = function getRowClassNames(index, selection) {
|
|
89
89
|
var hoveredRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
90
90
|
var isInDanger = arguments.length > 3 ? arguments[3] : undefined;
|
|
91
|
-
var isResizing
|
|
92
|
-
// Ignored via go/ees005
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
94
|
-
= arguments.length > 4 ? arguments[4] : undefined;
|
|
91
|
+
var isResizing = arguments.length > 4 ? arguments[4] : undefined;
|
|
95
92
|
var classNames = [];
|
|
96
93
|
if ((0, _utils3.isRowSelected)(index)(selection) || hoveredRows.indexOf(index) > -1 && !isResizing) {
|
|
97
94
|
classNames.push(_types.TableCssClassName.HOVERED_CELL_ACTIVE);
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -121,7 +121,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
121
121
|
actions: {
|
|
122
122
|
insertTable: function insertTable(analyticsPayload) {
|
|
123
123
|
return function (state, dispatch) {
|
|
124
|
-
|
|
124
|
+
var _options$tableOptions;
|
|
125
|
+
if (options !== null && options !== void 0 && (_options$tableOptions = options.tableOptions) !== null && _options$tableOptions !== void 0 && _options$tableOptions.allowNestedTables && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
|
|
125
126
|
return (0, _preset.editorCommandToPMCommand)((0, _insert.insertTableWithNestingSupport)({
|
|
126
127
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
127
128
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
@@ -184,10 +185,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
184
185
|
} : (0, _insert.insertTableWithSize)(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, options === null || options === void 0 ? void 0 : options.isCommentEditor)
|
|
185
186
|
},
|
|
186
187
|
nodes: function nodes() {
|
|
188
|
+
var _options$tableOptions2;
|
|
187
189
|
var _pluginConfig = (0, _createPluginConfig.pluginConfig)(options === null || options === void 0 ? void 0 : options.tableOptions),
|
|
188
190
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
189
191
|
// TODO: ED-25901 - We need to move this into a plugin config option so we don't accidentally enable nested nodes in Jira
|
|
190
|
-
var isNestingSupported = (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes');
|
|
192
|
+
var isNestingSupported = (options === null || options === void 0 || (_options$tableOptions2 = options.tableOptions) === null || _options$tableOptions2 === void 0 ? void 0 : _options$tableOptions2.allowNestedTables) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes');
|
|
191
193
|
return isNestingSupported ? [{
|
|
192
194
|
name: 'table',
|
|
193
195
|
node: (0, _toDOM.tableNodeSpecWithFixedToDOM)({
|
|
@@ -345,27 +347,27 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
345
347
|
}, {
|
|
346
348
|
name: 'tableWidth',
|
|
347
349
|
plugin: function plugin(_ref15) {
|
|
348
|
-
var _options$fullWidthEna, _options$isTableScali, _options$
|
|
350
|
+
var _options$fullWidthEna, _options$isTableScali, _options$tableOptions3, _options$isCommentEdi;
|
|
349
351
|
var dispatchAnalyticsEvent = _ref15.dispatchAnalyticsEvent,
|
|
350
352
|
dispatch = _ref15.dispatch;
|
|
351
|
-
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? (0, _tableWidth.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$
|
|
353
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? (0, _tableWidth.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$tableOptions3 = options.tableOptions.allowTableResizing) !== null && _options$tableOptions3 !== void 0 ? _options$tableOptions3 : false, (_options$isCommentEdi = options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
352
354
|
}
|
|
353
355
|
}, {
|
|
354
356
|
name: 'tableWidthInCommentFix',
|
|
355
357
|
plugin: function plugin(_ref16) {
|
|
356
|
-
var _options$
|
|
358
|
+
var _options$tableOptions4;
|
|
357
359
|
var dispatch = _ref16.dispatch;
|
|
358
|
-
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? (0, _tableWidthInCommentFix.createPlugin)(dispatch, (_options$
|
|
360
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? (0, _tableWidthInCommentFix.createPlugin)(dispatch, (_options$tableOptions4 = options.tableOptions.allowTableAlignment) !== null && _options$tableOptions4 !== void 0 ? _options$tableOptions4 : false) : undefined;
|
|
359
361
|
}
|
|
360
362
|
},
|
|
361
363
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
362
364
|
{
|
|
363
365
|
name: 'tableOverflowAnalyticsPlugin',
|
|
364
366
|
plugin: function plugin(_ref17) {
|
|
365
|
-
var _options$
|
|
367
|
+
var _options$tableOptions5;
|
|
366
368
|
var dispatch = _ref17.dispatch,
|
|
367
369
|
dispatchAnalyticsEvent = _ref17.dispatchAnalyticsEvent;
|
|
368
|
-
return (0, _tableAnalytics.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$
|
|
370
|
+
return (0, _tableAnalytics.createPlugin)(dispatch, dispatchAnalyticsEvent, (_options$tableOptions5 = options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) !== null && _options$tableOptions5 !== void 0 ? _options$tableOptions5 : false);
|
|
369
371
|
}
|
|
370
372
|
}, {
|
|
371
373
|
name: 'tableAnalyticsPlugin',
|
|
@@ -555,7 +557,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
555
557
|
return /*#__PURE__*/_react.default.createElement(_icons.IconTable, null);
|
|
556
558
|
},
|
|
557
559
|
action: function action(insert, state) {
|
|
558
|
-
var _api$table;
|
|
560
|
+
var _api$table, _options$tableOptions6;
|
|
559
561
|
// see comment on tablesPlugin.getSharedState on usage
|
|
560
562
|
var tableState = api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.sharedState.currentState();
|
|
561
563
|
var tableNodeProps = {
|
|
@@ -569,7 +571,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
569
571
|
var tableNode = (0, _create.createTableWithWidth)(tableNodeProps)(state.schema);
|
|
570
572
|
var tr = state.tr;
|
|
571
573
|
// If the cursor is inside a table
|
|
572
|
-
if ((0, _utils.hasParentNodeOfType)(state.schema.nodes.table)(state.selection) && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
|
|
574
|
+
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 && (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes')) {
|
|
573
575
|
// If the experiment is disabled, or we're trying to nest deeper than one level, we insert the table after the top table
|
|
574
576
|
if ((0, _experiments.editorExperiment)('nested-tables-in-tables', false, {
|
|
575
577
|
exposure: true
|
|
@@ -39,9 +39,6 @@ function getRowOptions(index, isDragAndDropEnabled) {
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
// Ignored via go/ees005
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
45
42
|
function getColumnOptions(index, tableContainer, hasNumberedColumns, isDragAndDropEnabled) {
|
|
46
43
|
var options = {
|
|
47
44
|
alignX: 'end',
|
|
@@ -82,9 +79,6 @@ function getColumnOptions(index, tableContainer, hasNumberedColumns, isDragAndDr
|
|
|
82
79
|
}
|
|
83
80
|
return options;
|
|
84
81
|
}
|
|
85
|
-
|
|
86
|
-
// Ignored via go/ees005
|
|
87
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
88
82
|
function getPopupOptions(direction, index, hasNumberedColumns, isDragAndDropEnabled, tableContainer) {
|
|
89
83
|
switch (direction) {
|
|
90
84
|
case 'column':
|
|
@@ -137,10 +137,7 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
137
137
|
var _getScrollOffset;
|
|
138
138
|
columnControlsRef.current.scrollLeft = (_getScrollOffset = getScrollOffset === null || getScrollOffset === void 0 ? void 0 : getScrollOffset()) !== null && _getScrollOffset !== void 0 ? _getScrollOffset : 0;
|
|
139
139
|
}
|
|
140
|
-
var generateHandleByType = function generateHandleByType(type, appearance, gridColumn, indexes
|
|
141
|
-
// Ignored via go/ees005
|
|
142
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
143
|
-
) {
|
|
140
|
+
var generateHandleByType = function generateHandleByType(type, appearance, gridColumn, indexes) {
|
|
144
141
|
var _rowHeights$reduce, _colWidths$reduce;
|
|
145
142
|
var isHover = type === 'hover';
|
|
146
143
|
var isPlaceholder = appearance === 'placeholder';
|
|
@@ -141,10 +141,7 @@ var DragControls = exports.DragControls = function DragControls(_ref) {
|
|
|
141
141
|
selectRows(selectedRowIndexes);
|
|
142
142
|
}
|
|
143
143
|
}, [rowIndex, selectRow, selectRows, selectedRowIndexes]);
|
|
144
|
-
var generateHandleByType = function generateHandleByType(type, appearance, gridRow, indexes
|
|
145
|
-
// Ignored via go/ees005
|
|
146
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
147
|
-
) {
|
|
144
|
+
var generateHandleByType = function generateHandleByType(type, appearance, gridRow, indexes) {
|
|
148
145
|
var isHover = type === 'hover';
|
|
149
146
|
var previewHeight = rowHeights.reduce(function (sum, v, i) {
|
|
150
147
|
return sum + v * (indexes.includes(i) ? 1 : 0);
|
|
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = exports.TableFloatingControls = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
11
|
-
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
11
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
13
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
@@ -84,8 +83,6 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
84
83
|
(0, _commands.hoverCell)(rowIndex, 0)(state, dispatch);
|
|
85
84
|
}
|
|
86
85
|
}, [editorView, tableActive]);
|
|
87
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['featureFlags']),
|
|
88
|
-
featureFlagsState = _useSharedPluginState.featureFlagsState;
|
|
89
86
|
if (!tableRef) {
|
|
90
87
|
return null;
|
|
91
88
|
}
|
|
@@ -95,7 +92,7 @@ var TableFloatingControls = exports.TableFloatingControls = function TableFloati
|
|
|
95
92
|
// Ignored via go/ees005
|
|
96
93
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
97
94
|
var isNested = tablePos !== undefined && (0, _nodes.isTableNested)(editorView.state, tablePos);
|
|
98
|
-
var shouldShowCornerControls =
|
|
95
|
+
var shouldShowCornerControls = isNested && !(0, _experiments.editorExperiment)('nested-dnd', true);
|
|
99
96
|
return (
|
|
100
97
|
/*#__PURE__*/
|
|
101
98
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -551,10 +551,7 @@ var getColumnSettingItems = function getColumnSettingItems(editorState, editorVi
|
|
|
551
551
|
}
|
|
552
552
|
return items;
|
|
553
553
|
};
|
|
554
|
-
var getColorPicker = function getColorPicker(state, menu, _ref5, editorAnalyticsAPI, getEditorView
|
|
555
|
-
// Ignored via go/ees005
|
|
556
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
557
|
-
) {
|
|
554
|
+
var getColorPicker = function getColorPicker(state, menu, _ref5, editorAnalyticsAPI, getEditorView) {
|
|
558
555
|
var _node$attrs;
|
|
559
556
|
var formatMessage = _ref5.formatMessage;
|
|
560
557
|
var _getPluginState2 = (0, _pluginFactory.getPluginState)(state),
|
|
@@ -617,10 +614,7 @@ var highlightColumnsHandler = function highlightColumnsHandler(state, dispatch)
|
|
|
617
614
|
}
|
|
618
615
|
return false;
|
|
619
616
|
};
|
|
620
|
-
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor
|
|
621
|
-
// Ignored via go/ees005
|
|
622
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
623
|
-
) {
|
|
617
|
+
var getAlignmentOptionsConfig = function getAlignmentOptionsConfig(editorState, _ref6, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor, isCommentEditor) {
|
|
624
618
|
var formatMessage = _ref6.formatMessage;
|
|
625
619
|
var tableObject = (0, _utils3.findTable)(editorState.selection);
|
|
626
620
|
if (!tableObject) {
|
|
@@ -699,10 +693,7 @@ var getSelectedAlignmentIcon = function getSelectedAlignmentIcon(alignmentIcons,
|
|
|
699
693
|
return icon.value === (0, _alignment.normaliseAlignment)(selectedAlignment);
|
|
700
694
|
});
|
|
701
695
|
};
|
|
702
|
-
var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor
|
|
703
|
-
// Ignored via go/ees005
|
|
704
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
705
|
-
) {
|
|
696
|
+
var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEditorContainerWidth, getDomRef, editorView, shouldUseIncreasedScalingPercent, isFullWidthEditor) {
|
|
706
697
|
var _getEditorContainerWi = getEditorContainerWidth(),
|
|
707
698
|
lineLength = _getEditorContainerWi.lineLength;
|
|
708
699
|
var tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(selectedNode);
|
|
@@ -26,8 +26,6 @@ function delayUntilIdle(cb) {
|
|
|
26
26
|
// eslint-disable-next-line require-unicode-regexp
|
|
27
27
|
const cssVariablePattern = /^VAR\(--.*\)$/;
|
|
28
28
|
export default class TableCell extends TableNodeView {
|
|
29
|
-
// Ignored via go/ees005
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
31
29
|
constructor(node, view, getPos, eventDispatcher, editorAnalyticsAPI) {
|
|
32
30
|
super(node, view, getPos, eventDispatcher);
|
|
33
31
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
1
2
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
3
|
import classNames from 'classnames';
|
|
3
4
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
5
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
6
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
6
7
|
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
9
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
8
10
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
9
11
|
import { TABLE_MAX_WIDTH, TABLE_OFFSET_IN_COMMENT_EDITOR } from '../pm-plugins/table-resizing/utils/consts';
|
|
@@ -254,7 +256,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
254
256
|
,
|
|
255
257
|
className: ClassName.TABLE_RESIZER_CONTAINER,
|
|
256
258
|
ref: containerRef
|
|
257
|
-
}, isLivePageViewMode ? /*#__PURE__*/React.createElement(InnerContainer
|
|
259
|
+
}, fg('platform_editor_live_page_prevent_table_recreation') ? null : isLivePageViewMode ? /*#__PURE__*/React.createElement(InnerContainer
|
|
258
260
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
259
261
|
, {
|
|
260
262
|
className: className,
|
|
@@ -271,7 +273,16 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
271
273
|
React.createElement(TableResizer, tableResizerProps, /*#__PURE__*/React.createElement(InnerContainer, {
|
|
272
274
|
className: className,
|
|
273
275
|
node: node
|
|
274
|
-
}, children)))
|
|
276
|
+
}, children)), fg('platform_editor_live_page_prevent_table_recreation') ?
|
|
277
|
+
/*#__PURE__*/
|
|
278
|
+
// Ignored via go/ees005
|
|
279
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
280
|
+
React.createElement(TableResizer, _extends({}, tableResizerProps, {
|
|
281
|
+
disabled: isLivePageViewMode
|
|
282
|
+
}), /*#__PURE__*/React.createElement(InnerContainer, {
|
|
283
|
+
className: className,
|
|
284
|
+
node: node
|
|
285
|
+
}, children)) : null));
|
|
275
286
|
});
|
|
276
287
|
export const TableContainer = ({
|
|
277
288
|
children,
|
|
@@ -72,10 +72,7 @@ const getResizerMinWidth = node => {
|
|
|
72
72
|
* @param isTableScalingEnabled
|
|
73
73
|
* @param isFullWidthModeEnabled
|
|
74
74
|
*/
|
|
75
|
-
const getVisibleGuidelines = (guidelines, containerWidth, lineLength, isTableScalingEnabled, isFullWidthModeEnabled
|
|
76
|
-
// Ignored via go/ees005
|
|
77
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
78
|
-
) => {
|
|
75
|
+
const getVisibleGuidelines = (guidelines, containerWidth, lineLength, isTableScalingEnabled, isFullWidthModeEnabled) => {
|
|
79
76
|
let guidelineVisibleAdjustment = TABLE_GUIDELINE_VISIBLE_ADJUSTMENT;
|
|
80
77
|
if (isTableScalingEnabled) {
|
|
81
78
|
// Notes:
|
|
@@ -116,7 +113,8 @@ export const TableResizer = ({
|
|
|
116
113
|
shouldUseIncreasedScalingPercent,
|
|
117
114
|
pluginInjectionApi,
|
|
118
115
|
isFullWidthModeEnabled,
|
|
119
|
-
isCommentEditor
|
|
116
|
+
isCommentEditor,
|
|
117
|
+
disabled
|
|
120
118
|
}) => {
|
|
121
119
|
var _editorView$state, _pluginInjectionApi$a2;
|
|
122
120
|
const currentGap = useRef(0);
|
|
@@ -186,10 +184,7 @@ export const TableResizer = ({
|
|
|
186
184
|
// was hardcoded to 0, using PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
|
|
187
185
|
isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth, excludeGuidelineConfig) : defaultSnappingWidths
|
|
188
186
|
} : undefined, [snappingEnabled, isTableScalingEnabled, excludeGuidelineConfig, containerWidth, lineLength, isFullWidthModeEnabled]);
|
|
189
|
-
const switchToCenterAlignment = useCallback((pos, node, newWidth, state, dispatch
|
|
190
|
-
// Ignored via go/ees005
|
|
191
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
192
|
-
) => {
|
|
187
|
+
const switchToCenterAlignment = useCallback((pos, node, newWidth, state, dispatch) => {
|
|
193
188
|
if (shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, node, lineLength, newWidth) && isResizing.current) {
|
|
194
189
|
var _pluginInjectionApi$a;
|
|
195
190
|
const tableNodeWithPos = {
|
|
@@ -477,7 +472,7 @@ export const TableResizer = ({
|
|
|
477
472
|
const resizeRatio = !isTableAlignmentEnabled || isTableAlignmentEnabled && normaliseAlignment(node.attrs.layout) === ALIGN_CENTER ? 2 : 1;
|
|
478
473
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ResizerNext, {
|
|
479
474
|
ref: resizerRef,
|
|
480
|
-
enable: handles,
|
|
475
|
+
enable: fg('platform_editor_live_page_prevent_table_recreation') ? disabled ? {} : handles : handles,
|
|
481
476
|
width: width,
|
|
482
477
|
handleAlignmentMethod: "sticky",
|
|
483
478
|
handleSize: handleSize,
|
|
@@ -19,8 +19,6 @@ const HEADER_ROW_SCROLL_THROTTLE_TIMEOUT = 200;
|
|
|
19
19
|
// if too short it would trigger too many dom updates.
|
|
20
20
|
const HEADER_ROW_SCROLL_RESET_DEBOUNCE_TIMEOUT = 400;
|
|
21
21
|
export default class TableRow extends TableNodeView {
|
|
22
|
-
// Ignored via go/ees005
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
24
22
|
constructor(node, view, getPos, eventDispatcher) {
|
|
25
23
|
super(node, view, getPos, eventDispatcher);
|
|
26
24
|
_defineProperty(this, "colControlsOffset", 0);
|
|
@@ -15,10 +15,7 @@ export const lazyTableView = options => {
|
|
|
15
15
|
'./table').then(({
|
|
16
16
|
createTableView
|
|
17
17
|
}) => {
|
|
18
|
-
return (node, view, getPos, decorations, getNodeViewOptions
|
|
19
|
-
// Ignored via go/ees005
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
21
|
-
) => {
|
|
18
|
+
return (node, view, getPos, decorations, getNodeViewOptions) => {
|
|
22
19
|
const {
|
|
23
20
|
portalProviderAPI,
|
|
24
21
|
eventDispatcher,
|
|
@@ -52,10 +49,7 @@ export const lazyTableCellView = options => {
|
|
|
52
49
|
'./TableCell').then(({
|
|
53
50
|
default: TableCell
|
|
54
51
|
}) => {
|
|
55
|
-
return (node, view, getPos, decorations, getNodeViewOptions
|
|
56
|
-
// Ignored via go/ees005
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
58
|
-
) => {
|
|
52
|
+
return (node, view, getPos, decorations, getNodeViewOptions) => {
|
|
59
53
|
var _pluginInjectionApi$a;
|
|
60
54
|
const {
|
|
61
55
|
eventDispatcher,
|
|
@@ -84,10 +78,7 @@ export const lazyTableHeaderView = options => {
|
|
|
84
78
|
'./TableCell').then(({
|
|
85
79
|
default: TableCell
|
|
86
80
|
}) => {
|
|
87
|
-
return (node, view, getPos, decorations, getNodeViewOptions
|
|
88
|
-
// Ignored via go/ees005
|
|
89
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
90
|
-
) => {
|
|
81
|
+
return (node, view, getPos, decorations, getNodeViewOptions) => {
|
|
91
82
|
var _pluginInjectionApi$a2;
|
|
92
83
|
const {
|
|
93
84
|
eventDispatcher,
|
|
@@ -115,10 +106,7 @@ export const lazyTableRowView = options => {
|
|
|
115
106
|
'./TableRow').then(({
|
|
116
107
|
default: TableRow
|
|
117
108
|
}) => {
|
|
118
|
-
return (node, view, getPos, decorations, getNodeViewOptions
|
|
119
|
-
// Ignored via go/ees005
|
|
120
|
-
// eslint-disable-next-line @typescript-eslint/max-params
|
|
121
|
-
) => {
|
|
109
|
+
return (node, view, getPos, decorations, getNodeViewOptions) => {
|
|
122
110
|
const {
|
|
123
111
|
eventDispatcher
|
|
124
112
|
} = getNodeViewOptions();
|