@atlaskit/editor-plugin-block-controls 3.19.0 → 3.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/cjs/blockControlsPlugin.js +4 -6
- package/dist/cjs/pm-plugins/decorations-drop-target-active.js +4 -1
- package/dist/cjs/pm-plugins/decorations-drop-target.js +16 -3
- package/dist/cjs/pm-plugins/first-node-dec-plugin.js +3 -3
- package/dist/cjs/pm-plugins/main.js +4 -6
- package/dist/es2019/blockControlsPlugin.js +4 -6
- package/dist/es2019/pm-plugins/decorations-drop-target-active.js +4 -1
- package/dist/es2019/pm-plugins/decorations-drop-target.js +16 -3
- package/dist/es2019/pm-plugins/first-node-dec-plugin.js +3 -3
- package/dist/es2019/pm-plugins/main.js +4 -6
- package/dist/esm/blockControlsPlugin.js +4 -6
- package/dist/esm/pm-plugins/decorations-drop-target-active.js +4 -1
- package/dist/esm/pm-plugins/decorations-drop-target.js +16 -3
- package/dist/esm/pm-plugins/first-node-dec-plugin.js +3 -3
- package/dist/esm/pm-plugins/main.js +4 -6
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.19.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#170734](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/170734)
|
|
8
|
+
[`85e062c13a08a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/85e062c13a08a) -
|
|
9
|
+
[ED-28213] Clean up platform_editor_user_intent_plugin and
|
|
10
|
+
platform_editor_user_intent_plugin_follow_up
|
|
11
|
+
|
|
12
|
+
## 3.19.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#171539](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/171539)
|
|
17
|
+
[`823e66121b671`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/823e66121b671) -
|
|
18
|
+
[ux] Fixes height of the resize handle when advanced layouts feature is enabled.
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
21
|
+
## 3.19.1
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [#171113](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/171113)
|
|
26
|
+
[`20200d3f20cfe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/20200d3f20cfe) -
|
|
27
|
+
Fix memory leak when cleaning up drop targets
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
|
|
3
30
|
## 3.19.0
|
|
4
31
|
|
|
5
32
|
### Minor Changes
|
|
@@ -91,6 +91,7 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
91
91
|
},
|
|
92
92
|
setNodeDragged: function setNodeDragged(getPos, anchorName, nodeType) {
|
|
93
93
|
return function (_ref5) {
|
|
94
|
+
var _api$userIntent;
|
|
94
95
|
var tr = _ref5.tr;
|
|
95
96
|
var pos = getPos();
|
|
96
97
|
if (pos === undefined) {
|
|
@@ -114,12 +115,9 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
114
115
|
tr: tr
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
tr: tr
|
|
121
|
-
});
|
|
122
|
-
}
|
|
118
|
+
api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('dragging')({
|
|
119
|
+
tr: tr
|
|
120
|
+
});
|
|
123
121
|
return tr;
|
|
124
122
|
};
|
|
125
123
|
},
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getActiveDropTargetDecorations = exports.canMoveNodeOrSliceToPos = void 0;
|
|
7
7
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
8
8
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
10
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
10
11
|
var _decorationsCommon = require("./decorations-common");
|
|
11
12
|
var _decorationsDropTarget = require("./decorations-drop-target");
|
|
@@ -59,7 +60,9 @@ var canMoveNodeOrSliceToPos = exports.canMoveNodeOrSliceToPos = function canMove
|
|
|
59
60
|
return true;
|
|
60
61
|
};
|
|
61
62
|
var getActiveDropTargetDecorations = exports.getActiveDropTargetDecorations = function getActiveDropTargetDecorations(activeDropTargetNode, state, api, formatMessage, nodeViewPortalProviderAPI, activeNode) {
|
|
62
|
-
(0,
|
|
63
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_block_controls_drop_target_mem_fix')) {
|
|
64
|
+
(0, _decorationsCommon.unmountDecorations)(nodeViewPortalProviderAPI, 'data-blocks-drop-target-container', 'data-blocks-drop-target-key');
|
|
65
|
+
}
|
|
63
66
|
var decs = [];
|
|
64
67
|
var activeNodePos = activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos;
|
|
65
68
|
var $activeNodePos = typeof activeNodePos === 'number' && state.doc.resolve(activeNodePos);
|
|
@@ -11,6 +11,7 @@ var _uuid = _interopRequireDefault(require("uuid"));
|
|
|
11
11
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
14
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
16
|
var _consts = require("../ui/consts");
|
|
16
17
|
var _dropTarget = require("../ui/drop-target");
|
|
@@ -112,7 +113,12 @@ var createDropTargetDecoration = exports.createDropTargetDecoration = function c
|
|
|
112
113
|
return element;
|
|
113
114
|
}, {
|
|
114
115
|
type: _decorationsCommon.TYPE_DROP_TARGET_DEC,
|
|
115
|
-
side: side
|
|
116
|
+
side: side,
|
|
117
|
+
destroy: function destroy() {
|
|
118
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_block_controls_drop_target_mem_fix')) {
|
|
119
|
+
nodeViewPortalProviderAPI.remove(key);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
116
122
|
});
|
|
117
123
|
};
|
|
118
124
|
var createLayoutDropTargetDecoration = exports.createLayoutDropTargetDecoration = function createLayoutDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, anchorRectCache) {
|
|
@@ -137,11 +143,18 @@ var createLayoutDropTargetDecoration = exports.createLayoutDropTargetDecoration
|
|
|
137
143
|
}, element, key);
|
|
138
144
|
return element;
|
|
139
145
|
}, {
|
|
140
|
-
type: _decorationsCommon.TYPE_DROP_TARGET_DEC
|
|
146
|
+
type: _decorationsCommon.TYPE_DROP_TARGET_DEC,
|
|
147
|
+
destroy: function destroy() {
|
|
148
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_block_controls_drop_target_mem_fix')) {
|
|
149
|
+
nodeViewPortalProviderAPI.remove(key);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
141
152
|
});
|
|
142
153
|
};
|
|
143
154
|
var dropTargetDecorations = exports.dropTargetDecorations = function dropTargetDecorations(newState, api, formatMessage, nodeViewPortalProviderAPI, activeNode, anchorRectCache, from, to) {
|
|
144
|
-
(0,
|
|
155
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_block_controls_drop_target_mem_fix')) {
|
|
156
|
+
(0, _decorationsCommon.unmountDecorations)(nodeViewPortalProviderAPI, 'data-blocks-drop-target-container', 'data-blocks-drop-target-key');
|
|
157
|
+
}
|
|
145
158
|
var decs = [];
|
|
146
159
|
var POS_END_OF_DOC = newState.doc.nodeSize - 2;
|
|
147
160
|
var docFrom = from === undefined || from < 0 ? 0 : from;
|
|
@@ -8,15 +8,15 @@ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
10
10
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
11
|
-
var
|
|
11
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
12
|
var firstNodeDecPluginKey = exports.firstNodeDecPluginKey = new _state.PluginKey('firstNodeDec');
|
|
13
13
|
var createFirstNodeDecSet = function createFirstNodeDecSet(state) {
|
|
14
14
|
var firstNode = state.doc.firstChild;
|
|
15
15
|
if (!firstNode) {
|
|
16
16
|
return _view.DecorationSet.empty;
|
|
17
17
|
}
|
|
18
|
-
var firstNodeDecoration = (0,
|
|
19
|
-
style: 'margin-top: 0',
|
|
18
|
+
var firstNodeDecoration = (0, _expValEquals.expValEquals)('platform_editor_breakout_resizing', 'isEnabled', true) ? _view.Decoration.node(0, firstNode.nodeSize, {
|
|
19
|
+
style: 'margin-top: 0;',
|
|
20
20
|
class: 'first-node-in-document'
|
|
21
21
|
}) : _view.Decoration.node(0, firstNode.nodeSize, {
|
|
22
22
|
style: 'margin-top: 0'
|
|
@@ -108,6 +108,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
110
|
(_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref3) {
|
|
111
|
+
var _api$userIntent;
|
|
111
112
|
var tr = _ref3.tr;
|
|
112
113
|
var isMultiSelect = (0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true);
|
|
113
114
|
if (isMultiSelect) {
|
|
@@ -168,12 +169,9 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
168
169
|
tr: tr
|
|
169
170
|
});
|
|
170
171
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
tr: tr
|
|
175
|
-
});
|
|
176
|
-
}
|
|
172
|
+
(_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('default')({
|
|
173
|
+
tr: tr
|
|
174
|
+
});
|
|
177
175
|
return tr.setMeta(key, _objectSpread(_objectSpread({}, tr.getMeta(key)), {}, {
|
|
178
176
|
isDragging: false,
|
|
179
177
|
isPMDragging: false,
|
|
@@ -82,6 +82,7 @@ export const blockControlsPlugin = ({
|
|
|
82
82
|
setNodeDragged: (getPos, anchorName, nodeType) => ({
|
|
83
83
|
tr
|
|
84
84
|
}) => {
|
|
85
|
+
var _api$userIntent;
|
|
85
86
|
const pos = getPos();
|
|
86
87
|
if (pos === undefined) {
|
|
87
88
|
return tr;
|
|
@@ -105,12 +106,9 @@ export const blockControlsPlugin = ({
|
|
|
105
106
|
tr
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
tr
|
|
112
|
-
});
|
|
113
|
-
}
|
|
109
|
+
api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging')({
|
|
110
|
+
tr
|
|
111
|
+
});
|
|
114
112
|
return tr;
|
|
115
113
|
},
|
|
116
114
|
setMultiSelectPositions: (anchor, head) => ({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
2
2
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
5
|
import { getNodeAnchor, unmountDecorations } from './decorations-common';
|
|
5
6
|
import { createDropTargetDecoration, createLayoutDropTargetDecoration } from './decorations-drop-target';
|
|
@@ -55,7 +56,9 @@ export const canMoveNodeOrSliceToPos = (state, node, parent, index, $toPos, acti
|
|
|
55
56
|
return true;
|
|
56
57
|
};
|
|
57
58
|
export const getActiveDropTargetDecorations = (activeDropTargetNode, state, api, formatMessage, nodeViewPortalProviderAPI, activeNode) => {
|
|
58
|
-
|
|
59
|
+
if (!fg('platform_editor_block_controls_drop_target_mem_fix')) {
|
|
60
|
+
unmountDecorations(nodeViewPortalProviderAPI, 'data-blocks-drop-target-container', 'data-blocks-drop-target-key');
|
|
61
|
+
}
|
|
59
62
|
const decs = [];
|
|
60
63
|
const activeNodePos = activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos;
|
|
61
64
|
const $activeNodePos = typeof activeNodePos === 'number' && state.doc.resolve(activeNodePos);
|
|
@@ -3,6 +3,7 @@ import uuid from 'uuid';
|
|
|
3
3
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
4
4
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
5
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
8
|
import { nodeMargins } from '../ui/consts';
|
|
8
9
|
import { DropTarget, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET } from '../ui/drop-target';
|
|
@@ -100,7 +101,12 @@ export const createDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI
|
|
|
100
101
|
return element;
|
|
101
102
|
}, {
|
|
102
103
|
type: TYPE_DROP_TARGET_DEC,
|
|
103
|
-
side
|
|
104
|
+
side,
|
|
105
|
+
destroy: () => {
|
|
106
|
+
if (fg('platform_editor_block_controls_drop_target_mem_fix')) {
|
|
107
|
+
nodeViewPortalProviderAPI.remove(key);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
104
110
|
});
|
|
105
111
|
};
|
|
106
112
|
export const createLayoutDropTargetDecoration = (pos, props, nodeViewPortalProviderAPI, anchorRectCache) => {
|
|
@@ -124,11 +130,18 @@ export const createLayoutDropTargetDecoration = (pos, props, nodeViewPortalProvi
|
|
|
124
130
|
}), element, key);
|
|
125
131
|
return element;
|
|
126
132
|
}, {
|
|
127
|
-
type: TYPE_DROP_TARGET_DEC
|
|
133
|
+
type: TYPE_DROP_TARGET_DEC,
|
|
134
|
+
destroy: () => {
|
|
135
|
+
if (fg('platform_editor_block_controls_drop_target_mem_fix')) {
|
|
136
|
+
nodeViewPortalProviderAPI.remove(key);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
128
139
|
});
|
|
129
140
|
};
|
|
130
141
|
export const dropTargetDecorations = (newState, api, formatMessage, nodeViewPortalProviderAPI, activeNode, anchorRectCache, from, to) => {
|
|
131
|
-
|
|
142
|
+
if (!fg('platform_editor_block_controls_drop_target_mem_fix')) {
|
|
143
|
+
unmountDecorations(nodeViewPortalProviderAPI, 'data-blocks-drop-target-container', 'data-blocks-drop-target-key');
|
|
144
|
+
}
|
|
132
145
|
const decs = [];
|
|
133
146
|
const POS_END_OF_DOC = newState.doc.nodeSize - 2;
|
|
134
147
|
const docFrom = from === undefined || from < 0 ? 0 : from;
|
|
@@ -2,15 +2,15 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import {
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
6
|
export const firstNodeDecPluginKey = new PluginKey('firstNodeDec');
|
|
7
7
|
const createFirstNodeDecSet = state => {
|
|
8
8
|
const firstNode = state.doc.firstChild;
|
|
9
9
|
if (!firstNode) {
|
|
10
10
|
return DecorationSet.empty;
|
|
11
11
|
}
|
|
12
|
-
const firstNodeDecoration =
|
|
13
|
-
style: 'margin-top: 0',
|
|
12
|
+
const firstNodeDecoration = expValEquals('platform_editor_breakout_resizing', 'isEnabled', true) ? Decoration.node(0, firstNode.nodeSize, {
|
|
13
|
+
style: 'margin-top: 0;',
|
|
14
14
|
class: 'first-node-in-document'
|
|
15
15
|
}) : Decoration.node(0, firstNode.nodeSize, {
|
|
16
16
|
style: 'margin-top: 0'
|
|
@@ -103,6 +103,7 @@ const destroyFn = (api, editorView) => {
|
|
|
103
103
|
(_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(({
|
|
104
104
|
tr
|
|
105
105
|
}) => {
|
|
106
|
+
var _api$userIntent;
|
|
106
107
|
const isMultiSelect = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true);
|
|
107
108
|
if (isMultiSelect) {
|
|
108
109
|
var _api$blockControls, _api$selection;
|
|
@@ -165,12 +166,9 @@ const destroyFn = (api, editorView) => {
|
|
|
165
166
|
tr
|
|
166
167
|
});
|
|
167
168
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
tr
|
|
172
|
-
});
|
|
173
|
-
}
|
|
169
|
+
(_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('default')({
|
|
170
|
+
tr
|
|
171
|
+
});
|
|
174
172
|
return tr.setMeta(key, {
|
|
175
173
|
...tr.getMeta(key),
|
|
176
174
|
isDragging: false,
|
|
@@ -84,6 +84,7 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
84
84
|
},
|
|
85
85
|
setNodeDragged: function setNodeDragged(getPos, anchorName, nodeType) {
|
|
86
86
|
return function (_ref5) {
|
|
87
|
+
var _api$userIntent;
|
|
87
88
|
var tr = _ref5.tr;
|
|
88
89
|
var pos = getPos();
|
|
89
90
|
if (pos === undefined) {
|
|
@@ -107,12 +108,9 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
107
108
|
tr: tr
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
tr: tr
|
|
114
|
-
});
|
|
115
|
-
}
|
|
111
|
+
api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('dragging')({
|
|
112
|
+
tr: tr
|
|
113
|
+
});
|
|
116
114
|
return tr;
|
|
117
115
|
};
|
|
118
116
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
2
2
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
5
|
import { getNodeAnchor, unmountDecorations } from './decorations-common';
|
|
5
6
|
import { createDropTargetDecoration, createLayoutDropTargetDecoration } from './decorations-drop-target';
|
|
@@ -54,7 +55,9 @@ export var canMoveNodeOrSliceToPos = function canMoveNodeOrSliceToPos(state, nod
|
|
|
54
55
|
return true;
|
|
55
56
|
};
|
|
56
57
|
export var getActiveDropTargetDecorations = function getActiveDropTargetDecorations(activeDropTargetNode, state, api, formatMessage, nodeViewPortalProviderAPI, activeNode) {
|
|
57
|
-
|
|
58
|
+
if (!fg('platform_editor_block_controls_drop_target_mem_fix')) {
|
|
59
|
+
unmountDecorations(nodeViewPortalProviderAPI, 'data-blocks-drop-target-container', 'data-blocks-drop-target-key');
|
|
60
|
+
}
|
|
58
61
|
var decs = [];
|
|
59
62
|
var activeNodePos = activeNode === null || activeNode === void 0 ? void 0 : activeNode.pos;
|
|
60
63
|
var $activeNodePos = typeof activeNodePos === 'number' && state.doc.resolve(activeNodePos);
|
|
@@ -6,6 +6,7 @@ import uuid from 'uuid';
|
|
|
6
6
|
import { expandSelectionBounds } from '@atlaskit/editor-common/selection';
|
|
7
7
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { nodeMargins } from '../ui/consts';
|
|
11
12
|
import { DropTarget, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET } from '../ui/drop-target';
|
|
@@ -105,7 +106,12 @@ export var createDropTargetDecoration = function createDropTargetDecoration(pos,
|
|
|
105
106
|
return element;
|
|
106
107
|
}, {
|
|
107
108
|
type: TYPE_DROP_TARGET_DEC,
|
|
108
|
-
side: side
|
|
109
|
+
side: side,
|
|
110
|
+
destroy: function destroy() {
|
|
111
|
+
if (fg('platform_editor_block_controls_drop_target_mem_fix')) {
|
|
112
|
+
nodeViewPortalProviderAPI.remove(key);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
109
115
|
});
|
|
110
116
|
};
|
|
111
117
|
export var createLayoutDropTargetDecoration = function createLayoutDropTargetDecoration(pos, props, nodeViewPortalProviderAPI, anchorRectCache) {
|
|
@@ -130,11 +136,18 @@ export var createLayoutDropTargetDecoration = function createLayoutDropTargetDec
|
|
|
130
136
|
}, element, key);
|
|
131
137
|
return element;
|
|
132
138
|
}, {
|
|
133
|
-
type: TYPE_DROP_TARGET_DEC
|
|
139
|
+
type: TYPE_DROP_TARGET_DEC,
|
|
140
|
+
destroy: function destroy() {
|
|
141
|
+
if (fg('platform_editor_block_controls_drop_target_mem_fix')) {
|
|
142
|
+
nodeViewPortalProviderAPI.remove(key);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
134
145
|
});
|
|
135
146
|
};
|
|
136
147
|
export var dropTargetDecorations = function dropTargetDecorations(newState, api, formatMessage, nodeViewPortalProviderAPI, activeNode, anchorRectCache, from, to) {
|
|
137
|
-
|
|
148
|
+
if (!fg('platform_editor_block_controls_drop_target_mem_fix')) {
|
|
149
|
+
unmountDecorations(nodeViewPortalProviderAPI, 'data-blocks-drop-target-container', 'data-blocks-drop-target-key');
|
|
150
|
+
}
|
|
138
151
|
var decs = [];
|
|
139
152
|
var POS_END_OF_DOC = newState.doc.nodeSize - 2;
|
|
140
153
|
var docFrom = from === undefined || from < 0 ? 0 : from;
|
|
@@ -2,15 +2,15 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { ReplaceAroundStep, ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
4
4
|
import { DecorationSet, Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import {
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
6
|
export var firstNodeDecPluginKey = new PluginKey('firstNodeDec');
|
|
7
7
|
var createFirstNodeDecSet = function createFirstNodeDecSet(state) {
|
|
8
8
|
var firstNode = state.doc.firstChild;
|
|
9
9
|
if (!firstNode) {
|
|
10
10
|
return DecorationSet.empty;
|
|
11
11
|
}
|
|
12
|
-
var firstNodeDecoration =
|
|
13
|
-
style: 'margin-top: 0',
|
|
12
|
+
var firstNodeDecoration = expValEquals('platform_editor_breakout_resizing', 'isEnabled', true) ? Decoration.node(0, firstNode.nodeSize, {
|
|
13
|
+
style: 'margin-top: 0;',
|
|
14
14
|
class: 'first-node-in-document'
|
|
15
15
|
}) : Decoration.node(0, firstNode.nodeSize, {
|
|
16
16
|
style: 'margin-top: 0'
|
|
@@ -101,6 +101,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
(_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref3) {
|
|
104
|
+
var _api$userIntent;
|
|
104
105
|
var tr = _ref3.tr;
|
|
105
106
|
var isMultiSelect = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true);
|
|
106
107
|
if (isMultiSelect) {
|
|
@@ -161,12 +162,9 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
161
162
|
tr: tr
|
|
162
163
|
});
|
|
163
164
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
tr: tr
|
|
168
|
-
});
|
|
169
|
-
}
|
|
165
|
+
(_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('default')({
|
|
166
|
+
tr: tr
|
|
167
|
+
});
|
|
170
168
|
return tr.setMeta(key, _objectSpread(_objectSpread({}, tr.getMeta(key)), {}, {
|
|
171
169
|
isDragging: false,
|
|
172
170
|
isPMDragging: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "3.19.
|
|
3
|
+
"version": "3.19.3",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^106.
|
|
36
|
+
"@atlaskit/editor-common": "^106.9.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
39
|
-
"@atlaskit/editor-plugin-editor-disabled": "^2.
|
|
39
|
+
"@atlaskit/editor-plugin-editor-disabled": "^2.1.0",
|
|
40
40
|
"@atlaskit/editor-plugin-feature-flags": "^1.4.0",
|
|
41
41
|
"@atlaskit/editor-plugin-interaction": "^2.0.0",
|
|
42
42
|
"@atlaskit/editor-plugin-metrics": "^3.5.0",
|
|
43
|
-
"@atlaskit/editor-plugin-quick-insert": "^2.
|
|
43
|
+
"@atlaskit/editor-plugin-quick-insert": "^2.6.0",
|
|
44
44
|
"@atlaskit/editor-plugin-selection": "^2.2.0",
|
|
45
45
|
"@atlaskit/editor-plugin-type-ahead": "^2.7.0",
|
|
46
46
|
"@atlaskit/editor-plugin-user-intent": "^0.1.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
49
49
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
50
50
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
51
|
-
"@atlaskit/icon": "^
|
|
51
|
+
"@atlaskit/icon": "^27.0.0",
|
|
52
52
|
"@atlaskit/link": "^3.2.0",
|
|
53
53
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
54
54
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
57
57
|
"@atlaskit/primitives": "^14.8.0",
|
|
58
58
|
"@atlaskit/theme": "^18.0.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^7.
|
|
60
|
-
"@atlaskit/tokens": "^5.
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^7.1.0",
|
|
60
|
+
"@atlaskit/tokens": "^5.2.0",
|
|
61
61
|
"@atlaskit/tooltip": "^20.3.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|
|
63
63
|
"@emotion/react": "^11.7.1",
|
|
@@ -174,9 +174,6 @@
|
|
|
174
174
|
"platform_editor_controls_patch_7": {
|
|
175
175
|
"type": "boolean"
|
|
176
176
|
},
|
|
177
|
-
"platform_editor_user_intent_plugin": {
|
|
178
|
-
"type": "boolean"
|
|
179
|
-
},
|
|
180
177
|
"platform_editor_no_cursor_on_live_doc_init": {
|
|
181
178
|
"type": "boolean"
|
|
182
179
|
},
|
|
@@ -206,6 +203,9 @@
|
|
|
206
203
|
},
|
|
207
204
|
"platform_editor_breakout_resizing_hello_release": {
|
|
208
205
|
"type": "boolean"
|
|
206
|
+
},
|
|
207
|
+
"platform_editor_block_controls_drop_target_mem_fix": {
|
|
208
|
+
"type": "boolean"
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
}
|