@atlaskit/editor-plugin-block-controls 18.2.0 → 18.2.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 +20 -0
- package/dist/cjs/ui/drag-handle.js +3 -14
- package/dist/cjs/ui/should-use-nested-drag-handle-icon.js +1 -5
- package/dist/es2019/ui/drag-handle.js +3 -13
- package/dist/es2019/ui/should-use-nested-drag-handle-icon.js +1 -5
- package/dist/esm/ui/drag-handle.js +3 -14
- package/dist/esm/ui/should-use-nested-drag-handle-icon.js +1 -5
- package/dist/types/ui/drag-handle.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 18.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 18.2.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 18.2.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`0cec43eb08826`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0cec43eb08826) -
|
|
20
|
+
Clean up experiment platform_editor_nested_drag_handle_icon
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 18.2.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -368,8 +368,6 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
368
368
|
anchorName = _ref2.anchorName,
|
|
369
369
|
nodeType = _ref2.nodeType,
|
|
370
370
|
handleOptions = _ref2.handleOptions,
|
|
371
|
-
_ref2$isTopLevelNode = _ref2.isTopLevelNode,
|
|
372
|
-
isTopLevelNode = _ref2$isTopLevelNode === void 0 ? true : _ref2$isTopLevelNode,
|
|
373
371
|
anchorRectCache = _ref2.anchorRectCache;
|
|
374
372
|
var buttonRef = (0, _react.useRef)(null);
|
|
375
373
|
var mouseDownRef = (0, _react.useRef)(false);
|
|
@@ -417,23 +415,15 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref2) {
|
|
|
417
415
|
var start = getPos();
|
|
418
416
|
var isLayoutColumn = nodeType === 'layoutColumn';
|
|
419
417
|
|
|
420
|
-
// Dynamically calculate if node is top-level based on current position
|
|
421
|
-
var
|
|
422
|
-
if (!(0, _expValEquals.expValEquals)('platform_editor_nested_drag_handle_icon', 'isEnabled', true)) {
|
|
423
|
-
return isTopLevelNode;
|
|
424
|
-
}
|
|
418
|
+
// Dynamically calculate if node is top-level based on current position
|
|
419
|
+
var isTopLevelNodeValue = (0, _react.useMemo)(function () {
|
|
425
420
|
var pos = getPos();
|
|
426
421
|
if (typeof pos === 'number') {
|
|
427
422
|
var $pos = view.state.doc.resolve(pos);
|
|
428
423
|
return ($pos === null || $pos === void 0 ? void 0 : $pos.parent.type.name) === 'doc';
|
|
429
424
|
}
|
|
430
425
|
return true;
|
|
431
|
-
}, [getPos, view.state.doc
|
|
432
|
-
|
|
433
|
-
// Use the dynamic value when experiment is on, otherwise use the prop
|
|
434
|
-
// When cleaning up the experiment, you can safely remove the isTopLevelNode as an prop and
|
|
435
|
-
// just rely on the dynamic value (rename it to isTopLevelNode for simplicitiy)
|
|
436
|
-
var isTopLevelNodeValue = (0, _expValEquals.expValEquals)('platform_editor_nested_drag_handle_icon', 'isEnabled', true) ? isTopLevelNodeDynamic : isTopLevelNode;
|
|
426
|
+
}, [getPos, view.state.doc]);
|
|
437
427
|
(0, _react.useEffect)(function () {
|
|
438
428
|
// blockCard/datasource width is rendered correctly after this decoraton does. We need to observe for changes.
|
|
439
429
|
if (nodeType === 'blockCard') {
|
|
@@ -1299,7 +1289,6 @@ var DragHandleWithVisibility = exports.DragHandleWithVisibility = function DragH
|
|
|
1299
1289
|
anchorName: anchorName,
|
|
1300
1290
|
nodeType: nodeType,
|
|
1301
1291
|
handleOptions: handleOptions,
|
|
1302
|
-
isTopLevelNode: isTopLevelNode,
|
|
1303
1292
|
anchorRectCache: anchorRectCache
|
|
1304
1293
|
}));
|
|
1305
1294
|
};
|
|
@@ -5,15 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.shouldUseNestedDragHandleIcon = void 0;
|
|
7
7
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
8
|
-
|
|
9
|
-
// Nested icon for non-top-level nodes when the experiment is on. Exception: with the
|
|
8
|
+
// Nested icon for non-top-level nodes. Exception: with the
|
|
10
9
|
// kill switch OFF, layout columns use the full block handle instead.
|
|
11
10
|
// TODO: EDITOR-7732 - remove this whole function when
|
|
12
11
|
// `platform_editor_layout_column_menu_kill_switch_1` is cleaned up
|
|
13
12
|
var shouldUseNestedDragHandleIcon = exports.shouldUseNestedDragHandleIcon = function shouldUseNestedDragHandleIcon(isTopLevelNode, isLayoutColumn) {
|
|
14
|
-
if (!(0, _expValEquals.expValEquals)('platform_editor_nested_drag_handle_icon', 'isEnabled', true)) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
13
|
if (isTopLevelNode) {
|
|
18
14
|
return false;
|
|
19
15
|
}
|
|
@@ -360,7 +360,6 @@ export const DragHandle = ({
|
|
|
360
360
|
anchorName,
|
|
361
361
|
nodeType,
|
|
362
362
|
handleOptions,
|
|
363
|
-
isTopLevelNode = true,
|
|
364
363
|
anchorRectCache
|
|
365
364
|
}) => {
|
|
366
365
|
var _api$core4, _api$blockControls8;
|
|
@@ -396,23 +395,15 @@ export const DragHandle = ({
|
|
|
396
395
|
const start = getPos();
|
|
397
396
|
const isLayoutColumn = nodeType === 'layoutColumn';
|
|
398
397
|
|
|
399
|
-
// Dynamically calculate if node is top-level based on current position
|
|
400
|
-
const
|
|
401
|
-
if (!expValEquals('platform_editor_nested_drag_handle_icon', 'isEnabled', true)) {
|
|
402
|
-
return isTopLevelNode;
|
|
403
|
-
}
|
|
398
|
+
// Dynamically calculate if node is top-level based on current position
|
|
399
|
+
const isTopLevelNodeValue = useMemo(() => {
|
|
404
400
|
const pos = getPos();
|
|
405
401
|
if (typeof pos === 'number') {
|
|
406
402
|
const $pos = view.state.doc.resolve(pos);
|
|
407
403
|
return ($pos === null || $pos === void 0 ? void 0 : $pos.parent.type.name) === 'doc';
|
|
408
404
|
}
|
|
409
405
|
return true;
|
|
410
|
-
}, [getPos, view.state.doc
|
|
411
|
-
|
|
412
|
-
// Use the dynamic value when experiment is on, otherwise use the prop
|
|
413
|
-
// When cleaning up the experiment, you can safely remove the isTopLevelNode as an prop and
|
|
414
|
-
// just rely on the dynamic value (rename it to isTopLevelNode for simplicitiy)
|
|
415
|
-
const isTopLevelNodeValue = expValEquals('platform_editor_nested_drag_handle_icon', 'isEnabled', true) ? isTopLevelNodeDynamic : isTopLevelNode;
|
|
406
|
+
}, [getPos, view.state.doc]);
|
|
416
407
|
useEffect(() => {
|
|
417
408
|
// blockCard/datasource width is rendered correctly after this decoraton does. We need to observe for changes.
|
|
418
409
|
if (nodeType === 'blockCard') {
|
|
@@ -1273,7 +1264,6 @@ export const DragHandleWithVisibility = ({
|
|
|
1273
1264
|
anchorName: anchorName,
|
|
1274
1265
|
nodeType: nodeType,
|
|
1275
1266
|
handleOptions: handleOptions,
|
|
1276
|
-
isTopLevelNode: isTopLevelNode,
|
|
1277
1267
|
anchorRectCache: anchorRectCache
|
|
1278
1268
|
}));
|
|
1279
1269
|
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
2
|
|
|
4
|
-
// Nested icon for non-top-level nodes
|
|
3
|
+
// Nested icon for non-top-level nodes. Exception: with the
|
|
5
4
|
// kill switch OFF, layout columns use the full block handle instead.
|
|
6
5
|
// TODO: EDITOR-7732 - remove this whole function when
|
|
7
6
|
// `platform_editor_layout_column_menu_kill_switch_1` is cleaned up
|
|
8
7
|
export const shouldUseNestedDragHandleIcon = (isTopLevelNode, isLayoutColumn) => {
|
|
9
|
-
if (!expValEquals('platform_editor_nested_drag_handle_icon', 'isEnabled', true)) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
8
|
if (isTopLevelNode) {
|
|
13
9
|
return false;
|
|
14
10
|
}
|
|
@@ -364,8 +364,6 @@ export var DragHandle = function DragHandle(_ref2) {
|
|
|
364
364
|
anchorName = _ref2.anchorName,
|
|
365
365
|
nodeType = _ref2.nodeType,
|
|
366
366
|
handleOptions = _ref2.handleOptions,
|
|
367
|
-
_ref2$isTopLevelNode = _ref2.isTopLevelNode,
|
|
368
|
-
isTopLevelNode = _ref2$isTopLevelNode === void 0 ? true : _ref2$isTopLevelNode,
|
|
369
367
|
anchorRectCache = _ref2.anchorRectCache;
|
|
370
368
|
var buttonRef = useRef(null);
|
|
371
369
|
var mouseDownRef = useRef(false);
|
|
@@ -413,23 +411,15 @@ export var DragHandle = function DragHandle(_ref2) {
|
|
|
413
411
|
var start = getPos();
|
|
414
412
|
var isLayoutColumn = nodeType === 'layoutColumn';
|
|
415
413
|
|
|
416
|
-
// Dynamically calculate if node is top-level based on current position
|
|
417
|
-
var
|
|
418
|
-
if (!expValEquals('platform_editor_nested_drag_handle_icon', 'isEnabled', true)) {
|
|
419
|
-
return isTopLevelNode;
|
|
420
|
-
}
|
|
414
|
+
// Dynamically calculate if node is top-level based on current position
|
|
415
|
+
var isTopLevelNodeValue = useMemo(function () {
|
|
421
416
|
var pos = getPos();
|
|
422
417
|
if (typeof pos === 'number') {
|
|
423
418
|
var $pos = view.state.doc.resolve(pos);
|
|
424
419
|
return ($pos === null || $pos === void 0 ? void 0 : $pos.parent.type.name) === 'doc';
|
|
425
420
|
}
|
|
426
421
|
return true;
|
|
427
|
-
}, [getPos, view.state.doc
|
|
428
|
-
|
|
429
|
-
// Use the dynamic value when experiment is on, otherwise use the prop
|
|
430
|
-
// When cleaning up the experiment, you can safely remove the isTopLevelNode as an prop and
|
|
431
|
-
// just rely on the dynamic value (rename it to isTopLevelNode for simplicitiy)
|
|
432
|
-
var isTopLevelNodeValue = expValEquals('platform_editor_nested_drag_handle_icon', 'isEnabled', true) ? isTopLevelNodeDynamic : isTopLevelNode;
|
|
422
|
+
}, [getPos, view.state.doc]);
|
|
433
423
|
useEffect(function () {
|
|
434
424
|
// blockCard/datasource width is rendered correctly after this decoraton does. We need to observe for changes.
|
|
435
425
|
if (nodeType === 'blockCard') {
|
|
@@ -1295,7 +1285,6 @@ export var DragHandleWithVisibility = function DragHandleWithVisibility(_ref10)
|
|
|
1295
1285
|
anchorName: anchorName,
|
|
1296
1286
|
nodeType: nodeType,
|
|
1297
1287
|
handleOptions: handleOptions,
|
|
1298
|
-
isTopLevelNode: isTopLevelNode,
|
|
1299
1288
|
anchorRectCache: anchorRectCache
|
|
1300
1289
|
}));
|
|
1301
1290
|
};
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
2
|
|
|
4
|
-
// Nested icon for non-top-level nodes
|
|
3
|
+
// Nested icon for non-top-level nodes. Exception: with the
|
|
5
4
|
// kill switch OFF, layout columns use the full block handle instead.
|
|
6
5
|
// TODO: EDITOR-7732 - remove this whole function when
|
|
7
6
|
// `platform_editor_layout_column_menu_kill_switch_1` is cleaned up
|
|
8
7
|
export var shouldUseNestedDragHandleIcon = function shouldUseNestedDragHandleIcon(isTopLevelNode, isLayoutColumn) {
|
|
9
|
-
if (!expValEquals('platform_editor_nested_drag_handle_icon', 'isEnabled', true)) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
8
|
if (isTopLevelNode) {
|
|
13
9
|
return false;
|
|
14
10
|
}
|
|
@@ -15,6 +15,6 @@ type DragHandleProps = {
|
|
|
15
15
|
nodeType: string;
|
|
16
16
|
view: EditorView;
|
|
17
17
|
};
|
|
18
|
-
export declare const DragHandle: ({ view, api, formatMessage, getPos, anchorName, nodeType, handleOptions,
|
|
18
|
+
export declare const DragHandle: ({ view, api, formatMessage, getPos, anchorName, nodeType, handleOptions, anchorRectCache, }: DragHandleProps) => jsx.JSX.Element;
|
|
19
19
|
export declare const DragHandleWithVisibility: ({ view, api, formatMessage, getPos, anchorName, nodeType, handleOptions, isTopLevelNode, anchorRectCache, }: DragHandleProps) => jsx.JSX.Element;
|
|
20
20
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "18.2.
|
|
3
|
+
"version": "18.2.3",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"@atlaskit/editor-plugin-interaction": "^28.0.0",
|
|
34
34
|
"@atlaskit/editor-plugin-limited-mode": "^14.1.0",
|
|
35
35
|
"@atlaskit/editor-plugin-metrics": "^18.0.0",
|
|
36
|
-
"@atlaskit/editor-plugin-quick-insert": "^17.
|
|
36
|
+
"@atlaskit/editor-plugin-quick-insert": "^17.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-selection": "^17.0.0",
|
|
38
|
-
"@atlaskit/editor-plugin-show-diff": "^15.
|
|
38
|
+
"@atlaskit/editor-plugin-show-diff": "^15.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-toolbar": "^14.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-type-ahead": "^18.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-ui-control-registry": "^11.0.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@atlaskit/primitives": "^22.5.0",
|
|
57
57
|
"@atlaskit/section-message": "^10.2.0",
|
|
58
58
|
"@atlaskit/theme": "^28.2.0",
|
|
59
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
59
|
+
"@atlaskit/tmp-editor-statsig": "^182.0.0",
|
|
60
60
|
"@atlaskit/tokens": "^16.11.0",
|
|
61
61
|
"@atlaskit/tooltip": "^24.3.0",
|
|
62
62
|
"@babel/runtime": "^7.0.0",
|