@atlaskit/editor-plugin-block-controls 2.26.0 → 2.26.2
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 +18 -0
- package/dist/cjs/editor-commands/move-node.js +79 -43
- package/dist/cjs/editor-commands/move-to-layout.js +23 -11
- package/dist/cjs/editor-commands/show-drag-handle.js +89 -3
- package/dist/cjs/pm-plugins/decorations-anchor.js +5 -10
- package/dist/cjs/pm-plugins/decorations-common.js +8 -10
- package/dist/cjs/pm-plugins/decorations-drag-handle.js +4 -19
- package/dist/cjs/pm-plugins/decorations-drop-target.js +8 -25
- package/dist/cjs/pm-plugins/main.js +28 -8
- package/dist/cjs/pm-plugins/utils/analytics.js +66 -0
- package/dist/cjs/pm-plugins/utils/selection.js +22 -2
- package/dist/cjs/ui/drag-handle.js +38 -10
- package/dist/es2019/editor-commands/move-node.js +76 -40
- package/dist/es2019/editor-commands/move-to-layout.js +23 -11
- package/dist/es2019/editor-commands/show-drag-handle.js +88 -3
- package/dist/es2019/pm-plugins/decorations-anchor.js +6 -11
- package/dist/es2019/pm-plugins/decorations-common.js +7 -9
- package/dist/es2019/pm-plugins/decorations-drag-handle.js +10 -25
- package/dist/es2019/pm-plugins/decorations-drop-target.js +11 -30
- package/dist/es2019/pm-plugins/main.js +24 -6
- package/dist/es2019/pm-plugins/utils/{fire-analytics.js → analytics.js} +31 -3
- package/dist/es2019/pm-plugins/utils/selection.js +22 -1
- package/dist/es2019/ui/drag-handle.js +34 -4
- package/dist/esm/editor-commands/move-node.js +80 -44
- package/dist/esm/editor-commands/move-to-layout.js +23 -11
- package/dist/esm/editor-commands/show-drag-handle.js +88 -2
- package/dist/esm/pm-plugins/decorations-anchor.js +6 -11
- package/dist/esm/pm-plugins/decorations-common.js +7 -9
- package/dist/esm/pm-plugins/decorations-drag-handle.js +4 -19
- package/dist/esm/pm-plugins/decorations-drop-target.js +8 -25
- package/dist/esm/pm-plugins/main.js +27 -7
- package/dist/esm/pm-plugins/utils/{fire-analytics.js → analytics.js} +32 -3
- package/dist/esm/pm-plugins/utils/selection.js +21 -1
- package/dist/esm/ui/drag-handle.js +37 -5
- package/dist/types/blockControlsPluginType.d.ts +1 -0
- package/dist/types/editor-commands/move-to-layout.d.ts +1 -0
- package/dist/types/editor-commands/show-drag-handle.d.ts +1 -1
- package/dist/types/pm-plugins/decorations-common.d.ts +1 -0
- package/dist/types/pm-plugins/main.d.ts +1 -0
- package/dist/types/pm-plugins/utils/analytics.d.ts +12 -0
- package/dist/types/pm-plugins/utils/selection.d.ts +9 -0
- package/dist/types-ts4.5/blockControlsPluginType.d.ts +1 -0
- package/dist/types-ts4.5/editor-commands/move-to-layout.d.ts +1 -0
- package/dist/types-ts4.5/editor-commands/show-drag-handle.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/decorations-common.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/utils/analytics.d.ts +12 -0
- package/dist/types-ts4.5/pm-plugins/utils/selection.d.ts +9 -0
- package/package.json +10 -7
- package/dist/cjs/pm-plugins/utils/fire-analytics.js +0 -36
- package/dist/types/pm-plugins/utils/fire-analytics.d.ts +0 -5
- package/dist/types-ts4.5/pm-plugins/utils/fire-analytics.d.ts +0 -5
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { createElement } from 'react';
|
|
3
3
|
import { bind } from 'bind-event-listener';
|
|
4
|
-
import ReactDOM from 'react-dom';
|
|
5
4
|
import uuid from 'uuid';
|
|
6
5
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
7
|
import { DragHandle } from '../ui/drag-handle';
|
|
10
8
|
import { TYPE_HANDLE_DEC, TYPE_NODE_DEC, unmountDecorations } from './decorations-common';
|
|
@@ -65,21 +63,8 @@ export var dragHandleDecoration = function dragHandleDecoration(api, formatMessa
|
|
|
65
63
|
// There are times when global clear: "both" styles are applied to this decoration causing jumpiness
|
|
66
64
|
// due to margins applied to other nodes eg. Headings
|
|
67
65
|
element.style.clear = 'unset';
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return /*#__PURE__*/createElement(DragHandle, {
|
|
71
|
-
view: view,
|
|
72
|
-
api: api,
|
|
73
|
-
formatMessage: formatMessage,
|
|
74
|
-
getPos: getPos,
|
|
75
|
-
anchorName: anchorName,
|
|
76
|
-
nodeType: nodeType,
|
|
77
|
-
handleOptions: handleOptions,
|
|
78
|
-
isTopLevelNode: isTopLevelNode
|
|
79
|
-
});
|
|
80
|
-
}, element, key);
|
|
81
|
-
} else {
|
|
82
|
-
ReactDOM.render( /*#__PURE__*/createElement(DragHandle, {
|
|
66
|
+
nodeViewPortalProviderAPI.render(function () {
|
|
67
|
+
return /*#__PURE__*/createElement(DragHandle, {
|
|
83
68
|
view: view,
|
|
84
69
|
api: api,
|
|
85
70
|
formatMessage: formatMessage,
|
|
@@ -88,8 +73,8 @@ export var dragHandleDecoration = function dragHandleDecoration(api, formatMessa
|
|
|
88
73
|
nodeType: nodeType,
|
|
89
74
|
handleOptions: handleOptions,
|
|
90
75
|
isTopLevelNode: isTopLevelNode
|
|
91
|
-
})
|
|
92
|
-
}
|
|
76
|
+
});
|
|
77
|
+
}, element, key);
|
|
93
78
|
return element;
|
|
94
79
|
}, {
|
|
95
80
|
side: -1,
|
|
@@ -2,11 +2,9 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
4
|
import { createElement } from 'react';
|
|
5
|
-
import ReactDOM from 'react-dom';
|
|
6
5
|
import uuid from 'uuid';
|
|
7
6
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
8
7
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
9
|
import { nodeMargins } from '../ui/consts';
|
|
12
10
|
import { DropTarget, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP, EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET } from '../ui/drop-target';
|
|
@@ -96,21 +94,13 @@ export var createDropTargetDecoration = function createDropTargetDecoration(pos,
|
|
|
96
94
|
element.style.setProperty(EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_OFFSET, "".concat(offset, "px"));
|
|
97
95
|
element.style.setProperty(EDITOR_BLOCK_CONTROLS_DROP_INDICATOR_GAP, "".concat(gap, "px"));
|
|
98
96
|
element.style.setProperty('display', 'block');
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return /*#__PURE__*/createElement(DropTarget, _objectSpread(_objectSpread({}, props), {}, {
|
|
102
|
-
getPos: getPos,
|
|
103
|
-
anchorRectCache: anchorRectCache,
|
|
104
|
-
isSameLayout: isSameLayout
|
|
105
|
-
}));
|
|
106
|
-
}, element, key);
|
|
107
|
-
} else {
|
|
108
|
-
ReactDOM.render( /*#__PURE__*/createElement(DropTarget, _objectSpread(_objectSpread({}, props), {}, {
|
|
97
|
+
nodeViewPortalProviderAPI.render(function () {
|
|
98
|
+
return /*#__PURE__*/createElement(DropTarget, _objectSpread(_objectSpread({}, props), {}, {
|
|
109
99
|
getPos: getPos,
|
|
110
100
|
anchorRectCache: anchorRectCache,
|
|
111
101
|
isSameLayout: isSameLayout
|
|
112
|
-
}))
|
|
113
|
-
}
|
|
102
|
+
}));
|
|
103
|
+
}, element, key);
|
|
114
104
|
return element;
|
|
115
105
|
}, {
|
|
116
106
|
type: TYPE_DROP_TARGET_DEC,
|
|
@@ -131,19 +121,12 @@ export var createLayoutDropTargetDecoration = function createLayoutDropTargetDec
|
|
|
131
121
|
element.setAttribute('data-blocks-drop-target-container', 'true');
|
|
132
122
|
element.setAttribute('data-blocks-drop-target-key', key);
|
|
133
123
|
element.style.clear = 'unset';
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return /*#__PURE__*/createElement(DropTargetLayout, _objectSpread(_objectSpread({}, props), {}, {
|
|
137
|
-
getPos: getPos,
|
|
138
|
-
anchorRectCache: anchorRectCache
|
|
139
|
-
}));
|
|
140
|
-
}, element, key);
|
|
141
|
-
} else {
|
|
142
|
-
ReactDOM.render( /*#__PURE__*/createElement(DropTargetLayout, _objectSpread(_objectSpread({}, props), {}, {
|
|
124
|
+
nodeViewPortalProviderAPI.render(function () {
|
|
125
|
+
return /*#__PURE__*/createElement(DropTargetLayout, _objectSpread(_objectSpread({}, props), {}, {
|
|
143
126
|
getPos: getPos,
|
|
144
127
|
anchorRectCache: anchorRectCache
|
|
145
|
-
}))
|
|
146
|
-
}
|
|
128
|
+
}));
|
|
129
|
+
}, element, key);
|
|
147
130
|
return element;
|
|
148
131
|
}, {
|
|
149
132
|
type: TYPE_DROP_TARGET_DEC
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
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; }
|
|
4
|
+
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) { _defineProperty(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; }
|
|
2
5
|
import rafSchedule from 'raf-schd';
|
|
3
6
|
import { AnalyticsStep } from '@atlaskit/adf-schema/steps';
|
|
4
7
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
@@ -19,7 +22,9 @@ import { dropTargetDecorations, findDropTargetDecs } from './decorations-drop-ta
|
|
|
19
22
|
import { handleMouseOver } from './handle-mouse-over';
|
|
20
23
|
import { boundKeydownHandler } from './keymap';
|
|
21
24
|
import { defaultActiveAnchorTracker } from './utils/active-anchor-tracker';
|
|
25
|
+
import { getMultiSelectAnalyticsAttributes } from './utils/analytics';
|
|
22
26
|
import { AnchorRectCache, isAnchorSupported } from './utils/anchor-utils';
|
|
27
|
+
import { getSelectedSlicePosition } from './utils/selection';
|
|
23
28
|
import { getTrMetadata } from './utils/transactions';
|
|
24
29
|
export var key = new PluginKey('blockControls');
|
|
25
30
|
var EDITOR_BLOCKS_DRAG_INIT = 'Editor Blocks Drag Initialization Time';
|
|
@@ -71,7 +76,8 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
71
76
|
}
|
|
72
77
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref3) {
|
|
73
78
|
var tr = _ref3.tr;
|
|
74
|
-
|
|
79
|
+
var isMultiSelect = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true);
|
|
80
|
+
if (isMultiSelect) {
|
|
75
81
|
var _api$blockControls, _api$selection;
|
|
76
82
|
var _ref4 = (api === null || api === void 0 || (_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
77
83
|
multiSelectDnD = _ref4.multiSelectDnD;
|
|
@@ -92,6 +98,13 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
92
98
|
// if no drop targets are rendered, assume that drop is invalid
|
|
93
99
|
if (location.current.dropTargets.length === 0) {
|
|
94
100
|
var _api$analytics2;
|
|
101
|
+
var nodeTypes, hasSelectedMultipleNodes;
|
|
102
|
+
if (isMultiSelect && api) {
|
|
103
|
+
var position = getSelectedSlicePosition(start, tr, api);
|
|
104
|
+
var attributes = getMultiSelectAnalyticsAttributes(tr, position.from, position.to);
|
|
105
|
+
nodeTypes = attributes.nodeTypes;
|
|
106
|
+
hasSelectedMultipleNodes = attributes.hasSelectedMultipleNodes;
|
|
107
|
+
}
|
|
95
108
|
var resolvedMovingNode = tr.doc.resolve(start);
|
|
96
109
|
var maybeNode = resolvedMovingNode.nodeAfter;
|
|
97
110
|
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
|
|
@@ -99,10 +112,13 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
99
112
|
action: ACTION.CANCELLED,
|
|
100
113
|
actionSubject: ACTION_SUBJECT.DRAG,
|
|
101
114
|
actionSubjectId: ACTION_SUBJECT_ID.ELEMENT_DRAG_HANDLE,
|
|
102
|
-
attributes: {
|
|
115
|
+
attributes: _objectSpread({
|
|
103
116
|
nodeDepth: resolvedMovingNode.depth,
|
|
104
117
|
nodeType: (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.type.name) || ''
|
|
105
|
-
}
|
|
118
|
+
}, isMultiSelect && {
|
|
119
|
+
nodeTypes: nodeTypes,
|
|
120
|
+
hasSelectedMultipleNodes: hasSelectedMultipleNodes
|
|
121
|
+
})
|
|
106
122
|
})(tr);
|
|
107
123
|
}
|
|
108
124
|
return tr.setMeta(key, {
|
|
@@ -127,6 +143,10 @@ var initialState = {
|
|
|
127
143
|
isPMDragging: false,
|
|
128
144
|
multiSelectDnD: undefined
|
|
129
145
|
};
|
|
146
|
+
export var getDecorations = function getDecorations(state) {
|
|
147
|
+
var _key$getState;
|
|
148
|
+
return (_key$getState = key.getState(state)) === null || _key$getState === void 0 ? void 0 : _key$getState.decorations;
|
|
149
|
+
};
|
|
130
150
|
export var newApply = function newApply(api, formatMessage, tr, currentState, newState, flags, nodeViewPortalProviderAPI, anchorRectCache) {
|
|
131
151
|
var _meta$activeNode, _activeNode, _activeNode2, _meta$activeNode$hand, _meta$isDragging, _meta$isDragging2, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$multiSelectDnD;
|
|
132
152
|
var activeNode = currentState.activeNode,
|
|
@@ -462,12 +482,12 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
462
482
|
},
|
|
463
483
|
props: {
|
|
464
484
|
decorations: function decorations(state) {
|
|
465
|
-
var _api$editorDisabled, _key$
|
|
485
|
+
var _api$editorDisabled, _key$getState2;
|
|
466
486
|
var isDisabled = api === null || api === void 0 || (_api$editorDisabled = api.editorDisabled) === null || _api$editorDisabled === void 0 || (_api$editorDisabled = _api$editorDisabled.sharedState.currentState()) === null || _api$editorDisabled === void 0 ? void 0 : _api$editorDisabled.editorDisabled;
|
|
467
487
|
if (isDisabled) {
|
|
468
488
|
return;
|
|
469
489
|
}
|
|
470
|
-
return (_key$
|
|
490
|
+
return (_key$getState2 = key.getState(state)) === null || _key$getState2 === void 0 ? void 0 : _key$getState2.decorations;
|
|
471
491
|
},
|
|
472
492
|
handleDOMEvents: {
|
|
473
493
|
drop: function drop(view, event) {
|
|
@@ -540,10 +560,10 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
540
560
|
}));
|
|
541
561
|
},
|
|
542
562
|
dragend: function dragend(view) {
|
|
543
|
-
var _key$
|
|
563
|
+
var _key$getState3;
|
|
544
564
|
var state = view.state,
|
|
545
565
|
dispatch = view.dispatch;
|
|
546
|
-
if ((_key$
|
|
566
|
+
if ((_key$getState3 = key.getState(state)) !== null && _key$getState3 !== void 0 && _key$getState3.isPMDragging) {
|
|
547
567
|
dispatch(state.tr.setMeta(key, {
|
|
548
568
|
isPMDragging: false
|
|
549
569
|
}));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
-
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
export var attachMoveNodeAnalytics = function attachMoveNodeAnalytics(tr, inputMethod, fromDepth, fromNodeType, toDepth, toNodeType, isSameParent, api, fromNodeTypes, hasSelectedMultipleNodes) {
|
|
3
5
|
var _api$analytics;
|
|
4
6
|
return api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.attachAnalyticsEvent({
|
|
5
7
|
eventType: EVENT_TYPE.TRACK,
|
|
@@ -9,6 +11,8 @@ export var attachMoveNodeAnalytics = function attachMoveNodeAnalytics(tr, inputM
|
|
|
9
11
|
attributes: {
|
|
10
12
|
nodeDepth: fromDepth,
|
|
11
13
|
nodeType: fromNodeType,
|
|
14
|
+
nodeTypes: fromNodeTypes,
|
|
15
|
+
hasSelectedMultipleNodes: hasSelectedMultipleNodes,
|
|
12
16
|
destinationNodeDepth: toDepth,
|
|
13
17
|
destinationNodeType: toNodeType,
|
|
14
18
|
isSameParent: isSameParent,
|
|
@@ -16,15 +20,40 @@ export var attachMoveNodeAnalytics = function attachMoveNodeAnalytics(tr, inputM
|
|
|
16
20
|
}
|
|
17
21
|
})(tr);
|
|
18
22
|
};
|
|
19
|
-
export var fireInsertLayoutAnalytics = function fireInsertLayoutAnalytics(tr, api) {
|
|
23
|
+
export var fireInsertLayoutAnalytics = function fireInsertLayoutAnalytics(tr, api, nodeTypes, hasSelectedMultipleNodes) {
|
|
20
24
|
var _api$analytics2;
|
|
21
25
|
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.attachAnalyticsEvent({
|
|
22
26
|
action: ACTION.INSERTED,
|
|
23
27
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
24
28
|
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
25
29
|
attributes: {
|
|
26
|
-
inputMethod: INPUT_METHOD.DRAG_AND_DROP
|
|
30
|
+
inputMethod: INPUT_METHOD.DRAG_AND_DROP,
|
|
31
|
+
nodeTypes: nodeTypes,
|
|
32
|
+
hasSelectedMultipleNodes: hasSelectedMultipleNodes
|
|
27
33
|
},
|
|
28
34
|
eventType: EVENT_TYPE.TRACK
|
|
29
35
|
})(tr);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Given a range, return distinctive types of node and whether there are multiple nodes in the range
|
|
40
|
+
*/
|
|
41
|
+
export var getMultiSelectAnalyticsAttributes = function getMultiSelectAnalyticsAttributes(tr, anchor, head) {
|
|
42
|
+
var nodeTypes = [];
|
|
43
|
+
var from = Math.min(anchor, head);
|
|
44
|
+
var to = Math.max(anchor, head);
|
|
45
|
+
tr.doc.nodesBetween(from, to, function (node, pos) {
|
|
46
|
+
if (pos < from) {
|
|
47
|
+
// ignore parent node
|
|
48
|
+
return true;
|
|
49
|
+
}
|
|
50
|
+
nodeTypes.push(node.type.name);
|
|
51
|
+
|
|
52
|
+
// only care about the top level (relatively in the range) nodes
|
|
53
|
+
return false;
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
nodeTypes: fg('platform_editor_track_node_types') ? _toConsumableArray(new Set(nodeTypes)).sort().join(',') : undefined,
|
|
57
|
+
hasSelectedMultipleNodes: nodeTypes.length > 1
|
|
58
|
+
};
|
|
30
59
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export var getMultiSelectionIfPosInside = function getMultiSelectionIfPosInside(api, pos) {
|
|
2
2
|
var _api$blockControls;
|
|
3
|
-
var _ref = (
|
|
3
|
+
var _ref = ((_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
4
4
|
multiSelectDnD = _ref.multiSelectDnD;
|
|
5
5
|
if (multiSelectDnD && multiSelectDnD.anchor >= 0 && multiSelectDnD.head >= 0) {
|
|
6
6
|
var multiFrom = Math.min(multiSelectDnD.anchor, multiSelectDnD.head);
|
|
@@ -13,4 +13,24 @@ export var getMultiSelectionIfPosInside = function getMultiSelectionIfPosInside(
|
|
|
13
13
|
} : {};
|
|
14
14
|
}
|
|
15
15
|
return {};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @returns from and to positions of the selected content (after expansion)
|
|
21
|
+
*/
|
|
22
|
+
export var getSelectedSlicePosition = function getSelectedSlicePosition(handlePos, tr, api) {
|
|
23
|
+
var _activeNode$nodeSize;
|
|
24
|
+
var _getMultiSelectionIfP = getMultiSelectionIfPosInside(api, handlePos),
|
|
25
|
+
anchor = _getMultiSelectionIfP.anchor,
|
|
26
|
+
head = _getMultiSelectionIfP.head;
|
|
27
|
+
var inSelection = anchor !== undefined && head !== undefined;
|
|
28
|
+
var from = inSelection ? Math.min(anchor, head) : handlePos;
|
|
29
|
+
var activeNode = tr.doc.nodeAt(handlePos);
|
|
30
|
+
var activeNodeEndPos = handlePos + ((_activeNode$nodeSize = activeNode === null || activeNode === void 0 ? void 0 : activeNode.nodeSize) !== null && _activeNode$nodeSize !== void 0 ? _activeNode$nodeSize : 1);
|
|
31
|
+
var to = inSelection ? Math.max(anchor, head) : activeNodeEndPos;
|
|
32
|
+
return {
|
|
33
|
+
from: from,
|
|
34
|
+
to: to
|
|
35
|
+
};
|
|
16
36
|
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
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; }
|
|
5
|
+
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) { _defineProperty(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; }
|
|
3
6
|
/**
|
|
4
7
|
* @jsxRuntime classic
|
|
5
8
|
* @jsx jsx
|
|
@@ -23,6 +26,7 @@ import { Box, xcss } from '@atlaskit/primitives';
|
|
|
23
26
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
24
27
|
import Tooltip from '@atlaskit/tooltip';
|
|
25
28
|
import { key } from '../pm-plugins/main';
|
|
29
|
+
import { getMultiSelectAnalyticsAttributes } from '../pm-plugins/utils/analytics';
|
|
26
30
|
import { getLeftPosition, getTopPosition } from '../pm-plugins/utils/drag-handle-positions';
|
|
27
31
|
import { getNestedNodePosition } from '../pm-plugins/utils/getNestedNodePosition';
|
|
28
32
|
import { isHandleInSelection, selectNode } from '../pm-plugins/utils/getSelection';
|
|
@@ -254,7 +258,11 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
254
258
|
var isMultiSelect = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true, {
|
|
255
259
|
exposure: true
|
|
256
260
|
});
|
|
261
|
+
var nodeTypes, hasSelectedMultipleNodes;
|
|
262
|
+
var resolvedMovingNode = tr.doc.resolve(start);
|
|
263
|
+
var maybeNode = resolvedMovingNode.nodeAfter;
|
|
257
264
|
if (isMultiSelect) {
|
|
265
|
+
var _tr$getMeta;
|
|
258
266
|
var handlePos = getPos();
|
|
259
267
|
if (typeof handlePos !== 'number') {
|
|
260
268
|
return tr;
|
|
@@ -265,22 +273,32 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
265
273
|
tr: tr
|
|
266
274
|
});
|
|
267
275
|
}
|
|
276
|
+
var multiSelectDnD = (_tr$getMeta = tr.getMeta(key)) === null || _tr$getMeta === void 0 ? void 0 : _tr$getMeta.multiSelectDnD;
|
|
277
|
+
if (multiSelectDnD) {
|
|
278
|
+
var attributes = getMultiSelectAnalyticsAttributes(tr, multiSelectDnD.anchor, multiSelectDnD.head);
|
|
279
|
+
nodeTypes = attributes.nodeTypes;
|
|
280
|
+
hasSelectedMultipleNodes = attributes.hasSelectedMultipleNodes;
|
|
281
|
+
} else {
|
|
282
|
+
nodeTypes = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.type.name;
|
|
283
|
+
hasSelectedMultipleNodes = false;
|
|
284
|
+
}
|
|
268
285
|
}
|
|
269
286
|
api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || _api$blockControls2.commands.setNodeDragged(getPos, anchorName, nodeType)({
|
|
270
287
|
tr: tr
|
|
271
288
|
});
|
|
272
|
-
var resolvedMovingNode = tr.doc.resolve(start);
|
|
273
|
-
var maybeNode = resolvedMovingNode.nodeAfter;
|
|
274
289
|
tr.setMeta('scrollIntoView', false);
|
|
275
290
|
api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 || _api$analytics3.actions.attachAnalyticsEvent({
|
|
276
291
|
eventType: EVENT_TYPE.UI,
|
|
277
292
|
action: ACTION.DRAGGED,
|
|
278
293
|
actionSubject: ACTION_SUBJECT.ELEMENT,
|
|
279
294
|
actionSubjectId: ACTION_SUBJECT_ID.ELEMENT_DRAG_HANDLE,
|
|
280
|
-
attributes: {
|
|
295
|
+
attributes: _objectSpread({
|
|
281
296
|
nodeDepth: resolvedMovingNode.depth,
|
|
282
297
|
nodeType: (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.type.name) || ''
|
|
283
|
-
}
|
|
298
|
+
}, isMultiSelect && {
|
|
299
|
+
nodeTypes: nodeTypes,
|
|
300
|
+
hasSelectedMultipleNodes: hasSelectedMultipleNodes
|
|
301
|
+
})
|
|
284
302
|
})(tr);
|
|
285
303
|
return tr;
|
|
286
304
|
});
|
|
@@ -380,7 +398,21 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
380
398
|
}
|
|
381
399
|
setDragHandleSelected(isHandleInSelection(view.state, selection, start));
|
|
382
400
|
}, [start, selection, view.state]);
|
|
383
|
-
var helpDescriptors = [{
|
|
401
|
+
var helpDescriptors = isTopLevelNode && fg('platform_editor_advanced_layouts_accessibility') ? [{
|
|
402
|
+
description: formatMessage(blockControlsMessages.dragToMove)
|
|
403
|
+
}, {
|
|
404
|
+
description: formatMessage(blockControlsMessages.moveUp),
|
|
405
|
+
keymap: dragToMoveUp
|
|
406
|
+
}, {
|
|
407
|
+
description: formatMessage(blockControlsMessages.moveDown),
|
|
408
|
+
keymap: dragToMoveDown
|
|
409
|
+
}, {
|
|
410
|
+
description: formatMessage(blockControlsMessages.moveLeft),
|
|
411
|
+
keymap: dragToMoveLeft
|
|
412
|
+
}, {
|
|
413
|
+
description: formatMessage(blockControlsMessages.moveRight),
|
|
414
|
+
keymap: dragToMoveRight
|
|
415
|
+
}] : [{
|
|
384
416
|
description: formatMessage(blockControlsMessages.dragToMove)
|
|
385
417
|
}, {
|
|
386
418
|
description: formatMessage(blockControlsMessages.moveUp),
|
|
@@ -82,6 +82,7 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
82
82
|
moveToLayout: (start: number, to: number, options?: {
|
|
83
83
|
moveToEnd?: boolean;
|
|
84
84
|
selectMovedNode?: boolean;
|
|
85
|
+
moveNodeAtCursorPos?: boolean;
|
|
85
86
|
}) => EditorCommand;
|
|
86
87
|
moveNode: MoveNode;
|
|
87
88
|
showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => EditorCommand;
|
|
@@ -3,4 +3,5 @@ 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
|
selectMovedNode?: boolean;
|
|
6
|
+
moveNodeAtCursorPos?: boolean;
|
|
6
7
|
}) => EditorCommand;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
3
|
-
export declare const showDragHandleAtSelection: (api?: ExtractInjectionAPI<BlockControlsPlugin
|
|
3
|
+
export declare const showDragHandleAtSelection: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => Command;
|
|
@@ -5,4 +5,5 @@ export declare const TYPE_HANDLE_DEC = "drag-handle";
|
|
|
5
5
|
export declare const TYPE_NODE_DEC = "node-decoration";
|
|
6
6
|
export declare const getNestedDepth: () => 0 | 100;
|
|
7
7
|
export declare const getNodeAnchor: (node: PMNode) => string;
|
|
8
|
+
export declare const getNodeTypeWithLevel: (node: PMNode) => string;
|
|
8
9
|
export declare const unmountDecorations: (nodeViewPortalProviderAPI: PortalProviderAPI, selector: string, key: string) => void;
|
|
@@ -12,6 +12,7 @@ export interface FlagType {
|
|
|
12
12
|
isNestedEnabled: boolean;
|
|
13
13
|
isMultiSelectEnabled: boolean;
|
|
14
14
|
}
|
|
15
|
+
export declare const getDecorations: (state: EditorState) => DecorationSet | undefined;
|
|
15
16
|
export declare const newApply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
|
|
16
17
|
decorations: DecorationSet;
|
|
17
18
|
activeNode: any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { type BlockControlsPlugin } from '../../blockControlsPluginType';
|
|
4
|
+
export declare const attachMoveNodeAnalytics: (tr: Transaction, inputMethod: string, fromDepth: number, fromNodeType: string, toDepth?: number, toNodeType?: string, isSameParent?: boolean, api?: ExtractInjectionAPI<BlockControlsPlugin>, fromNodeTypes?: string, hasSelectedMultipleNodes?: boolean) => boolean | undefined;
|
|
5
|
+
export declare const fireInsertLayoutAnalytics: (tr: Transaction, api?: ExtractInjectionAPI<BlockControlsPlugin>, nodeTypes?: string, hasSelectedMultipleNodes?: boolean) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Given a range, return distinctive types of node and whether there are multiple nodes in the range
|
|
8
|
+
*/
|
|
9
|
+
export declare const getMultiSelectAnalyticsAttributes: (tr: Transaction, anchor: number, head: number) => {
|
|
10
|
+
nodeTypes: string | undefined;
|
|
11
|
+
hasSelectedMultipleNodes: boolean;
|
|
12
|
+
};
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
3
|
import type { BlockControlsPlugin } from '../../blockControlsPluginType';
|
|
3
4
|
export declare const getMultiSelectionIfPosInside: (api: ExtractInjectionAPI<BlockControlsPlugin>, pos: number) => {
|
|
4
5
|
anchor?: number;
|
|
5
6
|
head?: number;
|
|
6
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @returns from and to positions of the selected content (after expansion)
|
|
11
|
+
*/
|
|
12
|
+
export declare const getSelectedSlicePosition: (handlePos: number, tr: Transaction, api: ExtractInjectionAPI<BlockControlsPlugin>) => {
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
};
|
|
@@ -82,6 +82,7 @@ export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
|
82
82
|
moveToLayout: (start: number, to: number, options?: {
|
|
83
83
|
moveToEnd?: boolean;
|
|
84
84
|
selectMovedNode?: boolean;
|
|
85
|
+
moveNodeAtCursorPos?: boolean;
|
|
85
86
|
}) => EditorCommand;
|
|
86
87
|
moveNode: MoveNode;
|
|
87
88
|
showDragHandleAt: (pos: number, anchorName: string, nodeType: string, handleOptions?: HandleOptions) => EditorCommand;
|
|
@@ -3,4 +3,5 @@ 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
|
selectMovedNode?: boolean;
|
|
6
|
+
moveNodeAtCursorPos?: boolean;
|
|
6
7
|
}) => EditorCommand;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { BlockControlsPlugin } from '../blockControlsPluginType';
|
|
3
|
-
export declare const showDragHandleAtSelection: (api?: ExtractInjectionAPI<BlockControlsPlugin
|
|
3
|
+
export declare const showDragHandleAtSelection: (api?: ExtractInjectionAPI<BlockControlsPlugin>) => Command;
|
|
@@ -5,4 +5,5 @@ export declare const TYPE_HANDLE_DEC = "drag-handle";
|
|
|
5
5
|
export declare const TYPE_NODE_DEC = "node-decoration";
|
|
6
6
|
export declare const getNestedDepth: () => 0 | 100;
|
|
7
7
|
export declare const getNodeAnchor: (node: PMNode) => string;
|
|
8
|
+
export declare const getNodeTypeWithLevel: (node: PMNode) => string;
|
|
8
9
|
export declare const unmountDecorations: (nodeViewPortalProviderAPI: PortalProviderAPI, selector: string, key: string) => void;
|
|
@@ -12,6 +12,7 @@ export interface FlagType {
|
|
|
12
12
|
isNestedEnabled: boolean;
|
|
13
13
|
isMultiSelectEnabled: boolean;
|
|
14
14
|
}
|
|
15
|
+
export declare const getDecorations: (state: EditorState) => DecorationSet | undefined;
|
|
15
16
|
export declare const newApply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, flags: FlagType, nodeViewPortalProviderAPI: PortalProviderAPI, anchorRectCache?: AnchorRectCache) => {
|
|
16
17
|
decorations: DecorationSet;
|
|
17
18
|
activeNode: any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { type BlockControlsPlugin } from '../../blockControlsPluginType';
|
|
4
|
+
export declare const attachMoveNodeAnalytics: (tr: Transaction, inputMethod: string, fromDepth: number, fromNodeType: string, toDepth?: number, toNodeType?: string, isSameParent?: boolean, api?: ExtractInjectionAPI<BlockControlsPlugin>, fromNodeTypes?: string, hasSelectedMultipleNodes?: boolean) => boolean | undefined;
|
|
5
|
+
export declare const fireInsertLayoutAnalytics: (tr: Transaction, api?: ExtractInjectionAPI<BlockControlsPlugin>, nodeTypes?: string, hasSelectedMultipleNodes?: boolean) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Given a range, return distinctive types of node and whether there are multiple nodes in the range
|
|
8
|
+
*/
|
|
9
|
+
export declare const getMultiSelectAnalyticsAttributes: (tr: Transaction, anchor: number, head: number) => {
|
|
10
|
+
nodeTypes: string | undefined;
|
|
11
|
+
hasSelectedMultipleNodes: boolean;
|
|
12
|
+
};
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
3
|
import type { BlockControlsPlugin } from '../../blockControlsPluginType';
|
|
3
4
|
export declare const getMultiSelectionIfPosInside: (api: ExtractInjectionAPI<BlockControlsPlugin>, pos: number) => {
|
|
4
5
|
anchor?: number;
|
|
5
6
|
head?: number;
|
|
6
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @returns from and to positions of the selected content (after expansion)
|
|
11
|
+
*/
|
|
12
|
+
export declare const getSelectedSlicePosition: (handlePos: number, tr: Transaction, api: ExtractInjectionAPI<BlockControlsPlugin>) => {
|
|
13
|
+
from: number;
|
|
14
|
+
to: number;
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.26.
|
|
3
|
+
"version": "2.26.2",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
34
|
-
"@atlaskit/editor-common": "^99.
|
|
34
|
+
"@atlaskit/editor-common": "^99.14.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.4.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.12.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^1.5.0",
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
43
43
|
"@atlaskit/editor-shared-styles": "^3.2.0",
|
|
44
44
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
45
|
-
"@atlaskit/icon": "^23.
|
|
45
|
+
"@atlaskit/icon": "^23.9.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.0.0",
|
|
47
47
|
"@atlaskit/pragmatic-drag-and-drop": "^1.5.0",
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
|
|
49
49
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.2.0",
|
|
50
50
|
"@atlaskit/primitives": "^13.5.0",
|
|
51
51
|
"@atlaskit/theme": "^15.0.0",
|
|
52
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
52
|
+
"@atlaskit/tmp-editor-statsig": "^2.46.0",
|
|
53
53
|
"@atlaskit/tokens": "^3.3.0",
|
|
54
54
|
"@atlaskit/tooltip": "^19.1.0",
|
|
55
55
|
"@babel/runtime": "^7.0.0",
|
|
@@ -119,9 +119,6 @@
|
|
|
119
119
|
"platform_editor_advanced_layouts_redraw_on_drag": {
|
|
120
120
|
"type": "boolean"
|
|
121
121
|
},
|
|
122
|
-
"platform_editor_react18_plugin_portalprovider": {
|
|
123
|
-
"type": "boolean"
|
|
124
|
-
},
|
|
125
122
|
"platform_editor_use_nested_table_pm_nodes": {
|
|
126
123
|
"type": "boolean"
|
|
127
124
|
},
|
|
@@ -145,6 +142,12 @@
|
|
|
145
142
|
},
|
|
146
143
|
"platform_editor_advanced_layouts_accessibility": {
|
|
147
144
|
"type": "boolean"
|
|
145
|
+
},
|
|
146
|
+
"platform_editor_advanced_layouts_a11y": {
|
|
147
|
+
"type": "boolean"
|
|
148
|
+
},
|
|
149
|
+
"platform_editor_track_node_types": {
|
|
150
|
+
"type": "boolean"
|
|
148
151
|
}
|
|
149
152
|
}
|
|
150
153
|
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.fireInsertLayoutAnalytics = exports.attachMoveNodeAnalytics = void 0;
|
|
7
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
|
-
var attachMoveNodeAnalytics = exports.attachMoveNodeAnalytics = function attachMoveNodeAnalytics(tr, inputMethod, fromDepth, fromNodeType, toDepth, toNodeType, isSameParent, api) {
|
|
9
|
-
var _api$analytics;
|
|
10
|
-
return api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.attachAnalyticsEvent({
|
|
11
|
-
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
12
|
-
action: _analytics.ACTION.MOVED,
|
|
13
|
-
actionSubject: _analytics.ACTION_SUBJECT.ELEMENT,
|
|
14
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.ELEMENT_DRAG_HANDLE,
|
|
15
|
-
attributes: {
|
|
16
|
-
nodeDepth: fromDepth,
|
|
17
|
-
nodeType: fromNodeType,
|
|
18
|
-
destinationNodeDepth: toDepth,
|
|
19
|
-
destinationNodeType: toNodeType,
|
|
20
|
-
isSameParent: isSameParent,
|
|
21
|
-
inputMethod: inputMethod
|
|
22
|
-
}
|
|
23
|
-
})(tr);
|
|
24
|
-
};
|
|
25
|
-
var fireInsertLayoutAnalytics = exports.fireInsertLayoutAnalytics = function fireInsertLayoutAnalytics(tr, api) {
|
|
26
|
-
var _api$analytics2;
|
|
27
|
-
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.attachAnalyticsEvent({
|
|
28
|
-
action: _analytics.ACTION.INSERTED,
|
|
29
|
-
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
30
|
-
actionSubjectId: _analytics.ACTION_SUBJECT_ID.LAYOUT,
|
|
31
|
-
attributes: {
|
|
32
|
-
inputMethod: _analytics.INPUT_METHOD.DRAG_AND_DROP
|
|
33
|
-
},
|
|
34
|
-
eventType: _analytics.EVENT_TYPE.TRACK
|
|
35
|
-
})(tr);
|
|
36
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { type BlockControlsPlugin } from '../../blockControlsPluginType';
|
|
4
|
-
export declare const attachMoveNodeAnalytics: (tr: Transaction, inputMethod: string, fromDepth: number, fromNodeType: string, toDepth?: number, toNodeType?: string, isSameParent?: boolean, api?: ExtractInjectionAPI<BlockControlsPlugin>) => boolean | undefined;
|
|
5
|
-
export declare const fireInsertLayoutAnalytics: (tr: Transaction, api?: ExtractInjectionAPI<BlockControlsPlugin>) => void;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { type BlockControlsPlugin } from '../../blockControlsPluginType';
|
|
4
|
-
export declare const attachMoveNodeAnalytics: (tr: Transaction, inputMethod: string, fromDepth: number, fromNodeType: string, toDepth?: number, toNodeType?: string, isSameParent?: boolean, api?: ExtractInjectionAPI<BlockControlsPlugin>) => boolean | undefined;
|
|
5
|
-
export declare const fireInsertLayoutAnalytics: (tr: Transaction, api?: ExtractInjectionAPI<BlockControlsPlugin>) => void;
|