@atlaskit/editor-plugin-block-controls 9.0.13 → 9.0.15
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 +17 -0
- package/dist/cjs/editor-commands/move-to-layout.js +3 -1
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +2 -2
- package/dist/cjs/pm-plugins/decorations-drop-target-active.js +3 -1
- package/dist/cjs/pm-plugins/decorations-quick-insert-button.js +1 -1
- package/dist/cjs/pm-plugins/utils/marks.js +2 -0
- package/dist/cjs/ui/drop-target.js +3 -1
- package/dist/es2019/editor-commands/move-to-layout.js +3 -1
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +2 -2
- package/dist/es2019/pm-plugins/decorations-drop-target-active.js +3 -1
- package/dist/es2019/pm-plugins/decorations-quick-insert-button.js +1 -1
- package/dist/es2019/pm-plugins/utils/marks.js +2 -0
- package/dist/es2019/ui/drop-target.js +3 -1
- package/dist/esm/editor-commands/move-to-layout.js +3 -1
- package/dist/esm/pm-plugins/decorations-drag-handle.js +2 -2
- package/dist/esm/pm-plugins/decorations-drop-target-active.js +3 -1
- package/dist/esm/pm-plugins/decorations-quick-insert-button.js +1 -1
- package/dist/esm/pm-plugins/utils/marks.js +2 -0
- package/dist/esm/ui/drop-target.js +3 -1
- package/dist/types/pm-plugins/utils/marks.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/utils/marks.d.ts +2 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 9.0.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`c9d8de9fd5a33`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c9d8de9fd5a33) -
|
|
8
|
+
Avoid wrapping block controls in any block mark - fixes issues with font size mark.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 9.0.14
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`3895f6d32cc49`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3895f6d32cc49) -
|
|
16
|
+
Replace expValEquals with editorExperiment for platform_synced_block experiment to ensure
|
|
17
|
+
consistent exposure firing
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 9.0.13
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -143,7 +143,9 @@ var canMoveToLayout = function canMoveToLayout(api, from, to, tr, moveNodeAtCurs
|
|
|
143
143
|
}
|
|
144
144
|
var $to = tr.doc.resolve(to);
|
|
145
145
|
var allowedParentTypes = [doc, layoutSection];
|
|
146
|
-
if (bodiedSyncBlock && (0,
|
|
146
|
+
if (bodiedSyncBlock && (0, _experiments.editorExperiment)('platform_synced_block', true) && (0, _experiments.editorExperiment)('platform_synced_block_patch_6', true, {
|
|
147
|
+
exposure: true
|
|
148
|
+
})) {
|
|
147
149
|
allowedParentTypes.push(bodiedSyncBlock);
|
|
148
150
|
}
|
|
149
151
|
|
|
@@ -62,7 +62,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
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: (0, _marks.getActiveBlockMarks)(editorState, pos),
|
|
65
|
+
marks: (0, _expValEquals.expValEquals)('platform_editor_clean_up_widget_mark_logic', 'isEnabled', true) ? [] : (0, _marks.getActiveBlockMarks)(editorState, pos),
|
|
66
66
|
destroy: function destroy(node) {
|
|
67
67
|
unbind && unbind();
|
|
68
68
|
if ((0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
@@ -74,7 +74,7 @@ var dragHandleDecoration = exports.dragHandleDecoration = function dragHandleDec
|
|
|
74
74
|
type: _decorationsCommon.TYPE_HANDLE_DEC,
|
|
75
75
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
76
76
|
testid: "".concat(_decorationsCommon.TYPE_HANDLE_DEC, "-").concat((0, _uuid.default)()),
|
|
77
|
-
marks: (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_native_anchor_patch_1') ? (0, _marks.getActiveBlockMarks)(editorState, pos) : undefined,
|
|
77
|
+
marks: (0, _expValEquals.expValEquals)('platform_editor_clean_up_widget_mark_logic', 'isEnabled', true) ? [] : (0, _expValEquals.expValEquals)('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_native_anchor_patch_1') ? (0, _marks.getActiveBlockMarks)(editorState, pos) : undefined,
|
|
78
78
|
destroy: function destroy(node) {
|
|
79
79
|
unbind && unbind();
|
|
80
80
|
if ((0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
@@ -214,7 +214,9 @@ var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = fu
|
|
|
214
214
|
}
|
|
215
215
|
var anchorEmitNodeWithPos = rootNodeWithPos;
|
|
216
216
|
if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
217
|
-
if ((0,
|
|
217
|
+
if ((0, _experiments.editorExperiment)('platform_synced_block', true) && (0, _experiments.editorExperiment)('platform_synced_block_patch_6', true, {
|
|
218
|
+
exposure: true
|
|
219
|
+
})) {
|
|
218
220
|
var schema = rootNodeWithPos.node.type.schema;
|
|
219
221
|
var layoutSection = schema.nodes.layoutSection;
|
|
220
222
|
var isLayoutSectionChildOfRoot = (0, _utils2.findChildrenByType)(rootNodeWithPos.node, layoutSection, false).length > 0;
|
|
@@ -46,7 +46,7 @@ var quickInsertButtonDecoration = exports.quickInsertButtonDecoration = function
|
|
|
46
46
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
47
47
|
*/
|
|
48
48
|
|
|
49
|
-
marks: (0, _marks.getActiveBlockMarks)(editorState, rootPos),
|
|
49
|
+
marks: (0, _expValEquals.expValEquals)('platform_editor_clean_up_widget_mark_logic', 'isEnabled', true) ? [] : (0, _marks.getActiveBlockMarks)(editorState, rootPos),
|
|
50
50
|
destroy: function destroy(_) {
|
|
51
51
|
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_widget_destroy')) {
|
|
52
52
|
nodeViewPortalProviderAPI.remove(key);
|
|
@@ -7,6 +7,8 @@ exports.getActiveBlockMarks = void 0;
|
|
|
7
7
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
8
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
9
|
/**
|
|
10
|
+
* Remove this when platform_editor_clean_up_widget_mark_logic is cleaned up.
|
|
11
|
+
*
|
|
10
12
|
* Returns list of block marks on schema that widgets are allowed to render inside
|
|
11
13
|
* Currently
|
|
12
14
|
* - indent
|
|
@@ -113,7 +113,9 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
113
113
|
_useActiveAnchorTrack2 = (0, _slicedToArray2.default)(_useActiveAnchorTrack, 2),
|
|
114
114
|
_isActive = _useActiveAnchorTrack2[0],
|
|
115
115
|
setActiveAnchor = _useActiveAnchorTrack2[1];
|
|
116
|
-
var isInsideBodiedSyncBlock = parent && parent.type.name === 'bodiedSyncBlock' && (0,
|
|
116
|
+
var isInsideBodiedSyncBlock = parent && parent.type.name === 'bodiedSyncBlock' && (0, _experiments.editorExperiment)('platform_synced_block', true) && (0, _experiments.editorExperiment)('platform_synced_block_patch_6', true, {
|
|
117
|
+
exposure: true
|
|
118
|
+
});
|
|
117
119
|
(0, _react.useEffect)(function () {
|
|
118
120
|
if (ref.current) {
|
|
119
121
|
return (0, _adapter.dropTargetForElements)({
|
|
@@ -140,7 +140,9 @@ const canMoveToLayout = (api, from, to, tr, moveNodeAtCursorPos) => {
|
|
|
140
140
|
}
|
|
141
141
|
const $to = tr.doc.resolve(to);
|
|
142
142
|
const allowedParentTypes = [doc, layoutSection];
|
|
143
|
-
if (bodiedSyncBlock &&
|
|
143
|
+
if (bodiedSyncBlock && editorExperiment('platform_synced_block', true) && editorExperiment('platform_synced_block_patch_6', true, {
|
|
144
|
+
exposure: true
|
|
145
|
+
})) {
|
|
144
146
|
allowedParentTypes.push(bodiedSyncBlock);
|
|
145
147
|
}
|
|
146
148
|
|
|
@@ -53,7 +53,7 @@ export const dragHandleDecoration = ({
|
|
|
53
53
|
* Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
|
|
54
54
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
55
55
|
*/
|
|
56
|
-
marks: getActiveBlockMarks(editorState, pos),
|
|
56
|
+
marks: expValEquals('platform_editor_clean_up_widget_mark_logic', 'isEnabled', true) ? [] : getActiveBlockMarks(editorState, pos),
|
|
57
57
|
destroy: node => {
|
|
58
58
|
unbind && unbind();
|
|
59
59
|
if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
@@ -65,7 +65,7 @@ export const dragHandleDecoration = ({
|
|
|
65
65
|
type: TYPE_HANDLE_DEC,
|
|
66
66
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
67
67
|
testid: `${TYPE_HANDLE_DEC}-${uuid()}`,
|
|
68
|
-
marks: expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && fg('platform_editor_native_anchor_patch_1') ? getActiveBlockMarks(editorState, pos) : undefined,
|
|
68
|
+
marks: expValEquals('platform_editor_clean_up_widget_mark_logic', 'isEnabled', true) ? [] : expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && fg('platform_editor_native_anchor_patch_1') ? getActiveBlockMarks(editorState, pos) : undefined,
|
|
69
69
|
destroy: node => {
|
|
70
70
|
unbind && unbind();
|
|
71
71
|
if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
@@ -197,7 +197,9 @@ export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api,
|
|
|
197
197
|
}
|
|
198
198
|
let anchorEmitNodeWithPos = rootNodeWithPos;
|
|
199
199
|
if (editorExperiment('advanced_layouts', true)) {
|
|
200
|
-
if (
|
|
200
|
+
if (editorExperiment('platform_synced_block', true) && editorExperiment('platform_synced_block_patch_6', true, {
|
|
201
|
+
exposure: true
|
|
202
|
+
})) {
|
|
201
203
|
const schema = rootNodeWithPos.node.type.schema;
|
|
202
204
|
const {
|
|
203
205
|
layoutSection
|
|
@@ -37,7 +37,7 @@ export const quickInsertButtonDecoration = ({
|
|
|
37
37
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
|
-
marks: getActiveBlockMarks(editorState, rootPos),
|
|
40
|
+
marks: expValEquals('platform_editor_clean_up_widget_mark_logic', 'isEnabled', true) ? [] : getActiveBlockMarks(editorState, rootPos),
|
|
41
41
|
destroy: _ => {
|
|
42
42
|
if (fg('platform_editor_fix_widget_destroy')) {
|
|
43
43
|
nodeViewPortalProviderAPI.remove(key);
|
|
@@ -2,6 +2,8 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
2
2
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
+
* Remove this when platform_editor_clean_up_widget_mark_logic is cleaned up.
|
|
6
|
+
*
|
|
5
7
|
* Returns list of block marks on schema that widgets are allowed to render inside
|
|
6
8
|
* Currently
|
|
7
9
|
* - indent
|
|
@@ -101,7 +101,9 @@ const HoverZone = ({
|
|
|
101
101
|
return node ? getNodeAnchor(node) : '';
|
|
102
102
|
}, [api, node, pos, position]);
|
|
103
103
|
const [_isActive, setActiveAnchor] = useActiveAnchorTracker(anchorName);
|
|
104
|
-
const isInsideBodiedSyncBlock = parent && parent.type.name === 'bodiedSyncBlock' &&
|
|
104
|
+
const isInsideBodiedSyncBlock = parent && parent.type.name === 'bodiedSyncBlock' && editorExperiment('platform_synced_block', true) && editorExperiment('platform_synced_block_patch_6', true, {
|
|
105
|
+
exposure: true
|
|
106
|
+
});
|
|
105
107
|
useEffect(() => {
|
|
106
108
|
if (ref.current) {
|
|
107
109
|
return dropTargetForElements({
|
|
@@ -137,7 +137,9 @@ var canMoveToLayout = function canMoveToLayout(api, from, to, tr, moveNodeAtCurs
|
|
|
137
137
|
}
|
|
138
138
|
var $to = tr.doc.resolve(to);
|
|
139
139
|
var allowedParentTypes = [doc, layoutSection];
|
|
140
|
-
if (bodiedSyncBlock &&
|
|
140
|
+
if (bodiedSyncBlock && editorExperiment('platform_synced_block', true) && editorExperiment('platform_synced_block_patch_6', true, {
|
|
141
|
+
exposure: true
|
|
142
|
+
})) {
|
|
141
143
|
allowedParentTypes.push(bodiedSyncBlock);
|
|
142
144
|
}
|
|
143
145
|
|
|
@@ -54,7 +54,7 @@ export var dragHandleDecoration = function dragHandleDecoration(_ref) {
|
|
|
54
54
|
* Exclude 'breakout' on purpose, so the widgets render at the top of the document to avoid z-index issues
|
|
55
55
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
56
56
|
*/
|
|
57
|
-
marks: getActiveBlockMarks(editorState, pos),
|
|
57
|
+
marks: expValEquals('platform_editor_clean_up_widget_mark_logic', 'isEnabled', true) ? [] : getActiveBlockMarks(editorState, pos),
|
|
58
58
|
destroy: function destroy(node) {
|
|
59
59
|
unbind && unbind();
|
|
60
60
|
if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
@@ -66,7 +66,7 @@ export var dragHandleDecoration = function dragHandleDecoration(_ref) {
|
|
|
66
66
|
type: TYPE_HANDLE_DEC,
|
|
67
67
|
// eslint-disable-next-line @atlaskit/platform/prefer-crypto-random-uuid -- Use crypto.randomUUID instead
|
|
68
68
|
testid: "".concat(TYPE_HANDLE_DEC, "-").concat(uuid()),
|
|
69
|
-
marks: expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && fg('platform_editor_native_anchor_patch_1') ? getActiveBlockMarks(editorState, pos) : undefined,
|
|
69
|
+
marks: expValEquals('platform_editor_clean_up_widget_mark_logic', 'isEnabled', true) ? [] : expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) && fg('platform_editor_native_anchor_patch_1') ? getActiveBlockMarks(editorState, pos) : undefined,
|
|
70
70
|
destroy: function destroy(node) {
|
|
71
71
|
unbind && unbind();
|
|
72
72
|
if (editorExperiment('platform_editor_block_control_optimise_render', true) && node instanceof HTMLElement) {
|
|
@@ -209,7 +209,9 @@ export var getActiveDropTargetDecorations = function getActiveDropTargetDecorati
|
|
|
209
209
|
}
|
|
210
210
|
var anchorEmitNodeWithPos = rootNodeWithPos;
|
|
211
211
|
if (editorExperiment('advanced_layouts', true)) {
|
|
212
|
-
if (
|
|
212
|
+
if (editorExperiment('platform_synced_block', true) && editorExperiment('platform_synced_block_patch_6', true, {
|
|
213
|
+
exposure: true
|
|
214
|
+
})) {
|
|
213
215
|
var schema = rootNodeWithPos.node.type.schema;
|
|
214
216
|
var layoutSection = schema.nodes.layoutSection;
|
|
215
217
|
var isLayoutSectionChildOfRoot = findChildrenByType(rootNodeWithPos.node, layoutSection, false).length > 0;
|
|
@@ -38,7 +38,7 @@ export var quickInsertButtonDecoration = function quickInsertButtonDecoration(_r
|
|
|
38
38
|
* Other block marks must be added, otherwise PM will split the DOM elements causing mutations and re-draws
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
|
-
marks: getActiveBlockMarks(editorState, rootPos),
|
|
41
|
+
marks: expValEquals('platform_editor_clean_up_widget_mark_logic', 'isEnabled', true) ? [] : getActiveBlockMarks(editorState, rootPos),
|
|
42
42
|
destroy: function destroy(_) {
|
|
43
43
|
if (fg('platform_editor_fix_widget_destroy')) {
|
|
44
44
|
nodeViewPortalProviderAPI.remove(key);
|
|
@@ -2,6 +2,8 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
2
2
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
+
* Remove this when platform_editor_clean_up_widget_mark_logic is cleaned up.
|
|
6
|
+
*
|
|
5
7
|
* Returns list of block marks on schema that widgets are allowed to render inside
|
|
6
8
|
* Currently
|
|
7
9
|
* - indent
|
|
@@ -105,7 +105,9 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
105
105
|
_useActiveAnchorTrack2 = _slicedToArray(_useActiveAnchorTrack, 2),
|
|
106
106
|
_isActive = _useActiveAnchorTrack2[0],
|
|
107
107
|
setActiveAnchor = _useActiveAnchorTrack2[1];
|
|
108
|
-
var isInsideBodiedSyncBlock = parent && parent.type.name === 'bodiedSyncBlock' &&
|
|
108
|
+
var isInsideBodiedSyncBlock = parent && parent.type.name === 'bodiedSyncBlock' && editorExperiment('platform_synced_block', true) && editorExperiment('platform_synced_block_patch_6', true, {
|
|
109
|
+
exposure: true
|
|
110
|
+
});
|
|
109
111
|
useEffect(function () {
|
|
110
112
|
if (ref.current) {
|
|
111
113
|
return dropTargetForElements({
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
/**
|
|
4
|
+
* Remove this when platform_editor_clean_up_widget_mark_logic is cleaned up.
|
|
5
|
+
*
|
|
4
6
|
* Returns list of block marks on schema that widgets are allowed to render inside
|
|
5
7
|
* Currently
|
|
6
8
|
* - indent
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Mark } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
/**
|
|
4
|
+
* Remove this when platform_editor_clean_up_widget_mark_logic is cleaned up.
|
|
5
|
+
*
|
|
4
6
|
* Returns list of block marks on schema that widgets are allowed to render inside
|
|
5
7
|
* Currently
|
|
6
8
|
* - indent
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.15",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
57
57
|
"@atlaskit/primitives": "^18.0.0",
|
|
58
58
|
"@atlaskit/theme": "^22.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^43.0.0",
|
|
60
60
|
"@atlaskit/tokens": "^11.1.0",
|
|
61
61
|
"@atlaskit/tooltip": "^21.0.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"uuid": "^3.1.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@atlaskit/editor-common": "^112.
|
|
70
|
+
"@atlaskit/editor-common": "^112.7.0",
|
|
71
71
|
"react": "^18.2.0",
|
|
72
72
|
"react-dom": "^18.2.0",
|
|
73
73
|
"react-intl-next": "npm:react-intl@^5.18.1"
|