@atlaskit/editor-plugin-block-controls 2.13.28 → 2.13.30
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/{plugin.js → blockControlsPlugin.js} +3 -3
- package/dist/cjs/{commands → editor-commands}/move-node.js +5 -5
- package/dist/cjs/{commands → editor-commands}/move-to-layout.js +4 -4
- package/dist/cjs/{commands → editor-commands}/show-drag-handle.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/pm-plugins/decorations-anchor.js +3 -4
- package/dist/cjs/pm-plugins/decorations-drop-target.js +9 -10
- package/dist/cjs/pm-plugins/handle-mouse-over.js +2 -3
- package/dist/cjs/pm-plugins/keymap.js +3 -3
- package/dist/cjs/pm-plugins/main.js +6 -7
- package/dist/cjs/{utils → pm-plugins/utils}/active-anchor-tracker.js +2 -2
- package/dist/cjs/{consts.js → pm-plugins/utils/consts.js} +2 -2
- package/dist/cjs/{utils → pm-plugins/utils}/drag-handle-positions.js +1 -1
- package/dist/cjs/{utils → pm-plugins/utils}/inline-drop-target.js +5 -5
- package/dist/cjs/{utils → pm-plugins/utils}/remove-from-source.js +1 -1
- package/dist/cjs/{utils → pm-plugins/utils}/update-column-widths.js +1 -1
- package/dist/cjs/{utils → pm-plugins/utils}/validation.js +1 -2
- package/dist/cjs/ui/consts.js +3 -3
- package/dist/cjs/ui/drag-handle.js +7 -8
- package/dist/cjs/ui/drop-target-layout.js +3 -3
- package/dist/cjs/ui/drop-target-v2.js +5 -6
- package/dist/cjs/ui/drop-target.js +2 -2
- package/dist/cjs/ui/inline-drop-target.js +10 -11
- package/dist/es2019/{plugin.js → blockControlsPlugin.js} +3 -3
- package/dist/es2019/{commands → editor-commands}/move-node.js +5 -5
- package/dist/es2019/{commands → editor-commands}/move-to-layout.js +4 -4
- package/dist/es2019/{commands → editor-commands}/show-drag-handle.js +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/pm-plugins/decorations-anchor.js +3 -4
- package/dist/es2019/pm-plugins/decorations-drop-target.js +4 -5
- package/dist/es2019/pm-plugins/handle-mouse-over.js +2 -3
- package/dist/es2019/pm-plugins/keymap.js +3 -3
- package/dist/es2019/pm-plugins/main.js +6 -7
- package/dist/es2019/{utils → pm-plugins/utils}/active-anchor-tracker.js +2 -2
- package/dist/es2019/{consts.js → pm-plugins/utils/consts.js} +2 -2
- package/dist/es2019/{utils → pm-plugins/utils}/drag-handle-positions.js +1 -1
- package/dist/es2019/{utils → pm-plugins/utils}/inline-drop-target.js +5 -5
- package/dist/es2019/{utils → pm-plugins/utils}/remove-from-source.js +1 -1
- package/dist/es2019/{utils → pm-plugins/utils}/update-column-widths.js +1 -1
- package/dist/es2019/{utils → pm-plugins/utils}/validation.js +1 -2
- package/dist/es2019/ui/consts.js +3 -3
- package/dist/es2019/ui/drag-handle.js +7 -8
- package/dist/es2019/ui/drop-target-layout.js +3 -3
- package/dist/es2019/ui/drop-target-v2.js +5 -6
- package/dist/es2019/ui/drop-target.js +2 -2
- package/dist/es2019/ui/inline-drop-target.js +10 -11
- package/dist/esm/{plugin.js → blockControlsPlugin.js} +3 -3
- package/dist/esm/{commands → editor-commands}/move-node.js +5 -5
- package/dist/esm/{commands → editor-commands}/move-to-layout.js +4 -4
- package/dist/esm/{commands → editor-commands}/show-drag-handle.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/pm-plugins/decorations-anchor.js +3 -4
- package/dist/esm/pm-plugins/decorations-drop-target.js +4 -5
- package/dist/esm/pm-plugins/handle-mouse-over.js +2 -3
- package/dist/esm/pm-plugins/keymap.js +3 -3
- package/dist/esm/pm-plugins/main.js +6 -7
- package/dist/esm/{utils → pm-plugins/utils}/active-anchor-tracker.js +2 -2
- package/dist/esm/{consts.js → pm-plugins/utils/consts.js} +2 -2
- package/dist/esm/{utils → pm-plugins/utils}/drag-handle-positions.js +1 -1
- package/dist/esm/{utils → pm-plugins/utils}/inline-drop-target.js +5 -5
- package/dist/esm/{utils → pm-plugins/utils}/remove-from-source.js +1 -1
- package/dist/esm/{utils → pm-plugins/utils}/update-column-widths.js +1 -1
- package/dist/esm/{utils → pm-plugins/utils}/validation.js +1 -2
- package/dist/esm/ui/consts.js +3 -3
- package/dist/esm/ui/drag-handle.js +7 -8
- package/dist/esm/ui/drop-target-layout.js +3 -3
- package/dist/esm/ui/drop-target-v2.js +5 -6
- package/dist/esm/ui/drop-target.js +2 -2
- package/dist/esm/ui/inline-drop-target.js +10 -11
- package/dist/types/blockControlsPlugin.d.ts +2 -0
- package/dist/types/{commands → editor-commands}/move-node.d.ts +2 -2
- package/dist/types/{commands → editor-commands}/move-to-layout.d.ts +1 -1
- package/dist/types/{commands → editor-commands}/show-drag-handle.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/pm-plugins/decorations-drag-handle.d.ts +1 -1
- package/dist/types/pm-plugins/decorations-drop-target.d.ts +2 -2
- package/dist/types/pm-plugins/handle-mouse-over.d.ts +1 -1
- package/dist/types/pm-plugins/keymap.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +2 -2
- package/dist/types/{utils → pm-plugins/utils}/active-anchor-tracker.d.ts +1 -1
- package/dist/types/{consts.d.ts → pm-plugins/utils/consts.d.ts} +1 -1
- package/dist/{types-ts4.5 → types/pm-plugins}/utils/inline-drop-target.d.ts +1 -1
- package/dist/types/ui/drag-handle-menu.d.ts +1 -1
- package/dist/types/ui/drag-handle.d.ts +1 -1
- package/dist/types/ui/drop-target-layout.d.ts +2 -2
- package/dist/types/ui/drop-target-v2.d.ts +1 -1
- package/dist/types/ui/drop-target.d.ts +1 -1
- package/dist/types/ui/inline-drop-target.d.ts +1 -1
- package/dist/types-ts4.5/blockControlsPlugin.d.ts +2 -0
- package/dist/types-ts4.5/{commands → editor-commands}/move-node.d.ts +2 -2
- package/dist/types-ts4.5/{commands → editor-commands}/move-to-layout.d.ts +1 -1
- package/dist/types-ts4.5/{commands → editor-commands}/show-drag-handle.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/decorations-drag-handle.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/decorations-drop-target.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/handle-mouse-over.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -2
- package/dist/types-ts4.5/{utils → pm-plugins/utils}/active-anchor-tracker.d.ts +1 -1
- package/dist/types-ts4.5/{consts.d.ts → pm-plugins/utils/consts.d.ts} +1 -1
- package/dist/{types → types-ts4.5/pm-plugins}/utils/inline-drop-target.d.ts +1 -1
- package/dist/types-ts4.5/ui/drag-handle-menu.d.ts +1 -1
- package/dist/types-ts4.5/ui/drag-handle.d.ts +1 -1
- package/dist/types-ts4.5/ui/drop-target-layout.d.ts +2 -2
- package/dist/types-ts4.5/ui/drop-target-v2.d.ts +1 -1
- package/dist/types-ts4.5/ui/drop-target.d.ts +1 -1
- package/dist/types-ts4.5/ui/inline-drop-target.d.ts +1 -1
- package/package.json +7 -13
- package/dist/cjs/utils/advanced-layouts-flags.js +0 -19
- package/dist/es2019/utils/advanced-layouts-flags.js +0 -14
- package/dist/esm/utils/advanced-layouts-flags.js +0 -14
- package/dist/types/plugin.d.ts +0 -2
- package/dist/types/utils/advanced-layouts-flags.d.ts +0 -3
- package/dist/types-ts4.5/plugin.d.ts +0 -2
- package/dist/types-ts4.5/utils/advanced-layouts-flags.d.ts +0 -3
- /package/dist/cjs/{types.js → blockControlsPluginType.js} +0 -0
- /package/dist/cjs/{utils → pm-plugins/utils}/anchor-utils.js +0 -0
- /package/dist/cjs/{utils → pm-plugins/utils}/check-media-layout.js +0 -0
- /package/dist/cjs/{utils → pm-plugins/utils}/drag-target-debug.js +0 -0
- /package/dist/cjs/{utils → pm-plugins/utils}/getNestedNodePosition.js +0 -0
- /package/dist/cjs/{utils → pm-plugins/utils}/getSelection.js +0 -0
- /package/dist/cjs/{utils → pm-plugins/utils}/index.js +0 -0
- /package/dist/cjs/{utils → pm-plugins/utils}/transactions.js +0 -0
- /package/dist/es2019/{types.js → blockControlsPluginType.js} +0 -0
- /package/dist/es2019/{utils → pm-plugins/utils}/anchor-utils.js +0 -0
- /package/dist/es2019/{utils → pm-plugins/utils}/check-media-layout.js +0 -0
- /package/dist/es2019/{utils → pm-plugins/utils}/drag-target-debug.js +0 -0
- /package/dist/es2019/{utils → pm-plugins/utils}/getNestedNodePosition.js +0 -0
- /package/dist/es2019/{utils → pm-plugins/utils}/getSelection.js +0 -0
- /package/dist/es2019/{utils → pm-plugins/utils}/index.js +0 -0
- /package/dist/es2019/{utils → pm-plugins/utils}/transactions.js +0 -0
- /package/dist/esm/{types.js → blockControlsPluginType.js} +0 -0
- /package/dist/esm/{utils → pm-plugins/utils}/anchor-utils.js +0 -0
- /package/dist/esm/{utils → pm-plugins/utils}/check-media-layout.js +0 -0
- /package/dist/esm/{utils → pm-plugins/utils}/drag-target-debug.js +0 -0
- /package/dist/esm/{utils → pm-plugins/utils}/getNestedNodePosition.js +0 -0
- /package/dist/esm/{utils → pm-plugins/utils}/getSelection.js +0 -0
- /package/dist/esm/{utils → pm-plugins/utils}/index.js +0 -0
- /package/dist/esm/{utils → pm-plugins/utils}/transactions.js +0 -0
- /package/dist/types/{types.d.ts → blockControlsPluginType.d.ts} +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/anchor-utils.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/check-media-layout.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/drag-handle-positions.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/drag-target-debug.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/getNestedNodePosition.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/getSelection.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/index.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/remove-from-source.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/transactions.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/update-column-widths.d.ts +0 -0
- /package/dist/types/{utils → pm-plugins/utils}/validation.d.ts +0 -0
- /package/dist/types-ts4.5/{types.d.ts → blockControlsPluginType.d.ts} +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/anchor-utils.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/check-media-layout.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/drag-handle-positions.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/drag-target-debug.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/getNestedNodePosition.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/getSelection.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/index.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/remove-from-source.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/transactions.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/update-column-widths.d.ts +0 -0
- /package/dist/types-ts4.5/{utils → pm-plugins/utils}/validation.d.ts +0 -0
|
@@ -8,15 +8,14 @@ import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
|
8
8
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
|
-
import { maxLayoutColumnSupported } from '../consts';
|
|
12
11
|
import { nodeMargins } from '../ui/consts';
|
|
13
12
|
import { DropTarget } from '../ui/drop-target';
|
|
14
13
|
import { DropTargetLayout } from '../ui/drop-target-layout';
|
|
15
14
|
import { DropTargetV2, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET } from '../ui/drop-target-v2';
|
|
16
|
-
import { isPreRelease2 } from '../utils/advanced-layouts-flags';
|
|
17
|
-
import { isBlocksDragTargetDebug } from '../utils/drag-target-debug';
|
|
18
|
-
import { canMoveNodeToIndex, isInSameLayout } from '../utils/validation';
|
|
19
15
|
import { getNestedDepth, TYPE_DROP_TARGET_DEC, unmountDecorations } from './decorations-common';
|
|
16
|
+
import { maxLayoutColumnSupported } from './utils/consts';
|
|
17
|
+
import { isBlocksDragTargetDebug } from './utils/drag-target-debug';
|
|
18
|
+
import { canMoveNodeToIndex, isInSameLayout } from './utils/validation';
|
|
20
19
|
var IGNORE_NODES = ['tableCell', 'tableHeader', 'tableRow', 'layoutColumn', 'listItem', 'caption'];
|
|
21
20
|
var PARENT_WITH_END_DROP_TARGET = ['tableCell', 'tableHeader', 'panel', 'layoutColumn', 'expand', 'nestedExpand', 'bodiedExtension'];
|
|
22
21
|
var DISABLE_CHILD_DROP_TARGET = ['orderedList', 'bulletList'];
|
|
@@ -179,7 +178,7 @@ export var dropTargetDecorations = function dropTargetDecorations(newState, api,
|
|
|
179
178
|
popNodeStack(depth);
|
|
180
179
|
prevNodeStack.push(node);
|
|
181
180
|
};
|
|
182
|
-
var isAdvancedLayoutsPreRelease2 =
|
|
181
|
+
var isAdvancedLayoutsPreRelease2 = editorExperiment('advanced_layouts', true);
|
|
183
182
|
newState.doc.nodesBetween(docFrom, docTo, function (node, pos, parent, index) {
|
|
184
183
|
var depth = 0;
|
|
185
184
|
// drop target deco at the end position
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
2
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
|
-
import { isPreRelease1, isPreRelease2 } from '../utils/advanced-layouts-flags';
|
|
4
3
|
var isEmptyNestedParagraphOrHeading = function isEmptyNestedParagraphOrHeading(target) {
|
|
5
4
|
if (target instanceof HTMLHeadingElement || target instanceof HTMLParagraphElement) {
|
|
6
5
|
var _target$parentElement;
|
|
@@ -50,7 +49,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
50
49
|
if (editorExperiment('nested-dnd', true) && isEmptyNestedParagraphOrHeading(rootElement)) {
|
|
51
50
|
return false;
|
|
52
51
|
}
|
|
53
|
-
if (rootElement.getAttribute('data-drag-handler-node-type') === 'media' &&
|
|
52
|
+
if (rootElement.getAttribute('data-drag-handler-node-type') === 'media' && editorExperiment('advanced_layouts', true)) {
|
|
54
53
|
rootElement = rootElement.closest('[data-drag-handler-anchor-name][data-drag-handler-node-type="mediaSingle"]');
|
|
55
54
|
if (!rootElement) {
|
|
56
55
|
return false;
|
|
@@ -94,7 +93,7 @@ export var handleMouseOver = function handleMouseOver(view, event, api) {
|
|
|
94
93
|
pos = view.posAtDOM(rootElement, 0);
|
|
95
94
|
}
|
|
96
95
|
var node = view.state.doc.nodeAt(pos);
|
|
97
|
-
if (
|
|
96
|
+
if (editorExperiment('advanced_layouts', true) && node && isLayoutColumnWithoutContent(node)) {
|
|
98
97
|
// Don't show drag handle when there is no content/only placeholder in layout column
|
|
99
98
|
return false;
|
|
100
99
|
}
|
|
@@ -2,9 +2,9 @@ import { bindKeymapWithCommand, dragToMoveDown, dragToMoveLeft, dragToMoveRight,
|
|
|
2
2
|
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
|
-
import { moveNodeViaShortcut } from '../commands/move-node';
|
|
6
|
-
import { showDragHandleAtSelection } from '../commands/show-drag-handle';
|
|
7
|
-
import { DIRECTION } from '
|
|
5
|
+
import { moveNodeViaShortcut } from '../editor-commands/move-node';
|
|
6
|
+
import { showDragHandleAtSelection } from '../editor-commands/show-drag-handle';
|
|
7
|
+
import { DIRECTION } from './utils/consts';
|
|
8
8
|
function keymapList(api, formatMessage) {
|
|
9
9
|
var keymapList = {};
|
|
10
10
|
if (api && fg('platform_editor_element_drag_and_drop_ed_23873')) {
|
|
@@ -12,16 +12,15 @@ import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-sc
|
|
|
12
12
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
13
13
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
14
14
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
|
-
import { defaultActiveAnchorTracker } from '../utils/active-anchor-tracker';
|
|
16
|
-
import { isPreRelease2 } from '../utils/advanced-layouts-flags';
|
|
17
|
-
import { AnchorRectCache, isAnchorSupported } from '../utils/anchor-utils';
|
|
18
|
-
import { isBlocksDragTargetDebug } from '../utils/drag-target-debug';
|
|
19
|
-
import { getTrMetadata } from '../utils/transactions';
|
|
20
15
|
import { findNodeDecs, nodeDecorations } from './decorations-anchor';
|
|
21
16
|
import { dragHandleDecoration, emptyParagraphNodeDecorations, findHandleDec } from './decorations-drag-handle';
|
|
22
17
|
import { dropTargetDecorations, findDropTargetDecs } from './decorations-drop-target';
|
|
23
18
|
import { handleMouseOver } from './handle-mouse-over';
|
|
24
19
|
import { boundKeydownHandler } from './keymap';
|
|
20
|
+
import { defaultActiveAnchorTracker } from './utils/active-anchor-tracker';
|
|
21
|
+
import { AnchorRectCache, isAnchorSupported } from './utils/anchor-utils';
|
|
22
|
+
import { isBlocksDragTargetDebug } from './utils/drag-target-debug';
|
|
23
|
+
import { getTrMetadata } from './utils/transactions';
|
|
25
24
|
export var key = new PluginKey('blockControls');
|
|
26
25
|
var isHTMLElement = function isHTMLElement(element) {
|
|
27
26
|
return element instanceof HTMLElement;
|
|
@@ -495,7 +494,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
495
494
|
return false;
|
|
496
495
|
},
|
|
497
496
|
dragenter: function dragenter(_view, event) {
|
|
498
|
-
if (
|
|
497
|
+
if (editorExperiment('advanced_layouts', true)) {
|
|
499
498
|
if (isHTMLElement(event.target)) {
|
|
500
499
|
var closestParentElement = event.target.closest('[data-drag-handler-anchor-depth="0"]');
|
|
501
500
|
if (closestParentElement) {
|
|
@@ -509,7 +508,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
509
508
|
},
|
|
510
509
|
dragstart: function dragstart(view) {
|
|
511
510
|
var _anchorRectCache;
|
|
512
|
-
if (
|
|
511
|
+
if (editorExperiment('advanced_layouts', true)) {
|
|
513
512
|
defaultActiveAnchorTracker.reset();
|
|
514
513
|
}
|
|
515
514
|
(_anchorRectCache = anchorRectCache) === null || _anchorRectCache === void 0 || _anchorRectCache.setEditorView(view);
|
|
@@ -4,7 +4,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
5
|
import { EventEmitter } from 'events';
|
|
6
6
|
import { useCallback, useEffect, useState } from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
8
|
export var ActiveAnchorTracker = /*#__PURE__*/function () {
|
|
9
9
|
function ActiveAnchorTracker() {
|
|
10
10
|
_classCallCheck(this, ActiveAnchorTracker);
|
|
@@ -62,7 +62,7 @@ export var useActiveAnchorTracker = function useActiveAnchorTracker(anchorName)
|
|
|
62
62
|
setIsActive(eventIsActive);
|
|
63
63
|
};
|
|
64
64
|
useEffect(function () {
|
|
65
|
-
if (activeAnchorTracker && anchorName &&
|
|
65
|
+
if (activeAnchorTracker && anchorName && editorExperiment('advanced_layouts', true)) {
|
|
66
66
|
activeAnchorTracker.subscribe(anchorName, onActive);
|
|
67
67
|
var unsubscribe = function unsubscribe() {
|
|
68
68
|
activeAnchorTracker.unsubscribe(anchorName, onActive);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
2
2
|
export var DIRECTION = /*#__PURE__*/function (DIRECTION) {
|
|
3
3
|
DIRECTION["UP"] = "up";
|
|
4
4
|
DIRECTION["DOWN"] = "down";
|
|
@@ -7,6 +7,6 @@ export var DIRECTION = /*#__PURE__*/function (DIRECTION) {
|
|
|
7
7
|
return DIRECTION;
|
|
8
8
|
}({});
|
|
9
9
|
export var maxLayoutColumnSupported = function maxLayoutColumnSupported() {
|
|
10
|
-
return
|
|
10
|
+
return editorExperiment('advanced_layouts', true) ? 5 : 3;
|
|
11
11
|
};
|
|
12
12
|
export var MIN_LAYOUT_COLUMN = 2;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H3_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, dragHandleGap } from '
|
|
1
|
+
import { DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, DRAG_HANDLE_H3_TOP_ADJUSTMENT, DRAG_HANDLE_H4_TOP_ADJUSTMENT, DRAG_HANDLE_H5_TOP_ADJUSTMENT, DRAG_HANDLE_H6_TOP_ADJUSTMENT, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, dragHandleGap } from '../../ui/consts';
|
|
2
2
|
export var getTopPosition = function getTopPosition(dom, type) {
|
|
3
3
|
if (!dom) {
|
|
4
4
|
return 'auto';
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
2
|
-
import {
|
|
3
|
-
import { isPreRelease1, isPreRelease2 } from './advanced-layouts-flags';
|
|
2
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
3
|
import { isWrappedMedia } from './check-media-layout';
|
|
4
|
+
import { maxLayoutColumnSupported } from './consts';
|
|
5
5
|
export var shouldAllowInlineDropTarget = function shouldAllowInlineDropTarget(isNested, node) {
|
|
6
6
|
var isSameLayout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
7
7
|
var activeNode = arguments.length > 3 ? arguments[3] : undefined;
|
|
8
|
-
if (
|
|
8
|
+
if (editorExperiment('advanced_layouts', false) || isNested) {
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
11
|
if (isWrappedMedia(node)) {
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
|
-
if (
|
|
14
|
+
if ((activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeType) === 'layoutSection') {
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
17
|
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'layoutSection') {
|
|
18
|
-
return node.childCount < maxLayoutColumnSupported() ||
|
|
18
|
+
return node.childCount < maxLayoutColumnSupported() || isSameLayout;
|
|
19
19
|
}
|
|
20
20
|
return !isEmptyParagraph(node);
|
|
21
21
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_COLUMN_DISTRIBUTIONS } from '
|
|
1
|
+
import { DEFAULT_COLUMN_DISTRIBUTIONS } from '../../ui/consts';
|
|
2
2
|
export var updateColumnWidths = function updateColumnWidths(tr, layoutNode, layoutNodePos, childCount) {
|
|
3
3
|
var newColumnWidth = DEFAULT_COLUMN_DISTRIBUTIONS[childCount];
|
|
4
4
|
if (newColumnWidth) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
|
2
2
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
3
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
|
-
import { isPreRelease2 } from '../utils/advanced-layouts-flags';
|
|
5
4
|
export var isInsideTable = function isInsideTable(nodeType) {
|
|
6
5
|
var _nodeType$schema$node = nodeType.schema.nodes,
|
|
7
6
|
tableCell = _nodeType$schema$node.tableCell,
|
|
@@ -73,7 +72,7 @@ export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNod
|
|
|
73
72
|
var srcNodeType = srcNode.type;
|
|
74
73
|
var parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
|
|
75
74
|
var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
|
|
76
|
-
if (
|
|
75
|
+
if (activeNodeType === 'layoutColumn' && editorExperiment('advanced_layouts', true)) {
|
|
77
76
|
// Allow drag layout column and drop into layout section
|
|
78
77
|
if ((destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection' || parentNodeType === 'doc') {
|
|
79
78
|
return true;
|
package/dist/esm/ui/consts.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
var _dropTargetMarginMap;
|
|
3
3
|
import { akEditorUnitZIndex, akRichMediaResizeZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import {
|
|
4
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
5
|
export var DRAG_HANDLE_HEIGHT = 24;
|
|
6
6
|
export var DRAG_HANDLE_WIDTH = 12;
|
|
7
7
|
export var DRAG_HANDLE_BORDER_RADIUS = 4;
|
|
@@ -20,7 +20,7 @@ export var dragHandleGap = function dragHandleGap(nodeType, parentNodeType) {
|
|
|
20
20
|
if (parentNodeType && parentNodeType !== 'doc') {
|
|
21
21
|
return DRAG_HANDLE_NARROW_GAP;
|
|
22
22
|
}
|
|
23
|
-
if (nodeType === 'layoutSection' &&
|
|
23
|
+
if (nodeType === 'layoutSection' && editorExperiment('advanced_layouts', true)) {
|
|
24
24
|
return DRAG_HANDLE_MAX_GAP + 12;
|
|
25
25
|
}
|
|
26
26
|
if (nodeTypeExcludeList.includes(nodeType)) {
|
|
@@ -48,7 +48,7 @@ export var getNestedNodeLeftPaddingMargin = function getNestedNodeLeftPaddingMar
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
export var topPositionAdjustment = function topPositionAdjustment(nodeType) {
|
|
51
|
-
if (
|
|
51
|
+
if (editorExperiment('advanced_layouts', true)) {
|
|
52
52
|
switch (nodeType) {
|
|
53
53
|
case 'rule':
|
|
54
54
|
return -DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT;
|
|
@@ -20,9 +20,8 @@ import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/el
|
|
|
20
20
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
21
21
|
import Tooltip from '@atlaskit/tooltip';
|
|
22
22
|
import { key } from '../pm-plugins/main';
|
|
23
|
-
import { getNestedNodePosition, selectNode } from '../utils';
|
|
24
|
-
import {
|
|
25
|
-
import { getLeftPosition, getTopPosition } from '../utils/drag-handle-positions';
|
|
23
|
+
import { getNestedNodePosition, selectNode } from '../pm-plugins/utils';
|
|
24
|
+
import { getLeftPosition, getTopPosition } from '../pm-plugins/utils/drag-handle-positions';
|
|
26
25
|
import { DRAG_HANDLE_BORDER_RADIUS, DRAG_HANDLE_HEIGHT, DRAG_HANDLE_WIDTH, DRAG_HANDLE_ZINDEX, dragHandleGap, topPositionAdjustment } from './consts';
|
|
27
26
|
import { dragPreview } from './drag-preview';
|
|
28
27
|
var dragHandleButtonStyles = css({
|
|
@@ -138,7 +137,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
138
137
|
// but ensures the preview is generated correctly.
|
|
139
138
|
var handleMouseDown = useCallback(function () {
|
|
140
139
|
var _api$core3;
|
|
141
|
-
if (!(isLayoutColumn &&
|
|
140
|
+
if (!(isLayoutColumn && editorExperiment('advanced_layouts', true)) && fg('platform_editor_element_drag_and_drop_ed_24885')) {
|
|
142
141
|
return undefined;
|
|
143
142
|
}
|
|
144
143
|
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(function (_ref3) {
|
|
@@ -152,7 +151,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
152
151
|
return tr;
|
|
153
152
|
}
|
|
154
153
|
var selection;
|
|
155
|
-
if (isLayoutColumn &&
|
|
154
|
+
if (isLayoutColumn && editorExperiment('advanced_layouts', true)) {
|
|
156
155
|
selection = new NodeSelection(tr.doc.resolve(startPos));
|
|
157
156
|
} else {
|
|
158
157
|
var $startPos = tr.doc.resolve(startPos + node.nodeSize);
|
|
@@ -285,8 +284,8 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
285
284
|
var isEdgeCase = (hasResizer || isExtension || isEmbedCard || isBlockCard) && innerContainer;
|
|
286
285
|
if (supportsAnchor) {
|
|
287
286
|
return {
|
|
288
|
-
left: isEdgeCase ? "calc(anchor(".concat(anchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") :
|
|
289
|
-
top:
|
|
287
|
+
left: isEdgeCase ? "calc(anchor(".concat(anchorName, " start) + ").concat(getLeftPosition(dom, nodeType, innerContainer, isMacroInteractionUpdates, parentNodeType), ")") : editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc((anchor(".concat(anchorName, " right) + anchor(").concat(anchorName, " left))/2 - ").concat(DRAG_HANDLE_HEIGHT / 2, "px)") : "calc(anchor(".concat(anchorName, " start) - ").concat(DRAG_HANDLE_WIDTH, "px - ").concat(dragHandleGap(nodeType, parentNodeType), "px)"),
|
|
288
|
+
top: editorExperiment('advanced_layouts', true) && isLayoutColumn ? "calc(anchor(".concat(anchorName, " top) - ").concat(DRAG_HANDLE_WIDTH, "px)") : fg('platform_editor_elements_dnd_ed_23674') ? "calc(anchor(".concat(anchorName, " start) + ").concat(topPositionAdjustment(nodeType), "px)") : anchorName.includes('table') ? "calc(anchor(".concat(anchorName, " start) + ").concat(DRAG_HANDLE_HEIGHT, "px)") : "anchor(".concat(anchorName, " start)")
|
|
290
289
|
};
|
|
291
290
|
}
|
|
292
291
|
return {
|
|
@@ -409,7 +408,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
409
408
|
// eslint-disable-next-line @atlaskit/design-system/no-html-button
|
|
410
409
|
jsx("button", {
|
|
411
410
|
type: "button",
|
|
412
|
-
css: [dragHandleButtonStyles,
|
|
411
|
+
css: [dragHandleButtonStyles, editorExperiment('advanced_layouts', true) && isLayoutColumn && layoutColumnDragHandleStyles, dragHandleSelected && selectedStyles],
|
|
413
412
|
ref: buttonRef
|
|
414
413
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
415
414
|
,
|
|
@@ -13,9 +13,9 @@ import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indi
|
|
|
13
13
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
14
14
|
import { B200 } from '@atlaskit/theme/colors';
|
|
15
15
|
import { getNodeAnchor } from '../pm-plugins/decorations-common';
|
|
16
|
-
import { useActiveAnchorTracker } from '../utils/active-anchor-tracker';
|
|
17
|
-
import { isAnchorSupported } from '../utils/anchor-utils';
|
|
18
|
-
import { isBlocksDragTargetDebug } from '../utils/drag-target-debug';
|
|
16
|
+
import { useActiveAnchorTracker } from '../pm-plugins/utils/active-anchor-tracker';
|
|
17
|
+
import { isAnchorSupported } from '../pm-plugins/utils/anchor-utils';
|
|
18
|
+
import { isBlocksDragTargetDebug } from '../pm-plugins/utils/drag-target-debug';
|
|
19
19
|
|
|
20
20
|
// 8px gap + 16px on left and right
|
|
21
21
|
var DROP_TARGET_LAYOUT_DROP_ZONE_WIDTH = 40;
|
|
@@ -15,11 +15,10 @@ import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element
|
|
|
15
15
|
import { layers } from '@atlaskit/theme/constants';
|
|
16
16
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
17
17
|
import { getNodeAnchor } from '../pm-plugins/decorations-common';
|
|
18
|
-
import { useActiveAnchorTracker } from '../utils/active-anchor-tracker';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { shouldAllowInlineDropTarget } from '../utils/inline-drop-target';
|
|
18
|
+
import { useActiveAnchorTracker } from '../pm-plugins/utils/active-anchor-tracker';
|
|
19
|
+
import { isAnchorSupported } from '../pm-plugins/utils/anchor-utils';
|
|
20
|
+
import { isBlocksDragTargetDebug } from '../pm-plugins/utils/drag-target-debug';
|
|
21
|
+
import { shouldAllowInlineDropTarget } from '../pm-plugins/utils/inline-drop-target';
|
|
23
22
|
import { getNestedNodeLeftPaddingMargin } from './consts';
|
|
24
23
|
import { InlineDropTarget } from './inline-drop-target';
|
|
25
24
|
var DEFAULT_DROP_INDICATOR_WIDTH = 760;
|
|
@@ -89,7 +88,7 @@ var HoverZone = function HoverZone(_ref) {
|
|
|
89
88
|
return dropTargetForElements({
|
|
90
89
|
element: ref.current,
|
|
91
90
|
onDragEnter: function onDragEnter() {
|
|
92
|
-
if (!isNestedDropTarget &&
|
|
91
|
+
if (!isNestedDropTarget && editorExperiment('advanced_layouts', true)) {
|
|
93
92
|
setActiveAnchor();
|
|
94
93
|
}
|
|
95
94
|
_onDragEnter();
|
|
@@ -14,7 +14,7 @@ import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indi
|
|
|
14
14
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
15
15
|
import { layers } from '@atlaskit/theme/constants';
|
|
16
16
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
17
|
-
import { isBlocksDragTargetDebug } from '../utils/drag-target-debug';
|
|
17
|
+
import { isBlocksDragTargetDebug } from '../pm-plugins/utils/drag-target-debug';
|
|
18
18
|
import { dropTargetMarginMap, getNestedNodeLeftPaddingMargin, nodeMargins, spaceLookupMap } from './consts';
|
|
19
19
|
var DEFAULT_DROP_INDICATOR_WIDTH = 760;
|
|
20
20
|
var EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_WIDTH = '--editor-block-controls-drop-indicator-width';
|
|
@@ -112,7 +112,7 @@ export var DropTarget = function DropTarget(_ref3) {
|
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
// This should be moved to platform/packages/editor/editor-plugin-block-controls/src/utils/validation.ts
|
|
115
|
+
// This should be moved to platform/packages/editor/editor-plugin-block-controls/src/pm-plugins/utils/validation.ts
|
|
116
116
|
// Since we are moved to drop-target-v2
|
|
117
117
|
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
118
118
|
if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
|
|
@@ -13,11 +13,11 @@ import { akEditorBreakoutPadding } from '@atlaskit/editor-shared-styles';
|
|
|
13
13
|
import { DropIndicator } from '@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box';
|
|
14
14
|
import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
15
15
|
import { B200 } from '@atlaskit/theme/colors';
|
|
16
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
16
17
|
import { getNodeAnchor } from '../pm-plugins/decorations-common';
|
|
17
|
-
import { useActiveAnchorTracker } from '../utils/active-anchor-tracker';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { isBlocksDragTargetDebug } from '../utils/drag-target-debug';
|
|
18
|
+
import { useActiveAnchorTracker } from '../pm-plugins/utils/active-anchor-tracker';
|
|
19
|
+
import { isAnchorSupported } from '../pm-plugins/utils/anchor-utils';
|
|
20
|
+
import { isBlocksDragTargetDebug } from '../pm-plugins/utils/drag-target-debug';
|
|
21
21
|
var hoverZoneCommonStyle = css({
|
|
22
22
|
position: 'absolute',
|
|
23
23
|
// above the top and bottom drop zone as block hover zone
|
|
@@ -77,7 +77,6 @@ export var InlineDropTarget = function InlineDropTarget(_ref) {
|
|
|
77
77
|
_useActiveAnchorTrack2 = _slicedToArray(_useActiveAnchorTrack, 1),
|
|
78
78
|
isActiveAnchor = _useActiveAnchorTrack2[0];
|
|
79
79
|
var isLeftPosition = position === 'left';
|
|
80
|
-
var shouldShowResponsiveLayout = showResponsiveLayout();
|
|
81
80
|
var nodeDimension = useMemo(function () {
|
|
82
81
|
if (!nextNode) {
|
|
83
82
|
return defaultNodeDimension;
|
|
@@ -118,7 +117,7 @@ export var InlineDropTarget = function InlineDropTarget(_ref) {
|
|
|
118
117
|
|
|
119
118
|
// Set the height target anchor name to the first or last column of the layout section so that it also works for stacked layout
|
|
120
119
|
var heightTargetAnchorName = targetAnchorName;
|
|
121
|
-
if (
|
|
120
|
+
if (editorExperiment('advanced_layouts', true) && nextNode.type.name === 'layoutSection' && nextNode.firstChild && nextNode.lastChild) {
|
|
122
121
|
heightTargetAnchorName = isLeftPosition ? getNodeAnchor(nextNode.firstChild) : getNodeAnchor(nextNode.lastChild);
|
|
123
122
|
}
|
|
124
123
|
if (isAnchorSupported()) {
|
|
@@ -151,7 +150,7 @@ export var InlineDropTarget = function InlineDropTarget(_ref) {
|
|
|
151
150
|
};
|
|
152
151
|
}
|
|
153
152
|
return defaultNodeDimension;
|
|
154
|
-
}, [anchorName, anchorRectCache, nextNode, position, isLeftPosition
|
|
153
|
+
}, [anchorName, anchorRectCache, nextNode, position, isLeftPosition]);
|
|
155
154
|
var onDrop = useCallback(function () {
|
|
156
155
|
var _api$blockControls;
|
|
157
156
|
var _ref2 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
@@ -169,8 +168,8 @@ export var InlineDropTarget = function InlineDropTarget(_ref) {
|
|
|
169
168
|
}
|
|
170
169
|
}, [api, getPos, position]);
|
|
171
170
|
var inlineHoverZoneRectStyle = useMemo(function () {
|
|
172
|
-
var isLayoutNode = (nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name) === 'layoutSection';
|
|
173
|
-
var layoutAdjustment = isLayoutNode
|
|
171
|
+
var isLayoutNode = editorExperiment('advanced_layouts', true) && (nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name) === 'layoutSection';
|
|
172
|
+
var layoutAdjustment = isLayoutNode ? {
|
|
174
173
|
width: 11,
|
|
175
174
|
height: 4,
|
|
176
175
|
top: 6,
|
|
@@ -184,11 +183,11 @@ export var InlineDropTarget = function InlineDropTarget(_ref) {
|
|
|
184
183
|
top: "calc(anchor(top))",
|
|
185
184
|
width: nodeDimension.widthOffset ? "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px + ").concat(nodeDimension.widthOffset, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)") : "calc((100% - ".concat(nodeDimension.width, ")/2 - ").concat(GAP, "px - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.width) || 0, "px)"),
|
|
186
185
|
height: "calc(".concat(nodeDimension.height, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.height) || 0, "px)")
|
|
187
|
-
}, isLayoutNode &&
|
|
186
|
+
}, isLayoutNode && {
|
|
188
187
|
top: isLeftPosition ? "calc(".concat(nodeDimension.top, " + ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.top) || 0, "px)") : 'unset',
|
|
189
188
|
bottom: isLeftPosition ? 'unset' : "calc(".concat(nodeDimension.bottom, " - ").concat((layoutAdjustment === null || layoutAdjustment === void 0 ? void 0 : layoutAdjustment.bottom) || 0, "px)")
|
|
190
189
|
});
|
|
191
|
-
}, [anchorName, isLeftPosition, nodeDimension
|
|
190
|
+
}, [nextNode === null || nextNode === void 0 ? void 0 : nextNode.type.name, anchorName, isLeftPosition, nodeDimension]);
|
|
192
191
|
var dropIndicatorPos = useMemo(function () {
|
|
193
192
|
return isLeftPosition ? 'right' : 'left';
|
|
194
193
|
}, [isLeftPosition]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type IntlShape } from 'react-intl-next';
|
|
2
2
|
import type { Command, EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import type { BlockControlsPlugin, MoveNodeMethod } from '../blockControlsPluginType';
|
|
4
|
+
import { DIRECTION } from '../pm-plugins/utils/consts';
|
|
5
5
|
export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION, formatMessage?: IntlShape['formatMessage']) => Command;
|
|
6
6
|
export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { BlockControlsPlugin } from '../
|
|
2
|
+
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
3
3
|
export declare const moveToLayout: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (from: number, to: number, options?: {
|
|
4
4
|
moveToEnd?: boolean;
|
|
5
5
|
}) => EditorCommand;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import type { BlockControlsPlugin } from '../
|
|
2
|
+
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
3
3
|
export declare const showDragHandleAtSelection: (api?: ExtractInjectionAPI<BlockControlsPlugin>, shouldFocusParentNode?: boolean) => Command;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { blockControlsPlugin } from './
|
|
2
|
-
export type { BlockControlsPlugin, BlockControlsSharedState, HandleOptions, MoveNodeMethod, } from './
|
|
1
|
+
export { blockControlsPlugin } from './blockControlsPlugin';
|
|
2
|
+
export type { BlockControlsPlugin, BlockControlsSharedState, HandleOptions, MoveNodeMethod, } from './blockControlsPluginType';
|
|
@@ -2,7 +2,7 @@ import { type IntlShape } from 'react-intl-next';
|
|
|
2
2
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { BlockControlsPlugin, HandleOptions } from '../
|
|
5
|
+
import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
|
|
6
6
|
export declare const emptyParagraphNodeDecorations: () => Decoration;
|
|
7
7
|
export declare const findHandleDec: (decorations: DecorationSet, from?: number, to?: number) => Decoration[];
|
|
8
8
|
export declare const dragHandleDecoration: (api: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage: IntlShape['formatMessage'], pos: number, anchorName: string, nodeType: string, nodeViewPortalProviderAPI: PortalProviderAPI, handleOptions?: HandleOptions) => Decoration;
|
|
@@ -3,10 +3,10 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { Decoration, type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
-
import type { ActiveNode, BlockControlsPlugin } from '../
|
|
6
|
+
import type { ActiveNode, BlockControlsPlugin } from '../blockControlsPluginType';
|
|
7
7
|
import { type DropTargetProps } from '../ui/drop-target';
|
|
8
8
|
import { type DropTargetLayoutProps } from '../ui/drop-target-layout';
|
|
9
|
-
import { type AnchorRectCache } from '
|
|
9
|
+
import { type AnchorRectCache } from './utils/anchor-utils';
|
|
10
10
|
/**
|
|
11
11
|
* Find drop target decorations in the pos range between from and to
|
|
12
12
|
* @param decorations
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import { type BlockControlsPlugin } from '../
|
|
3
|
+
import { type BlockControlsPlugin } from '../blockControlsPluginType';
|
|
4
4
|
export declare const handleMouseOver: (view: EditorView, event: Event, api: ExtractInjectionAPI<BlockControlsPlugin> | undefined) => false | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type IntlShape } from 'react-intl-next';
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { BlockControlsPlugin } from '../
|
|
3
|
+
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
4
4
|
export declare const boundKeydownHandler: (api?: ExtractInjectionAPI<BlockControlsPlugin>, formatMessage?: IntlShape['formatMessage']) => (view: import("prosemirror-view").EditorView, event: KeyboardEvent) => boolean;
|
|
@@ -5,8 +5,8 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
|
5
5
|
import type { EditorState, ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
8
|
-
import type { BlockControlsPlugin, PluginState } from '../
|
|
9
|
-
import { AnchorRectCache } from '
|
|
8
|
+
import type { BlockControlsPlugin, PluginState } from '../blockControlsPluginType';
|
|
9
|
+
import { AnchorRectCache } from './utils/anchor-utils';
|
|
10
10
|
export declare const key: PluginKey<PluginState>;
|
|
11
11
|
export interface FlagType {
|
|
12
12
|
isNestedEnabled: boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { type ActiveNode } from '
|
|
2
|
+
import { type ActiveNode } from '../../blockControlsPluginType';
|
|
3
3
|
export declare const shouldAllowInlineDropTarget: (isNested: boolean, node?: PMNode, isSameLayout?: boolean, activeNode?: ActiveNode) => boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import type { BlockControlsPlugin } from '../
|
|
3
|
+
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
4
4
|
export declare const DragHandleMenu: ({ api, }: {
|
|
5
5
|
api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
|
|
6
6
|
}) => JSX.Element | null;
|
|
@@ -2,7 +2,7 @@ import { jsx } from '@emotion/react';
|
|
|
2
2
|
import { type IntlShape } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
5
|
-
import type { BlockControlsPlugin, HandleOptions } from '../
|
|
5
|
+
import type { BlockControlsPlugin, HandleOptions } from '../blockControlsPluginType';
|
|
6
6
|
export declare const DragHandle: ({ view, api, formatMessage, getPos, anchorName, nodeType, handleOptions, isTopLevelNode, }: {
|
|
7
7
|
view: EditorView;
|
|
8
8
|
api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
|
|
@@ -2,8 +2,8 @@ import { jsx } from '@emotion/react';
|
|
|
2
2
|
import { type IntlShape } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import type { BlockControlsPlugin } from '../
|
|
6
|
-
import { type AnchorRectCache } from '../utils/anchor-utils';
|
|
5
|
+
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
6
|
+
import { type AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
|
|
7
7
|
export type DropTargetLayoutProps = {
|
|
8
8
|
api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
|
|
9
9
|
getPos: () => number | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import { type AnchorRectCache } from '../utils/anchor-utils';
|
|
2
|
+
import { type AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
|
|
3
3
|
import { type DropTargetProps } from './drop-target';
|
|
4
4
|
export declare const EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET = "--editor-block-controls-drop-indicator-offset";
|
|
5
5
|
export declare const EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP = "--editor-block-controls-drop-indicator-gap";
|
|
@@ -2,7 +2,7 @@ import { jsx } from '@emotion/react';
|
|
|
2
2
|
import { type IntlShape } from 'react-intl-next';
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
5
|
-
import type { BlockControlsPlugin } from '../
|
|
5
|
+
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
6
6
|
export type DropTargetStyle = 'default' | 'remainingHeight';
|
|
7
7
|
export type DropTargetProps = {
|
|
8
8
|
api: ExtractInjectionAPI<BlockControlsPlugin> | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from '@emotion/react';
|
|
2
|
-
import { type AnchorRectCache } from '../utils/anchor-utils';
|
|
2
|
+
import { type AnchorRectCache } from '../pm-plugins/utils/anchor-utils';
|
|
3
3
|
import { type DropTargetProps } from './drop-target';
|
|
4
4
|
export declare const InlineDropTarget: ({ api, nextNode, position, anchorRectCache, getPos, }: DropTargetProps & {
|
|
5
5
|
anchorRectCache?: AnchorRectCache | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type IntlShape } from 'react-intl-next';
|
|
2
2
|
import type { Command, EditorCommand, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import type { BlockControlsPlugin, MoveNodeMethod } from '../blockControlsPluginType';
|
|
4
|
+
import { DIRECTION } from '../pm-plugins/utils/consts';
|
|
5
5
|
export declare const moveNodeViaShortcut: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, direction: DIRECTION, formatMessage?: IntlShape['formatMessage']) => Command;
|
|
6
6
|
export declare const moveNode: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => (start: number, to: number, inputMethod?: MoveNodeMethod, formatMessage?: IntlShape['formatMessage']) => EditorCommand;
|