@atlaskit/editor-plugin-table 4.0.2 → 4.1.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 +12 -0
- 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 +6 -11
- 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 +2 -3
- 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 +2 -3
- 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 +5 -9
- package/dist/cjs/plugins/table/transforms/column-width.js +4 -6
- package/dist/cjs/plugins/table/transforms/delete-columns.js +58 -58
- 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 +4 -7
- 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/ui/common-styles.js +40 -4
- package/dist/es2019/plugins/table/ui/ui-styles.js +223 -85
- package/dist/esm/plugins/table/event-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 +1 -1
- package/dist/esm/plugins/table/transforms/column-width.js +1 -1
- package/dist/esm/plugins/table/transforms/delete-columns.js +56 -55
- 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 +1 -1
- 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/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/index.d.ts +1 -0
- package/package.json +5 -2
- package/report.api.md +2 -0
- package/src/plugins/table/index.tsx +1 -1
- package/src/plugins/table/ui/common-styles.ts +46 -4
- package/src/plugins/table/ui/ui-styles.ts +235 -90
- package/tmp/api-report-tmp.d.ts +2 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25;
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
4
|
import { tableCellBorderWidth, tableMarginTop, tableMarginTopWithControl } from '@atlaskit/editor-common/styles';
|
|
5
5
|
import { akEditorShadowZIndex, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -51,29 +51,37 @@ export var OverflowShadow = function OverflowShadow(props) {
|
|
|
51
51
|
return css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n .", ", .", " {\n display: block;\n height: calc(100% - ", "px);\n position: absolute;\n pointer-events: none;\n top: ", "px;\n z-index: ", ";\n width: ", "px;\n }\n .", " {\n background: linear-gradient(\n to left,\n transparent 0,\n ", "\n ", "%\n ),\n linear-gradient(\n to right,\n ", " 0px,\n transparent 1px\n );\n left: 0px;\n }\n .", "[data-number-column='true'] > :not(.", ").", " {\n left: ", "px;\n }\n .", " {\n background: linear-gradient(\n to right,\n transparent 0,\n ", "\n ", "%\n ),\n linear-gradient(\n to left,\n ", " 0px,\n transparent 1px\n );\n left: ", ";\n }\n .", " {\n .", ", .", " {\n height: calc(100% - ", "px);\n top: ", "px;\n }\n .", " {\n border-left: 1px solid ", ";\n }\n }\n"])), ClassName.TABLE_RIGHT_SHADOW, ClassName.TABLE_LEFT_SHADOW, tableMarginTop, tableMarginTop, akEditorShadowZIndex, getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? tableOverflowShadowWidthWide : tableOverflowShadowWidth, ClassName.TABLE_LEFT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(N40A, ")"), getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? 140 : 100, "var(--ds-shadow-overflow-perimeter, transparent)", ClassName.TABLE_CONTAINER, ClassName.TABLE_STICKY_SHADOW, ClassName.TABLE_LEFT_SHADOW, akEditorTableNumberColumnWidth - 1, ClassName.TABLE_RIGHT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(N40A, ")"), getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? 140 : 100, "var(--ds-shadow-overflow-perimeter, transparent)", getBooleanFF('platform.editor.custom-table-width') ? "calc(100% - ".concat(getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? tableOverflowShadowWidthWide : tableOverflowShadowWidth, "px)") : "calc(100% - ".concat(getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r') ? tableOverflowShadowWidthWide - 10 : -2, "px)"), ClassName.WITH_CONTROLS, ClassName.TABLE_RIGHT_SHADOW, ClassName.TABLE_LEFT_SHADOW, tableMarginTopWithControl, tableMarginTopWithControl, ClassName.TABLE_LEFT_SHADOW, tableBorderColor(props));
|
|
52
52
|
};
|
|
53
53
|
var columnHeaderButton = function columnHeaderButton(props, cssString) {
|
|
54
|
-
|
|
54
|
+
if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
|
|
55
|
+
return css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n background: ", ";\n display: block;\n box-sizing: border-box;\n padding: 0;\n\n :focus {\n outline: none;\n }\n\n ", "\n "])), tableHeaderCellBackgroundColor(props), cssString);
|
|
56
|
+
} else {
|
|
57
|
+
return css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n background: ", ";\n border: 1px solid ", ";\n display: block;\n box-sizing: border-box;\n padding: 0;\n\n :focus {\n outline: none;\n }\n\n ", "\n "])), tableHeaderCellBackgroundColor(props), tableBorderColor(props), cssString);
|
|
58
|
+
}
|
|
55
59
|
};
|
|
56
60
|
var columnHeaderButtonSelected = function columnHeaderButtonSelected(props) {
|
|
57
|
-
return css(
|
|
61
|
+
return css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n border-color: ", ";\n z-index: ", ";\n"])), "var(--ds-text-inverse, ".concat(N0, ")"), tableToolbarSelectedColor(props), tableBorderSelectedColor(props), columnControlsSelectedZIndex);
|
|
58
62
|
};
|
|
59
63
|
var getFloatingDotOverrides = function getFloatingDotOverrides(props) {
|
|
60
|
-
return getBooleanFF('platform.editor.custom-table-width') ? css(
|
|
64
|
+
return getBooleanFF('platform.editor.custom-table-width') ? css(_templateObject18 || (_templateObject18 = _taggedTemplateLiteral(["\n tr\n th:last-child\n .", "::before,\n tr\n td:last-child\n .", "::before {\n content: '';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: ", ";\n right: 0px;\n }\n "])), ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.COLUMN_CONTROLS_DECORATIONS, tableBorderColor(props), lineMarkerSize, lineMarkerSize, "var(--ds-space-025, 2px)") : '';
|
|
61
65
|
};
|
|
62
66
|
export var columnControlsDecoration = function columnControlsDecoration(props) {
|
|
63
|
-
|
|
67
|
+
if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
|
|
68
|
+
return css(_templateObject19 || (_templateObject19 = _taggedTemplateLiteral(["\n .", " {\n display: none;\n cursor: pointer;\n position: absolute;\n width: 100%;\n left: 0;\n top: -", "px;\n height: ", "px;\n // floating dot for adding column button\n &::before {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: 2px;\n right: -1px;\n }\n\n &::after {\n content: ' ';\n\n ", "\n }\n }\n\n // floating dot for adding column button - overriding style on last column to avoid scroll\n ", "\n\n div.", ">.", "::after {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: -", "px;\n right: -1px;\n }\n\n .", " .", " {\n display: block;\n }\n\n table tr:first-of-type th.", " {\n &.", ", &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border-color: ", ";\n z-index: ", ";\n }\n }\n }\n\n table tr:first-of-type th.", " {\n &.", ", &.", " {\n .", "::after {\n ", ";\n border-left: ", "px solid\n ", ";\n left: -", "px;\n }\n }\n }\n\n table tr:first-of-type th.", " {\n &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border-color: ", ";\n border-left: ", "px solid\n ", ";\n left: -", "px;\n z-index: ", ";\n }\n }\n }\n\n .", "\n table\n tr:first-of-type\n td.", ",\n .", "\n table\n tr:first-of-type\n th.", " {\n .", "::after {\n ", ";\n }\n }\n "])), ClassName.COLUMN_CONTROLS_DECORATIONS, columnControlsDecorationHeight + tableCellBorderWidth, columnControlsDecorationHeight, tableBorderColor(props), lineMarkerSize, lineMarkerSize, columnHeaderButton(props, "\n border-right: ".concat(tableCellBorderWidth, "px solid ").concat(tableBorderColor(props), ";\n border-top: ").concat(tableCellBorderWidth, "px solid ").concat(tableBorderColor(props), ";\n border-bottom: ").concat(tableCellBorderWidth, "px solid ").concat(tableBorderColor(props), ";\n box-sizing: content-box;\n height: ").concat(tableToolbarSize - 1, "px;\n width: 100%;\n position: absolute;\n top: ").concat(columnControlsDecorationHeight - tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(columnControlsZIndex, ";\n ")), getFloatingDotOverrides(props), ClassName.WITH_CONTROLS, ClassName.ROW_CONTROLS_WRAPPER, tableBorderColor(props), lineMarkerSize, lineMarkerSize, tableToolbarSize + tableCellBorderWidth, ClassName.WITH_CONTROLS, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_TABLE, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), ClassName.HOVERED_CELL_IN_DANGER, ClassName.COLUMN_CONTROLS_DECORATIONS, tableToolbarDeleteColor(props), tableBorderDeleteColor(props), akEditorUnitZIndex * 100, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_COLUMN, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), tableCellBorderWidth, tableBorderSelectedColor(props), tableCellBorderWidth, ClassName.TABLE_HEADER_CELL, ClassName.HOVERED_COLUMN, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), ClassName.HOVERED_CELL_IN_DANGER, ClassName.COLUMN_CONTROLS_DECORATIONS, tableToolbarDeleteColor(props), tableBorderDeleteColor(props), tableCellBorderWidth, tableBorderDeleteColor(props), tableCellBorderWidth, akEditorUnitZIndex * 100, ClassName.TABLE_SELECTED, ClassName.TABLE_CELL, ClassName.TABLE_SELECTED, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props));
|
|
69
|
+
} else {
|
|
70
|
+
return css(_templateObject20 || (_templateObject20 = _taggedTemplateLiteral(["\n .", " {\n display: none;\n cursor: pointer;\n position: absolute;\n width: calc(100% + ", "px);\n left: -1px;\n top: -", "px;\n height: ", "px;\n // floating dot for adding column button\n &::before {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: 2px;\n right: -1px;\n }\n\n &::after {\n content: ' ';\n\n ", "\n }\n }\n\n // floating dot for adding column button - overriding style on last column to avoid scroll\n ", "\n\n div.", ">.", "::after {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: -", "px;\n right: -1px;\n }\n\n .", " .", " {\n display: block;\n }\n\n table\n tr:first-of-type\n td.", ",\n table\n tr:first-of-type\n th.", " {\n &.", ",\n &.", ",\n &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border: 1px solid ", ";\n border-bottom: none;\n z-index: ", ";\n }\n }\n }\n\n .", "\n table\n tr:first-of-type\n td.", ",\n .", "\n table\n tr:first-of-type\n th.", " {\n .", "::after {\n ", ";\n }\n }\n "])), ClassName.COLUMN_CONTROLS_DECORATIONS, tableCellBorderWidth * 2, columnControlsDecorationHeight + tableCellBorderWidth, columnControlsDecorationHeight, tableBorderColor(props), lineMarkerSize, lineMarkerSize, columnHeaderButton(props, "\n border-right: ".concat(tableCellBorderWidth, "px solid ").concat(tableBorderColor(props), ";\n border-bottom: none;\n height: ").concat(tableToolbarSize, "px;\n width: 100%;\n position: absolute;\n top: ").concat(columnControlsDecorationHeight - tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(columnControlsZIndex, ";\n ")), getFloatingDotOverrides(props), ClassName.WITH_CONTROLS, ClassName.ROW_CONTROLS_WRAPPER, tableBorderColor(props), lineMarkerSize, lineMarkerSize, tableToolbarSize + tableCellBorderWidth, ClassName.WITH_CONTROLS, ClassName.COLUMN_CONTROLS_DECORATIONS, ClassName.TABLE_CELL, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_COLUMN, ClassName.HOVERED_TABLE, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), ClassName.HOVERED_CELL_IN_DANGER, ClassName.COLUMN_CONTROLS_DECORATIONS, tableToolbarDeleteColor(props), tableBorderDeleteColor(props), akEditorUnitZIndex * 100, ClassName.TABLE_SELECTED, ClassName.TABLE_CELL, ClassName.TABLE_SELECTED, ClassName.TABLE_HEADER_CELL, ClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props));
|
|
71
|
+
}
|
|
64
72
|
};
|
|
65
73
|
export var hoveredDeleteButton = function hoveredDeleteButton(props) {
|
|
66
|
-
return css(
|
|
74
|
+
return css(_templateObject21 || (_templateObject21 = _taggedTemplateLiteral(["\n .", ".", " {\n .", ",\n .", ",\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n }\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.HOVERED_DELETE_BUTTON, ClassName.SELECTED_CELL, ClassName.COLUMN_SELECTED, ClassName.HOVERED_CELL, tableBorderDeleteColor(props), ClassName.SELECTED_CELL, tableCellDeleteColor(props));
|
|
67
75
|
};
|
|
68
76
|
export var hoveredCell = function hoveredCell(props) {
|
|
69
|
-
return css(
|
|
77
|
+
return css(_templateObject22 || (_templateObject22 = _taggedTemplateLiteral(["\n :not(.", ")\n .", ":not(.", ") {\n .", " {\n position: relative;\n border: 1px solid ", ";\n }\n }\n"])), ClassName.IS_RESIZING, ClassName.TABLE_CONTAINER, ClassName.HOVERED_DELETE_BUTTON, ClassName.HOVERED_CELL, tableBorderSelectedColor(props));
|
|
70
78
|
};
|
|
71
|
-
export var hoveredWarningCell = css(
|
|
79
|
+
export var hoveredWarningCell = css(_templateObject23 || (_templateObject23 = _taggedTemplateLiteral(["\n :not(.", ")\n .", ":not(.", ") {\n td.", " {\n background-color: ", " !important; // We need to override the background-color added to the cell\n border: 1px solid ", ";\n }\n }\n"])), ClassName.IS_RESIZING, ClassName.TABLE_CONTAINER, ClassName.HOVERED_DELETE_BUTTON, ClassName.HOVERED_CELL_WARNING, "var(--ds-background-warning, ".concat(Y50, ")"), "var(--ds-border-warning, ".concat(Y200, ")"));
|
|
72
80
|
|
|
73
81
|
// move the resize handle zone completely inside the table cell to avoid overflow
|
|
74
82
|
var getLastColumnResizerOverrides = function getLastColumnResizerOverrides() {
|
|
75
|
-
return getBooleanFF('platform.editor.custom-table-width') ? css(
|
|
83
|
+
return getBooleanFF('platform.editor.custom-table-width') ? css(_templateObject24 || (_templateObject24 = _taggedTemplateLiteral(["\n tr\n th:last-child\n .", ",\n tr\n td:last-child\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: 0;\n cursor: col-resize;\n z-index: ", ";\n }\n "])), ClassName.RESIZE_HANDLE_DECORATION, ClassName.RESIZE_HANDLE_DECORATION, resizeHandlerAreaWidth / 2, resizeHandlerZIndex) : '';
|
|
76
84
|
};
|
|
77
85
|
export var resizeHandle = function resizeHandle(props) {
|
|
78
|
-
return css(
|
|
86
|
+
return css(_templateObject25 || (_templateObject25 = _taggedTemplateLiteral(["\n .", " {\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: -", "px;\n cursor: col-resize;\n z-index: ", ";\n }\n\n ", "\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: ", ";\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: ", ";\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n right: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n table\n tr:first-of-type\n th.", "\n .", "::after,\n table\n tr:first-of-type\n td.", "\n .", "::after {\n top: -", "px;\n height: calc(100% + ", "px);\n }\n }\n"])), ClassName.TABLE_CONTAINER, ClassName.RESIZE_HANDLE_DECORATION, resizeHandlerAreaWidth, resizeHandlerAreaWidth / 2, resizeHandlerZIndex, getLastColumnResizerOverrides(), ClassName.WITH_RESIZE_LINE, "var(--ds-space-negative-025, -2px)", resizeLineWidth, tableBorderSelectedColor(props), columnControlsZIndex * 2, ClassName.WITH_RESIZE_LINE, "var(--ds-space-negative-025, -2px)", resizeLineWidth, tableToolbarSize + tableCellBorderWidth, tableBorderSelectedColor(props), columnControlsZIndex * 2, tableToolbarSize + tableCellBorderWidth, ClassName.WITH_RESIZE_LINE_LAST_COLUMN, resizeLineWidth, tableBorderSelectedColor(props), columnControlsZIndex * 2, ClassName.WITH_RESIZE_LINE_LAST_COLUMN, resizeLineWidth, tableToolbarSize + tableCellBorderWidth, tableBorderSelectedColor(props), columnControlsZIndex * 2, tableToolbarSize + tableCellBorderWidth, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, ClassName.WITH_RESIZE_LINE, ClassName.RESIZE_HANDLE_DECORATION, tableToolbarSize + tableCellBorderWidth, tableToolbarSize + tableCellBorderWidth);
|
|
79
87
|
};
|
|
@@ -53,7 +53,7 @@ export var withEditorAnalyticsAPI = function withEditorAnalyticsAPI(payload) {
|
|
|
53
53
|
return command(state, function (tr) {
|
|
54
54
|
var dynamicPayload = payload instanceof Function ? payload(state) : payload;
|
|
55
55
|
if (dynamicPayload) {
|
|
56
|
-
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0
|
|
56
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent(dynamicPayload)(tr);
|
|
57
57
|
}
|
|
58
58
|
if (dispatch) {
|
|
59
59
|
dispatch(tr);
|
|
@@ -91,7 +91,7 @@ export var getMousePositionHorizontalRelativeByElement = function getMousePositi
|
|
|
91
91
|
var width, x;
|
|
92
92
|
var closestCell = element.closest(SELECTOR_TABLE_LEAFS);
|
|
93
93
|
var id = (_closestCell$id = closestCell === null || closestCell === void 0 ? void 0 : closestCell.id) !== null && _closestCell$id !== void 0 ? _closestCell$id : '';
|
|
94
|
-
width = (_elementContentRects$ = elementContentRects === null || elementContentRects === void 0
|
|
94
|
+
width = (_elementContentRects$ = elementContentRects === null || elementContentRects === void 0 || (_elementContentRects$2 = elementContentRects[id]) === null || _elementContentRects$2 === void 0 ? void 0 : _elementContentRects$2.width) !== null && _elementContentRects$ !== void 0 ? _elementContentRects$ : 0;
|
|
95
95
|
x = mouseEvent.offsetX;
|
|
96
96
|
if (width <= 0) {
|
|
97
97
|
return null;
|
|
@@ -57,7 +57,7 @@ export var transformSliceToFixHardBreakProblemOnCopyFromCell = function transfor
|
|
|
57
57
|
return slice;
|
|
58
58
|
};
|
|
59
59
|
export var transformSliceToRemoveOpenTable = function transformSliceToRemoveOpenTable(slice, schema) {
|
|
60
|
-
var _slice$content$
|
|
60
|
+
var _slice$content$firstC2;
|
|
61
61
|
// we're removing the table, tableRow and tableCell reducing the open depth by 3
|
|
62
62
|
var depthDecrement = 3;
|
|
63
63
|
|
|
@@ -67,14 +67,14 @@ export var transformSliceToRemoveOpenTable = function transformSliceToRemoveOpen
|
|
|
67
67
|
slice.openStart >= 4 && slice.openEnd >= 4 &&
|
|
68
68
|
// slice is a table node
|
|
69
69
|
slice.content.childCount === 1 && slice.content.firstChild.type === schema.nodes.table) {
|
|
70
|
-
var _slice$content$firstC
|
|
70
|
+
var _slice$content$firstC;
|
|
71
71
|
// prosemirror-view has a bug that it duplicates table entry when selecting multiple paragraphs in a table cell.
|
|
72
72
|
// https://github.com/ProseMirror/prosemirror/issues/1270
|
|
73
73
|
// The structure becomes
|
|
74
74
|
// table(genuine) > tableRow(genuine) > table(duplicated) > tableRow(duplicated) > tableCell/tableHeader(genuine) > contents(genuine)
|
|
75
75
|
// As we are removing wrapping table anyway, we keep duplicated table and tableRow for simplicity
|
|
76
76
|
var cleaned = slice;
|
|
77
|
-
if (((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0
|
|
77
|
+
if (((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 || (_slice$content$firstC = _slice$content$firstC.content) === null || _slice$content$firstC === void 0 || (_slice$content$firstC = _slice$content$firstC.firstChild) === null || _slice$content$firstC === void 0 || (_slice$content$firstC = _slice$content$firstC.content) === null || _slice$content$firstC === void 0 || (_slice$content$firstC = _slice$content$firstC.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === schema.nodes.table) {
|
|
78
78
|
cleaned = new Slice(slice.content.firstChild.content.firstChild.content, slice.openStart - 2, slice.openEnd - 2);
|
|
79
79
|
}
|
|
80
80
|
return new Slice(flatmap(cleaned.content, unwrapContentFromTable), cleaned.openStart - depthDecrement, cleaned.openEnd - depthDecrement);
|
|
@@ -85,7 +85,7 @@ export var transformSliceToRemoveOpenTable = function transformSliceToRemoveOpen
|
|
|
85
85
|
// starts inside of a cell but ends outside of the starting table
|
|
86
86
|
slice.openStart >= 4 &&
|
|
87
87
|
// slice starts from a table node (and spans across more than one node)
|
|
88
|
-
slice.content.childCount > 1 && ((_slice$content$
|
|
88
|
+
slice.content.childCount > 1 && ((_slice$content$firstC2 = slice.content.firstChild) === null || _slice$content$firstC2 === void 0 ? void 0 : _slice$content$firstC2.type) === schema.nodes.table) {
|
|
89
89
|
// repoint the slice's cutting depth so that cell content where the slice starts
|
|
90
90
|
// does not get lifted out of the cell on paste
|
|
91
91
|
return new Slice(slice.content, 1, slice.openEnd);
|
|
@@ -9,6 +9,7 @@ import type { PluginConfig } from './types';
|
|
|
9
9
|
interface TablePluginOptions {
|
|
10
10
|
tableOptions: PluginConfig;
|
|
11
11
|
tableResizingEnabled?: boolean;
|
|
12
|
+
dragAndDropEnabled?: boolean;
|
|
12
13
|
breakoutEnabled?: boolean;
|
|
13
14
|
allowContextualMenu?: boolean;
|
|
14
15
|
fullWidthEnabled?: boolean;
|
|
@@ -9,6 +9,7 @@ import type { PluginConfig } from './types';
|
|
|
9
9
|
interface TablePluginOptions {
|
|
10
10
|
tableOptions: PluginConfig;
|
|
11
11
|
tableResizingEnabled?: boolean;
|
|
12
|
+
dragAndDropEnabled?: boolean;
|
|
12
13
|
breakoutEnabled?: boolean;
|
|
13
14
|
allowContextualMenu?: boolean;
|
|
14
15
|
fullWidthEnabled?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "^32.0.0",
|
|
31
31
|
"@atlaskit/custom-steps": "^0.0.2",
|
|
32
|
-
"@atlaskit/editor-common": "^76.
|
|
32
|
+
"@atlaskit/editor-common": "^76.5.0",
|
|
33
33
|
"@atlaskit/editor-palette": "1.5.1",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^0.2.0",
|
|
35
35
|
"@atlaskit/editor-plugin-content-insertion": "^0.1.0",
|
|
@@ -106,6 +106,9 @@
|
|
|
106
106
|
"platform.editor.table-sticky-scrollbar": {
|
|
107
107
|
"type": "boolean"
|
|
108
108
|
},
|
|
109
|
+
"platform.editor.table.column-controls-styles-updated": {
|
|
110
|
+
"type": "boolean"
|
|
111
|
+
},
|
|
109
112
|
"platform.editor.update-table-cell-width-via-step": {
|
|
110
113
|
"type": "boolean"
|
|
111
114
|
},
|
package/report.api.md
CHANGED
|
@@ -106,6 +106,8 @@ interface TablePluginOptions {
|
|
|
106
106
|
// (undocumented)
|
|
107
107
|
breakoutEnabled?: boolean;
|
|
108
108
|
// (undocumented)
|
|
109
|
+
dragAndDropEnabled?: boolean;
|
|
110
|
+
// (undocumented)
|
|
109
111
|
editorSelectionAPI?: EditorSelectionAPI;
|
|
110
112
|
// (undocumented)
|
|
111
113
|
fullWidthEnabled?: boolean;
|
|
@@ -82,6 +82,7 @@ interface TablePluginOptions {
|
|
|
82
82
|
// experimental custom table resizing experience, set inside editor-core behind a feature flag
|
|
83
83
|
// will eventually replace breakoutEnabled
|
|
84
84
|
tableResizingEnabled?: boolean;
|
|
85
|
+
dragAndDropEnabled?: boolean;
|
|
85
86
|
breakoutEnabled?: boolean;
|
|
86
87
|
allowContextualMenu?: boolean;
|
|
87
88
|
// TODO these two need to be rethought
|
|
@@ -279,7 +280,6 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
279
280
|
)
|
|
280
281
|
: undefined,
|
|
281
282
|
},
|
|
282
|
-
|
|
283
283
|
{
|
|
284
284
|
name: 'tableLocalId',
|
|
285
285
|
plugin: ({ dispatch }) => createTableLocalIdPlugin(dispatch),
|
|
@@ -194,6 +194,50 @@ const breakoutWidthStyling = () => {
|
|
|
194
194
|
`;
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
+
const tableBorderStyles = (
|
|
198
|
+
props: ThemeProps & { featureFlags?: FeatureFlags },
|
|
199
|
+
) => {
|
|
200
|
+
if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
|
|
201
|
+
return `border-color: ${tableBorderDeleteColor(props)}`;
|
|
202
|
+
} else {
|
|
203
|
+
return `border: 1px solid ${tableBorderDeleteColor(props)}`;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const tableStickyHeaderColumnControlsDecorationsStyle = (
|
|
208
|
+
props: ThemeProps & { featureFlags?: FeatureFlags },
|
|
209
|
+
) => {
|
|
210
|
+
if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
|
|
211
|
+
return css`
|
|
212
|
+
.${ClassName.TABLE_STICKY} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
213
|
+
z-index: 0;
|
|
214
|
+
left: -1px;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.${ClassName.TABLE_STICKY}
|
|
218
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
219
|
+
border-left: 1px solid ${tableBorderColor(props)};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.${ClassName.TABLE_STICKY}
|
|
223
|
+
tr:first-of-type
|
|
224
|
+
th.${ClassName.TABLE_HEADER_CELL} {
|
|
225
|
+
&.${ClassName.COLUMN_SELECTED}, &.${ClassName.HOVERED_COLUMN} {
|
|
226
|
+
.${ClassName.COLUMN_CONTROLS_DECORATIONS}::after {
|
|
227
|
+
left: 0;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
`;
|
|
232
|
+
} else {
|
|
233
|
+
return css`
|
|
234
|
+
.${ClassName.TABLE_STICKY} .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
|
|
235
|
+
z-index: 0;
|
|
236
|
+
}
|
|
237
|
+
`;
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
197
241
|
const tableWrapperStyles = () => {
|
|
198
242
|
if (getBooleanFF('platform.editor.custom-table-width')) {
|
|
199
243
|
return css`
|
|
@@ -323,9 +367,7 @@ export const tableStyles = (
|
|
|
323
367
|
width: ${tableToolbarSize}px;
|
|
324
368
|
}
|
|
325
369
|
|
|
326
|
-
|
|
327
|
-
z-index: 0;
|
|
328
|
-
}
|
|
370
|
+
${tableStickyHeaderColumnControlsDecorationsStyle(props)}
|
|
329
371
|
|
|
330
372
|
.${ClassName.TABLE_STICKY}
|
|
331
373
|
.${ClassName.ROW_CONTROLS}
|
|
@@ -798,7 +840,7 @@ export const tableStyles = (
|
|
|
798
840
|
pointer-events: none;
|
|
799
841
|
}
|
|
800
842
|
&.${ClassName.HOVERED_CELL_IN_DANGER}::after {
|
|
801
|
-
|
|
843
|
+
${tableBorderStyles(props)};
|
|
802
844
|
z-index: ${akEditorUnitZIndex * 100};
|
|
803
845
|
}
|
|
804
846
|
}
|