@atlaskit/editor-plugin-selection-toolbar 3.1.0 → 3.2.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 +18 -0
- package/dist/cjs/pm-plugins/commands.js +15 -1
- package/dist/cjs/selectionToolbarPlugin.js +5 -4
- package/dist/es2019/pm-plugins/commands.js +15 -1
- package/dist/es2019/selectionToolbarPlugin.js +5 -4
- package/dist/esm/pm-plugins/commands.js +15 -1
- package/dist/esm/selectionToolbarPlugin.js +5 -4
- package/dist/types/pm-plugins/commands.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/commands.d.ts +3 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-toolbar
|
|
2
2
|
|
|
3
|
+
## 3.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#138170](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/138170)
|
|
8
|
+
[`160cf374f7ac1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/160cf374f7ac1) -
|
|
9
|
+
ED-27441 update docking preference with analytics
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 3.1.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 3.1.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.toggleToolbar = exports.setToolbarDocking = void 0;
|
|
7
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
7
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
10
|
var _pluginKey = require("./plugin-key");
|
|
9
11
|
var toggleToolbar = exports.toggleToolbar = function toggleToolbar(_ref) {
|
|
10
12
|
var hide = _ref.hide;
|
|
@@ -18,7 +20,8 @@ var toggleToolbar = exports.toggleToolbar = function toggleToolbar(_ref) {
|
|
|
18
20
|
};
|
|
19
21
|
var setToolbarDocking = exports.setToolbarDocking = function setToolbarDocking(_ref3) {
|
|
20
22
|
var toolbarDocking = _ref3.toolbarDocking,
|
|
21
|
-
userPreferencesProvider = _ref3.userPreferencesProvider
|
|
23
|
+
userPreferencesProvider = _ref3.userPreferencesProvider,
|
|
24
|
+
editorAnalyticsApi = _ref3.editorAnalyticsApi;
|
|
22
25
|
return function (_ref4) {
|
|
23
26
|
var tr = _ref4.tr;
|
|
24
27
|
// We currently ignore any update failures, need to confirm this is the desired behaviour
|
|
@@ -30,6 +33,17 @@ var setToolbarDocking = exports.setToolbarDocking = function setToolbarDocking(_
|
|
|
30
33
|
// Remove the selection if the toolbar is docked to the top
|
|
31
34
|
tr.setSelection(_state.TextSelection.create(tr.doc, tr.selection.head));
|
|
32
35
|
}
|
|
36
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_2')) {
|
|
37
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
38
|
+
action: _analytics.ACTION.UPDATED,
|
|
39
|
+
actionSubject: _analytics.ACTION_SUBJECT.USER_PREFERENCES,
|
|
40
|
+
actionSubjectId: _analytics.ACTION_SUBJECT_ID.SELECTION_TOOLBAR_PREFERENCES,
|
|
41
|
+
attributes: {
|
|
42
|
+
toolbarDocking: toolbarDocking
|
|
43
|
+
},
|
|
44
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
45
|
+
})(tr);
|
|
46
|
+
}
|
|
33
47
|
return tr;
|
|
34
48
|
};
|
|
35
49
|
};
|
|
@@ -73,10 +73,11 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
73
73
|
}))) !== null && _api$core$actions$exe2 !== void 0 ? _api$core$actions$exe2 : false;
|
|
74
74
|
},
|
|
75
75
|
setToolbarDocking: function setToolbarDocking(toolbarDocking) {
|
|
76
|
-
var _api$core$actions$exe3;
|
|
76
|
+
var _api$core$actions$exe3, _api$analytics;
|
|
77
77
|
return (_api$core$actions$exe3 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.setToolbarDocking)({
|
|
78
78
|
toolbarDocking: toolbarDocking,
|
|
79
|
-
userPreferencesProvider: userPreferencesProvider
|
|
79
|
+
userPreferencesProvider: userPreferencesProvider,
|
|
80
|
+
editorAnalyticsApi: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
80
81
|
}))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
|
|
81
82
|
}
|
|
82
83
|
},
|
|
@@ -162,13 +163,13 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
|
|
|
162
163
|
if (!isPreferenceInitialized && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_2')) {
|
|
163
164
|
var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
|
|
164
165
|
if (toolbarDockingPreference !== undefined) {
|
|
165
|
-
var _api$
|
|
166
|
+
var _api$analytics2;
|
|
166
167
|
isPreferenceInitialized = true;
|
|
167
168
|
var userToolbarDockingPref = getInitialToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
|
|
168
169
|
var tr = newState.tr.setMeta(_pluginKey.selectionToolbarPluginKey, {
|
|
169
170
|
toolbarDocking: userToolbarDockingPref
|
|
170
171
|
});
|
|
171
|
-
api === null || api === void 0 || (_api$
|
|
172
|
+
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
|
|
172
173
|
action: _analytics.ACTION.INITIALISED,
|
|
173
174
|
actionSubject: _analytics.ACTION_SUBJECT.USER_PREFERENCES,
|
|
174
175
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.SELECTION_TOOLBAR_PREFERENCES,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
4
|
import { selectionToolbarPluginKey } from './plugin-key';
|
|
3
5
|
export const toggleToolbar = ({
|
|
4
6
|
hide
|
|
@@ -12,7 +14,8 @@ export const toggleToolbar = ({
|
|
|
12
14
|
};
|
|
13
15
|
export const setToolbarDocking = ({
|
|
14
16
|
toolbarDocking,
|
|
15
|
-
userPreferencesProvider
|
|
17
|
+
userPreferencesProvider,
|
|
18
|
+
editorAnalyticsApi
|
|
16
19
|
}) => ({
|
|
17
20
|
tr
|
|
18
21
|
}) => {
|
|
@@ -25,5 +28,16 @@ export const setToolbarDocking = ({
|
|
|
25
28
|
// Remove the selection if the toolbar is docked to the top
|
|
26
29
|
tr.setSelection(TextSelection.create(tr.doc, tr.selection.head));
|
|
27
30
|
}
|
|
31
|
+
if (fg('platform_editor_controls_patch_2')) {
|
|
32
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 ? void 0 : editorAnalyticsApi.attachAnalyticsEvent({
|
|
33
|
+
action: ACTION.UPDATED,
|
|
34
|
+
actionSubject: ACTION_SUBJECT.USER_PREFERENCES,
|
|
35
|
+
actionSubjectId: ACTION_SUBJECT_ID.SELECTION_TOOLBAR_PREFERENCES,
|
|
36
|
+
attributes: {
|
|
37
|
+
toolbarDocking
|
|
38
|
+
},
|
|
39
|
+
eventType: EVENT_TYPE.TRACK
|
|
40
|
+
})(tr);
|
|
41
|
+
}
|
|
28
42
|
return tr;
|
|
29
43
|
};
|
|
@@ -64,10 +64,11 @@ export const selectionToolbarPlugin = ({
|
|
|
64
64
|
}))) !== null && _api$core$actions$exe2 !== void 0 ? _api$core$actions$exe2 : false;
|
|
65
65
|
},
|
|
66
66
|
setToolbarDocking: toolbarDocking => {
|
|
67
|
-
var _api$core$actions$exe3;
|
|
67
|
+
var _api$core$actions$exe3, _api$analytics;
|
|
68
68
|
return (_api$core$actions$exe3 = api === null || api === void 0 ? void 0 : api.core.actions.execute(setToolbarDocking({
|
|
69
69
|
toolbarDocking,
|
|
70
|
-
userPreferencesProvider
|
|
70
|
+
userPreferencesProvider,
|
|
71
|
+
editorAnalyticsApi: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
71
72
|
}))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
|
|
72
73
|
}
|
|
73
74
|
},
|
|
@@ -157,13 +158,13 @@ export const selectionToolbarPlugin = ({
|
|
|
157
158
|
if (!isPreferenceInitialized && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_2')) {
|
|
158
159
|
const toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
|
|
159
160
|
if (toolbarDockingPreference !== undefined) {
|
|
160
|
-
var _api$
|
|
161
|
+
var _api$analytics2;
|
|
161
162
|
isPreferenceInitialized = true;
|
|
162
163
|
const userToolbarDockingPref = getInitialToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
|
|
163
164
|
const tr = newState.tr.setMeta(selectionToolbarPluginKey, {
|
|
164
165
|
toolbarDocking: userToolbarDockingPref
|
|
165
166
|
});
|
|
166
|
-
api === null || api === void 0 ? void 0 : (_api$
|
|
167
|
+
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.attachAnalyticsEvent({
|
|
167
168
|
action: ACTION.INITIALISED,
|
|
168
169
|
actionSubject: ACTION_SUBJECT.USER_PREFERENCES,
|
|
169
170
|
actionSubjectId: ACTION_SUBJECT_ID.SELECTION_TOOLBAR_PREFERENCES,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
4
|
import { selectionToolbarPluginKey } from './plugin-key';
|
|
3
5
|
export var toggleToolbar = function toggleToolbar(_ref) {
|
|
4
6
|
var hide = _ref.hide;
|
|
@@ -12,7 +14,8 @@ export var toggleToolbar = function toggleToolbar(_ref) {
|
|
|
12
14
|
};
|
|
13
15
|
export var setToolbarDocking = function setToolbarDocking(_ref3) {
|
|
14
16
|
var toolbarDocking = _ref3.toolbarDocking,
|
|
15
|
-
userPreferencesProvider = _ref3.userPreferencesProvider
|
|
17
|
+
userPreferencesProvider = _ref3.userPreferencesProvider,
|
|
18
|
+
editorAnalyticsApi = _ref3.editorAnalyticsApi;
|
|
16
19
|
return function (_ref4) {
|
|
17
20
|
var tr = _ref4.tr;
|
|
18
21
|
// We currently ignore any update failures, need to confirm this is the desired behaviour
|
|
@@ -24,6 +27,17 @@ export var setToolbarDocking = function setToolbarDocking(_ref3) {
|
|
|
24
27
|
// Remove the selection if the toolbar is docked to the top
|
|
25
28
|
tr.setSelection(TextSelection.create(tr.doc, tr.selection.head));
|
|
26
29
|
}
|
|
30
|
+
if (fg('platform_editor_controls_patch_2')) {
|
|
31
|
+
editorAnalyticsApi === null || editorAnalyticsApi === void 0 || editorAnalyticsApi.attachAnalyticsEvent({
|
|
32
|
+
action: ACTION.UPDATED,
|
|
33
|
+
actionSubject: ACTION_SUBJECT.USER_PREFERENCES,
|
|
34
|
+
actionSubjectId: ACTION_SUBJECT_ID.SELECTION_TOOLBAR_PREFERENCES,
|
|
35
|
+
attributes: {
|
|
36
|
+
toolbarDocking: toolbarDocking
|
|
37
|
+
},
|
|
38
|
+
eventType: EVENT_TYPE.TRACK
|
|
39
|
+
})(tr);
|
|
40
|
+
}
|
|
27
41
|
return tr;
|
|
28
42
|
};
|
|
29
43
|
};
|
|
@@ -66,10 +66,11 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
|
|
|
66
66
|
}))) !== null && _api$core$actions$exe2 !== void 0 ? _api$core$actions$exe2 : false;
|
|
67
67
|
},
|
|
68
68
|
setToolbarDocking: function setToolbarDocking(toolbarDocking) {
|
|
69
|
-
var _api$core$actions$exe3;
|
|
69
|
+
var _api$core$actions$exe3, _api$analytics;
|
|
70
70
|
return (_api$core$actions$exe3 = api === null || api === void 0 ? void 0 : api.core.actions.execute(_setToolbarDocking({
|
|
71
71
|
toolbarDocking: toolbarDocking,
|
|
72
|
-
userPreferencesProvider: userPreferencesProvider
|
|
72
|
+
userPreferencesProvider: userPreferencesProvider,
|
|
73
|
+
editorAnalyticsApi: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
73
74
|
}))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
|
|
74
75
|
}
|
|
75
76
|
},
|
|
@@ -155,13 +156,13 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
|
|
|
155
156
|
if (!isPreferenceInitialized && editorExperiment('platform_editor_controls', 'variant1') && fg('platform_editor_controls_patch_2')) {
|
|
156
157
|
var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
|
|
157
158
|
if (toolbarDockingPreference !== undefined) {
|
|
158
|
-
var _api$
|
|
159
|
+
var _api$analytics2;
|
|
159
160
|
isPreferenceInitialized = true;
|
|
160
161
|
var userToolbarDockingPref = getInitialToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
|
|
161
162
|
var tr = newState.tr.setMeta(selectionToolbarPluginKey, {
|
|
162
163
|
toolbarDocking: userToolbarDockingPref
|
|
163
164
|
});
|
|
164
|
-
api === null || api === void 0 || (_api$
|
|
165
|
+
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.attachAnalyticsEvent({
|
|
165
166
|
action: ACTION.INITIALISED,
|
|
166
167
|
actionSubject: ACTION_SUBJECT.USER_PREFERENCES,
|
|
167
168
|
actionSubjectId: ACTION_SUBJECT_ID.SELECTION_TOOLBAR_PREFERENCES,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { EditorCommand, UserPreferencesProvider } from '@atlaskit/editor-common/types';
|
|
2
3
|
import type { ToolbarDocking } from '../types';
|
|
3
4
|
export declare const toggleToolbar: ({ hide }: {
|
|
4
5
|
hide: boolean;
|
|
5
6
|
}) => EditorCommand;
|
|
6
|
-
export declare const setToolbarDocking: ({ toolbarDocking, userPreferencesProvider, }: {
|
|
7
|
+
export declare const setToolbarDocking: ({ toolbarDocking, userPreferencesProvider, editorAnalyticsApi, }: {
|
|
7
8
|
toolbarDocking: ToolbarDocking;
|
|
8
9
|
userPreferencesProvider?: UserPreferencesProvider | undefined;
|
|
10
|
+
editorAnalyticsApi?: EditorAnalyticsAPI | undefined;
|
|
9
11
|
}) => EditorCommand;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { EditorCommand, UserPreferencesProvider } from '@atlaskit/editor-common/types';
|
|
2
3
|
import type { ToolbarDocking } from '../types';
|
|
3
4
|
export declare const toggleToolbar: ({ hide }: {
|
|
4
5
|
hide: boolean;
|
|
5
6
|
}) => EditorCommand;
|
|
6
|
-
export declare const setToolbarDocking: ({ toolbarDocking, userPreferencesProvider, }: {
|
|
7
|
+
export declare const setToolbarDocking: ({ toolbarDocking, userPreferencesProvider, editorAnalyticsApi, }: {
|
|
7
8
|
toolbarDocking: ToolbarDocking;
|
|
8
9
|
userPreferencesProvider?: UserPreferencesProvider | undefined;
|
|
10
|
+
editorAnalyticsApi?: EditorAnalyticsAPI | undefined;
|
|
9
11
|
}) => EditorCommand;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-toolbar",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "@atlaskit/editor-plugin-selection-toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/css": "^0.10.0",
|
|
37
|
-
"@atlaskit/editor-common": "^
|
|
37
|
+
"@atlaskit/editor-common": "^103.1.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-primary-toolbar": "^3.1.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/menu": "^3.2.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
46
46
|
"@atlaskit/tmp-editor-statsig": "^4.6.0",
|
|
47
|
-
"@atlaskit/tokens": "^4.
|
|
47
|
+
"@atlaskit/tokens": "^4.7.0",
|
|
48
48
|
"@babel/runtime": "^7.0.0",
|
|
49
49
|
"bind-event-listener": "^3.0.0"
|
|
50
50
|
},
|