@atlaskit/editor-plugin-block-controls 3.19.0 → 3.19.1
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 +9 -0
- 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/es2019/pm-plugins/decorations-drop-target-active.js +4 -1
- package/dist/es2019/pm-plugins/decorations-drop-target.js +16 -3
- package/dist/esm/pm-plugins/decorations-drop-target-active.js +4 -1
- package/dist/esm/pm-plugins/decorations-drop-target.js +16 -3
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.19.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#171113](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/171113)
|
|
8
|
+
[`20200d3f20cfe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/20200d3f20cfe) -
|
|
9
|
+
Fix memory leak when cleaning up drop targets
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 3.19.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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;
|
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.1",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^106.
|
|
36
|
+
"@atlaskit/editor-common": "^106.7.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@atlaskit/primitives": "^14.8.0",
|
|
58
58
|
"@atlaskit/theme": "^18.0.0",
|
|
59
59
|
"@atlaskit/tmp-editor-statsig": "^7.0.0",
|
|
60
|
-
"@atlaskit/tokens": "^5.
|
|
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",
|
|
@@ -206,6 +206,9 @@
|
|
|
206
206
|
},
|
|
207
207
|
"platform_editor_breakout_resizing_hello_release": {
|
|
208
208
|
"type": "boolean"
|
|
209
|
+
},
|
|
210
|
+
"platform_editor_block_controls_drop_target_mem_fix": {
|
|
211
|
+
"type": "boolean"
|
|
209
212
|
}
|
|
210
213
|
}
|
|
211
214
|
}
|