@atlaskit/editor-plugin-selection-toolbar 3.5.7 → 3.6.1

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 CHANGED
@@ -1,5 +1,27 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 3.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 3.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#151276](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/151276)
14
+ [`e483670a03fa3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e483670a03fa3) -
15
+ [ux] [EDITOR-670] Adds a new action to selectionToolbar `forceToolbarDockingWithoutAnalytics`
16
+ which performs similarly to `setToolbarDocking` with a couple of differences. 1) It does not fire
17
+ any analytics. 2) It does not make any changes to the selection. This was required due to issues
18
+ with the Confluence Legacy Content Extension which needs to manipulate the scrollbar position when
19
+ editor controls are enabled but relies on the selection remaining stable.
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+
3
25
  ## 3.5.7
4
26
 
5
27
  ### Patch Changes
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.updateToolbarDocking = exports.toggleToolbar = exports.setToolbarDocking = void 0;
6
+ exports.updateToolbarDocking = exports.toggleToolbar = exports.setToolbarDocking = exports.forceToolbarDockingWithoutAnalytics = void 0;
7
7
  var _analytics = require("@atlaskit/editor-common/analytics");
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
9
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
@@ -56,4 +56,22 @@ var setToolbarDocking = exports.setToolbarDocking = function setToolbarDocking(_
56
56
  }
57
57
  return tr;
58
58
  };
59
+ };
60
+
61
+ // Performs similarly to `setToolbarDocking` with a couple of differences.
62
+ // 1) It does not fire any analytics.
63
+ // 2) It does not make any changes to the selection.
64
+ // This was required due to issues with the Confluence Legacy Content Extension which needs to manipulate the scrollbar position when editor controls are enabled
65
+ // but relies on the selection remaining stable.
66
+ var forceToolbarDockingWithoutAnalytics = exports.forceToolbarDockingWithoutAnalytics = function forceToolbarDockingWithoutAnalytics(_ref7) {
67
+ var toolbarDocking = _ref7.toolbarDocking,
68
+ userPreferencesProvider = _ref7.userPreferencesProvider;
69
+ return function (_ref8) {
70
+ var tr = _ref8.tr;
71
+ userPreferencesProvider === null || userPreferencesProvider === void 0 || userPreferencesProvider.updatePreference('toolbarDockingInitialPosition', toolbarDocking);
72
+ tr.setMeta(_pluginKey.selectionToolbarPluginKey, {
73
+ toolbarDocking: toolbarDocking
74
+ });
75
+ return tr;
76
+ };
59
77
  };
@@ -81,13 +81,20 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
81
81
  editorAnalyticsApi: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
82
82
  }))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
83
83
  },
84
+ forceToolbarDockingWithoutAnalytics: function forceToolbarDockingWithoutAnalytics(toolbarDocking) {
85
+ var _api$core$actions$exe4;
86
+ return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.forceToolbarDockingWithoutAnalytics)({
87
+ toolbarDocking: toolbarDocking,
88
+ userPreferencesProvider: userPreferencesProvider
89
+ }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
90
+ },
84
91
  refreshToolbarDocking: function refreshToolbarDocking() {
85
92
  if (userPreferencesProvider) {
86
- var _api$core$actions$exe4;
93
+ var _api$core$actions$exe5;
87
94
  var userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
88
- return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.updateToolbarDocking)({
95
+ return (_api$core$actions$exe5 = api === null || api === void 0 ? void 0 : api.core.actions.execute((0, _commands.updateToolbarDocking)({
89
96
  toolbarDocking: userToolbarDockingPref
90
- }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
97
+ }))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
91
98
  }
92
99
  return false;
93
100
  }
@@ -50,4 +50,22 @@ export const setToolbarDocking = ({
50
50
  })(tr);
51
51
  }
52
52
  return tr;
53
+ };
54
+
55
+ // Performs similarly to `setToolbarDocking` with a couple of differences.
56
+ // 1) It does not fire any analytics.
57
+ // 2) It does not make any changes to the selection.
58
+ // This was required due to issues with the Confluence Legacy Content Extension which needs to manipulate the scrollbar position when editor controls are enabled
59
+ // but relies on the selection remaining stable.
60
+ export const forceToolbarDockingWithoutAnalytics = ({
61
+ toolbarDocking,
62
+ userPreferencesProvider
63
+ }) => ({
64
+ tr
65
+ }) => {
66
+ userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.updatePreference('toolbarDockingInitialPosition', toolbarDocking);
67
+ tr.setMeta(selectionToolbarPluginKey, {
68
+ toolbarDocking
69
+ });
70
+ return tr;
53
71
  };
@@ -6,7 +6,7 @@ import { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellS
6
6
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
8
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
9
- import { setToolbarDocking, toggleToolbar, updateToolbarDocking } from './pm-plugins/commands';
9
+ import { setToolbarDocking, toggleToolbar, updateToolbarDocking, forceToolbarDockingWithoutAnalytics } from './pm-plugins/commands';
10
10
  import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
11
11
  import { getOverflowFloatingToolbarConfig } from './ui/overflow-toolbar-config';
12
12
  import { PageVisibilityWatcher } from './ui/PageVisibilityWatcher';
@@ -72,13 +72,20 @@ export const selectionToolbarPlugin = ({
72
72
  editorAnalyticsApi: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
73
73
  }))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
74
74
  },
75
+ forceToolbarDockingWithoutAnalytics: toolbarDocking => {
76
+ var _api$core$actions$exe4;
77
+ return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute(forceToolbarDockingWithoutAnalytics({
78
+ toolbarDocking,
79
+ userPreferencesProvider
80
+ }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
81
+ },
75
82
  refreshToolbarDocking: () => {
76
83
  if (userPreferencesProvider) {
77
- var _api$core$actions$exe4;
84
+ var _api$core$actions$exe5;
78
85
  const userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
79
- return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute(updateToolbarDocking({
86
+ return (_api$core$actions$exe5 = api === null || api === void 0 ? void 0 : api.core.actions.execute(updateToolbarDocking({
80
87
  toolbarDocking: userToolbarDockingPref
81
- }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
88
+ }))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
82
89
  }
83
90
  return false;
84
91
  }
@@ -50,4 +50,22 @@ export var setToolbarDocking = function setToolbarDocking(_ref5) {
50
50
  }
51
51
  return tr;
52
52
  };
53
+ };
54
+
55
+ // Performs similarly to `setToolbarDocking` with a couple of differences.
56
+ // 1) It does not fire any analytics.
57
+ // 2) It does not make any changes to the selection.
58
+ // This was required due to issues with the Confluence Legacy Content Extension which needs to manipulate the scrollbar position when editor controls are enabled
59
+ // but relies on the selection remaining stable.
60
+ export var forceToolbarDockingWithoutAnalytics = function forceToolbarDockingWithoutAnalytics(_ref7) {
61
+ var toolbarDocking = _ref7.toolbarDocking,
62
+ userPreferencesProvider = _ref7.userPreferencesProvider;
63
+ return function (_ref8) {
64
+ var tr = _ref8.tr;
65
+ userPreferencesProvider === null || userPreferencesProvider === void 0 || userPreferencesProvider.updatePreference('toolbarDockingInitialPosition', toolbarDocking);
66
+ tr.setMeta(selectionToolbarPluginKey, {
67
+ toolbarDocking: toolbarDocking
68
+ });
69
+ return tr;
70
+ };
53
71
  };
@@ -10,7 +10,7 @@ import { calculateToolbarPositionAboveSelection, calculateToolbarPositionOnCellS
10
10
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
11
11
  import { fg } from '@atlaskit/platform-feature-flags';
12
12
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
- import { setToolbarDocking as _setToolbarDocking, toggleToolbar, updateToolbarDocking } from './pm-plugins/commands';
13
+ import { setToolbarDocking as _setToolbarDocking, toggleToolbar, updateToolbarDocking, forceToolbarDockingWithoutAnalytics as _forceToolbarDockingWithoutAnalytics } from './pm-plugins/commands';
14
14
  import { selectionToolbarPluginKey } from './pm-plugins/plugin-key';
15
15
  import { getOverflowFloatingToolbarConfig } from './ui/overflow-toolbar-config';
16
16
  import { PageVisibilityWatcher } from './ui/PageVisibilityWatcher';
@@ -74,13 +74,20 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
74
74
  editorAnalyticsApi: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
75
75
  }))) !== null && _api$core$actions$exe3 !== void 0 ? _api$core$actions$exe3 : false;
76
76
  },
77
+ forceToolbarDockingWithoutAnalytics: function forceToolbarDockingWithoutAnalytics(toolbarDocking) {
78
+ var _api$core$actions$exe4;
79
+ return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute(_forceToolbarDockingWithoutAnalytics({
80
+ toolbarDocking: toolbarDocking,
81
+ userPreferencesProvider: userPreferencesProvider
82
+ }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
83
+ },
77
84
  refreshToolbarDocking: function refreshToolbarDocking() {
78
85
  if (userPreferencesProvider) {
79
- var _api$core$actions$exe4;
86
+ var _api$core$actions$exe5;
80
87
  var userToolbarDockingPref = getToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
81
- return (_api$core$actions$exe4 = api === null || api === void 0 ? void 0 : api.core.actions.execute(updateToolbarDocking({
88
+ return (_api$core$actions$exe5 = api === null || api === void 0 ? void 0 : api.core.actions.execute(updateToolbarDocking({
82
89
  toolbarDocking: userToolbarDockingPref
83
- }))) !== null && _api$core$actions$exe4 !== void 0 ? _api$core$actions$exe4 : false;
90
+ }))) !== null && _api$core$actions$exe5 !== void 0 ? _api$core$actions$exe5 : false;
84
91
  }
85
92
  return false;
86
93
  }
@@ -12,3 +12,7 @@ export declare const setToolbarDocking: ({ toolbarDocking, userPreferencesProvid
12
12
  userPreferencesProvider?: UserPreferencesProvider | undefined;
13
13
  editorAnalyticsApi?: EditorAnalyticsAPI | undefined;
14
14
  }) => EditorCommand;
15
+ export declare const forceToolbarDockingWithoutAnalytics: ({ toolbarDocking, userPreferencesProvider, }: {
16
+ toolbarDocking: ToolbarDocking;
17
+ userPreferencesProvider?: UserPreferencesProvider | undefined;
18
+ }) => EditorCommand;
@@ -25,6 +25,7 @@ export type SelectionToolbarPlugin = NextEditorPlugin<'selectionToolbar', {
25
25
  suppressToolbar?: () => boolean;
26
26
  unsuppressToolbar?: () => boolean;
27
27
  setToolbarDocking?: (toolbarDocking: ToolbarDocking) => boolean;
28
+ forceToolbarDockingWithoutAnalytics?: (toolbarDocking: ToolbarDocking) => boolean;
28
29
  refreshToolbarDocking?: () => boolean;
29
30
  };
30
31
  }>;
@@ -12,3 +12,7 @@ export declare const setToolbarDocking: ({ toolbarDocking, userPreferencesProvid
12
12
  userPreferencesProvider?: UserPreferencesProvider | undefined;
13
13
  editorAnalyticsApi?: EditorAnalyticsAPI | undefined;
14
14
  }) => EditorCommand;
15
+ export declare const forceToolbarDockingWithoutAnalytics: ({ toolbarDocking, userPreferencesProvider, }: {
16
+ toolbarDocking: ToolbarDocking;
17
+ userPreferencesProvider?: UserPreferencesProvider | undefined;
18
+ }) => EditorCommand;
@@ -25,6 +25,7 @@ export type SelectionToolbarPlugin = NextEditorPlugin<'selectionToolbar', {
25
25
  suppressToolbar?: () => boolean;
26
26
  unsuppressToolbar?: () => boolean;
27
27
  setToolbarDocking?: (toolbarDocking: ToolbarDocking) => boolean;
28
+ forceToolbarDockingWithoutAnalytics?: (toolbarDocking: ToolbarDocking) => boolean;
28
29
  refreshToolbarDocking?: () => boolean;
29
30
  };
30
31
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "3.5.7",
3
+ "version": "3.6.1",
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,17 +34,17 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/css": "^0.10.0",
37
- "@atlaskit/editor-common": "^104.0.0",
37
+ "@atlaskit/editor-common": "^104.1.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
39
39
  "@atlaskit/editor-plugin-block-controls": "^3.13.0",
40
40
  "@atlaskit/editor-plugin-editor-viewmode": "^3.1.0",
41
41
  "@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
42
42
  "@atlaskit/editor-prosemirror": "7.0.0",
43
- "@atlaskit/icon": "^25.6.0",
44
- "@atlaskit/icon-lab": "^4.10.0",
43
+ "@atlaskit/icon": "^26.0.0",
44
+ "@atlaskit/icon-lab": "^4.12.0",
45
45
  "@atlaskit/menu": "^5.0.0",
46
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
- "@atlaskit/tmp-editor-statsig": "^4.16.0",
47
+ "@atlaskit/tmp-editor-statsig": "^4.19.0",
48
48
  "@atlaskit/tokens": "^4.8.0",
49
49
  "@babel/runtime": "^7.0.0",
50
50
  "bind-event-listener": "^3.0.0"