@atlaskit/editor-plugin-block-menu 6.0.40 → 6.0.42
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
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-menu
|
|
2
2
|
|
|
3
|
+
## 6.0.42
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f0de8d658199d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f0de8d658199d) -
|
|
8
|
+
[ux] Ensure if table transform occurs, the result remains selected
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 6.0.41
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 6.0.40
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -9,6 +9,8 @@ var _performanceMeasures = require("@atlaskit/editor-common/performance-measures
|
|
|
9
9
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
10
10
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
11
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
12
|
+
var _editorTables = require("@atlaskit/editor-tables");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
14
|
var _isNestedNode = require("../ui/utils/isNestedNode");
|
|
13
15
|
var _transform2 = require("./transform-node-utils/transform");
|
|
14
16
|
var _utils = require("./transforms/utils");
|
|
@@ -76,6 +78,26 @@ var transformNode = exports.transformNode = function transformNode(api) {
|
|
|
76
78
|
} else {
|
|
77
79
|
tr.replaceWith(sliceStart, $to.pos, content);
|
|
78
80
|
}
|
|
81
|
+
|
|
82
|
+
// [FEATURE FLAG: platform_editor_table_transform_selection_fix]
|
|
83
|
+
// Fixes table cell selection not being preserved after transform to expand/layout.
|
|
84
|
+
// When a table with CellSelection is transformed, we need to re-select the wrapper node.
|
|
85
|
+
// To clean up: remove the if-else block and keep only the flag-on behavior.
|
|
86
|
+
if (preservedSelection instanceof _editorTables.CellSelection && (0, _platformFeatureFlags.fg)('platform_editor_table_transform_selection_fix')) {
|
|
87
|
+
var insertedNode = tr.doc.nodeAt($from.pos);
|
|
88
|
+
var isSelectable = insertedNode && _state.NodeSelection.isSelectable(insertedNode);
|
|
89
|
+
if (isSelectable) {
|
|
90
|
+
var _api$blockControls3;
|
|
91
|
+
var nodeSelection = _state.NodeSelection.create(tr.doc, $from.pos);
|
|
92
|
+
tr.setSelection(nodeSelection);
|
|
93
|
+
|
|
94
|
+
// Update preserved selection to match the new NodeSelection
|
|
95
|
+
// This prevents appendTransaction from restoring the old table selection positions
|
|
96
|
+
api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.startPreservingSelection()({
|
|
97
|
+
tr: tr
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
79
101
|
(0, _performanceMeasures.stopMeasure)(measureId, function (duration, startTime) {
|
|
80
102
|
var _api$analytics;
|
|
81
103
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.attachAnalyticsEvent({
|
|
@@ -3,6 +3,8 @@ import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-m
|
|
|
3
3
|
import { expandSelectionToBlockRange, getSourceNodesFromSelectionRange } from '@atlaskit/editor-common/selection';
|
|
4
4
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { Mapping, StepMap } from '@atlaskit/editor-prosemirror/transform';
|
|
6
|
+
import { CellSelection } from '@atlaskit/editor-tables';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
8
|
import { isNestedNode } from '../ui/utils/isNestedNode';
|
|
7
9
|
import { convertNodesToTargetType } from './transform-node-utils/transform';
|
|
8
10
|
import { isListNode } from './transforms/utils';
|
|
@@ -68,6 +70,26 @@ export const transformNode = api => (targetType, metadata) => ({
|
|
|
68
70
|
} else {
|
|
69
71
|
tr.replaceWith(sliceStart, $to.pos, content);
|
|
70
72
|
}
|
|
73
|
+
|
|
74
|
+
// [FEATURE FLAG: platform_editor_table_transform_selection_fix]
|
|
75
|
+
// Fixes table cell selection not being preserved after transform to expand/layout.
|
|
76
|
+
// When a table with CellSelection is transformed, we need to re-select the wrapper node.
|
|
77
|
+
// To clean up: remove the if-else block and keep only the flag-on behavior.
|
|
78
|
+
if (preservedSelection instanceof CellSelection && fg('platform_editor_table_transform_selection_fix')) {
|
|
79
|
+
const insertedNode = tr.doc.nodeAt($from.pos);
|
|
80
|
+
const isSelectable = insertedNode && NodeSelection.isSelectable(insertedNode);
|
|
81
|
+
if (isSelectable) {
|
|
82
|
+
var _api$blockControls3;
|
|
83
|
+
const nodeSelection = NodeSelection.create(tr.doc, $from.pos);
|
|
84
|
+
tr.setSelection(nodeSelection);
|
|
85
|
+
|
|
86
|
+
// Update preserved selection to match the new NodeSelection
|
|
87
|
+
// This prevents appendTransaction from restoring the old table selection positions
|
|
88
|
+
api === null || api === void 0 ? void 0 : (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 ? void 0 : _api$blockControls3.commands.startPreservingSelection()({
|
|
89
|
+
tr
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
71
93
|
stopMeasure(measureId, (duration, startTime) => {
|
|
72
94
|
var _api$analytics, _api$analytics$action;
|
|
73
95
|
api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.attachAnalyticsEvent({
|
|
@@ -3,6 +3,8 @@ import { startMeasure, stopMeasure } from '@atlaskit/editor-common/performance-m
|
|
|
3
3
|
import { expandSelectionToBlockRange, getSourceNodesFromSelectionRange } from '@atlaskit/editor-common/selection';
|
|
4
4
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { Mapping, StepMap } from '@atlaskit/editor-prosemirror/transform';
|
|
6
|
+
import { CellSelection } from '@atlaskit/editor-tables';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
8
|
import { isNestedNode } from '../ui/utils/isNestedNode';
|
|
7
9
|
import { convertNodesToTargetType } from './transform-node-utils/transform';
|
|
8
10
|
import { isListNode } from './transforms/utils';
|
|
@@ -70,6 +72,26 @@ export var transformNode = function transformNode(api) {
|
|
|
70
72
|
} else {
|
|
71
73
|
tr.replaceWith(sliceStart, $to.pos, content);
|
|
72
74
|
}
|
|
75
|
+
|
|
76
|
+
// [FEATURE FLAG: platform_editor_table_transform_selection_fix]
|
|
77
|
+
// Fixes table cell selection not being preserved after transform to expand/layout.
|
|
78
|
+
// When a table with CellSelection is transformed, we need to re-select the wrapper node.
|
|
79
|
+
// To clean up: remove the if-else block and keep only the flag-on behavior.
|
|
80
|
+
if (preservedSelection instanceof CellSelection && fg('platform_editor_table_transform_selection_fix')) {
|
|
81
|
+
var insertedNode = tr.doc.nodeAt($from.pos);
|
|
82
|
+
var isSelectable = insertedNode && NodeSelection.isSelectable(insertedNode);
|
|
83
|
+
if (isSelectable) {
|
|
84
|
+
var _api$blockControls3;
|
|
85
|
+
var nodeSelection = NodeSelection.create(tr.doc, $from.pos);
|
|
86
|
+
tr.setSelection(nodeSelection);
|
|
87
|
+
|
|
88
|
+
// Update preserved selection to match the new NodeSelection
|
|
89
|
+
// This prevents appendTransaction from restoring the old table selection positions
|
|
90
|
+
api === null || api === void 0 || (_api$blockControls3 = api.blockControls) === null || _api$blockControls3 === void 0 || _api$blockControls3.commands.startPreservingSelection()({
|
|
91
|
+
tr: tr
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
73
95
|
stopMeasure(measureId, function (duration, startTime) {
|
|
74
96
|
var _api$analytics;
|
|
75
97
|
api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 || _api$analytics.attachAnalyticsEvent({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-menu",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.42",
|
|
4
4
|
"description": "BlockMenu plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -46,13 +46,13 @@
|
|
|
46
46
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
47
47
|
"@atlaskit/primitives": "^18.0.0",
|
|
48
48
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^25.2.0",
|
|
50
50
|
"@atlaskit/tokens": "^11.0.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"bind-event-listener": "^3.0.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@atlaskit/editor-common": "^111.
|
|
55
|
+
"@atlaskit/editor-common": "^111.13.0",
|
|
56
56
|
"react": "^18.2.0",
|
|
57
57
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
58
58
|
},
|
|
@@ -98,6 +98,9 @@
|
|
|
98
98
|
},
|
|
99
99
|
"platform_editor_block_menu_v2_patch_2": {
|
|
100
100
|
"type": "boolean"
|
|
101
|
+
},
|
|
102
|
+
"platform_editor_table_transform_selection_fix": {
|
|
103
|
+
"type": "boolean"
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
}
|