@atlaskit/editor-plugin-block-controls 3.3.0 → 3.3.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 +8 -0
- package/dist/cjs/pm-plugins/main.js +10 -11
- package/dist/es2019/pm-plugins/main.js +10 -11
- package/dist/esm/pm-plugins/main.js +10 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#122490](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/122490)
|
|
8
|
+
[`6ec36bc622c47`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6ec36bc622c47) -
|
|
9
|
+
Check for undefined on root pos before inserting
|
|
10
|
+
|
|
3
11
|
## 3.3.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
|
@@ -319,24 +319,23 @@ var newApply = exports.newApply = function newApply(api, formatMessage, tr, curr
|
|
|
319
319
|
var oldHandle = (0, _decorationsDragHandle.findHandleDec)(decorations, (_activeNode3 = activeNode) === null || _activeNode3 === void 0 ? void 0 : _activeNode3.pos, (_activeNode4 = activeNode) === null || _activeNode4 === void 0 ? void 0 : _activeNode4.pos);
|
|
320
320
|
decorations = decorations.remove(oldHandle);
|
|
321
321
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
322
|
-
var
|
|
323
|
-
var oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.rootPos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.rootPos);
|
|
322
|
+
var oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations);
|
|
324
323
|
decorations = decorations.remove(oldQuickInsertButton);
|
|
325
324
|
}
|
|
326
325
|
} else if (api && shouldRecreateHandle) {
|
|
327
|
-
var
|
|
328
|
-
var _oldHandle = (0, _decorationsDragHandle.findHandleDec)(decorations, (
|
|
326
|
+
var _activeNode5, _activeNode6;
|
|
327
|
+
var _oldHandle = (0, _decorationsDragHandle.findHandleDec)(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
|
|
329
328
|
decorations = decorations.remove(_oldHandle);
|
|
330
329
|
var handleDec = (0, _decorationsDragHandle.dragHandleDecoration)(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.handleOptions);
|
|
331
330
|
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
decorations = decorations.add(newState.doc, [handleDec]);
|
|
331
|
+
if ((latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos) !== undefined) {
|
|
332
|
+
var _oldQuickInsertButton = (0, _decorationsQuickInsertButton.findQuickInsertInsertButtonDecoration)(decorations);
|
|
333
|
+
decorations = decorations.remove(_oldQuickInsertButton);
|
|
334
|
+
var quickInsertButton = (0, _decorationsQuickInsertButton.quickInsertButtonDecoration)(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootAnchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootNodeType);
|
|
335
|
+
decorations = decorations.add(newState.doc, [quickInsertButton]);
|
|
336
|
+
}
|
|
339
337
|
}
|
|
338
|
+
decorations = decorations.add(newState.doc, [handleDec]);
|
|
340
339
|
}
|
|
341
340
|
|
|
342
341
|
// Drop targets may be missing when the node count is being changed during a drag
|
|
@@ -316,24 +316,23 @@ export const newApply = (api, formatMessage, tr, currentState, newState, flags,
|
|
|
316
316
|
const oldHandle = findHandleDec(decorations, (_activeNode3 = activeNode) === null || _activeNode3 === void 0 ? void 0 : _activeNode3.pos, (_activeNode4 = activeNode) === null || _activeNode4 === void 0 ? void 0 : _activeNode4.pos);
|
|
317
317
|
decorations = decorations.remove(oldHandle);
|
|
318
318
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
319
|
-
|
|
320
|
-
const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.rootPos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.rootPos);
|
|
319
|
+
const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations);
|
|
321
320
|
decorations = decorations.remove(oldQuickInsertButton);
|
|
322
321
|
}
|
|
323
322
|
} else if (api && shouldRecreateHandle) {
|
|
324
|
-
var
|
|
325
|
-
const oldHandle = findHandleDec(decorations, (
|
|
323
|
+
var _activeNode5, _activeNode6;
|
|
324
|
+
const oldHandle = findHandleDec(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
|
|
326
325
|
decorations = decorations.remove(oldHandle);
|
|
327
326
|
const handleDec = dragHandleDecoration(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.handleOptions);
|
|
328
327
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
decorations = decorations.add(newState.doc, [handleDec]);
|
|
328
|
+
if ((latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos) !== undefined) {
|
|
329
|
+
const oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations);
|
|
330
|
+
decorations = decorations.remove(oldQuickInsertButton);
|
|
331
|
+
const quickInsertButton = quickInsertButtonDecoration(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootAnchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootNodeType);
|
|
332
|
+
decorations = decorations.add(newState.doc, [quickInsertButton]);
|
|
333
|
+
}
|
|
336
334
|
}
|
|
335
|
+
decorations = decorations.add(newState.doc, [handleDec]);
|
|
337
336
|
}
|
|
338
337
|
|
|
339
338
|
// Drop targets may be missing when the node count is being changed during a drag
|
|
@@ -312,24 +312,23 @@ export var newApply = function newApply(api, formatMessage, tr, currentState, ne
|
|
|
312
312
|
var oldHandle = findHandleDec(decorations, (_activeNode3 = activeNode) === null || _activeNode3 === void 0 ? void 0 : _activeNode3.pos, (_activeNode4 = activeNode) === null || _activeNode4 === void 0 ? void 0 : _activeNode4.pos);
|
|
313
313
|
decorations = decorations.remove(oldHandle);
|
|
314
314
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
315
|
-
var
|
|
316
|
-
var oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.rootPos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.rootPos);
|
|
315
|
+
var oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations);
|
|
317
316
|
decorations = decorations.remove(oldQuickInsertButton);
|
|
318
317
|
}
|
|
319
318
|
} else if (api && shouldRecreateHandle) {
|
|
320
|
-
var
|
|
321
|
-
var _oldHandle = findHandleDec(decorations, (
|
|
319
|
+
var _activeNode5, _activeNode6;
|
|
320
|
+
var _oldHandle = findHandleDec(decorations, (_activeNode5 = activeNode) === null || _activeNode5 === void 0 ? void 0 : _activeNode5.pos, (_activeNode6 = activeNode) === null || _activeNode6 === void 0 ? void 0 : _activeNode6.pos);
|
|
322
321
|
decorations = decorations.remove(_oldHandle);
|
|
323
322
|
var handleDec = dragHandleDecoration(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.pos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.handleOptions);
|
|
324
323
|
if (editorExperiment('platform_editor_controls', 'variant1')) {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
decorations = decorations.add(newState.doc, [handleDec]);
|
|
324
|
+
if ((latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos) !== undefined) {
|
|
325
|
+
var _oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations);
|
|
326
|
+
decorations = decorations.remove(_oldQuickInsertButton);
|
|
327
|
+
var quickInsertButton = quickInsertButtonDecoration(api, formatMessage, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootPos, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.anchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.nodeType, nodeViewPortalProviderAPI, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootAnchorName, latestActiveNode === null || latestActiveNode === void 0 ? void 0 : latestActiveNode.rootNodeType);
|
|
328
|
+
decorations = decorations.add(newState.doc, [quickInsertButton]);
|
|
329
|
+
}
|
|
332
330
|
}
|
|
331
|
+
decorations = decorations.add(newState.doc, [handleDec]);
|
|
333
332
|
}
|
|
334
333
|
|
|
335
334
|
// Drop targets may be missing when the node count is being changed during a drag
|