@atlaskit/editor-plugin-table 4.0.1 → 4.0.3
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 +146 -133
- package/README.md +1 -1
- package/dist/cjs/i18n/cs.js +2 -3
- package/dist/cjs/i18n/da.js +2 -3
- package/dist/cjs/i18n/de.js +2 -3
- package/dist/cjs/i18n/en.js +2 -3
- package/dist/cjs/i18n/en_GB.js +2 -3
- package/dist/cjs/i18n/en_ZZ.js +2 -3
- package/dist/cjs/i18n/es.js +2 -3
- package/dist/cjs/i18n/fi.js +2 -3
- package/dist/cjs/i18n/fr.js +2 -3
- package/dist/cjs/i18n/hu.js +2 -3
- package/dist/cjs/i18n/it.js +2 -3
- package/dist/cjs/i18n/ja.js +2 -3
- package/dist/cjs/i18n/ko.js +2 -3
- package/dist/cjs/i18n/nb.js +2 -3
- package/dist/cjs/i18n/nl.js +2 -3
- package/dist/cjs/i18n/pl.js +2 -3
- package/dist/cjs/i18n/pt_BR.js +2 -3
- package/dist/cjs/i18n/ru.js +2 -3
- package/dist/cjs/i18n/sv.js +2 -3
- package/dist/cjs/i18n/th.js +2 -3
- package/dist/cjs/i18n/tr.js +2 -3
- package/dist/cjs/i18n/uk.js +2 -3
- package/dist/cjs/i18n/vi.js +2 -3
- package/dist/cjs/i18n/zh.js +2 -3
- package/dist/cjs/i18n/zh_TW.js +2 -3
- package/dist/cjs/plugins/table/commands/clear.js +3 -5
- package/dist/cjs/plugins/table/commands/collapse.js +2 -3
- package/dist/cjs/plugins/table/commands/go-to-next-cell.js +2 -3
- package/dist/cjs/plugins/table/commands/hover.js +8 -15
- package/dist/cjs/plugins/table/commands/insert.js +8 -13
- package/dist/cjs/plugins/table/commands/misc.js +23 -45
- package/dist/cjs/plugins/table/commands/referentiality.js +2 -3
- package/dist/cjs/plugins/table/commands/selection.js +3 -6
- package/dist/cjs/plugins/table/commands/sort.js +5 -6
- package/dist/cjs/plugins/table/commands/split-cell.js +2 -3
- package/dist/cjs/plugins/table/commands/toggle.js +7 -13
- package/dist/cjs/plugins/table/commands-with-analytics.js +19 -37
- package/dist/cjs/plugins/table/create-plugin-config.js +2 -3
- package/dist/cjs/plugins/table/event-handlers.js +12 -22
- package/dist/cjs/plugins/table/handlers.js +4 -5
- package/dist/cjs/plugins/table/index.js +8 -9
- package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +5 -6
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +2 -3
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +10 -13
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +4 -5
- package/dist/cjs/plugins/table/nodeviews/TableStickyScrollbar.js +5 -10
- package/dist/cjs/plugins/table/nodeviews/table.js +4 -6
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +2 -3
- package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +5 -9
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +3 -5
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +3 -5
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/default-table-selection.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/keymap.js +1 -2
- package/dist/cjs/plugins/table/pm-plugins/main.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +3 -6
- package/dist/cjs/plugins/table/pm-plugins/plugin-key.js +1 -2
- package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +3 -5
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/commands.js +3 -5
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +3 -5
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +6 -8
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-key.js +1 -2
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-state.js +2 -4
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/util.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-analytics.js +5 -8
- package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +7 -13
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +3 -4
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-factory.js +3 -6
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-key.js +1 -2
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/reducer.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +7 -13
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/column-state.js +5 -10
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/consts.js +2 -4
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +8 -15
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-column.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +70 -71
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +11 -21
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +5 -9
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.js +2 -3
- package/dist/cjs/plugins/table/pm-plugins/table-selection-keymap.js +1 -2
- package/dist/cjs/plugins/table/pm-plugins/table-width.js +3 -5
- package/dist/cjs/plugins/table/reducer.js +2 -3
- package/dist/cjs/plugins/table/toolbar.js +8 -12
- package/dist/cjs/plugins/table/transforms/column-width.js +4 -6
- package/dist/cjs/plugins/table/transforms/delete-columns.js +60 -60
- package/dist/cjs/plugins/table/transforms/delete-rows.js +52 -52
- package/dist/cjs/plugins/table/transforms/fix-tables.js +3 -6
- package/dist/cjs/plugins/table/transforms/replace-table.js +3 -4
- package/dist/cjs/plugins/table/types.js +5 -9
- package/dist/cjs/plugins/table/ui/ColumnResizeWidget/index.js +2 -3
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/FixedButton.js +5 -10
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +3 -5
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +7 -10
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +1 -2
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/styles.js +2 -4
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +1 -2
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +1 -2
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +1 -2
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +1 -2
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +2 -4
- package/dist/cjs/plugins/table/ui/LayoutButton/index.js +1 -2
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +1 -2
- package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +2 -3
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +1 -2
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +1 -2
- package/dist/cjs/plugins/table/ui/common-styles.js +23 -14
- package/dist/cjs/plugins/table/ui/consts.js +47 -94
- package/dist/cjs/plugins/table/ui/messages.js +2 -3
- package/dist/cjs/plugins/table/ui/ui-styles.js +32 -38
- package/dist/cjs/plugins/table/utils/analytics.js +7 -12
- package/dist/cjs/plugins/table/utils/collapse.js +3 -5
- package/dist/cjs/plugins/table/utils/column-controls.js +6 -11
- package/dist/cjs/plugins/table/utils/decoration.js +10 -19
- package/dist/cjs/plugins/table/utils/dom.js +16 -28
- package/dist/cjs/plugins/table/utils/guidelines.js +1 -2
- package/dist/cjs/plugins/table/utils/nodes.js +12 -23
- package/dist/cjs/plugins/table/utils/paste.js +10 -16
- package/dist/cjs/plugins/table/utils/row-controls.js +7 -13
- package/dist/cjs/plugins/table/utils/selection.js +5 -9
- package/dist/cjs/plugins/table/utils/snapping.js +4 -7
- package/dist/cjs/plugins/table/utils/table.js +3 -5
- package/dist/cjs/plugins/table/utils/update-plugin-state-decorations.js +2 -3
- package/dist/cjs/plugins/table-plugin.js +1 -2
- package/dist/es2019/plugins/table/commands/insert.js +1 -1
- package/dist/es2019/plugins/table/commands/sort.js +1 -1
- package/dist/es2019/plugins/table/handlers.js +1 -1
- package/dist/es2019/plugins/table/toolbar.js +1 -1
- package/dist/es2019/plugins/table/transforms/delete-columns.js +1 -1
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -1
- package/dist/es2019/plugins/table/ui/common-styles.js +40 -4
- package/dist/es2019/plugins/table/ui/ui-styles.js +223 -85
- package/dist/esm/plugins/table/commands/insert.js +1 -1
- package/dist/esm/plugins/table/commands/sort.js +1 -1
- package/dist/esm/plugins/table/event-handlers.js +1 -1
- package/dist/esm/plugins/table/handlers.js +1 -1
- package/dist/esm/plugins/table/index.js +7 -7
- package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +3 -3
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +1 -1
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +6 -6
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +2 -2
- package/dist/esm/plugins/table/nodeviews/TableStickyScrollbar.js +3 -7
- package/dist/esm/plugins/table/nodeviews/table.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +3 -3
- package/dist/esm/plugins/table/pm-plugins/table-analytics.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +68 -67
- package/dist/esm/plugins/table/toolbar.js +2 -2
- package/dist/esm/plugins/table/transforms/column-width.js +1 -1
- package/dist/esm/plugins/table/transforms/delete-columns.js +57 -56
- package/dist/esm/plugins/table/transforms/delete-rows.js +51 -50
- package/dist/esm/plugins/table/transforms/replace-table.js +1 -1
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +2 -2
- package/dist/esm/plugins/table/ui/common-styles.js +20 -6
- package/dist/esm/plugins/table/ui/ui-styles.js +18 -10
- package/dist/esm/plugins/table/utils/analytics.js +1 -1
- package/dist/esm/plugins/table/utils/dom.js +1 -1
- package/dist/esm/plugins/table/utils/paste.js +4 -4
- package/dist/types/plugins/table/commands/sort.d.ts +2 -2
- package/dist/types/plugins/table/commands-with-analytics.d.ts +4 -4
- package/dist/types/plugins/table/handlers.d.ts +2 -2
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +1 -1
- package/dist/types/plugins/table/types.d.ts +1 -1
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +4 -4
- package/dist/types-ts4.5/plugins/table/commands/sort.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/commands-with-analytics.d.ts +4 -4
- package/dist/types-ts4.5/plugins/table/handlers.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/types.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +4 -4
- package/docs/0-intro.tsx +1 -1
- package/package.json +8 -4
- package/src/__tests__/integration/__snapshots__/auto-size.ts.snap +3 -0
- package/src/__tests__/integration/__snapshots__/copy-button.ts.snap +2 -0
- package/src/__tests__/integration/__snapshots__/delete-columns.ts.snap +2 -0
- package/src/__tests__/integration/__snapshots__/delete-last-column-in-full-width.ts.snap +1 -0
- package/src/__tests__/integration/__snapshots__/delete-last-column-with-empty-action.ts.snap +1 -0
- package/src/__tests__/integration/__snapshots__/delete-last-row-with-empty-action.ts.snap +2 -0
- package/src/__tests__/integration/__snapshots__/delete-rows.ts.snap +3 -0
- package/src/__tests__/integration/__snapshots__/deleting-empty-paragraph-under-table.ts.snap +3 -0
- package/src/__tests__/integration/__snapshots__/even-columns.ts.snap +2 -0
- package/src/__tests__/integration/__snapshots__/insert-cell-header-with-strong-mark.ts.snap +1 -0
- package/src/__tests__/integration/__snapshots__/insert-row-inside-layout.ts.snap +1 -0
- package/src/__tests__/integration/__snapshots__/layout.ts.snap +9 -0
- package/src/__tests__/integration/__snapshots__/resize.ts.snap +11 -0
- package/src/__tests__/integration/__snapshots__/scale.ts.snap +2 -0
- package/src/__tests__/unit/commands/sort.ts +1 -1
- package/src/__tests__/unit/pm-plugins/table-width.ts +190 -1
- package/src/__tests__/unit/sort-column.ts +1 -1
- package/src/plugins/table/commands/insert.ts +1 -1
- package/src/plugins/table/commands/sort.ts +7 -7
- package/src/plugins/table/commands-with-analytics.ts +11 -6
- package/src/plugins/table/handlers.ts +7 -8
- package/src/plugins/table/nodeviews/TableComponent.tsx +1 -1
- package/src/plugins/table/nodeviews/table.tsx +1 -1
- package/src/plugins/table/toolbar.tsx +1 -1
- package/src/plugins/table/transforms/delete-columns.ts +1 -1
- package/src/plugins/table/types.ts +1 -1
- package/src/plugins/table/ui/FloatingContextualMenu/ContextualMenu.tsx +1 -1
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +4 -4
- package/src/plugins/table/ui/common-styles.ts +46 -4
- package/src/plugins/table/ui/ui-styles.ts +235 -90
- package/tsconfig.app.json +3 -0
- package/tsconfig.dev.json +3 -0
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.deleteColumns = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var
|
|
10
|
+
var _customSteps = require("@atlaskit/custom-steps");
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
12
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
13
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
@@ -33,7 +33,7 @@ var deleteColumnsCustomStep = function deleteColumnsCustomStep(rect) {
|
|
|
33
33
|
var originalDoc = tr.doc;
|
|
34
34
|
var deletedColumns = [];
|
|
35
35
|
for (var i = rect.left; i < rect.right; i++) {
|
|
36
|
-
var step =
|
|
36
|
+
var step = _customSteps.AddColumnStep.create(originalDoc, table.pos, i, true);
|
|
37
37
|
deletedColumns.push(i);
|
|
38
38
|
tr.step(step.map(tr.mapping.slice(mapStart)));
|
|
39
39
|
}
|
|
@@ -72,69 +72,70 @@ var deleteColumnsLegacy = function deleteColumnsLegacy(rect) {
|
|
|
72
72
|
var rowCells = [];
|
|
73
73
|
var row = table.node.child(rowIndex);
|
|
74
74
|
var _loop = function _loop(colIndex) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
75
|
+
var cellPos = map.map[rowIndex * map.width + colIndex];
|
|
76
|
+
var cell = table.node.nodeAt(cellPos);
|
|
77
|
+
if (!cell) {
|
|
78
|
+
return 0; // continue
|
|
79
|
+
}
|
|
80
|
+
var cellsInColumn = map.cellsInRect({
|
|
81
|
+
left: colIndex,
|
|
82
|
+
top: 0,
|
|
83
|
+
right: colIndex + 1,
|
|
84
|
+
bottom: map.height
|
|
85
|
+
});
|
|
86
|
+
if (columnsToDelete.indexOf(colIndex) === -1) {
|
|
87
|
+
// decrement colspans for col-spanning cells that overlap deleted columns
|
|
88
|
+
if (cellsInColumn.indexOf(cellPos) > -1 && !seen[cellPos]) {
|
|
89
|
+
var overlappingCols = 0;
|
|
90
|
+
columnsToDelete.forEach(function (colIndexToDelete) {
|
|
91
|
+
if (colIndex < colIndexToDelete && cell.attrs.colspan + colIndex - 1 >= colIndexToDelete) {
|
|
92
|
+
overlappingCols += 1;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
if (overlappingCols > 0) {
|
|
96
|
+
var attrs = _objectSpread(_objectSpread({}, cell.attrs), {}, {
|
|
97
|
+
colspan: cell.attrs.colspan - overlappingCols
|
|
98
|
+
});
|
|
99
|
+
if (cell.attrs.colwidth) {
|
|
100
|
+
var minColIndex = Math.min.apply(Math, columnsToDelete);
|
|
101
|
+
var pos = minColIndex > 0 ? minColIndex - map.colCount(cellPos) : 0;
|
|
102
|
+
var colwidth = cell.attrs.colwidth.slice() || [];
|
|
103
|
+
colwidth.splice(pos, overlappingCols);
|
|
104
|
+
attrs.colwidth = colwidth;
|
|
105
|
+
}
|
|
106
|
+
var newCell = cell.type.createChecked(attrs, cell.content, cell.marks);
|
|
107
|
+
rowCells.push(newCell);
|
|
108
|
+
seen[cellPos] = true;
|
|
109
|
+
return 0; // continue
|
|
93
110
|
}
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
var
|
|
97
|
-
colspan:
|
|
111
|
+
} else if (deletedCells[cellPos]) {
|
|
112
|
+
// if we're removing a col-spanning cell, we need to add missing cells to columns to the right
|
|
113
|
+
var _attrs = _objectSpread(_objectSpread({}, cell.attrs), {}, {
|
|
114
|
+
colspan: 1,
|
|
115
|
+
rowspan: 1
|
|
98
116
|
});
|
|
99
117
|
if (cell.attrs.colwidth) {
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
var colwidth = cell.attrs.colwidth.slice() || [];
|
|
103
|
-
colwidth.splice(pos, overlappingCols);
|
|
104
|
-
attrs.colwidth = colwidth;
|
|
118
|
+
var _pos = colIndex > 0 ? colIndex - map.colCount(cellPos) : 0;
|
|
119
|
+
_attrs.colwidth = cell.attrs.colwidth.slice().splice(_pos, 1);
|
|
105
120
|
}
|
|
106
|
-
var
|
|
107
|
-
rowCells.push(
|
|
108
|
-
|
|
109
|
-
return "continue";
|
|
110
|
-
}
|
|
111
|
-
} else if (deletedCells[cellPos]) {
|
|
112
|
-
// if we're removing a col-spanning cell, we need to add missing cells to columns to the right
|
|
113
|
-
var _attrs = _objectSpread(_objectSpread({}, cell.attrs), {}, {
|
|
114
|
-
colspan: 1,
|
|
115
|
-
rowspan: 1
|
|
116
|
-
});
|
|
117
|
-
if (cell.attrs.colwidth) {
|
|
118
|
-
var _pos = colIndex > 0 ? colIndex - map.colCount(cellPos) : 0;
|
|
119
|
-
_attrs.colwidth = cell.attrs.colwidth.slice().splice(_pos, 1);
|
|
121
|
+
var _newCell = cell.type.createChecked(_attrs, cell.type.schema.nodes.paragraph.createChecked(), cell.marks);
|
|
122
|
+
rowCells.push(_newCell);
|
|
123
|
+
return 0; // continue
|
|
120
124
|
}
|
|
121
|
-
var _newCell = cell.type.createChecked(_attrs, cell.type.schema.nodes.paragraph.createChecked(), cell.marks);
|
|
122
|
-
rowCells.push(_newCell);
|
|
123
|
-
return "continue";
|
|
124
|
-
}
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
// normal cells that we want to keep
|
|
127
|
+
if (!seen[cellPos]) {
|
|
128
|
+
seen[cellPos] = true;
|
|
129
|
+
rowCells.push(cell);
|
|
130
|
+
}
|
|
131
|
+
} else if (cellsInColumn.indexOf(cellPos) > -1) {
|
|
132
|
+
deletedCells[cellPos] = true;
|
|
130
133
|
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
};
|
|
134
|
+
},
|
|
135
|
+
_ret;
|
|
135
136
|
for (var colIndex = 0; colIndex < map.width; colIndex++) {
|
|
136
|
-
|
|
137
|
-
if (_ret ===
|
|
137
|
+
_ret = _loop(colIndex);
|
|
138
|
+
if (_ret === 0) continue;
|
|
138
139
|
}
|
|
139
140
|
if (rowCells.length) {
|
|
140
141
|
rows.push(row.type.createChecked(row.attrs, rowCells, row.marks));
|
|
@@ -209,7 +210,7 @@ function fixRowSpans(table) {
|
|
|
209
210
|
}
|
|
210
211
|
return table.type.createChecked(table.attrs, rows, table.marks);
|
|
211
212
|
}
|
|
212
|
-
var deleteColumns = function deleteColumns(rect) {
|
|
213
|
+
var deleteColumns = exports.deleteColumns = function deleteColumns(rect) {
|
|
213
214
|
var allowAddColumnCustomStep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
214
215
|
return function (tr) {
|
|
215
216
|
tr.setMeta(_tableAnalytics.META_KEYS.OVERFLOW_TRIGGER, {
|
|
@@ -220,5 +221,4 @@ var deleteColumns = function deleteColumns(rect) {
|
|
|
220
221
|
}
|
|
221
222
|
return deleteColumnsLegacy(rect)(tr);
|
|
222
223
|
};
|
|
223
|
-
};
|
|
224
|
-
exports.deleteColumns = deleteColumns;
|
|
224
|
+
};
|
|
@@ -13,7 +13,7 @@ var _utils = require("@atlaskit/editor-tables/utils");
|
|
|
13
13
|
var _merge = require("./merge");
|
|
14
14
|
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; }
|
|
15
15
|
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; }
|
|
16
|
-
var deleteRows = function deleteRows(rect) {
|
|
16
|
+
var deleteRows = exports.deleteRows = function deleteRows(rect) {
|
|
17
17
|
var isHeaderRowRequired = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
18
18
|
return function (tr) {
|
|
19
19
|
var table = (0, _utils.findTable)(tr.selection);
|
|
@@ -43,61 +43,62 @@ var deleteRows = function deleteRows(rect) {
|
|
|
43
43
|
var rowCells = [];
|
|
44
44
|
var row = table.node.child(rowIndex);
|
|
45
45
|
var _loop2 = function _loop2() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
46
|
+
var cellPos = map.map[rowIndex * map.width + colIndex];
|
|
47
|
+
var cell = table.node.nodeAt(cellPos);
|
|
48
|
+
if (!cell) {
|
|
49
|
+
return 0; // continue
|
|
50
|
+
}
|
|
51
|
+
var cellsInRow = map.cellsInRect({
|
|
52
|
+
left: 0,
|
|
53
|
+
top: rowIndex,
|
|
54
|
+
right: map.width,
|
|
55
|
+
bottom: rowIndex + 1
|
|
56
|
+
});
|
|
57
|
+
if (rowsToDelete.indexOf(rowIndex) === -1 && !seen[cellPos]) {
|
|
58
|
+
// decrement rowspans for row-spanning cells that overlap deleted rows
|
|
59
|
+
if (cellsInRow.indexOf(cellPos) > -1) {
|
|
60
|
+
var overlappingRows = 0;
|
|
61
|
+
rowsToDelete.forEach(function (rowIndexToDelete) {
|
|
62
|
+
if (rowIndex < rowIndexToDelete && cell.attrs.rowspan + rowIndex - 1 >= rowIndexToDelete) {
|
|
63
|
+
overlappingRows += 1;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
if (overlappingRows > 0) {
|
|
67
|
+
var newCell = cell.type.createChecked(_objectSpread(_objectSpread({}, cell.attrs), {}, {
|
|
68
|
+
rowspan: cell.attrs.rowspan - overlappingRows
|
|
69
|
+
}), cell.content, cell.marks);
|
|
70
|
+
rowCells.push(newCell);
|
|
71
|
+
seen[cellPos] = true;
|
|
72
|
+
return 0; // continue
|
|
64
73
|
}
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
var
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
rowspan: 1
|
|
79
|
-
});
|
|
80
|
-
if (cell.attrs.colwidth) {
|
|
81
|
-
var pos = colIndex > 0 ? colIndex - map.colCount(cellPos) : 0;
|
|
82
|
-
attrs.colwidth = cell.attrs.colwidth.slice().splice(pos, 1);
|
|
74
|
+
} else if (deletedCells[cellPos]) {
|
|
75
|
+
// if we're removing a row-spanning cell, we need to add missing cells to rows below
|
|
76
|
+
var attrs = _objectSpread(_objectSpread({}, cell.attrs), {}, {
|
|
77
|
+
colspan: 1,
|
|
78
|
+
rowspan: 1
|
|
79
|
+
});
|
|
80
|
+
if (cell.attrs.colwidth) {
|
|
81
|
+
var pos = colIndex > 0 ? colIndex - map.colCount(cellPos) : 0;
|
|
82
|
+
attrs.colwidth = cell.attrs.colwidth.slice().splice(pos, 1);
|
|
83
|
+
}
|
|
84
|
+
var _newCell = cell.type.createChecked(attrs, cell.type.schema.nodes.paragraph.createChecked(), cell.marks);
|
|
85
|
+
rowCells.push(_newCell);
|
|
86
|
+
return 0; // continue
|
|
83
87
|
}
|
|
84
|
-
var _newCell = cell.type.createChecked(attrs, cell.type.schema.nodes.paragraph.createChecked(), cell.marks);
|
|
85
|
-
rowCells.push(_newCell);
|
|
86
|
-
return "continue";
|
|
87
|
-
}
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
// normal cells that we want to keep
|
|
90
|
+
if (!seen[cellPos]) {
|
|
91
|
+
seen[cellPos] = true;
|
|
92
|
+
rowCells.push(cell);
|
|
93
|
+
}
|
|
94
|
+
} else if (cellsInRow.indexOf(cellPos) > -1) {
|
|
95
|
+
deletedCells[cellPos] = true;
|
|
93
96
|
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
};
|
|
97
|
+
},
|
|
98
|
+
_ret;
|
|
98
99
|
for (var colIndex = 0; colIndex < map.width; colIndex++) {
|
|
99
|
-
|
|
100
|
-
if (_ret ===
|
|
100
|
+
_ret = _loop2();
|
|
101
|
+
if (_ret === 0) continue;
|
|
101
102
|
}
|
|
102
103
|
if (rowCells.length) {
|
|
103
104
|
rows.push(row.type.createChecked(row.attrs, rowCells, row.marks));
|
|
@@ -120,7 +121,6 @@ var deleteRows = function deleteRows(rect) {
|
|
|
120
121
|
.setSelection(_state.Selection.near(tr.doc.resolve(table.pos + cursorPos)));
|
|
121
122
|
};
|
|
122
123
|
};
|
|
123
|
-
exports.deleteRows = deleteRows;
|
|
124
124
|
function getNextCursorPos(table, deletedRows) {
|
|
125
125
|
var minRow = Math.min.apply(Math, (0, _toConsumableArray2.default)(deletedRows));
|
|
126
126
|
var nextRowWithCursor = minRow > 0 ? minRow - 1 : 0;
|
|
@@ -43,7 +43,7 @@ var validateTableCellNodeAttrs = function validateTableCellNodeAttrs(_ref, repor
|
|
|
43
43
|
//
|
|
44
44
|
// This row only spans two columns, yet it contains widths for 3.
|
|
45
45
|
// We remove the third width here, assumed duplicate content.
|
|
46
|
-
var removeExtraneousColumnWidths = function removeExtraneousColumnWidths(node, basePos, tr, reportInvalidTableCellSpanAttrs) {
|
|
46
|
+
var removeExtraneousColumnWidths = exports.removeExtraneousColumnWidths = function removeExtraneousColumnWidths(node, basePos, tr, reportInvalidTableCellSpanAttrs) {
|
|
47
47
|
var hasProblems = false;
|
|
48
48
|
tr = replaceCells(tr, node, basePos, function (cell) {
|
|
49
49
|
var _cell$attrs = cell.attrs,
|
|
@@ -70,8 +70,7 @@ var removeExtraneousColumnWidths = function removeExtraneousColumnWidths(node, b
|
|
|
70
70
|
}
|
|
71
71
|
return false;
|
|
72
72
|
};
|
|
73
|
-
exports.
|
|
74
|
-
var fixTables = function fixTables(tr, reportInvalidTableCellSpanAttrs) {
|
|
73
|
+
var fixTables = exports.fixTables = function fixTables(tr, reportInvalidTableCellSpanAttrs) {
|
|
75
74
|
var hasProblems = false;
|
|
76
75
|
tr.doc.descendants(function (node, pos) {
|
|
77
76
|
if (node.type.name === 'table') {
|
|
@@ -95,8 +94,7 @@ var fixTables = function fixTables(tr, reportInvalidTableCellSpanAttrs) {
|
|
|
95
94
|
//
|
|
96
95
|
// We use this when migrating TinyMCE tables for Confluence, for example:
|
|
97
96
|
// https://pug.jira-dev.com/wiki/spaces/AEC/pages/3362882215/How+do+we+map+TinyMCE+tables+to+Fabric+tables
|
|
98
|
-
exports.
|
|
99
|
-
var fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, tablePos, opts) {
|
|
97
|
+
var fixAutoSizedTable = exports.fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, tablePos, opts) {
|
|
100
98
|
var tr = view.state.tr;
|
|
101
99
|
var domAtPos = view.domAtPos.bind(view);
|
|
102
100
|
var tableStart = tablePos + 1;
|
|
@@ -130,7 +128,6 @@ var fixAutoSizedTable = function fixAutoSizedTable(view, tableNode, tableRef, ta
|
|
|
130
128
|
__autoSize: false
|
|
131
129
|
})).setMeta('addToHistory', false);
|
|
132
130
|
};
|
|
133
|
-
exports.fixAutoSizedTable = fixAutoSizedTable;
|
|
134
131
|
var getLayoutBasedOnWidth = function getLayoutBasedOnWidth(totalWidth) {
|
|
135
132
|
if (totalWidth > _editorSharedStyles.akEditorWideLayoutWidth) {
|
|
136
133
|
return 'full-width';
|
|
@@ -9,7 +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 _utils2 = require("../utils");
|
|
12
|
-
var replaceSelectedTable = function replaceSelectedTable(state, content, inputMethod, editorAnalyticsAPI) {
|
|
12
|
+
var replaceSelectedTable = exports.replaceSelectedTable = function replaceSelectedTable(state, content, inputMethod, editorAnalyticsAPI) {
|
|
13
13
|
if ((0, _utils.isTableSelected)(state.selection)) {
|
|
14
14
|
var table = (0, _utils.findTable)(state.selection);
|
|
15
15
|
if (table) {
|
|
@@ -19,7 +19,7 @@ var replaceSelectedTable = function replaceSelectedTable(state, content, inputMe
|
|
|
19
19
|
var _getSelectedTableInfo = (0, _utils2.getSelectedTableInfo)(state.selection),
|
|
20
20
|
totalRowCount = _getSelectedTableInfo.totalRowCount,
|
|
21
21
|
totalColumnCount = _getSelectedTableInfo.totalColumnCount;
|
|
22
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0
|
|
22
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
23
23
|
action: _analytics.TABLE_ACTION.REPLACED,
|
|
24
24
|
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
25
25
|
attributes: {
|
|
@@ -33,5 +33,4 @@ var replaceSelectedTable = function replaceSelectedTable(state, content, inputMe
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
return state.tr;
|
|
36
|
-
};
|
|
37
|
-
exports.replaceSelectedTable = replaceSelectedTable;
|
|
36
|
+
};
|
|
@@ -10,7 +10,7 @@ var _adfSchema = require("@atlaskit/adf-schema");
|
|
|
10
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
11
11
|
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; }
|
|
12
12
|
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; }
|
|
13
|
-
var RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
|
|
13
|
+
var RESIZE_HANDLE_AREA_DECORATION_GAP = exports.RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
|
|
14
14
|
|
|
15
15
|
/*
|
|
16
16
|
* This type represents the start and end from a cell in a column,
|
|
@@ -36,8 +36,7 @@ var RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
|
|
|
36
36
|
* ```
|
|
37
37
|
*
|
|
38
38
|
*/
|
|
39
|
-
exports.
|
|
40
|
-
var TableDecorations = /*#__PURE__*/function (TableDecorations) {
|
|
39
|
+
var TableDecorations = exports.TableDecorations = /*#__PURE__*/function (TableDecorations) {
|
|
41
40
|
TableDecorations["ALL_CONTROLS_HOVER"] = "CONTROLS_HOVER";
|
|
42
41
|
TableDecorations["ROW_CONTROLS_HOVER"] = "ROW_CONTROLS_HOVER";
|
|
43
42
|
TableDecorations["COLUMN_CONTROLS_HOVER"] = "COLUMN_CONTROLS_HOVER";
|
|
@@ -51,8 +50,7 @@ var TableDecorations = /*#__PURE__*/function (TableDecorations) {
|
|
|
51
50
|
TableDecorations["LAST_CELL_ELEMENT"] = "LAST_CELL_ELEMENT";
|
|
52
51
|
return TableDecorations;
|
|
53
52
|
}({});
|
|
54
|
-
exports.
|
|
55
|
-
var TableCssClassName = _objectSpread(_objectSpread({}, _styles.TableSharedCssClassName), {}, {
|
|
53
|
+
var TableCssClassName = exports.TableCssClassName = _objectSpread(_objectSpread({}, _styles.TableSharedCssClassName), {}, {
|
|
56
54
|
COLUMN_CONTROLS: "".concat(_adfSchema.tablePrefixSelector, "-column-controls"),
|
|
57
55
|
COLUMN_CONTROLS_DECORATIONS: "".concat(_adfSchema.tablePrefixSelector, "-column-controls-decoration"),
|
|
58
56
|
COLUMN_SELECTED: "".concat(_adfSchema.tablePrefixSelector, "-column__selected"),
|
|
@@ -115,10 +113,8 @@ var TableCssClassName = _objectSpread(_objectSpread({}, _styles.TableSharedCssCl
|
|
|
115
113
|
WITH_RESIZE_LINE: "".concat(_adfSchema.tablePrefixSelector, "-column-resize-line"),
|
|
116
114
|
WITH_RESIZE_LINE_LAST_COLUMN: "".concat(_adfSchema.tablePrefixSelector, "-column-resize-line-last-column")
|
|
117
115
|
});
|
|
118
|
-
exports.
|
|
119
|
-
var ShadowEvent = /*#__PURE__*/function (ShadowEvent) {
|
|
116
|
+
var ShadowEvent = exports.ShadowEvent = /*#__PURE__*/function (ShadowEvent) {
|
|
120
117
|
ShadowEvent["SHOW_BEFORE_SHADOW"] = "showBeforeShadow";
|
|
121
118
|
ShadowEvent["SHOW_AFTER_SHADOW"] = "showAfterShadow";
|
|
122
119
|
return ShadowEvent;
|
|
123
|
-
}({});
|
|
124
|
-
exports.ShadowEvent = ShadowEvent;
|
|
120
|
+
}({});
|
|
@@ -14,7 +14,7 @@ var _types = require("../../types");
|
|
|
14
14
|
var _messages = _interopRequireDefault(require("../messages"));
|
|
15
15
|
/** @jsx jsx */
|
|
16
16
|
|
|
17
|
-
var ColumnResizeWidget = function ColumnResizeWidget(_ref) {
|
|
17
|
+
var ColumnResizeWidget = exports.ColumnResizeWidget = function ColumnResizeWidget(_ref) {
|
|
18
18
|
var startIndex = _ref.startIndex,
|
|
19
19
|
endIndex = _ref.endIndex,
|
|
20
20
|
includeTooltip = _ref.includeTooltip;
|
|
@@ -40,5 +40,4 @@ var ColumnResizeWidget = function ColumnResizeWidget(_ref) {
|
|
|
40
40
|
"data-end-index": endIndex
|
|
41
41
|
}, tooltipProps));
|
|
42
42
|
});
|
|
43
|
-
};
|
|
44
|
-
exports.ColumnResizeWidget = ColumnResizeWidget;
|
|
43
|
+
};
|
|
@@ -14,24 +14,21 @@ var _types = require("../../types");
|
|
|
14
14
|
var _commonStyles = require("../common-styles");
|
|
15
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
var BUTTON_WIDTH = 20;
|
|
18
|
-
exports.
|
|
19
|
-
var calcLeftPos = function calcLeftPos(_ref) {
|
|
17
|
+
var BUTTON_WIDTH = exports.BUTTON_WIDTH = 20;
|
|
18
|
+
var calcLeftPos = exports.calcLeftPos = function calcLeftPos(_ref) {
|
|
20
19
|
var buttonWidth = _ref.buttonWidth,
|
|
21
20
|
cellRectLeft = _ref.cellRectLeft,
|
|
22
21
|
cellRefWidth = _ref.cellRefWidth,
|
|
23
22
|
offset = _ref.offset;
|
|
24
23
|
return cellRectLeft + cellRefWidth - buttonWidth - offset;
|
|
25
24
|
};
|
|
26
|
-
exports.
|
|
27
|
-
var calcObserverTargetMargin = function calcObserverTargetMargin(tableWrapper, fixedButtonRefCurrent) {
|
|
25
|
+
var calcObserverTargetMargin = exports.calcObserverTargetMargin = function calcObserverTargetMargin(tableWrapper, fixedButtonRefCurrent) {
|
|
28
26
|
var tableWrapperRect = tableWrapper.getBoundingClientRect();
|
|
29
27
|
var fixedButtonRect = fixedButtonRefCurrent.getBoundingClientRect();
|
|
30
28
|
var scrollLeft = tableWrapper.scrollLeft;
|
|
31
29
|
return fixedButtonRect.left - tableWrapperRect.left + scrollLeft;
|
|
32
30
|
};
|
|
33
|
-
exports.
|
|
34
|
-
var FixedButton = function FixedButton(_ref2) {
|
|
31
|
+
var FixedButton = exports.FixedButton = function FixedButton(_ref2) {
|
|
35
32
|
var children = _ref2.children,
|
|
36
33
|
isContextualMenuOpen = _ref2.isContextualMenuOpen,
|
|
37
34
|
mountTo = _ref2.mountTo,
|
|
@@ -128,6 +125,4 @@ var FixedButton = function FixedButton(_ref2) {
|
|
|
128
125
|
className: _types.TableCssClassName.CONTEXTUAL_MENU_BUTTON_FIXED
|
|
129
126
|
}, children)), mountTo);
|
|
130
127
|
};
|
|
131
|
-
exports.
|
|
132
|
-
var _default = FixedButton;
|
|
133
|
-
exports.default = _default;
|
|
128
|
+
var _default = exports.default = FixedButton;
|
|
@@ -12,7 +12,7 @@ var _components = require("@atlaskit/theme/components");
|
|
|
12
12
|
var _constants = require("@atlaskit/theme/constants");
|
|
13
13
|
var _consts = require("../consts");
|
|
14
14
|
var _templateObject, _templateObject2;
|
|
15
|
-
var tableFloatingCellButtonStyles = function tableFloatingCellButtonStyles(props) {
|
|
15
|
+
var tableFloatingCellButtonStyles = exports.tableFloatingCellButtonStyles = function tableFloatingCellButtonStyles(props) {
|
|
16
16
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n > div {\n // Sits behind button to provide surface-color background\n background: ", ";\n border-radius: ", "px;\n display: flex;\n height: ", "px;\n flex-direction: column;\n }\n && button {\n background: ", ";\n flex-direction: column;\n margin: 2px;\n outline: 2px solid ", ";\n border-radius: 1px;\n padding: 0;\n height: calc(100% - 4px);\n display: flex;\n }\n && button:hover {\n background: ", ";\n }\n && button:active {\n background: ", ";\n }\n && button > span {\n margin: 0px -4px;\n }\n && span {\n pointer-events: none;\n }\n"])), "var(--ds-surface, ".concat(_colors.N20, ")"), (0, _constants.borderRadius)(), _consts.contextualMenuTriggerSize + 2, (0, _components.themed)({
|
|
17
17
|
light: "var(--ds-background-neutral, none)",
|
|
18
18
|
dark: "var(--ds-background-neutral, none)"
|
|
@@ -24,8 +24,7 @@ var tableFloatingCellButtonStyles = function tableFloatingCellButtonStyles(props
|
|
|
24
24
|
dark: "var(--ds-background-neutral-pressed, ".concat(_colors.B75, ")")
|
|
25
25
|
})(props));
|
|
26
26
|
};
|
|
27
|
-
exports.
|
|
28
|
-
var tableFloatingCellButtonSelectedStyles = function tableFloatingCellButtonSelectedStyles(props) {
|
|
27
|
+
var tableFloatingCellButtonSelectedStyles = exports.tableFloatingCellButtonSelectedStyles = function tableFloatingCellButtonSelectedStyles(props) {
|
|
29
28
|
return (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n && button {\n background: ", ";\n }\n && button:hover {\n background: ", ";\n }\n && button:active {\n background: ", ";\n }\n"])), (0, _components.themed)({
|
|
30
29
|
light: "var(--ds-background-selected, ".concat(_colors.N700, ")"),
|
|
31
30
|
dark: "var(--ds-background-selected, ".concat(_colors.DN0, ")")
|
|
@@ -36,5 +35,4 @@ var tableFloatingCellButtonSelectedStyles = function tableFloatingCellButtonSele
|
|
|
36
35
|
light: "var(--ds-background-selected-pressed, ".concat(_colors.N700, ")"),
|
|
37
36
|
dark: "var(--ds-background-selected-pressed, ".concat(_colors.DN0, ")")
|
|
38
37
|
})(props));
|
|
39
|
-
};
|
|
40
|
-
exports.tableFloatingCellButtonSelectedStyles = tableFloatingCellButtonSelectedStyles;
|
|
38
|
+
};
|
|
@@ -15,7 +15,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
var _react = require("react");
|
|
16
16
|
var _react2 = require("@emotion/react");
|
|
17
17
|
var _reactIntlNext = require("react-intl-next");
|
|
18
|
-
var
|
|
18
|
+
var _customSteps = require("@atlaskit/custom-steps");
|
|
19
19
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
20
20
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
21
21
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
@@ -39,7 +39,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
39
39
|
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; }
|
|
40
40
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
41
41
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
|
|
42
|
-
var messages = (0, _reactIntlNext.defineMessages)({
|
|
42
|
+
var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
43
43
|
cellBackground: {
|
|
44
44
|
id: 'fabric.editor.cellBackground',
|
|
45
45
|
defaultMessage: 'Cell background',
|
|
@@ -81,8 +81,7 @@ var messages = (0, _reactIntlNext.defineMessages)({
|
|
|
81
81
|
description: "Distribute widths between selected columns"
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
exports.
|
|
85
|
-
var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
84
|
+
var ContextualMenu = exports.ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
86
85
|
(0, _inherits2.default)(ContextualMenu, _Component);
|
|
87
86
|
var _super = _createSuper(ContextualMenu);
|
|
88
87
|
function ContextualMenu() {
|
|
@@ -125,7 +124,7 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
125
124
|
if (allowBackgroundColor) {
|
|
126
125
|
var _node$attrs;
|
|
127
126
|
var node = isOpen && targetCellPosition ? state.doc.nodeAt(targetCellPosition) : null;
|
|
128
|
-
var background = (0, _editorPalette.hexToEditorBackgroundPaletteColor)((node === null || node === void 0
|
|
127
|
+
var background = (0, _editorPalette.hexToEditorBackgroundPaletteColor)((node === null || node === void 0 || (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.background) || '#ffffff');
|
|
129
128
|
items.push({
|
|
130
129
|
content: formatMessage(messages.cellBackground),
|
|
131
130
|
value: {
|
|
@@ -267,11 +266,11 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
267
266
|
targetCellPosition = _getPluginState2.targetCellPosition;
|
|
268
267
|
switch (item.value.name) {
|
|
269
268
|
case 'sort_column_desc':
|
|
270
|
-
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect.left,
|
|
269
|
+
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect.left, _customSteps.TableSortOrder.DESC)(state, dispatch);
|
|
271
270
|
_this.toggleOpen();
|
|
272
271
|
break;
|
|
273
272
|
case 'sort_column_asc':
|
|
274
|
-
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect.left,
|
|
273
|
+
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.CONTEXT_MENU, selectionRect.left, _customSteps.TableSortOrder.ASC)(state, dispatch);
|
|
275
274
|
_this.toggleOpen();
|
|
276
275
|
break;
|
|
277
276
|
case 'merge':
|
|
@@ -434,9 +433,7 @@ var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
434
433
|
}]);
|
|
435
434
|
return ContextualMenu;
|
|
436
435
|
}(_react.Component);
|
|
437
|
-
exports.ContextualMenu = ContextualMenu;
|
|
438
436
|
(0, _defineProperty2.default)(ContextualMenu, "defaultProps", {
|
|
439
437
|
boundariesElement: typeof document !== 'undefined' ? document.body : undefined
|
|
440
438
|
});
|
|
441
|
-
var _default = (0, _reactIntlNext.injectIntl)(ContextualMenu);
|
|
442
|
-
exports.default = _default;
|
|
439
|
+
var _default = exports.default = (0, _reactIntlNext.injectIntl)(ContextualMenu);
|
|
@@ -75,5 +75,4 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
75
75
|
})));
|
|
76
76
|
};
|
|
77
77
|
FloatingContextualMenu.displayName = 'FloatingContextualMenu';
|
|
78
|
-
var _default = FloatingContextualMenu;
|
|
79
|
-
exports.default = _default;
|
|
78
|
+
var _default = exports.default = FloatingContextualMenu;
|
|
@@ -13,12 +13,10 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
13
13
|
var _types = require("../../types");
|
|
14
14
|
var _consts = require("../consts");
|
|
15
15
|
var _templateObject, _templateObject2;
|
|
16
|
-
var cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
|
|
16
|
+
var cellColourPreviewStyles = exports.cellColourPreviewStyles = function cellColourPreviewStyles(selectedColor) {
|
|
17
17
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n &::before {\n background: ", ";\n }\n"])), selectedColor);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
// TODO Delete this comment after verifying space token -> previous value `padding: 8px`
|
|
21
21
|
// TODO Delete this comment after verifying space token -> previous value `margin-left: 4px`
|
|
22
|
-
exports.
|
|
23
|
-
var tablePopupStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n border-radius: ", "px;\n background: ", ";\n box-shadow: ", ";\n display: block;\n position: absolute;\n top: 0;\n left: ", "px;\n padding: ", ";\n\n > div {\n padding: 0;\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", "px;\n width: 20px;\n height: 20px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 20px;\n color: ", ";\n }\n }\n"])), _types.TableCssClassName.CONTEXTUAL_SUBMENU, (0, _constants.borderRadius)(), "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N60A, ", 0 0 1px ").concat(_colors.N60A), ")"), _consts.contextualMenuDropdownWidth, "var(--ds-space-100, 8px)", _types.TableCssClassName.CONTEXTUAL_MENU_ICON, _adfSchema.tableBackgroundBorderColor, (0, _constants.borderRadius)(), "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(_colors.N90, ")"));
|
|
24
|
-
exports.tablePopupStyles = tablePopupStyles;
|
|
22
|
+
var tablePopupStyles = exports.tablePopupStyles = (0, _react.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n border-radius: ", "px;\n background: ", ";\n box-shadow: ", ";\n display: block;\n position: absolute;\n top: 0;\n left: ", "px;\n padding: ", ";\n\n > div {\n padding: 0;\n }\n }\n\n .", " {\n display: flex;\n\n &::before {\n content: '';\n display: block;\n border: 1px solid ", ";\n border-radius: ", "px;\n width: 20px;\n height: 20px;\n }\n\n &::after {\n content: '\u203A';\n margin-left: ", ";\n line-height: 20px;\n color: ", ";\n }\n }\n"])), _types.TableCssClassName.CONTEXTUAL_SUBMENU, (0, _constants.borderRadius)(), "var(--ds-surface-overlay, white)", "var(--ds-shadow-overlay, ".concat("0 4px 8px -2px ".concat(_colors.N60A, ", 0 0 1px ").concat(_colors.N60A), ")"), _consts.contextualMenuDropdownWidth, "var(--ds-space-100, 8px)", _types.TableCssClassName.CONTEXTUAL_MENU_ICON, _adfSchema.tableBackgroundBorderColor, (0, _constants.borderRadius)(), "var(--ds-space-050, 4px)", "var(--ds-icon, ".concat(_colors.N90, ")"));
|
|
@@ -298,5 +298,4 @@ var FloatingDeleteButton = /*#__PURE__*/function (_Component) {
|
|
|
298
298
|
return FloatingDeleteButton;
|
|
299
299
|
}(_react.Component);
|
|
300
300
|
(0, _defineProperty2.default)(FloatingDeleteButton, "displayName", 'FloatingDeleteButton');
|
|
301
|
-
var _default = FloatingDeleteButton;
|
|
302
|
-
exports.default = _default;
|
|
301
|
+
var _default = exports.default = FloatingDeleteButton;
|
|
@@ -86,5 +86,4 @@ var InsertButton = function InsertButton(_ref2) {
|
|
|
86
86
|
className: "".concat(_types.TableCssClassName.CONTROLS_INSERT_BUTTON_WRAP, " ").concat(_types.TableCssClassName.CONTROLS_INSERT_ROW)
|
|
87
87
|
}, content));
|
|
88
88
|
};
|
|
89
|
-
var _default = (0, _reactIntlNext.injectIntl)(InsertButton);
|
|
90
|
-
exports.default = _default;
|
|
89
|
+
var _default = exports.default = (0, _reactIntlNext.injectIntl)(InsertButton);
|
|
@@ -30,7 +30,7 @@ var _getPopupOptions = _interopRequireDefault(require("./getPopupOptions"));
|
|
|
30
30
|
var _InsertButton = _interopRequireDefault(require("./InsertButton"));
|
|
31
31
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
32
32
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
33
|
-
var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
33
|
+
var FloatingInsertButton = exports.FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
34
34
|
(0, _inherits2.default)(FloatingInsertButton, _React$Component);
|
|
35
35
|
var _super = _createSuper(FloatingInsertButton);
|
|
36
36
|
function FloatingInsertButton(props) {
|
|
@@ -194,7 +194,5 @@ var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
194
194
|
}]);
|
|
195
195
|
return FloatingInsertButton;
|
|
196
196
|
}(_react.default.Component);
|
|
197
|
-
exports.FloatingInsertButton = FloatingInsertButton;
|
|
198
197
|
(0, _defineProperty2.default)(FloatingInsertButton, "displayName", 'FloatingInsertButton');
|
|
199
|
-
var _default = (0, _reactIntlNext.injectIntl)(FloatingInsertButton);
|
|
200
|
-
exports.default = _default;
|
|
198
|
+
var _default = exports.default = (0, _reactIntlNext.injectIntl)(FloatingInsertButton);
|
|
@@ -201,5 +201,4 @@ var LayoutButton = /*#__PURE__*/function (_React$Component) {
|
|
|
201
201
|
return LayoutButton;
|
|
202
202
|
}(_react.default.Component);
|
|
203
203
|
(0, _defineProperty2.default)(LayoutButton, "displayName", 'LayoutButton');
|
|
204
|
-
var _default = (0, _reactIntlNext.injectIntl)(LayoutButton);
|
|
205
|
-
exports.default = _default;
|
|
204
|
+
var _default = exports.default = (0, _reactIntlNext.injectIntl)(LayoutButton);
|