@atlaskit/editor-plugin-block-controls 13.0.5 → 13.0.7
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 +24 -0
- package/dist/cjs/blockControlsPlugin.js +23 -0
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +2 -2
- package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +1 -1
- package/dist/cjs/pm-plugins/interaction-tracking/handle-mouse-move.js +3 -1
- package/dist/cjs/pm-plugins/utils/marks.js +1 -55
- package/dist/cjs/ui/drag-handle.js +39 -2
- package/dist/es2019/blockControlsPlugin.js +23 -0
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +3 -3
- package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +2 -2
- package/dist/es2019/pm-plugins/interaction-tracking/handle-mouse-move.js +3 -1
- package/dist/es2019/pm-plugins/utils/marks.js +0 -49
- package/dist/es2019/ui/drag-handle.js +39 -2
- package/dist/esm/blockControlsPlugin.js +23 -0
- package/dist/esm/pm-plugins/decorations-drag-handle.js +3 -3
- package/dist/esm/pm-plugins/decorations-quick-insert-button.js +2 -2
- package/dist/esm/pm-plugins/interaction-tracking/handle-mouse-move.js +3 -1
- package/dist/esm/pm-plugins/utils/marks.js +0 -55
- package/dist/esm/ui/drag-handle.js +39 -2
- package/dist/types/pm-plugins/utils/marks.d.ts +0 -17
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 13.0.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c664929c3f15d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c664929c3f15d) -
|
|
8
|
+
Clean up experiment `platform_editor_clean_up_widget_mark_logic`
|
|
9
|
+
- [`5c279743e9b74`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5c279743e9b74) -
|
|
10
|
+
Fire an exposure event for the `remix_button_right_margin_hover` experiment.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 13.0.6
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`e850980f5a66f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e850980f5a66f) -
|
|
18
|
+
[EDITOR-6790] Block-controls drag-handle wrapper's background is removed and instead set
|
|
19
|
+
on`::before` on `.pm-table-container.pm-table-sticky` to keep masking the row insert dots when
|
|
20
|
+
legacy sticky header is activated while also not overlapping the column insert button.
|
|
21
|
+
- [`7754772ebfa47`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7754772ebfa47) -
|
|
22
|
+
Fix table text length calculation for Remix/Improve Writing hero prompts: use
|
|
23
|
+
tableNode.textContent for CellSelection instead of textBetween which only spans anchor/head cell
|
|
24
|
+
range
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 13.0.5
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -10,7 +10,9 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
11
11
|
var _toolbarFlagCheck = require("@atlaskit/editor-common/toolbar-flag-check");
|
|
12
12
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
13
|
+
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
13
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
16
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
17
|
var _handleKeyDownWithPreservedSelection = require("./editor-commands/handle-key-down-with-preserved-selection");
|
|
16
18
|
var _mapPreservedSelection2 = require("./editor-commands/map-preserved-selection");
|
|
@@ -44,6 +46,27 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
44
46
|
var blockControlsState = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState();
|
|
45
47
|
var preservedSelection = blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.preservedSelection;
|
|
46
48
|
if (preservedSelection && preservedSelection.from !== preservedSelection.to) {
|
|
49
|
+
// CellSelection covers a table: collect each selected cell's text joined with spaces
|
|
50
|
+
// so that adjacent cells are not fused (e.g. 'hello world' + 'foo' must not
|
|
51
|
+
// become 'hello worldfoo'). Intl.Segmenter word-counting requires correct
|
|
52
|
+
// word boundaries, which raw textContent fusion breaks.
|
|
53
|
+
if (preservedSelection instanceof _cellSelection.CellSelection && (0, _expValEquals.expValEquals)('remix_iw_block_menu_table_calc_fix', 'isEnabled', true)) {
|
|
54
|
+
// Use node(1) to reliably target the table node regardless of $anchorCell depth.
|
|
55
|
+
// node(-1) would return tableRow if $anchorCell is at tableCell depth.
|
|
56
|
+
var tableNode = preservedSelection.$anchorCell.node(1);
|
|
57
|
+
var cellTexts = [];
|
|
58
|
+
if (tableNode) {
|
|
59
|
+
// forEachCell iterates only the selected cells, not all cells in the table.
|
|
60
|
+
preservedSelection.forEachCell(function (cell) {
|
|
61
|
+
cellTexts.push(cell.textContent);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
var _textContent = cellTexts.filter(Boolean).join(' ');
|
|
65
|
+
return {
|
|
66
|
+
textLength: _textContent.length,
|
|
67
|
+
textContent: _textContent
|
|
68
|
+
};
|
|
69
|
+
}
|
|
47
70
|
var from = preservedSelection.from,
|
|
48
71
|
to = preservedSelection.to;
|
|
49
72
|
var textContent = editorView.state.doc.textBetween(from, to, '\n');
|
|
@@ -75,7 +75,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
75
75
|
* Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
|
|
76
76
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
77
77
|
*/
|
|
78
|
-
marks: (0, _expValEquals.expValEquals)('platform_editor_small_font_size', 'isEnabled', true) ? (0, _marks.getMatchingBlockMarks)(editorState, pos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) :
|
|
78
|
+
marks: (0, _expValEquals.expValEquals)('platform_editor_small_font_size', 'isEnabled', true) ? (0, _marks.getMatchingBlockMarks)(editorState, pos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) : [],
|
|
79
79
|
destroy: function destroy(node) {
|
|
80
80
|
unbind && unbind();
|
|
81
81
|
}
|
|
@@ -84,7 +84,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
84
84
|
type: _decorationsCommon.TYPE_HANDLE_DEC,
|
|
85
85
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
86
86
|
testid: "".concat(_decorationsCommon.TYPE_HANDLE_DEC, "-").concat((0, _uuid.default)()),
|
|
87
|
-
marks: (0, _expValEquals.expValEquals)('platform_editor_small_font_size', 'isEnabled', true) ? (0, _marks.getMatchingBlockMarks)(editorState, pos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) :
|
|
87
|
+
marks: (0, _expValEquals.expValEquals)('platform_editor_small_font_size', 'isEnabled', true) ? (0, _marks.getMatchingBlockMarks)(editorState, pos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) : [],
|
|
88
88
|
destroy: function destroy(node) {
|
|
89
89
|
unbind && unbind();
|
|
90
90
|
}
|
|
@@ -62,7 +62,7 @@ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function
|
|
|
62
62
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
63
63
|
*/
|
|
64
64
|
|
|
65
|
-
marks: (0, _expValEquals.expValEquals)('platform_editor_small_font_size', 'isEnabled', true) ? (0, _marks.getMatchingBlockMarks)(editorState, rootPos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) :
|
|
65
|
+
marks: (0, _expValEquals.expValEquals)('platform_editor_small_font_size', 'isEnabled', true) ? (0, _marks.getMatchingBlockMarks)(editorState, rootPos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) : [],
|
|
66
66
|
destroy: function destroy(_) {
|
|
67
67
|
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_widget_destroy')) {
|
|
68
68
|
nodeViewPortalProviderAPI.remove(key);
|
|
@@ -123,7 +123,9 @@ var processHoverSide = function processHoverSide(view, api) {
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
// Added right-margin hover, gated so it can be rolled back. When off, fall through to midpoint.
|
|
126
|
-
if ((0, _experiments.editorExperiment)('remix_button_right_margin_hover', true
|
|
126
|
+
if ((0, _experiments.editorExperiment)('remix_button_right_margin_hover', true, {
|
|
127
|
+
exposure: true
|
|
128
|
+
})) {
|
|
127
129
|
var closestBlock = target === null || target === void 0 ? void 0 : target.closest(BLOCK_SELECTORS);
|
|
128
130
|
var blockElement = closestBlock instanceof HTMLElement ? closestBlock : null;
|
|
129
131
|
|
|
@@ -3,61 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getMatchingBlockMarks =
|
|
7
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
8
|
-
/**
|
|
9
|
-
* Remove this when platform_editor_clean_up_widget_mark_logic is cleaned up.
|
|
10
|
-
*
|
|
11
|
-
* Returns list of block marks on schema that widgets are allowed to render inside
|
|
12
|
-
* Currently
|
|
13
|
-
* - indent
|
|
14
|
-
* - alignment
|
|
15
|
-
* @param state - The editor state
|
|
16
|
-
* @returns The block marks
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* const marks = getBlockMarks(state);
|
|
20
|
-
* console.log(marks);
|
|
21
|
-
* // [indent, alignment]
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
var getActiveBlockMarks = exports.getActiveBlockMarks = function getActiveBlockMarks(state, pos) {
|
|
25
|
-
var alignment = state.schema.marks.alignment;
|
|
26
|
-
var resolvedPos = state.doc.resolve(pos);
|
|
27
|
-
|
|
28
|
-
// find all active marks at the position
|
|
29
|
-
var marks = resolvedPos.marks();
|
|
30
|
-
var supportedMarks = marks.filter(function (mark) {
|
|
31
|
-
return mark.type === alignment;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Fix for widget positioning at alignment mark boundaries.
|
|
36
|
-
* When the previous node has alignment but the next node doesn't, we need to prevent
|
|
37
|
-
* the widget from inheriting alignment marks. This ensures the widget is positioned
|
|
38
|
-
* correctly at the boundary rather than being absorbed into the alignment wrapper.
|
|
39
|
-
*/
|
|
40
|
-
if (supportedMarks.length > 0 && (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
41
|
-
var _resolvedPos$nodeAfte;
|
|
42
|
-
var nextNodeMarks = ((_resolvedPos$nodeAfte = resolvedPos.nodeAfter) === null || _resolvedPos$nodeAfte === void 0 ? void 0 : _resolvedPos$nodeAfte.marks.filter(function (mark) {
|
|
43
|
-
return mark.type === alignment;
|
|
44
|
-
})) || [];
|
|
45
|
-
|
|
46
|
-
// Compare alignment values to ensure they are the same
|
|
47
|
-
var alignmentValuesMatch = supportedMarks.length === nextNodeMarks.length && supportedMarks.some(function (mark) {
|
|
48
|
-
return nextNodeMarks.some(function (nextMark) {
|
|
49
|
-
return nextMark.eq(mark);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// previous node has alignment but next node does not have alignment or alignment values differ
|
|
54
|
-
if (nextNodeMarks.length === 0 || !alignmentValuesMatch) {
|
|
55
|
-
return [];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return supportedMarks;
|
|
59
|
-
};
|
|
60
|
-
|
|
6
|
+
exports.getMatchingBlockMarks = void 0;
|
|
61
7
|
/** True when `mark` has an equal counterpart (type + attrs) in `marks`. */
|
|
62
8
|
var hasMatchingMark = function hasMatchingMark(mark, marks) {
|
|
63
9
|
var found = mark.type.isInSet(marks);
|
|
@@ -82,6 +82,37 @@ var buttonWrapperStyles = (0, _react2.css)({
|
|
|
82
82
|
boxSizing: 'border-box'
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
+
|
|
86
|
+
// EDITOR-6790 - When the `platform_editor_table_col_insert` experiment is enabled,
|
|
87
|
+
// drop the linear-gradient background that paints over the legacy `tr.sticky` table
|
|
88
|
+
// header so the new left-edge column-insert affordance is not visually clipped.
|
|
89
|
+
// Keep all paddings / margins identical to `buttonWrapperStyles` so the drag-handle
|
|
90
|
+
// layout does not shift between the two variants.
|
|
91
|
+
var buttonWrapperStylesNoBackground = (0, _react2.css)({
|
|
92
|
+
display: 'flex',
|
|
93
|
+
justifyContent: 'center',
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
96
|
+
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
97
|
+
marginBottom: "var(--ds-space-negative-200, -16px)",
|
|
98
|
+
paddingBottom: "var(--ds-space-200, 16px)",
|
|
99
|
+
marginTop: "var(--ds-space-negative-400, -32px)",
|
|
100
|
+
paddingTop: "calc(".concat("var(--ds-space-400, 32px)", " - 1px)"),
|
|
101
|
+
marginRight: "var(--ds-space-negative-150, -12px)",
|
|
102
|
+
paddingRight: "var(--ds-space-150, 12px)",
|
|
103
|
+
boxSizing: 'border-box'
|
|
104
|
+
},
|
|
105
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
106
|
+
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
107
|
+
marginBottom: "var(--ds-space-negative-200, -16px)",
|
|
108
|
+
paddingBottom: "var(--ds-space-200, 16px)",
|
|
109
|
+
marginTop: "var(--ds-space-negative-400, -32px)",
|
|
110
|
+
paddingTop: "calc(".concat("var(--ds-space-400, 32px)", " - 1px)"),
|
|
111
|
+
marginRight: "var(--ds-space-negative-150, -12px)",
|
|
112
|
+
paddingRight: "var(--ds-space-150, 12px)",
|
|
113
|
+
boxSizing: 'border-box'
|
|
114
|
+
}
|
|
115
|
+
});
|
|
85
116
|
var buttonWrapperStylesPatch = (0, _react2.css)({
|
|
86
117
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
87
118
|
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls [data-number-column="true"] tr.sticky) &': {
|
|
@@ -1092,7 +1123,10 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
1092
1123
|
});
|
|
1093
1124
|
}
|
|
1094
1125
|
}, (0, _react2.jsx)("span", {
|
|
1095
|
-
css: [(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) &&
|
|
1126
|
+
css: [(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && (
|
|
1127
|
+
// EDITOR-6790 - drop the masking background under the new
|
|
1128
|
+
// column-insert experiment so the left-edge dot is not clipped.
|
|
1129
|
+
(0, _expValEquals.expValEquals)('platform_editor_table_col_insert', 'isEnabled', true) ? buttonWrapperStylesNoBackground : buttonWrapperStyles), buttonWrapperStylesPatch]
|
|
1096
1130
|
}, renderButton()))));
|
|
1097
1131
|
};
|
|
1098
1132
|
var stickyWithoutTooltip = function stickyWithoutTooltip() {
|
|
@@ -1108,7 +1142,10 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
1108
1142
|
}, (0, _react2.jsx)("span", {
|
|
1109
1143
|
css: [tooltipContainerStyles, (0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithMask, !(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
1110
1144
|
}, (0, _react2.jsx)("span", {
|
|
1111
|
-
css: [(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) &&
|
|
1145
|
+
css: [(0, _dragHandlePositions.shouldMaskNodeControls)(nodeType, isTopLevelNodeValue) && (
|
|
1146
|
+
// EDITOR-6790 - drop the masking background under the new
|
|
1147
|
+
// column-insert experiment so the left-edge dot is not clipped.
|
|
1148
|
+
(0, _expValEquals.expValEquals)('platform_editor_table_col_insert', 'isEnabled', true) ? buttonWrapperStylesNoBackground : buttonWrapperStyles), buttonWrapperStylesPatch]
|
|
1112
1149
|
}, renderButton())));
|
|
1113
1150
|
};
|
|
1114
1151
|
var buttonWithTooltip = function buttonWithTooltip() {
|
|
@@ -2,7 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
3
3
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
4
4
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
|
+
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
9
|
import { handleKeyDownWithPreservedSelection } from './editor-commands/handle-key-down-with-preserved-selection';
|
|
8
10
|
import { mapPreservedSelection } from './editor-commands/map-preserved-selection';
|
|
@@ -35,6 +37,27 @@ export const blockControlsPlugin = ({
|
|
|
35
37
|
const blockControlsState = api === null || api === void 0 ? void 0 : (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState();
|
|
36
38
|
const preservedSelection = blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.preservedSelection;
|
|
37
39
|
if (preservedSelection && preservedSelection.from !== preservedSelection.to) {
|
|
40
|
+
// CellSelection covers a table: collect each selected cell's text joined with spaces
|
|
41
|
+
// so that adjacent cells are not fused (e.g. 'hello world' + 'foo' must not
|
|
42
|
+
// become 'hello worldfoo'). Intl.Segmenter word-counting requires correct
|
|
43
|
+
// word boundaries, which raw textContent fusion breaks.
|
|
44
|
+
if (preservedSelection instanceof CellSelection && expValEquals('remix_iw_block_menu_table_calc_fix', 'isEnabled', true)) {
|
|
45
|
+
// Use node(1) to reliably target the table node regardless of $anchorCell depth.
|
|
46
|
+
// node(-1) would return tableRow if $anchorCell is at tableCell depth.
|
|
47
|
+
const tableNode = preservedSelection.$anchorCell.node(1);
|
|
48
|
+
const cellTexts = [];
|
|
49
|
+
if (tableNode) {
|
|
50
|
+
// forEachCell iterates only the selected cells, not all cells in the table.
|
|
51
|
+
preservedSelection.forEachCell(cell => {
|
|
52
|
+
cellTexts.push(cell.textContent);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const textContent = cellTexts.filter(Boolean).join(' ');
|
|
56
|
+
return {
|
|
57
|
+
textLength: textContent.length,
|
|
58
|
+
textContent
|
|
59
|
+
};
|
|
60
|
+
}
|
|
38
61
|
const {
|
|
39
62
|
from,
|
|
40
63
|
to
|
|
@@ -10,7 +10,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
|
10
10
|
import { ACTIVE_DRAG_HANDLE_ATTR } from '../ui/consts';
|
|
11
11
|
import { DragHandle, DragHandleWithVisibility } from '../ui/drag-handle';
|
|
12
12
|
import { TYPE_HANDLE_DEC, TYPE_NODE_DEC, unmountDecorations } from './decorations-common';
|
|
13
|
-
import {
|
|
13
|
+
import { getMatchingBlockMarks } from './utils/marks';
|
|
14
14
|
const TYPE_ACTIVE_HANDLE_DEC = 'active-drag-handle-node';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -62,7 +62,7 @@ export const dragHandleDecoration = ({
|
|
|
62
62
|
* Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
|
|
63
63
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
64
64
|
*/
|
|
65
|
-
marks: expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getMatchingBlockMarks(editorState, pos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) :
|
|
65
|
+
marks: expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getMatchingBlockMarks(editorState, pos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) : [],
|
|
66
66
|
destroy: node => {
|
|
67
67
|
unbind && unbind();
|
|
68
68
|
}
|
|
@@ -71,7 +71,7 @@ export const dragHandleDecoration = ({
|
|
|
71
71
|
type: TYPE_HANDLE_DEC,
|
|
72
72
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
73
73
|
testid: `${TYPE_HANDLE_DEC}-${uuid()}`,
|
|
74
|
-
marks: expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getMatchingBlockMarks(editorState, pos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) :
|
|
74
|
+
marks: expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getMatchingBlockMarks(editorState, pos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) : [],
|
|
75
75
|
destroy: node => {
|
|
76
76
|
unbind && unbind();
|
|
77
77
|
}
|
|
@@ -7,7 +7,7 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
|
7
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
8
|
import { ACTIVE_QUICK_INSERT_ATTR } from '../ui/consts';
|
|
9
9
|
import { QuickInsertWithVisibility } from '../ui/quick-insert-button';
|
|
10
|
-
import {
|
|
10
|
+
import { getMatchingBlockMarks } from './utils/marks';
|
|
11
11
|
const TYPE_QUICK_INSERT = 'INSERT_BUTTON';
|
|
12
12
|
const TYPE_ACTIVE_QUICK_INSERT_NODE = 'active-quick-insert-node';
|
|
13
13
|
export const findQuickInsertInsertButtonDecoration = (decorations, from, to) => {
|
|
@@ -48,7 +48,7 @@ export const quickInsertButtonDecoration = ({
|
|
|
48
48
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
|
-
marks: expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getMatchingBlockMarks(editorState, rootPos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) :
|
|
51
|
+
marks: expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getMatchingBlockMarks(editorState, rootPos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) : [],
|
|
52
52
|
destroy: _ => {
|
|
53
53
|
if (fg('platform_editor_fix_widget_destroy')) {
|
|
54
54
|
nodeViewPortalProviderAPI.remove(key);
|
|
@@ -104,7 +104,9 @@ const processHoverSide = (view, api) => {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
// Added right-margin hover, gated so it can be rolled back. When off, fall through to midpoint.
|
|
107
|
-
if (editorExperiment('remix_button_right_margin_hover', true
|
|
107
|
+
if (editorExperiment('remix_button_right_margin_hover', true, {
|
|
108
|
+
exposure: true
|
|
109
|
+
})) {
|
|
108
110
|
const closestBlock = target === null || target === void 0 ? void 0 : target.closest(BLOCK_SELECTORS);
|
|
109
111
|
const blockElement = closestBlock instanceof HTMLElement ? closestBlock : null;
|
|
110
112
|
|
|
@@ -1,52 +1,3 @@
|
|
|
1
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Remove this when platform_editor_clean_up_widget_mark_logic is cleaned up.
|
|
5
|
-
*
|
|
6
|
-
* Returns list of block marks on schema that widgets are allowed to render inside
|
|
7
|
-
* Currently
|
|
8
|
-
* - indent
|
|
9
|
-
* - alignment
|
|
10
|
-
* @param state - The editor state
|
|
11
|
-
* @returns The block marks
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* const marks = getBlockMarks(state);
|
|
15
|
-
* console.log(marks);
|
|
16
|
-
* // [indent, alignment]
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export const getActiveBlockMarks = (state, pos) => {
|
|
20
|
-
const {
|
|
21
|
-
alignment
|
|
22
|
-
} = state.schema.marks;
|
|
23
|
-
const resolvedPos = state.doc.resolve(pos);
|
|
24
|
-
|
|
25
|
-
// find all active marks at the position
|
|
26
|
-
const marks = resolvedPos.marks();
|
|
27
|
-
const supportedMarks = marks.filter(mark => mark.type === alignment);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Fix for widget positioning at alignment mark boundaries.
|
|
31
|
-
* When the previous node has alignment but the next node doesn't, we need to prevent
|
|
32
|
-
* the widget from inheriting alignment marks. This ensures the widget is positioned
|
|
33
|
-
* correctly at the boundary rather than being absorbed into the alignment wrapper.
|
|
34
|
-
*/
|
|
35
|
-
if (supportedMarks.length > 0 && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
36
|
-
var _resolvedPos$nodeAfte;
|
|
37
|
-
const nextNodeMarks = ((_resolvedPos$nodeAfte = resolvedPos.nodeAfter) === null || _resolvedPos$nodeAfte === void 0 ? void 0 : _resolvedPos$nodeAfte.marks.filter(mark => mark.type === alignment)) || [];
|
|
38
|
-
|
|
39
|
-
// Compare alignment values to ensure they are the same
|
|
40
|
-
const alignmentValuesMatch = supportedMarks.length === nextNodeMarks.length && supportedMarks.some(mark => nextNodeMarks.some(nextMark => nextMark.eq(mark)));
|
|
41
|
-
|
|
42
|
-
// previous node has alignment but next node does not have alignment or alignment values differ
|
|
43
|
-
if (nextNodeMarks.length === 0 || !alignmentValuesMatch) {
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return supportedMarks;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
1
|
/** True when `mark` has an equal counterpart (type + attrs) in `marks`. */
|
|
51
2
|
const hasMatchingMark = (mark, marks) => {
|
|
52
3
|
const found = mark.type.isInSet(marks);
|
|
@@ -73,6 +73,37 @@ const buttonWrapperStyles = css({
|
|
|
73
73
|
boxSizing: 'border-box'
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
+
|
|
77
|
+
// EDITOR-6790 - When the `platform_editor_table_col_insert` experiment is enabled,
|
|
78
|
+
// drop the linear-gradient background that paints over the legacy `tr.sticky` table
|
|
79
|
+
// header so the new left-edge column-insert affordance is not visually clipped.
|
|
80
|
+
// Keep all paddings / margins identical to `buttonWrapperStyles` so the drag-handle
|
|
81
|
+
// layout does not shift between the two variants.
|
|
82
|
+
const buttonWrapperStylesNoBackground = css({
|
|
83
|
+
display: 'flex',
|
|
84
|
+
justifyContent: 'center',
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
87
|
+
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
88
|
+
marginBottom: "var(--ds-space-negative-200, -16px)",
|
|
89
|
+
paddingBottom: "var(--ds-space-200, 16px)",
|
|
90
|
+
marginTop: "var(--ds-space-negative-400, -32px)",
|
|
91
|
+
paddingTop: `calc(${"var(--ds-space-400, 32px)"} - 1px)`,
|
|
92
|
+
marginRight: "var(--ds-space-negative-150, -12px)",
|
|
93
|
+
paddingRight: "var(--ds-space-150, 12px)",
|
|
94
|
+
boxSizing: 'border-box'
|
|
95
|
+
},
|
|
96
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
97
|
+
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
98
|
+
marginBottom: "var(--ds-space-negative-200, -16px)",
|
|
99
|
+
paddingBottom: "var(--ds-space-200, 16px)",
|
|
100
|
+
marginTop: "var(--ds-space-negative-400, -32px)",
|
|
101
|
+
paddingTop: `calc(${"var(--ds-space-400, 32px)"} - 1px)`,
|
|
102
|
+
marginRight: "var(--ds-space-negative-150, -12px)",
|
|
103
|
+
paddingRight: "var(--ds-space-150, 12px)",
|
|
104
|
+
boxSizing: 'border-box'
|
|
105
|
+
}
|
|
106
|
+
});
|
|
76
107
|
const buttonWrapperStylesPatch = css({
|
|
77
108
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
78
109
|
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls [data-number-column="true"] tr.sticky) &': {
|
|
@@ -1071,7 +1102,10 @@ export const DragHandle = ({
|
|
|
1071
1102
|
});
|
|
1072
1103
|
}
|
|
1073
1104
|
}, jsx("span", {
|
|
1074
|
-
css: [shouldMaskNodeControls(nodeType, isTopLevelNodeValue) &&
|
|
1105
|
+
css: [shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && (
|
|
1106
|
+
// EDITOR-6790 - drop the masking background under the new
|
|
1107
|
+
// column-insert experiment so the left-edge dot is not clipped.
|
|
1108
|
+
expValEquals('platform_editor_table_col_insert', 'isEnabled', true) ? buttonWrapperStylesNoBackground : buttonWrapperStyles), buttonWrapperStylesPatch]
|
|
1075
1109
|
}, renderButton()))));
|
|
1076
1110
|
const stickyWithoutTooltip = () => jsx(Box
|
|
1077
1111
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
@@ -1085,7 +1119,10 @@ export const DragHandle = ({
|
|
|
1085
1119
|
}, jsx("span", {
|
|
1086
1120
|
css: [tooltipContainerStyles, shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithMask, !shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
1087
1121
|
}, jsx("span", {
|
|
1088
|
-
css: [shouldMaskNodeControls(nodeType, isTopLevelNodeValue) &&
|
|
1122
|
+
css: [shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && (
|
|
1123
|
+
// EDITOR-6790 - drop the masking background under the new
|
|
1124
|
+
// column-insert experiment so the left-edge dot is not clipped.
|
|
1125
|
+
expValEquals('platform_editor_table_col_insert', 'isEnabled', true) ? buttonWrapperStylesNoBackground : buttonWrapperStyles), buttonWrapperStylesPatch]
|
|
1089
1126
|
}, renderButton())));
|
|
1090
1127
|
const buttonWithTooltip = () => jsx(Tooltip, {
|
|
1091
1128
|
content: tooltipContent,
|
|
@@ -5,7 +5,9 @@ import React from 'react';
|
|
|
5
5
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
6
6
|
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
7
7
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
|
+
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
8
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
12
|
import { handleKeyDownWithPreservedSelection } from './editor-commands/handle-key-down-with-preserved-selection';
|
|
11
13
|
import { mapPreservedSelection as _mapPreservedSelection } from './editor-commands/map-preserved-selection';
|
|
@@ -37,6 +39,27 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
37
39
|
var blockControlsState = api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState();
|
|
38
40
|
var preservedSelection = blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.preservedSelection;
|
|
39
41
|
if (preservedSelection && preservedSelection.from !== preservedSelection.to) {
|
|
42
|
+
// CellSelection covers a table: collect each selected cell's text joined with spaces
|
|
43
|
+
// so that adjacent cells are not fused (e.g. 'hello world' + 'foo' must not
|
|
44
|
+
// become 'hello worldfoo'). Intl.Segmenter word-counting requires correct
|
|
45
|
+
// word boundaries, which raw textContent fusion breaks.
|
|
46
|
+
if (preservedSelection instanceof CellSelection && expValEquals('remix_iw_block_menu_table_calc_fix', 'isEnabled', true)) {
|
|
47
|
+
// Use node(1) to reliably target the table node regardless of $anchorCell depth.
|
|
48
|
+
// node(-1) would return tableRow if $anchorCell is at tableCell depth.
|
|
49
|
+
var tableNode = preservedSelection.$anchorCell.node(1);
|
|
50
|
+
var cellTexts = [];
|
|
51
|
+
if (tableNode) {
|
|
52
|
+
// forEachCell iterates only the selected cells, not all cells in the table.
|
|
53
|
+
preservedSelection.forEachCell(function (cell) {
|
|
54
|
+
cellTexts.push(cell.textContent);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
var _textContent = cellTexts.filter(Boolean).join(' ');
|
|
58
|
+
return {
|
|
59
|
+
textLength: _textContent.length,
|
|
60
|
+
textContent: _textContent
|
|
61
|
+
};
|
|
62
|
+
}
|
|
40
63
|
var from = preservedSelection.from,
|
|
41
64
|
to = preservedSelection.to;
|
|
42
65
|
var textContent = editorView.state.doc.textBetween(from, to, '\n');
|
|
@@ -11,7 +11,7 @@ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
|
11
11
|
import { ACTIVE_DRAG_HANDLE_ATTR } from '../ui/consts';
|
|
12
12
|
import { DragHandle, DragHandleWithVisibility } from '../ui/drag-handle';
|
|
13
13
|
import { TYPE_HANDLE_DEC, TYPE_NODE_DEC, unmountDecorations } from './decorations-common';
|
|
14
|
-
import {
|
|
14
|
+
import { getMatchingBlockMarks } from './utils/marks';
|
|
15
15
|
var TYPE_ACTIVE_HANDLE_DEC = 'active-drag-handle-node';
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -67,7 +67,7 @@ export var dragHandleDecoration = function dragHandleDecoration(_ref) {
|
|
|
67
67
|
* Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
|
|
68
68
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
69
69
|
*/
|
|
70
|
-
marks: expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getMatchingBlockMarks(editorState, pos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) :
|
|
70
|
+
marks: expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getMatchingBlockMarks(editorState, pos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) : [],
|
|
71
71
|
destroy: function destroy(node) {
|
|
72
72
|
unbind && unbind();
|
|
73
73
|
}
|
|
@@ -76,7 +76,7 @@ export var dragHandleDecoration = function dragHandleDecoration(_ref) {
|
|
|
76
76
|
type: TYPE_HANDLE_DEC,
|
|
77
77
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
78
78
|
testid: "".concat(TYPE_HANDLE_DEC, "-").concat(uuid()),
|
|
79
|
-
marks: expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getMatchingBlockMarks(editorState, pos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) :
|
|
79
|
+
marks: expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getMatchingBlockMarks(editorState, pos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) : [],
|
|
80
80
|
destroy: function destroy(node) {
|
|
81
81
|
unbind && unbind();
|
|
82
82
|
}
|
|
@@ -8,7 +8,7 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
|
8
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
9
|
import { ACTIVE_QUICK_INSERT_ATTR } from '../ui/consts';
|
|
10
10
|
import { QuickInsertWithVisibility } from '../ui/quick-insert-button';
|
|
11
|
-
import {
|
|
11
|
+
import { getMatchingBlockMarks } from './utils/marks';
|
|
12
12
|
var TYPE_QUICK_INSERT = 'INSERT_BUTTON';
|
|
13
13
|
var TYPE_ACTIVE_QUICK_INSERT_NODE = 'active-quick-insert-node';
|
|
14
14
|
export var findQuickInsertInsertButtonDecoration = function findQuickInsertInsertButtonDecoration(decorations, from, to) {
|
|
@@ -54,7 +54,7 @@ export var quickInsertButtonDecoration = function quickInsertButtonDecoration(_r
|
|
|
54
54
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
55
55
|
*/
|
|
56
56
|
|
|
57
|
-
marks: expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getMatchingBlockMarks(editorState, rootPos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) :
|
|
57
|
+
marks: expValEquals('platform_editor_small_font_size', 'isEnabled', true) ? getMatchingBlockMarks(editorState, rootPos, [editorState.schema.marks.alignment, editorState.schema.marks.fontSize]) : [],
|
|
58
58
|
destroy: function destroy(_) {
|
|
59
59
|
if (fg('platform_editor_fix_widget_destroy')) {
|
|
60
60
|
nodeViewPortalProviderAPI.remove(key);
|
|
@@ -118,7 +118,9 @@ var processHoverSide = function processHoverSide(view, api) {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
// Added right-margin hover, gated so it can be rolled back. When off, fall through to midpoint.
|
|
121
|
-
if (editorExperiment('remix_button_right_margin_hover', true
|
|
121
|
+
if (editorExperiment('remix_button_right_margin_hover', true, {
|
|
122
|
+
exposure: true
|
|
123
|
+
})) {
|
|
122
124
|
var closestBlock = target === null || target === void 0 ? void 0 : target.closest(BLOCK_SELECTORS);
|
|
123
125
|
var blockElement = closestBlock instanceof HTMLElement ? closestBlock : null;
|
|
124
126
|
|
|
@@ -1,58 +1,3 @@
|
|
|
1
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Remove this when platform_editor_clean_up_widget_mark_logic is cleaned up.
|
|
5
|
-
*
|
|
6
|
-
* Returns list of block marks on schema that widgets are allowed to render inside
|
|
7
|
-
* Currently
|
|
8
|
-
* - indent
|
|
9
|
-
* - alignment
|
|
10
|
-
* @param state - The editor state
|
|
11
|
-
* @returns The block marks
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* const marks = getBlockMarks(state);
|
|
15
|
-
* console.log(marks);
|
|
16
|
-
* // [indent, alignment]
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export var getActiveBlockMarks = function getActiveBlockMarks(state, pos) {
|
|
20
|
-
var alignment = state.schema.marks.alignment;
|
|
21
|
-
var resolvedPos = state.doc.resolve(pos);
|
|
22
|
-
|
|
23
|
-
// find all active marks at the position
|
|
24
|
-
var marks = resolvedPos.marks();
|
|
25
|
-
var supportedMarks = marks.filter(function (mark) {
|
|
26
|
-
return mark.type === alignment;
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Fix for widget positioning at alignment mark boundaries.
|
|
31
|
-
* When the previous node has alignment but the next node doesn't, we need to prevent
|
|
32
|
-
* the widget from inheriting alignment marks. This ensures the widget is positioned
|
|
33
|
-
* correctly at the boundary rather than being absorbed into the alignment wrapper.
|
|
34
|
-
*/
|
|
35
|
-
if (supportedMarks.length > 0 && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true)) {
|
|
36
|
-
var _resolvedPos$nodeAfte;
|
|
37
|
-
var nextNodeMarks = ((_resolvedPos$nodeAfte = resolvedPos.nodeAfter) === null || _resolvedPos$nodeAfte === void 0 ? void 0 : _resolvedPos$nodeAfte.marks.filter(function (mark) {
|
|
38
|
-
return mark.type === alignment;
|
|
39
|
-
})) || [];
|
|
40
|
-
|
|
41
|
-
// Compare alignment values to ensure they are the same
|
|
42
|
-
var alignmentValuesMatch = supportedMarks.length === nextNodeMarks.length && supportedMarks.some(function (mark) {
|
|
43
|
-
return nextNodeMarks.some(function (nextMark) {
|
|
44
|
-
return nextMark.eq(mark);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// previous node has alignment but next node does not have alignment or alignment values differ
|
|
49
|
-
if (nextNodeMarks.length === 0 || !alignmentValuesMatch) {
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return supportedMarks;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
1
|
/** True when `mark` has an equal counterpart (type + attrs) in `marks`. */
|
|
57
2
|
var hasMatchingMark = function hasMatchingMark(mark, marks) {
|
|
58
3
|
var found = mark.type.isInSet(marks);
|
|
@@ -78,6 +78,37 @@ var buttonWrapperStyles = css({
|
|
|
78
78
|
boxSizing: 'border-box'
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
|
+
|
|
82
|
+
// EDITOR-6790 - When the `platform_editor_table_col_insert` experiment is enabled,
|
|
83
|
+
// drop the linear-gradient background that paints over the legacy `tr.sticky` table
|
|
84
|
+
// header so the new left-edge column-insert affordance is not visually clipped.
|
|
85
|
+
// Keep all paddings / margins identical to `buttonWrapperStyles` so the drag-handle
|
|
86
|
+
// layout does not shift between the two variants.
|
|
87
|
+
var buttonWrapperStylesNoBackground = css({
|
|
88
|
+
display: 'flex',
|
|
89
|
+
justifyContent: 'center',
|
|
90
|
+
alignItems: 'center',
|
|
91
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
92
|
+
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
93
|
+
marginBottom: "var(--ds-space-negative-200, -16px)",
|
|
94
|
+
paddingBottom: "var(--ds-space-200, 16px)",
|
|
95
|
+
marginTop: "var(--ds-space-negative-400, -32px)",
|
|
96
|
+
paddingTop: "calc(".concat("var(--ds-space-400, 32px)", " - 1px)"),
|
|
97
|
+
marginRight: "var(--ds-space-negative-150, -12px)",
|
|
98
|
+
paddingRight: "var(--ds-space-150, 12px)",
|
|
99
|
+
boxSizing: 'border-box'
|
|
100
|
+
},
|
|
101
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
102
|
+
'[data-prosemirror-mark-name="breakout"]:has([data-blocks-drag-handle-container]):has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls tr.sticky) &': {
|
|
103
|
+
marginBottom: "var(--ds-space-negative-200, -16px)",
|
|
104
|
+
paddingBottom: "var(--ds-space-200, 16px)",
|
|
105
|
+
marginTop: "var(--ds-space-negative-400, -32px)",
|
|
106
|
+
paddingTop: "calc(".concat("var(--ds-space-400, 32px)", " - 1px)"),
|
|
107
|
+
marginRight: "var(--ds-space-negative-150, -12px)",
|
|
108
|
+
paddingRight: "var(--ds-space-150, 12px)",
|
|
109
|
+
boxSizing: 'border-box'
|
|
110
|
+
}
|
|
111
|
+
});
|
|
81
112
|
var buttonWrapperStylesPatch = css({
|
|
82
113
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
83
114
|
'[data-blocks-drag-handle-container]:has(+ [data-prosemirror-node-name="table"] .pm-table-with-controls [data-number-column="true"] tr.sticky) &': {
|
|
@@ -1088,7 +1119,10 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
1088
1119
|
});
|
|
1089
1120
|
}
|
|
1090
1121
|
}, jsx("span", {
|
|
1091
|
-
css: [shouldMaskNodeControls(nodeType, isTopLevelNodeValue) &&
|
|
1122
|
+
css: [shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && (
|
|
1123
|
+
// EDITOR-6790 - drop the masking background under the new
|
|
1124
|
+
// column-insert experiment so the left-edge dot is not clipped.
|
|
1125
|
+
expValEquals('platform_editor_table_col_insert', 'isEnabled', true) ? buttonWrapperStylesNoBackground : buttonWrapperStyles), buttonWrapperStylesPatch]
|
|
1092
1126
|
}, renderButton()))));
|
|
1093
1127
|
};
|
|
1094
1128
|
var stickyWithoutTooltip = function stickyWithoutTooltip() {
|
|
@@ -1104,7 +1138,10 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
1104
1138
|
}, jsx("span", {
|
|
1105
1139
|
css: [tooltipContainerStyles, shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithMask, !shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && tooltipContainerStylesStickyHeaderWithoutMask]
|
|
1106
1140
|
}, jsx("span", {
|
|
1107
|
-
css: [shouldMaskNodeControls(nodeType, isTopLevelNodeValue) &&
|
|
1141
|
+
css: [shouldMaskNodeControls(nodeType, isTopLevelNodeValue) && (
|
|
1142
|
+
// EDITOR-6790 - drop the masking background under the new
|
|
1143
|
+
// column-insert experiment so the left-edge dot is not clipped.
|
|
1144
|
+
expValEquals('platform_editor_table_col_insert', 'isEnabled', true) ? buttonWrapperStylesNoBackground : buttonWrapperStyles), buttonWrapperStylesPatch]
|
|
1108
1145
|
}, renderButton())));
|
|
1109
1146
|
};
|
|
1110
1147
|
var buttonWithTooltip = function buttonWithTooltip() {
|
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import type { Mark, MarkType } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
/**
|
|
4
|
-
* Remove this when platform_editor_clean_up_widget_mark_logic is cleaned up.
|
|
5
|
-
*
|
|
6
|
-
* Returns list of block marks on schema that widgets are allowed to render inside
|
|
7
|
-
* Currently
|
|
8
|
-
* - indent
|
|
9
|
-
* - alignment
|
|
10
|
-
* @param state - The editor state
|
|
11
|
-
* @returns The block marks
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* const marks = getBlockMarks(state);
|
|
15
|
-
* console.log(marks);
|
|
16
|
-
* // [indent, alignment]
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export declare const getActiveBlockMarks: (state: EditorState, pos: number) => Mark[];
|
|
20
3
|
/**
|
|
21
4
|
* Returns supported block marks at `pos` only when both adjacent siblings
|
|
22
5
|
* share the exact same set of those marks. Returns `[]` when they differ,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.7",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,20 +27,20 @@
|
|
|
27
27
|
"@atlaskit/editor-plugin-editor-disabled": "^12.0.0",
|
|
28
28
|
"@atlaskit/editor-plugin-editor-viewmode": "^14.0.0",
|
|
29
29
|
"@atlaskit/editor-plugin-feature-flags": "^11.0.0",
|
|
30
|
-
"@atlaskit/editor-plugin-interaction": "^
|
|
30
|
+
"@atlaskit/editor-plugin-interaction": "^22.0.0",
|
|
31
31
|
"@atlaskit/editor-plugin-limited-mode": "^9.0.0",
|
|
32
32
|
"@atlaskit/editor-plugin-metrics": "^13.0.0",
|
|
33
33
|
"@atlaskit/editor-plugin-quick-insert": "^12.0.0",
|
|
34
34
|
"@atlaskit/editor-plugin-selection": "^12.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-toolbar": "^9.0.0",
|
|
36
|
-
"@atlaskit/editor-plugin-type-ahead": "^12.
|
|
36
|
+
"@atlaskit/editor-plugin-type-ahead": "^12.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-user-intent": "^10.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-width": "^13.0.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^4.0.0",
|
|
41
41
|
"@atlaskit/editor-tables": "^3.0.0",
|
|
42
42
|
"@atlaskit/icon": "^36.0.0",
|
|
43
|
-
"@atlaskit/icon-lab": "^7.
|
|
43
|
+
"@atlaskit/icon-lab": "^7.1.0",
|
|
44
44
|
"@atlaskit/link": "^4.0.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
46
46
|
"@atlaskit/pragmatic-drag-and-drop": "^2.0.0",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^4.0.0",
|
|
49
49
|
"@atlaskit/primitives": "^20.0.0",
|
|
50
50
|
"@atlaskit/theme": "^26.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
52
|
-
"@atlaskit/tokens": "^
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^110.0.0",
|
|
52
|
+
"@atlaskit/tokens": "^15.0.0",
|
|
53
53
|
"@atlaskit/tooltip": "^23.0.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"@emotion/react": "^11.7.1",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"uuid": "^3.1.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@atlaskit/editor-common": "^116.
|
|
62
|
+
"@atlaskit/editor-common": "^116.11.0",
|
|
63
63
|
"react": "^18.2.0",
|
|
64
64
|
"react-dom": "^18.2.0",
|
|
65
65
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -147,6 +147,6 @@
|
|
|
147
147
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
148
148
|
"react": "^18.2.0",
|
|
149
149
|
"react-dom": "^18.2.0",
|
|
150
|
-
"react-intl": "^
|
|
150
|
+
"react-intl": "^7.0.0"
|
|
151
151
|
}
|
|
152
152
|
}
|