@atlaskit/editor-plugin-block-controls 3.10.3 → 3.11.0
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 +13 -0
- package/dist/cjs/blockControlsPlugin.js +6 -0
- package/dist/cjs/pm-plugins/main.js +15 -6
- package/dist/es2019/blockControlsPlugin.js +6 -0
- package/dist/es2019/pm-plugins/main.js +15 -6
- package/dist/esm/blockControlsPlugin.js +6 -0
- package/dist/esm/pm-plugins/main.js +15 -6
- package/dist/types/blockControlsPluginType.d.ts +3 -1
- package/dist/types-ts4.5/blockControlsPluginType.d.ts +3 -1
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#141095](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/141095)
|
|
8
|
+
[`5f0694bcf5c1f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5f0694bcf5c1f) -
|
|
9
|
+
Add UserIntentPlugin as an optional dependency, and add its corresponding package as package
|
|
10
|
+
dependency
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 3.10.3
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -114,6 +114,12 @@ var blockControlsPlugin = exports.blockControlsPlugin = function blockControlsPl
|
|
|
114
114
|
tr: tr
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_user_intent_plugin')) {
|
|
118
|
+
var _api$userIntent;
|
|
119
|
+
api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('dragging')({
|
|
120
|
+
tr: tr
|
|
121
|
+
});
|
|
122
|
+
}
|
|
117
123
|
return tr;
|
|
118
124
|
};
|
|
119
125
|
},
|
|
@@ -83,12 +83,15 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
83
83
|
if (isHTMLElement(scrollable)) {
|
|
84
84
|
scrollable.style.setProperty('scroll-behavior', null);
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
if (!api) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
(_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref3) {
|
|
87
90
|
var tr = _ref3.tr;
|
|
88
91
|
var isMultiSelect = (0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true);
|
|
89
92
|
if (isMultiSelect) {
|
|
90
93
|
var _api$blockControls, _api$selection;
|
|
91
|
-
var _ref4 = (
|
|
94
|
+
var _ref4 = ((_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
92
95
|
multiSelectDnD = _ref4.multiSelectDnD;
|
|
93
96
|
// Restore the users initial Editor selection when the drop completes
|
|
94
97
|
if (multiSelectDnD) {
|
|
@@ -105,7 +108,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
|
-
|
|
111
|
+
(_api$selection = api.selection) === null || _api$selection === void 0 || _api$selection.commands.clearManualSelection()({
|
|
109
112
|
tr: tr
|
|
110
113
|
});
|
|
111
114
|
}
|
|
@@ -116,7 +119,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
116
119
|
if (lastDragCancelled) {
|
|
117
120
|
var _api$analytics2;
|
|
118
121
|
var nodeTypes, hasSelectedMultipleNodes;
|
|
119
|
-
if (isMultiSelect
|
|
122
|
+
if (isMultiSelect) {
|
|
120
123
|
var position = (0, _selection2.getSelectedSlicePosition)(start, tr, api);
|
|
121
124
|
var attributes = (0, _analytics2.getMultiSelectAnalyticsAttributes)(tr, position.from, position.to);
|
|
122
125
|
nodeTypes = attributes.nodeTypes;
|
|
@@ -124,7 +127,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
124
127
|
}
|
|
125
128
|
var resolvedMovingNode = tr.doc.resolve(start);
|
|
126
129
|
var maybeNode = resolvedMovingNode.nodeAfter;
|
|
127
|
-
|
|
130
|
+
(_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
|
|
128
131
|
eventType: _analytics.EVENT_TYPE.UI,
|
|
129
132
|
action: _analytics.ACTION.CANCELLED,
|
|
130
133
|
actionSubject: _analytics.ACTION_SUBJECT.DRAG,
|
|
@@ -140,7 +143,13 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
140
143
|
}
|
|
141
144
|
if ((0, _platformFeatureFlags.fg)('platform_editor_ease_of_use_metrics')) {
|
|
142
145
|
var _api$metrics;
|
|
143
|
-
|
|
146
|
+
(_api$metrics = api.metrics) === null || _api$metrics === void 0 || _api$metrics.commands.startActiveSessionTimer()({
|
|
147
|
+
tr: tr
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_user_intent_plugin')) {
|
|
151
|
+
var _api$userIntent;
|
|
152
|
+
(_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('default')({
|
|
144
153
|
tr: tr
|
|
145
154
|
});
|
|
146
155
|
}
|
|
@@ -105,6 +105,12 @@ export const blockControlsPlugin = ({
|
|
|
105
105
|
tr
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
|
+
if (fg('platform_editor_user_intent_plugin')) {
|
|
109
|
+
var _api$userIntent;
|
|
110
|
+
api === null || api === void 0 ? void 0 : (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('dragging')({
|
|
111
|
+
tr
|
|
112
|
+
});
|
|
113
|
+
}
|
|
108
114
|
return tr;
|
|
109
115
|
},
|
|
110
116
|
setMultiSelectPositions: (anchor, head) => ({
|
|
@@ -75,7 +75,10 @@ const destroyFn = (api, editorView) => {
|
|
|
75
75
|
if (isHTMLElement(scrollable)) {
|
|
76
76
|
scrollable.style.setProperty('scroll-behavior', null);
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
if (!api) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
(_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(({
|
|
79
82
|
tr
|
|
80
83
|
}) => {
|
|
81
84
|
const isMultiSelect = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true);
|
|
@@ -83,7 +86,7 @@ const destroyFn = (api, editorView) => {
|
|
|
83
86
|
var _api$blockControls, _api$selection;
|
|
84
87
|
const {
|
|
85
88
|
multiSelectDnD
|
|
86
|
-
} = (
|
|
89
|
+
} = ((_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {};
|
|
87
90
|
// Restore the users initial Editor selection when the drop completes
|
|
88
91
|
if (multiSelectDnD) {
|
|
89
92
|
// If the TextSelection between the drag start and end has changed, the document has changed, and we should not reapply the last selection
|
|
@@ -99,7 +102,7 @@ const destroyFn = (api, editorView) => {
|
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
|
-
|
|
105
|
+
(_api$selection = api.selection) === null || _api$selection === void 0 ? void 0 : _api$selection.commands.clearManualSelection()({
|
|
103
106
|
tr
|
|
104
107
|
});
|
|
105
108
|
}
|
|
@@ -111,7 +114,7 @@ const destroyFn = (api, editorView) => {
|
|
|
111
114
|
if (lastDragCancelled) {
|
|
112
115
|
var _api$analytics2;
|
|
113
116
|
let nodeTypes, hasSelectedMultipleNodes;
|
|
114
|
-
if (isMultiSelect
|
|
117
|
+
if (isMultiSelect) {
|
|
115
118
|
const position = getSelectedSlicePosition(start, tr, api);
|
|
116
119
|
const attributes = getMultiSelectAnalyticsAttributes(tr, position.from, position.to);
|
|
117
120
|
nodeTypes = attributes.nodeTypes;
|
|
@@ -119,7 +122,7 @@ const destroyFn = (api, editorView) => {
|
|
|
119
122
|
}
|
|
120
123
|
const resolvedMovingNode = tr.doc.resolve(start);
|
|
121
124
|
const maybeNode = resolvedMovingNode.nodeAfter;
|
|
122
|
-
|
|
125
|
+
(_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
|
|
123
126
|
eventType: EVENT_TYPE.UI,
|
|
124
127
|
action: ACTION.CANCELLED,
|
|
125
128
|
actionSubject: ACTION_SUBJECT.DRAG,
|
|
@@ -136,7 +139,13 @@ const destroyFn = (api, editorView) => {
|
|
|
136
139
|
}
|
|
137
140
|
if (fg('platform_editor_ease_of_use_metrics')) {
|
|
138
141
|
var _api$metrics;
|
|
139
|
-
|
|
142
|
+
(_api$metrics = api.metrics) === null || _api$metrics === void 0 ? void 0 : _api$metrics.commands.startActiveSessionTimer()({
|
|
143
|
+
tr
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
if (fg('platform_editor_user_intent_plugin')) {
|
|
147
|
+
var _api$userIntent;
|
|
148
|
+
(_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 ? void 0 : _api$userIntent.commands.setCurrentUserIntent('default')({
|
|
140
149
|
tr
|
|
141
150
|
});
|
|
142
151
|
}
|
|
@@ -107,6 +107,12 @@ export var blockControlsPlugin = function blockControlsPlugin(_ref) {
|
|
|
107
107
|
tr: tr
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
+
if (fg('platform_editor_user_intent_plugin')) {
|
|
111
|
+
var _api$userIntent;
|
|
112
|
+
api === null || api === void 0 || (_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('dragging')({
|
|
113
|
+
tr: tr
|
|
114
|
+
});
|
|
115
|
+
}
|
|
110
116
|
return tr;
|
|
111
117
|
};
|
|
112
118
|
},
|
|
@@ -76,12 +76,15 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
76
76
|
if (isHTMLElement(scrollable)) {
|
|
77
77
|
scrollable.style.setProperty('scroll-behavior', null);
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
if (!api) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
(_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref3) {
|
|
80
83
|
var tr = _ref3.tr;
|
|
81
84
|
var isMultiSelect = editorExperiment('platform_editor_element_drag_and_drop_multiselect', true);
|
|
82
85
|
if (isMultiSelect) {
|
|
83
86
|
var _api$blockControls, _api$selection;
|
|
84
|
-
var _ref4 = (
|
|
87
|
+
var _ref4 = ((_api$blockControls = api.blockControls) === null || _api$blockControls === void 0 ? void 0 : _api$blockControls.sharedState.currentState()) || {},
|
|
85
88
|
multiSelectDnD = _ref4.multiSelectDnD;
|
|
86
89
|
// Restore the users initial Editor selection when the drop completes
|
|
87
90
|
if (multiSelectDnD) {
|
|
@@ -98,7 +101,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
98
101
|
}
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
|
|
104
|
+
(_api$selection = api.selection) === null || _api$selection === void 0 || _api$selection.commands.clearManualSelection()({
|
|
102
105
|
tr: tr
|
|
103
106
|
});
|
|
104
107
|
}
|
|
@@ -109,7 +112,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
109
112
|
if (lastDragCancelled) {
|
|
110
113
|
var _api$analytics2;
|
|
111
114
|
var nodeTypes, hasSelectedMultipleNodes;
|
|
112
|
-
if (isMultiSelect
|
|
115
|
+
if (isMultiSelect) {
|
|
113
116
|
var position = getSelectedSlicePosition(start, tr, api);
|
|
114
117
|
var attributes = getMultiSelectAnalyticsAttributes(tr, position.from, position.to);
|
|
115
118
|
nodeTypes = attributes.nodeTypes;
|
|
@@ -117,7 +120,7 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
117
120
|
}
|
|
118
121
|
var resolvedMovingNode = tr.doc.resolve(start);
|
|
119
122
|
var maybeNode = resolvedMovingNode.nodeAfter;
|
|
120
|
-
|
|
123
|
+
(_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
|
|
121
124
|
eventType: EVENT_TYPE.UI,
|
|
122
125
|
action: ACTION.CANCELLED,
|
|
123
126
|
actionSubject: ACTION_SUBJECT.DRAG,
|
|
@@ -133,7 +136,13 @@ var destroyFn = function destroyFn(api, editorView) {
|
|
|
133
136
|
}
|
|
134
137
|
if (fg('platform_editor_ease_of_use_metrics')) {
|
|
135
138
|
var _api$metrics;
|
|
136
|
-
|
|
139
|
+
(_api$metrics = api.metrics) === null || _api$metrics === void 0 || _api$metrics.commands.startActiveSessionTimer()({
|
|
140
|
+
tr: tr
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
if (fg('platform_editor_user_intent_plugin')) {
|
|
144
|
+
var _api$userIntent;
|
|
145
|
+
(_api$userIntent = api.userIntent) === null || _api$userIntent === void 0 || _api$userIntent.commands.setCurrentUserIntent('default')({
|
|
137
146
|
tr: tr
|
|
138
147
|
});
|
|
139
148
|
}
|
|
@@ -9,6 +9,7 @@ import type { MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
|
|
|
9
9
|
import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
|
|
10
10
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
11
11
|
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
12
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
12
13
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
13
14
|
import { type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
14
15
|
export type ActiveNode = {
|
|
@@ -77,7 +78,8 @@ export type BlockControlsPluginDependencies = [
|
|
|
77
78
|
OptionalPlugin<QuickInsertPlugin>,
|
|
78
79
|
OptionalPlugin<TypeAheadPlugin>,
|
|
79
80
|
OptionalPlugin<SelectionPlugin>,
|
|
80
|
-
OptionalPlugin<MetricsPlugin
|
|
81
|
+
OptionalPlugin<MetricsPlugin>,
|
|
82
|
+
OptionalPlugin<UserIntentPlugin>
|
|
81
83
|
];
|
|
82
84
|
export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
83
85
|
dependencies: BlockControlsPluginDependencies;
|
|
@@ -9,6 +9,7 @@ import type { MetricsPlugin } from '@atlaskit/editor-plugin-metrics';
|
|
|
9
9
|
import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
|
|
10
10
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
11
11
|
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
12
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
12
13
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
13
14
|
import { type DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
14
15
|
export type ActiveNode = {
|
|
@@ -77,7 +78,8 @@ export type BlockControlsPluginDependencies = [
|
|
|
77
78
|
OptionalPlugin<QuickInsertPlugin>,
|
|
78
79
|
OptionalPlugin<TypeAheadPlugin>,
|
|
79
80
|
OptionalPlugin<SelectionPlugin>,
|
|
80
|
-
OptionalPlugin<MetricsPlugin
|
|
81
|
+
OptionalPlugin<MetricsPlugin>,
|
|
82
|
+
OptionalPlugin<UserIntentPlugin>
|
|
81
83
|
];
|
|
82
84
|
export type BlockControlsPlugin = NextEditorPlugin<'blockControls', {
|
|
83
85
|
dependencies: BlockControlsPluginDependencies;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
36
|
-
"@atlaskit/editor-common": "^103.
|
|
36
|
+
"@atlaskit/editor-common": "^103.11.0",
|
|
37
37
|
"@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"@atlaskit/editor-plugin-quick-insert": "^2.4.0",
|
|
43
43
|
"@atlaskit/editor-plugin-selection": "^2.1.0",
|
|
44
44
|
"@atlaskit/editor-plugin-type-ahead": "^2.5.0",
|
|
45
|
+
"@atlaskit/editor-plugin-user-intent": "^0.1.0",
|
|
45
46
|
"@atlaskit/editor-plugin-width": "^3.0.0",
|
|
46
47
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
47
48
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
@@ -176,6 +177,9 @@
|
|
|
176
177
|
"platform_editor_controls_patch_5": {
|
|
177
178
|
"type": "boolean"
|
|
178
179
|
},
|
|
180
|
+
"platform_editor_user_intent_plugin": {
|
|
181
|
+
"type": "boolean"
|
|
182
|
+
},
|
|
179
183
|
"platform_editor_controls_sticky_mask": {
|
|
180
184
|
"type": "boolean"
|
|
181
185
|
},
|