@atlaskit/editor-plugin-block-controls 6.3.2 → 6.3.4
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 +16 -0
- package/dist/cjs/editor-commands/move-node.js +8 -12
- package/dist/cjs/pm-plugins/keymap.js +1 -2
- package/dist/cjs/pm-plugins/main.js +2 -29
- package/dist/cjs/ui/drag-handle.js +29 -31
- package/dist/cjs/ui/global-styles.js +3 -1
- package/dist/cjs/ui/visibility-container.js +4 -2
- package/dist/es2019/editor-commands/move-node.js +6 -11
- package/dist/es2019/pm-plugins/keymap.js +1 -2
- package/dist/es2019/pm-plugins/main.js +1 -30
- package/dist/es2019/ui/drag-handle.js +28 -30
- package/dist/es2019/ui/global-styles.js +3 -1
- package/dist/es2019/ui/visibility-container.js +4 -2
- package/dist/esm/editor-commands/move-node.js +8 -12
- package/dist/esm/pm-plugins/keymap.js +1 -2
- package/dist/esm/pm-plugins/main.js +1 -28
- package/dist/esm/ui/drag-handle.js +29 -31
- package/dist/esm/ui/global-styles.js +3 -1
- package/dist/esm/ui/visibility-container.js +4 -2
- package/package.json +3 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 6.3.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d278f35b3fb0f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d278f35b3fb0f) -
|
|
8
|
+
Cleaned up platform_editor_element_drag_and_drop_ed_23873
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 6.3.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`6b6eca9cee16d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6b6eca9cee16d) -
|
|
16
|
+
Switch to use editorExperiment to use productKey for responsive preview panel changes.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 6.3.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -341,7 +341,7 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
341
341
|
var inputMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _analytics.INPUT_METHOD.DRAG_AND_DROP;
|
|
342
342
|
var formatMessage = arguments.length > 3 ? arguments[3] : undefined;
|
|
343
343
|
return function (_ref7) {
|
|
344
|
-
var _api$blockControls$co;
|
|
344
|
+
var _api$blockControls$co, _api$accessibilityUti;
|
|
345
345
|
var tr = _ref7.tr;
|
|
346
346
|
if (!api || (start < 0 || to < 0) && (0, _platformFeatureFlags.fg)('platform_editor_elements_dnd_multi_select_patch_2')) {
|
|
347
347
|
return tr;
|
|
@@ -453,26 +453,22 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
453
453
|
action: _analytics.ACTION.MOVED,
|
|
454
454
|
actionSubject: _analytics.ACTION_SUBJECT.ELEMENT,
|
|
455
455
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.ELEMENT_DRAG_HANDLE,
|
|
456
|
-
attributes: _objectSpread(
|
|
456
|
+
attributes: _objectSpread({
|
|
457
457
|
nodeDepth: $handlePos.depth,
|
|
458
458
|
nodeType: handleNode.type.name,
|
|
459
459
|
destinationNodeDepth: $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.depth,
|
|
460
|
-
destinationNodeType: $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.parent.type.name
|
|
461
|
-
}, (0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_23873') && {
|
|
460
|
+
destinationNodeType: $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.parent.type.name,
|
|
462
461
|
inputMethod: inputMethod
|
|
463
|
-
}
|
|
462
|
+
}, isMultiSelect && {
|
|
464
463
|
sourceNodeTypes: sourceNodeTypes,
|
|
465
464
|
hasSelectedMultipleNodes: hasSelectedMultipleNodes
|
|
466
465
|
})
|
|
467
466
|
})(tr);
|
|
468
467
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
priority: 'important'
|
|
474
|
-
});
|
|
475
|
-
}
|
|
468
|
+
var movedMessage = to > sliceFrom ? _messages.blockControlsMessages.movedDown : _messages.blockControlsMessages.movedup;
|
|
469
|
+
api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(formatMessage ? formatMessage(movedMessage) : movedMessage.defaultMessage, {
|
|
470
|
+
priority: 'important'
|
|
471
|
+
});
|
|
476
472
|
return tr;
|
|
477
473
|
};
|
|
478
474
|
};
|
|
@@ -7,12 +7,11 @@ exports.boundKeydownHandler = void 0;
|
|
|
7
7
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
8
8
|
var _types = require("@atlaskit/editor-common/types");
|
|
9
9
|
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
10
|
var _moveNode = require("../editor-commands/move-node");
|
|
12
11
|
var _showDragHandle = require("../editor-commands/show-drag-handle");
|
|
13
12
|
function keymapList(api, formatMessage) {
|
|
14
13
|
var keymapList = {};
|
|
15
|
-
if (api
|
|
14
|
+
if (api) {
|
|
16
15
|
(0, _keymaps.bindKeymapWithCommand)(
|
|
17
16
|
// Ignored via go/ees005
|
|
18
17
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -37,7 +37,7 @@ var _activeAnchorTracker = require("./utils/active-anchor-tracker");
|
|
|
37
37
|
var _analytics2 = require("./utils/analytics");
|
|
38
38
|
var _anchorUtils = require("./utils/anchor-utils");
|
|
39
39
|
var _getSelection = require("./utils/getSelection");
|
|
40
|
-
var
|
|
40
|
+
var _selection = require("./utils/selection");
|
|
41
41
|
var _transactions = require("./utils/transactions");
|
|
42
42
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
43
43
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -144,7 +144,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
144
144
|
var _api$analytics2;
|
|
145
145
|
var nodeTypes, hasSelectedMultipleNodes;
|
|
146
146
|
if (isMultiSelect) {
|
|
147
|
-
var position = (0,
|
|
147
|
+
var position = (0, _selection.getSelectedSlicePosition)(start, tr, api);
|
|
148
148
|
var attributes = (0, _analytics2.getMultiSelectAnalyticsAttributes)(tr, position.from, position.to);
|
|
149
149
|
nodeTypes = attributes.nodeTypes;
|
|
150
150
|
hasSelectedMultipleNodes = attributes.hasSelectedMultipleNodes;
|
|
@@ -759,20 +759,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
759
759
|
return true;
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
|
|
763
|
-
// Command + Shift + ArrowUp to select was broken with the plugin enabled so this manually sets the selection
|
|
764
|
-
var _view$state = view.state,
|
|
765
|
-
selection = _view$state.selection,
|
|
766
|
-
doc = _view$state.doc,
|
|
767
|
-
tr = _view$state.tr;
|
|
768
|
-
var metaKey = _browser.browser.mac ? event.metaKey : event.ctrlKey;
|
|
769
|
-
if (event.key === 'ArrowUp' && event.shiftKey && metaKey) {
|
|
770
|
-
if (selection instanceof _state.TextSelection || selection instanceof _state.NodeSelection) {
|
|
771
|
-
var newSelection = _state.TextSelection.create(doc, selection.head, 1);
|
|
772
|
-
view.dispatch(tr.setSelection(newSelection));
|
|
773
|
-
return true;
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
762
|
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
|
|
777
763
|
var isDragHandle = event.target.closest((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_block_menu', 'isEnabled', true) ? _styles.DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
778
764
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
@@ -790,19 +776,6 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
790
776
|
}
|
|
791
777
|
return false;
|
|
792
778
|
} else {
|
|
793
|
-
// Command + Shift + ArrowUp to select was broken with the plugin enabled so this manually sets the selection
|
|
794
|
-
var _view$state2 = view.state,
|
|
795
|
-
_selection = _view$state2.selection,
|
|
796
|
-
_doc = _view$state2.doc,
|
|
797
|
-
_tr = _view$state2.tr;
|
|
798
|
-
var _metaKey = _browser.browser.mac ? event.metaKey : event.ctrlKey;
|
|
799
|
-
if (event.key === 'ArrowUp' && event.shiftKey && _metaKey) {
|
|
800
|
-
if (_selection instanceof _state.TextSelection || _selection instanceof _state.NodeSelection) {
|
|
801
|
-
var _newSelection = _state.TextSelection.create(_doc, _selection.head, 1);
|
|
802
|
-
view.dispatch(_tr.setSelection(_newSelection));
|
|
803
|
-
return true;
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
779
|
if (event.shiftKey && event.ctrlKey) {
|
|
807
780
|
//prevent holding down key combo from firing repeatedly
|
|
808
781
|
if (!event.repeat && (0, _keymap.boundKeydownHandler)(api, formatMessage)(view, event)) {
|
|
@@ -238,7 +238,7 @@ var selectedStyles = (0, _react2.css)({
|
|
|
238
238
|
// icon span receives dragStart event, instead of button, and since it is not registered as a draggable element
|
|
239
239
|
// with pragmatic DnD and pragmatic DnD is not triggered
|
|
240
240
|
var handleIconDragStart = function handleIconDragStart(e) {
|
|
241
|
-
if (!_browser.browser.chrome
|
|
241
|
+
if (!_browser.browser.chrome) {
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
// prevent dragStart handler triggered by icon
|
|
@@ -416,35 +416,33 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
416
416
|
}
|
|
417
417
|
}, [isLayoutColumn]);
|
|
418
418
|
var handleKeyDown = (0, _react.useCallback)(function (e) {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
if (startPos === undefined) {
|
|
427
|
-
return tr;
|
|
428
|
-
}
|
|
429
|
-
var node = tr.doc.nodeAt(startPos);
|
|
430
|
-
if (!node) {
|
|
431
|
-
return tr;
|
|
432
|
-
}
|
|
433
|
-
var $startPos = tr.doc.resolve(startPos + node.nodeSize);
|
|
434
|
-
var selection = new _state.TextSelection($startPos);
|
|
435
|
-
tr.setSelection(selection);
|
|
436
|
-
!isMultiSelect && tr.setMeta(_main.key, {
|
|
437
|
-
pos: startPos
|
|
438
|
-
});
|
|
419
|
+
// allow user to use spacebar to select the node
|
|
420
|
+
if (!e.repeat && e.key === ' ') {
|
|
421
|
+
var _api$core3;
|
|
422
|
+
var startPos = getPos();
|
|
423
|
+
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref3) {
|
|
424
|
+
var tr = _ref3.tr;
|
|
425
|
+
if (startPos === undefined) {
|
|
439
426
|
return tr;
|
|
427
|
+
}
|
|
428
|
+
var node = tr.doc.nodeAt(startPos);
|
|
429
|
+
if (!node) {
|
|
430
|
+
return tr;
|
|
431
|
+
}
|
|
432
|
+
var $startPos = tr.doc.resolve(startPos + node.nodeSize);
|
|
433
|
+
var selection = new _state.TextSelection($startPos);
|
|
434
|
+
tr.setSelection(selection);
|
|
435
|
+
!isMultiSelect && tr.setMeta(_main.key, {
|
|
436
|
+
pos: startPos
|
|
440
437
|
});
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
438
|
+
return tr;
|
|
439
|
+
});
|
|
440
|
+
} else if (![e.altKey, e.ctrlKey, e.shiftKey].some(function (pressed) {
|
|
441
|
+
return pressed;
|
|
442
|
+
})) {
|
|
443
|
+
// If not trying to press shortcut keys,
|
|
444
|
+
// return focus to editor to resume editing from caret position
|
|
445
|
+
view.focus();
|
|
448
446
|
}
|
|
449
447
|
}, [getPos, api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 ? void 0 : _api$core4.actions, isMultiSelect, view]);
|
|
450
448
|
(0, _react.useEffect)(function () {
|
|
@@ -769,7 +767,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
769
767
|
};
|
|
770
768
|
}, [view, anchorName, nodeType, recalculatePosition]);
|
|
771
769
|
(0, _react.useEffect)(function () {
|
|
772
|
-
if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current
|
|
770
|
+
if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current) {
|
|
773
771
|
var id = requestAnimationFrame(function () {
|
|
774
772
|
var _buttonRef$current2;
|
|
775
773
|
(_buttonRef$current2 = buttonRef.current) === null || _buttonRef$current2 === void 0 || _buttonRef$current2.focus();
|
|
@@ -881,7 +879,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
881
879
|
css: [(0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
882
880
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
883
881
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
884
|
-
_browser.browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, (0,
|
|
882
|
+
_browser.browser.gecko && dragHandleMultiLineSelectionFixFirefox, (0, _experiments.editorExperiment)('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true) && (0, _experiments.editorExperiment)('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles],
|
|
885
883
|
ref: buttonRef
|
|
886
884
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
887
885
|
,
|
|
@@ -964,7 +962,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
964
962
|
}
|
|
965
963
|
}, renderButton());
|
|
966
964
|
};
|
|
967
|
-
var isTooltip = !dragHandleDisabled
|
|
965
|
+
var isTooltip = !dragHandleDisabled;
|
|
968
966
|
var stickyRender = isTooltip ? stickyWithTooltip() : stickyWithoutTooltip();
|
|
969
967
|
var render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
970
968
|
return (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? stickyRender : render;
|
|
@@ -404,6 +404,8 @@ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWra
|
|
|
404
404
|
disabled: !(0, _expValEquals.expValEquals)('platform_editor_block_controls_perf_optimization', 'isEnabled', true)
|
|
405
405
|
});
|
|
406
406
|
return (0, _react.jsx)(_react.Global, {
|
|
407
|
-
styles: [globalStyles(), globalDnDStyle, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedHoverZoneNext() : extendedHoverZone(), isDragging && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedDragZoneNext : extendedDragZone), (0,
|
|
407
|
+
styles: [globalStyles(), globalDnDStyle, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedHoverZoneNext() : extendedHoverZone(), isDragging && ((0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedDragZoneNext : extendedDragZone), (0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
|
|
408
|
+
exposure: true
|
|
409
|
+
}) ? (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined, (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, (0, _experiments.editorExperiment)('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? withRelativePosStyleNext : withRelativePosStyle, topLevelNodeMarginStyles, (0, _expValEquals.expValEquals)('platform_editor_native_anchor_support', 'isEnabled', true) ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle]
|
|
408
410
|
});
|
|
409
411
|
};
|
|
@@ -11,7 +11,7 @@ var _react2 = require("@emotion/react");
|
|
|
11
11
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
13
|
var _primitives = require("@atlaskit/primitives");
|
|
14
|
-
var
|
|
14
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
15
|
/**
|
|
16
16
|
* @jsxRuntime classic
|
|
17
17
|
* @jsx jsx
|
|
@@ -53,7 +53,9 @@ var VisibilityContainer = exports.VisibilityContainer = function VisibilityConta
|
|
|
53
53
|
var isEditing = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockControls.isEditing');
|
|
54
54
|
var isMouseOut = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockControls.isMouseOut');
|
|
55
55
|
var shouldHide = isTypeAheadOpen || isEditing || isMouseOut;
|
|
56
|
-
if ((0,
|
|
56
|
+
if ((0, _experiments.editorExperiment)('platform_editor_preview_panel_responsiveness', true, {
|
|
57
|
+
exposure: true
|
|
58
|
+
})) {
|
|
57
59
|
return (0, _react2.jsx)("div", {
|
|
58
60
|
css: [baseStylesCSS, shouldHide ? hiddenStylesCSS : visibleStylesCSS]
|
|
59
61
|
}, children);
|
|
@@ -344,7 +344,7 @@ export const moveNodeViaShortcut = (api, direction, formatMessage) => {
|
|
|
344
344
|
export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_DROP, formatMessage) => ({
|
|
345
345
|
tr
|
|
346
346
|
}) => {
|
|
347
|
-
var _api$blockControls$co2;
|
|
347
|
+
var _api$blockControls$co2, _api$accessibilityUti;
|
|
348
348
|
if (!api || (start < 0 || to < 0) && fg('platform_editor_elements_dnd_multi_select_patch_2')) {
|
|
349
349
|
return tr;
|
|
350
350
|
}
|
|
@@ -462,9 +462,7 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
462
462
|
nodeType: handleNode.type.name,
|
|
463
463
|
destinationNodeDepth: $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.depth,
|
|
464
464
|
destinationNodeType: $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.parent.type.name,
|
|
465
|
-
|
|
466
|
-
inputMethod
|
|
467
|
-
}),
|
|
465
|
+
inputMethod,
|
|
468
466
|
...(isMultiSelect && {
|
|
469
467
|
sourceNodeTypes,
|
|
470
468
|
hasSelectedMultipleNodes
|
|
@@ -472,12 +470,9 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
472
470
|
}
|
|
473
471
|
})(tr);
|
|
474
472
|
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
priority: 'important'
|
|
480
|
-
});
|
|
481
|
-
}
|
|
473
|
+
const movedMessage = to > sliceFrom ? blockControlsMessages.movedDown : blockControlsMessages.movedup;
|
|
474
|
+
api === null || api === void 0 ? void 0 : (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify(formatMessage ? formatMessage(movedMessage) : movedMessage.defaultMessage, {
|
|
475
|
+
priority: 'important'
|
|
476
|
+
});
|
|
482
477
|
return tr;
|
|
483
478
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { bindKeymapWithCommand, dragToMoveDown, dragToMoveLeft, dragToMoveRight, dragToMoveUp, showElementDragHandle } from '@atlaskit/editor-common/keymaps';
|
|
2
2
|
import { DIRECTION } from '@atlaskit/editor-common/types';
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { moveNodeViaShortcut } from '../editor-commands/move-node';
|
|
6
5
|
import { showDragHandleAtSelection } from '../editor-commands/show-drag-handle';
|
|
7
6
|
function keymapList(api, formatMessage) {
|
|
8
7
|
const keymapList = {};
|
|
9
|
-
if (api
|
|
8
|
+
if (api) {
|
|
10
9
|
bindKeymapWithCommand(
|
|
11
10
|
// Ignored via go/ees005
|
|
12
11
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -6,7 +6,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
6
6
|
import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles';
|
|
7
7
|
import { EDIT_AREA_ID } from '@atlaskit/editor-common/ui';
|
|
8
8
|
import { isEmptyDocument } from '@atlaskit/editor-common/utils';
|
|
9
|
-
import {
|
|
9
|
+
import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
|
|
@@ -763,21 +763,6 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
763
763
|
return true;
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
|
-
|
|
767
|
-
// Command + Shift + ArrowUp to select was broken with the plugin enabled so this manually sets the selection
|
|
768
|
-
const {
|
|
769
|
-
selection,
|
|
770
|
-
doc,
|
|
771
|
-
tr
|
|
772
|
-
} = view.state;
|
|
773
|
-
const metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
774
|
-
if (event.key === 'ArrowUp' && event.shiftKey && metaKey) {
|
|
775
|
-
if (selection instanceof TextSelection || selection instanceof NodeSelection) {
|
|
776
|
-
const newSelection = TextSelection.create(doc, selection.head, 1);
|
|
777
|
-
view.dispatch(tr.setSelection(newSelection));
|
|
778
|
-
return true;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
766
|
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
782
767
|
const isDragHandle = event.target.closest(expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
783
768
|
api === null || api === void 0 ? void 0 : api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
@@ -796,20 +781,6 @@ export const createPlugin = (api, getIntl, nodeViewPortalProviderAPI) => {
|
|
|
796
781
|
}
|
|
797
782
|
return false;
|
|
798
783
|
} else {
|
|
799
|
-
// Command + Shift + ArrowUp to select was broken with the plugin enabled so this manually sets the selection
|
|
800
|
-
const {
|
|
801
|
-
selection,
|
|
802
|
-
doc,
|
|
803
|
-
tr
|
|
804
|
-
} = view.state;
|
|
805
|
-
const metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
806
|
-
if (event.key === 'ArrowUp' && event.shiftKey && metaKey) {
|
|
807
|
-
if (selection instanceof TextSelection || selection instanceof NodeSelection) {
|
|
808
|
-
const newSelection = TextSelection.create(doc, selection.head, 1);
|
|
809
|
-
view.dispatch(tr.setSelection(newSelection));
|
|
810
|
-
return true;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
784
|
if (event.shiftKey && event.ctrlKey) {
|
|
814
785
|
//prevent holding down key combo from firing repeatedly
|
|
815
786
|
if (!event.repeat && boundKeydownHandler(api, formatMessage)(view, event)) {
|
|
@@ -233,7 +233,7 @@ const selectedStyles = css({
|
|
|
233
233
|
// icon span receives dragStart event, instead of button, and since it is not registered as a draggable element
|
|
234
234
|
// with pragmatic DnD and pragmatic DnD is not triggered
|
|
235
235
|
const handleIconDragStart = e => {
|
|
236
|
-
if (!browser.chrome
|
|
236
|
+
if (!browser.chrome) {
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
239
|
// prevent dragStart handler triggered by icon
|
|
@@ -396,34 +396,32 @@ export const DragHandle = ({
|
|
|
396
396
|
}
|
|
397
397
|
}, [isLayoutColumn]);
|
|
398
398
|
const handleKeyDown = useCallback(e => {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
if (!node) {
|
|
412
|
-
return tr;
|
|
413
|
-
}
|
|
414
|
-
const $startPos = tr.doc.resolve(startPos + node.nodeSize);
|
|
415
|
-
const selection = new TextSelection($startPos);
|
|
416
|
-
tr.setSelection(selection);
|
|
417
|
-
!isMultiSelect && tr.setMeta(key, {
|
|
418
|
-
pos: startPos
|
|
419
|
-
});
|
|
399
|
+
// allow user to use spacebar to select the node
|
|
400
|
+
if (!e.repeat && e.key === ' ') {
|
|
401
|
+
var _api$core3;
|
|
402
|
+
const startPos = getPos();
|
|
403
|
+
api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(({
|
|
404
|
+
tr
|
|
405
|
+
}) => {
|
|
406
|
+
if (startPos === undefined) {
|
|
407
|
+
return tr;
|
|
408
|
+
}
|
|
409
|
+
const node = tr.doc.nodeAt(startPos);
|
|
410
|
+
if (!node) {
|
|
420
411
|
return tr;
|
|
412
|
+
}
|
|
413
|
+
const $startPos = tr.doc.resolve(startPos + node.nodeSize);
|
|
414
|
+
const selection = new TextSelection($startPos);
|
|
415
|
+
tr.setSelection(selection);
|
|
416
|
+
!isMultiSelect && tr.setMeta(key, {
|
|
417
|
+
pos: startPos
|
|
421
418
|
});
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
419
|
+
return tr;
|
|
420
|
+
});
|
|
421
|
+
} else if (![e.altKey, e.ctrlKey, e.shiftKey].some(pressed => pressed)) {
|
|
422
|
+
// If not trying to press shortcut keys,
|
|
423
|
+
// return focus to editor to resume editing from caret position
|
|
424
|
+
view.focus();
|
|
427
425
|
}
|
|
428
426
|
}, [getPos, api === null || api === void 0 ? void 0 : (_api$core4 = api.core) === null || _api$core4 === void 0 ? void 0 : _api$core4.actions, isMultiSelect, view]);
|
|
429
427
|
useEffect(() => {
|
|
@@ -759,7 +757,7 @@ export const DragHandle = ({
|
|
|
759
757
|
};
|
|
760
758
|
}, [view, anchorName, nodeType, recalculatePosition]);
|
|
761
759
|
useEffect(() => {
|
|
762
|
-
if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current
|
|
760
|
+
if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current) {
|
|
763
761
|
const id = requestAnimationFrame(() => {
|
|
764
762
|
var _buttonRef$current2;
|
|
765
763
|
(_buttonRef$current2 = buttonRef.current) === null || _buttonRef$current2 === void 0 ? void 0 : _buttonRef$current2.focus();
|
|
@@ -870,7 +868,7 @@ export const DragHandle = ({
|
|
|
870
868
|
css: [editorExperiment('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
871
869
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
872
870
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
873
|
-
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles,
|
|
871
|
+
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorExperiment('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles],
|
|
874
872
|
ref: buttonRef
|
|
875
873
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
876
874
|
,
|
|
@@ -945,7 +943,7 @@ export const DragHandle = ({
|
|
|
945
943
|
});
|
|
946
944
|
}
|
|
947
945
|
}, renderButton());
|
|
948
|
-
const isTooltip = !dragHandleDisabled
|
|
946
|
+
const isTooltip = !dragHandleDisabled;
|
|
949
947
|
const stickyRender = isTooltip ? stickyWithTooltip() : stickyWithoutTooltip();
|
|
950
948
|
const render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
951
949
|
return editorExperiment('platform_editor_controls', 'variant1') ? stickyRender : render;
|
|
@@ -475,6 +475,8 @@ export const GlobalStylesWrapper = ({
|
|
|
475
475
|
disabled: !expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true)
|
|
476
476
|
});
|
|
477
477
|
return jsx(Global, {
|
|
478
|
-
styles: [globalStyles(), globalDnDStyle, expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedHoverZoneNext() : extendedHoverZone(), isDragging && (expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedDragZoneNext : extendedDragZone),
|
|
478
|
+
styles: [globalStyles(), globalDnDStyle, expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedHoverZoneNext() : extendedHoverZone(), isDragging && (expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedDragZoneNext : extendedDragZone), editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
479
|
+
exposure: true
|
|
480
|
+
}) ? expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined, editorExperiment('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, editorExperiment('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? withRelativePosStyleNext : withRelativePosStyle, topLevelNodeMarginStyles, expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle]
|
|
479
481
|
});
|
|
480
482
|
};
|
|
@@ -10,7 +10,7 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
|
|
|
10
10
|
import { akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
11
11
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
12
12
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
13
|
-
import {
|
|
13
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
14
|
const baseStyles = xcss({
|
|
15
15
|
transition: 'opacity 0.1s ease-in-out, visibility 0.1s ease-in-out'
|
|
16
16
|
});
|
|
@@ -46,7 +46,9 @@ export const VisibilityContainer = ({
|
|
|
46
46
|
const isEditing = useSharedPluginStateSelector(api, 'blockControls.isEditing');
|
|
47
47
|
const isMouseOut = useSharedPluginStateSelector(api, 'blockControls.isMouseOut');
|
|
48
48
|
const shouldHide = isTypeAheadOpen || isEditing || isMouseOut;
|
|
49
|
-
if (
|
|
49
|
+
if (editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
50
|
+
exposure: true
|
|
51
|
+
})) {
|
|
50
52
|
return jsx("div", {
|
|
51
53
|
css: [baseStylesCSS, shouldHide ? hiddenStylesCSS : visibleStylesCSS]
|
|
52
54
|
}, children);
|
|
@@ -335,7 +335,7 @@ export var moveNode = function moveNode(api) {
|
|
|
335
335
|
var inputMethod = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : INPUT_METHOD.DRAG_AND_DROP;
|
|
336
336
|
var formatMessage = arguments.length > 3 ? arguments[3] : undefined;
|
|
337
337
|
return function (_ref7) {
|
|
338
|
-
var _api$blockControls$co;
|
|
338
|
+
var _api$blockControls$co, _api$accessibilityUti;
|
|
339
339
|
var tr = _ref7.tr;
|
|
340
340
|
if (!api || (start < 0 || to < 0) && fg('platform_editor_elements_dnd_multi_select_patch_2')) {
|
|
341
341
|
return tr;
|
|
@@ -447,26 +447,22 @@ export var moveNode = function moveNode(api) {
|
|
|
447
447
|
action: ACTION.MOVED,
|
|
448
448
|
actionSubject: ACTION_SUBJECT.ELEMENT,
|
|
449
449
|
actionSubjectId: ACTION_SUBJECT_ID.ELEMENT_DRAG_HANDLE,
|
|
450
|
-
attributes: _objectSpread(
|
|
450
|
+
attributes: _objectSpread({
|
|
451
451
|
nodeDepth: $handlePos.depth,
|
|
452
452
|
nodeType: handleNode.type.name,
|
|
453
453
|
destinationNodeDepth: $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.depth,
|
|
454
|
-
destinationNodeType: $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.parent.type.name
|
|
455
|
-
}, fg('platform_editor_element_drag_and_drop_ed_23873') && {
|
|
454
|
+
destinationNodeType: $mappedTo === null || $mappedTo === void 0 ? void 0 : $mappedTo.parent.type.name,
|
|
456
455
|
inputMethod: inputMethod
|
|
457
|
-
}
|
|
456
|
+
}, isMultiSelect && {
|
|
458
457
|
sourceNodeTypes: sourceNodeTypes,
|
|
459
458
|
hasSelectedMultipleNodes: hasSelectedMultipleNodes
|
|
460
459
|
})
|
|
461
460
|
})(tr);
|
|
462
461
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
priority: 'important'
|
|
468
|
-
});
|
|
469
|
-
}
|
|
462
|
+
var movedMessage = to > sliceFrom ? blockControlsMessages.movedDown : blockControlsMessages.movedup;
|
|
463
|
+
api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 || _api$accessibilityUti.actions.ariaNotify(formatMessage ? formatMessage(movedMessage) : movedMessage.defaultMessage, {
|
|
464
|
+
priority: 'important'
|
|
465
|
+
});
|
|
470
466
|
return tr;
|
|
471
467
|
};
|
|
472
468
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { bindKeymapWithCommand, dragToMoveDown, dragToMoveLeft, dragToMoveRight, dragToMoveUp, showElementDragHandle } from '@atlaskit/editor-common/keymaps';
|
|
2
2
|
import { DIRECTION } from '@atlaskit/editor-common/types';
|
|
3
3
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
4
|
import { moveNodeViaShortcut } from '../editor-commands/move-node';
|
|
6
5
|
import { showDragHandleAtSelection } from '../editor-commands/show-drag-handle';
|
|
7
6
|
function keymapList(api, formatMessage) {
|
|
8
7
|
var keymapList = {};
|
|
9
|
-
if (api
|
|
8
|
+
if (api) {
|
|
10
9
|
bindKeymapWithCommand(
|
|
11
10
|
// Ignored via go/ees005
|
|
12
11
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -9,7 +9,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
9
9
|
import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles';
|
|
10
10
|
import { EDIT_AREA_ID } from '@atlaskit/editor-common/ui';
|
|
11
11
|
import { isEmptyDocument } from '@atlaskit/editor-common/utils';
|
|
12
|
-
import {
|
|
12
|
+
import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
|
|
@@ -753,20 +753,6 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
753
753
|
return true;
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
|
-
|
|
757
|
-
// Command + Shift + ArrowUp to select was broken with the plugin enabled so this manually sets the selection
|
|
758
|
-
var _view$state = view.state,
|
|
759
|
-
selection = _view$state.selection,
|
|
760
|
-
doc = _view$state.doc,
|
|
761
|
-
tr = _view$state.tr;
|
|
762
|
-
var metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
763
|
-
if (event.key === 'ArrowUp' && event.shiftKey && metaKey) {
|
|
764
|
-
if (selection instanceof TextSelection || selection instanceof NodeSelection) {
|
|
765
|
-
var newSelection = TextSelection.create(doc, selection.head, 1);
|
|
766
|
-
view.dispatch(tr.setSelection(newSelection));
|
|
767
|
-
return true;
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
756
|
if ((event.key === 'Enter' || event.key === ' ') && event.target instanceof HTMLElement && editorExperiment('platform_editor_controls', 'variant1')) {
|
|
771
757
|
var isDragHandle = event.target.closest(expValEqualsNoExposure('platform_editor_block_menu', 'isEnabled', true) ? DRAG_HANDLE_SELECTOR : '[data-editor-block-ctrl-drag-handle="true"]') !== null;
|
|
772
758
|
api === null || api === void 0 || api.core.actions.execute(api === null || api === void 0 ? void 0 : api.blockControls.commands.setSelectedViaDragHandle(isDragHandle));
|
|
@@ -784,19 +770,6 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
784
770
|
}
|
|
785
771
|
return false;
|
|
786
772
|
} else {
|
|
787
|
-
// Command + Shift + ArrowUp to select was broken with the plugin enabled so this manually sets the selection
|
|
788
|
-
var _view$state2 = view.state,
|
|
789
|
-
_selection = _view$state2.selection,
|
|
790
|
-
_doc = _view$state2.doc,
|
|
791
|
-
_tr = _view$state2.tr;
|
|
792
|
-
var _metaKey = browser.mac ? event.metaKey : event.ctrlKey;
|
|
793
|
-
if (event.key === 'ArrowUp' && event.shiftKey && _metaKey) {
|
|
794
|
-
if (_selection instanceof TextSelection || _selection instanceof NodeSelection) {
|
|
795
|
-
var _newSelection = TextSelection.create(_doc, _selection.head, 1);
|
|
796
|
-
view.dispatch(_tr.setSelection(_newSelection));
|
|
797
|
-
return true;
|
|
798
|
-
}
|
|
799
|
-
}
|
|
800
773
|
if (event.shiftKey && event.ctrlKey) {
|
|
801
774
|
//prevent holding down key combo from firing repeatedly
|
|
802
775
|
if (!event.repeat && boundKeydownHandler(api, formatMessage)(view, event)) {
|
|
@@ -235,7 +235,7 @@ var selectedStyles = css({
|
|
|
235
235
|
// icon span receives dragStart event, instead of button, and since it is not registered as a draggable element
|
|
236
236
|
// with pragmatic DnD and pragmatic DnD is not triggered
|
|
237
237
|
var handleIconDragStart = function handleIconDragStart(e) {
|
|
238
|
-
if (!browser.chrome
|
|
238
|
+
if (!browser.chrome) {
|
|
239
239
|
return;
|
|
240
240
|
}
|
|
241
241
|
// prevent dragStart handler triggered by icon
|
|
@@ -413,35 +413,33 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
413
413
|
}
|
|
414
414
|
}, [isLayoutColumn]);
|
|
415
415
|
var handleKeyDown = useCallback(function (e) {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
if (startPos === undefined) {
|
|
424
|
-
return tr;
|
|
425
|
-
}
|
|
426
|
-
var node = tr.doc.nodeAt(startPos);
|
|
427
|
-
if (!node) {
|
|
428
|
-
return tr;
|
|
429
|
-
}
|
|
430
|
-
var $startPos = tr.doc.resolve(startPos + node.nodeSize);
|
|
431
|
-
var selection = new TextSelection($startPos);
|
|
432
|
-
tr.setSelection(selection);
|
|
433
|
-
!isMultiSelect && tr.setMeta(key, {
|
|
434
|
-
pos: startPos
|
|
435
|
-
});
|
|
416
|
+
// allow user to use spacebar to select the node
|
|
417
|
+
if (!e.repeat && e.key === ' ') {
|
|
418
|
+
var _api$core3;
|
|
419
|
+
var startPos = getPos();
|
|
420
|
+
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref3) {
|
|
421
|
+
var tr = _ref3.tr;
|
|
422
|
+
if (startPos === undefined) {
|
|
436
423
|
return tr;
|
|
424
|
+
}
|
|
425
|
+
var node = tr.doc.nodeAt(startPos);
|
|
426
|
+
if (!node) {
|
|
427
|
+
return tr;
|
|
428
|
+
}
|
|
429
|
+
var $startPos = tr.doc.resolve(startPos + node.nodeSize);
|
|
430
|
+
var selection = new TextSelection($startPos);
|
|
431
|
+
tr.setSelection(selection);
|
|
432
|
+
!isMultiSelect && tr.setMeta(key, {
|
|
433
|
+
pos: startPos
|
|
437
434
|
});
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
435
|
+
return tr;
|
|
436
|
+
});
|
|
437
|
+
} else if (![e.altKey, e.ctrlKey, e.shiftKey].some(function (pressed) {
|
|
438
|
+
return pressed;
|
|
439
|
+
})) {
|
|
440
|
+
// If not trying to press shortcut keys,
|
|
441
|
+
// return focus to editor to resume editing from caret position
|
|
442
|
+
view.focus();
|
|
445
443
|
}
|
|
446
444
|
}, [getPos, api === null || api === void 0 || (_api$core4 = api.core) === null || _api$core4 === void 0 ? void 0 : _api$core4.actions, isMultiSelect, view]);
|
|
447
445
|
useEffect(function () {
|
|
@@ -766,7 +764,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
766
764
|
};
|
|
767
765
|
}, [view, anchorName, nodeType, recalculatePosition]);
|
|
768
766
|
useEffect(function () {
|
|
769
|
-
if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current
|
|
767
|
+
if (handleOptions !== null && handleOptions !== void 0 && handleOptions.isFocused && buttonRef.current) {
|
|
770
768
|
var id = requestAnimationFrame(function () {
|
|
771
769
|
var _buttonRef$current2;
|
|
772
770
|
(_buttonRef$current2 = buttonRef.current) === null || _buttonRef$current2 === void 0 || _buttonRef$current2.focus();
|
|
@@ -878,7 +876,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
878
876
|
css: [editorExperiment('platform_editor_controls', 'variant1') ? dragHandleButtonStyles : dragHandleButtonStylesOld, editorExperiment('platform_editor_controls', 'variant1') && dragHandleColor,
|
|
879
877
|
// ED-26266: Fixed the drag handle highlight when selecting multiple line in Firefox
|
|
880
878
|
// See https://product-fabric.atlassian.net/browse/ED-26266
|
|
881
|
-
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles,
|
|
879
|
+
browser.gecko && dragHandleMultiLineSelectionFixFirefox, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && hasHadInteraction && selectedStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorExperiment('platform_editor_controls', 'control') && dragHandleButtonSmallScreenStyles],
|
|
882
880
|
ref: buttonRef
|
|
883
881
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
884
882
|
,
|
|
@@ -961,7 +959,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
961
959
|
}
|
|
962
960
|
}, renderButton());
|
|
963
961
|
};
|
|
964
|
-
var isTooltip = !dragHandleDisabled
|
|
962
|
+
var isTooltip = !dragHandleDisabled;
|
|
965
963
|
var stickyRender = isTooltip ? stickyWithTooltip() : stickyWithoutTooltip();
|
|
966
964
|
var render = isTooltip ? buttonWithTooltip() : renderButton();
|
|
967
965
|
return editorExperiment('platform_editor_controls', 'variant1') ? stickyRender : render;
|
|
@@ -397,6 +397,8 @@ export var GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
|
|
|
397
397
|
disabled: !expValEquals('platform_editor_block_controls_perf_optimization', 'isEnabled', true)
|
|
398
398
|
});
|
|
399
399
|
return jsx(Global, {
|
|
400
|
-
styles: [globalStyles(), globalDnDStyle, expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedHoverZoneNext() : extendedHoverZone(), isDragging && (expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedDragZoneNext : extendedDragZone),
|
|
400
|
+
styles: [globalStyles(), globalDnDStyle, expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedHoverZoneNext() : extendedHoverZone(), isDragging && (expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? extendedDragZoneNext : extendedDragZone), editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
401
|
+
exposure: true
|
|
402
|
+
}) ? expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined, editorExperiment('platform_editor_controls', 'variant1') ? undefined : withInlineNodeStyle, editorExperiment('platform_editor_block_control_optimise_render', true) ? quickInsertStyles : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? withRelativePosStyleNext : withRelativePosStyle, topLevelNodeMarginStyles, expValEquals('platform_editor_native_anchor_support', 'isEnabled', true) ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle]
|
|
401
403
|
});
|
|
402
404
|
};
|
|
@@ -11,7 +11,7 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
|
|
|
11
11
|
import { akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
12
12
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
13
13
|
import { Box, xcss } from '@atlaskit/primitives';
|
|
14
|
-
import {
|
|
14
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
15
|
var baseStyles = xcss({
|
|
16
16
|
transition: 'opacity 0.1s ease-in-out, visibility 0.1s ease-in-out'
|
|
17
17
|
});
|
|
@@ -44,7 +44,9 @@ export var VisibilityContainer = function VisibilityContainer(_ref) {
|
|
|
44
44
|
var isEditing = useSharedPluginStateSelector(api, 'blockControls.isEditing');
|
|
45
45
|
var isMouseOut = useSharedPluginStateSelector(api, 'blockControls.isMouseOut');
|
|
46
46
|
var shouldHide = isTypeAheadOpen || isEditing || isMouseOut;
|
|
47
|
-
if (
|
|
47
|
+
if (editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
48
|
+
exposure: true
|
|
49
|
+
})) {
|
|
48
50
|
return jsx("div", {
|
|
49
51
|
css: [baseStylesCSS, shouldHide ? hiddenStylesCSS : visibleStylesCSS]
|
|
50
52
|
}, children);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.4",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^3.2.0",
|
|
53
53
|
"@atlaskit/primitives": "^14.14.0",
|
|
54
54
|
"@atlaskit/theme": "^21.0.0",
|
|
55
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
55
|
+
"@atlaskit/tmp-editor-statsig": "^12.25.0",
|
|
56
56
|
"@atlaskit/tokens": "^6.3.0",
|
|
57
57
|
"@atlaskit/tooltip": "^20.4.0",
|
|
58
58
|
"@babel/runtime": "^7.0.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"uuid": "^3.1.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@atlaskit/editor-common": "^109.
|
|
67
|
+
"@atlaskit/editor-common": "^109.10.0",
|
|
68
68
|
"react": "^18.2.0",
|
|
69
69
|
"react-dom": "^18.2.0",
|
|
70
70
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -108,15 +108,9 @@
|
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
"platform-feature-flags": {
|
|
111
|
-
"platform_editor_element_drag_and_drop_ed_23873": {
|
|
112
|
-
"type": "boolean"
|
|
113
|
-
},
|
|
114
111
|
"platform_editor_use_nested_table_pm_nodes": {
|
|
115
112
|
"type": "boolean"
|
|
116
113
|
},
|
|
117
|
-
"platform_editor_dnd_update_drag_start_target": {
|
|
118
|
-
"type": "boolean"
|
|
119
|
-
},
|
|
120
114
|
"platform_editor_track_node_types": {
|
|
121
115
|
"type": "boolean"
|
|
122
116
|
},
|