@atlaskit/editor-plugin-selection-toolbar 2.2.0 → 2.3.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,21 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 2.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#131384](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131384)
8
+ [`e3a1b4a5535aa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3a1b4a5535aa) -
9
+ [ux] ED-26882 remove mock extension toolbar items
10
+
11
+ ## 2.3.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#128813](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128813)
16
+ [`6ced71640a4ba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6ced71640a4ba) -
17
+ ED-26877 selection toolbar plugin refreshes with user preferences
18
+
3
19
  ## 2.2.0
4
20
 
5
21
  ### Minor Changes
@@ -53,6 +53,7 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
53
53
  component: primaryToolbarComponent
54
54
  });
55
55
  }
56
+ var previousToolbarDocking = (userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition')) || null;
56
57
  return {
57
58
  name: 'selectionToolbar',
58
59
  actions: {
@@ -104,6 +105,22 @@ var selectionToolbarPlugin = exports.selectionToolbarPlugin = function selection
104
105
  if (meta) {
105
106
  return _objectSpread(_objectSpread({}, pluginState), meta);
106
107
  }
108
+
109
+ // if the toolbarDockingInitialPosition preference has changed
110
+ // update the toolbarDocking state
111
+ if (!previousToolbarDocking) {
112
+ // we currently only check for the initial value
113
+ var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
114
+ if (toolbarDockingPreference && toolbarDockingPreference !== previousToolbarDocking) {
115
+ previousToolbarDocking = toolbarDockingPreference;
116
+ var userToolbarDockingPref = getInitialToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
117
+ if (pluginState.toolbarDocking !== userToolbarDockingPref) {
118
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
119
+ toolbarDocking: userToolbarDockingPref
120
+ });
121
+ }
122
+ }
123
+ }
107
124
  return pluginState;
108
125
  }
109
126
  },
@@ -9,7 +9,6 @@ var _react = require("@emotion/react");
9
9
  var _dockToolbarTop = _interopRequireDefault(require("@atlaskit/icon-lab/core/dock-toolbar-top"));
10
10
  var _minus = _interopRequireDefault(require("@atlaskit/icon/core/minus"));
11
11
  var _checkMark = _interopRequireDefault(require("@atlaskit/icon/utility/check-mark"));
12
- var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-right"));
13
12
  var _menu = require("@atlaskit/menu");
14
13
  /**
15
14
  * @jsxRuntime classic
@@ -22,32 +21,8 @@ var _menu = require("@atlaskit/menu");
22
21
  var getOverflowFloatingToolbarConfig = exports.getOverflowFloatingToolbarConfig = function getOverflowFloatingToolbarConfig(_ref) {
23
22
  var api = _ref.api,
24
23
  toolbarDocking = _ref.toolbarDocking;
25
- var dropdownOptions = [{
26
- title: 'Create Jira issue',
27
- onClick: function onClick() {
28
- return false;
29
- },
30
- elemAfter: (0, _react.jsx)(_chevronRight.default, {
31
- spacing: "spacious",
32
- label: ""
33
- })
34
- }, {
35
- title: 'Define',
36
- onClick: function onClick() {
37
- return false;
38
- }
39
- }, {
40
- title: 'Apps',
41
- onClick: function onClick() {
42
- return false;
43
- },
44
- elemAfter: (0, _react.jsx)(_chevronRight.default, {
45
- spacing: "spacious",
46
- label: ""
47
- })
48
- }];
49
24
  var isDockedToTop = toolbarDocking === 'top';
50
- dropdownOptions.push({
25
+ var dropdownOptions = [{
51
26
  type: 'overflow-dropdown-heading',
52
27
  title: 'Toolbar appears'
53
28
  }, {
@@ -76,7 +51,7 @@ var getOverflowFloatingToolbarConfig = exports.getOverflowFloatingToolbarConfig
76
51
  elemAfter: isDockedToTop ? (0, _react.jsx)(_checkMark.default, {
77
52
  label: ""
78
53
  }) : undefined
79
- });
54
+ }];
80
55
  return [{
81
56
  type: 'separator',
82
57
  fullHeight: true
@@ -44,6 +44,7 @@ export const selectionToolbarPlugin = ({
44
44
  component: primaryToolbarComponent
45
45
  });
46
46
  }
47
+ let previousToolbarDocking = (userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition')) || null;
47
48
  return {
48
49
  name: 'selectionToolbar',
49
50
  actions: {
@@ -98,6 +99,23 @@ export const selectionToolbarPlugin = ({
98
99
  ...meta
99
100
  };
100
101
  }
102
+
103
+ // if the toolbarDockingInitialPosition preference has changed
104
+ // update the toolbarDocking state
105
+ if (!previousToolbarDocking) {
106
+ // we currently only check for the initial value
107
+ const toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
108
+ if (toolbarDockingPreference && toolbarDockingPreference !== previousToolbarDocking) {
109
+ previousToolbarDocking = toolbarDockingPreference;
110
+ const userToolbarDockingPref = getInitialToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
111
+ if (pluginState.toolbarDocking !== userToolbarDockingPref) {
112
+ return {
113
+ ...pluginState,
114
+ toolbarDocking: userToolbarDockingPref
115
+ };
116
+ }
117
+ }
118
+ }
101
119
  return pluginState;
102
120
  }
103
121
  },
@@ -8,39 +8,14 @@ import { jsx } from '@emotion/react'; // eslint-disable-line @atlaskit/ui-stylin
8
8
  import DockToolbarTopIcon from '@atlaskit/icon-lab/core/dock-toolbar-top';
9
9
  import MinusIcon from '@atlaskit/icon/core/minus';
10
10
  import CheckMarkIcon from '@atlaskit/icon/utility/check-mark';
11
- import ChevronRightIcon from '@atlaskit/icon/utility/migration/chevron-right';
12
11
  import { HeadingItem } from '@atlaskit/menu';
13
12
  // New editor controls
14
13
  export const getOverflowFloatingToolbarConfig = ({
15
14
  api,
16
15
  toolbarDocking
17
16
  }) => {
18
- const dropdownOptions = [{
19
- title: 'Create Jira issue',
20
- onClick: () => {
21
- return false;
22
- },
23
- elemAfter: jsx(ChevronRightIcon, {
24
- spacing: "spacious",
25
- label: ""
26
- })
27
- }, {
28
- title: 'Define',
29
- onClick: () => {
30
- return false;
31
- }
32
- }, {
33
- title: 'Apps',
34
- onClick: () => {
35
- return false;
36
- },
37
- elemAfter: jsx(ChevronRightIcon, {
38
- spacing: "spacious",
39
- label: ""
40
- })
41
- }];
42
17
  const isDockedToTop = toolbarDocking === 'top';
43
- dropdownOptions.push({
18
+ const dropdownOptions = [{
44
19
  type: 'overflow-dropdown-heading',
45
20
  title: 'Toolbar appears'
46
21
  }, {
@@ -69,7 +44,7 @@ export const getOverflowFloatingToolbarConfig = ({
69
44
  elemAfter: isDockedToTop ? jsx(CheckMarkIcon, {
70
45
  label: ""
71
46
  }) : undefined
72
- });
47
+ }];
73
48
  return [{
74
49
  type: 'separator',
75
50
  fullHeight: true
@@ -46,6 +46,7 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
46
46
  component: primaryToolbarComponent
47
47
  });
48
48
  }
49
+ var previousToolbarDocking = (userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition')) || null;
49
50
  return {
50
51
  name: 'selectionToolbar',
51
52
  actions: {
@@ -97,6 +98,22 @@ export var selectionToolbarPlugin = function selectionToolbarPlugin(_ref) {
97
98
  if (meta) {
98
99
  return _objectSpread(_objectSpread({}, pluginState), meta);
99
100
  }
101
+
102
+ // if the toolbarDockingInitialPosition preference has changed
103
+ // update the toolbarDocking state
104
+ if (!previousToolbarDocking) {
105
+ // we currently only check for the initial value
106
+ var toolbarDockingPreference = userPreferencesProvider === null || userPreferencesProvider === void 0 ? void 0 : userPreferencesProvider.getPreference('toolbarDockingInitialPosition');
107
+ if (toolbarDockingPreference && toolbarDockingPreference !== previousToolbarDocking) {
108
+ previousToolbarDocking = toolbarDockingPreference;
109
+ var userToolbarDockingPref = getInitialToolbarDocking(contextualFormattingEnabled, userPreferencesProvider);
110
+ if (pluginState.toolbarDocking !== userToolbarDockingPref) {
111
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
112
+ toolbarDocking: userToolbarDockingPref
113
+ });
114
+ }
115
+ }
116
+ }
100
117
  return pluginState;
101
118
  }
102
119
  },
@@ -8,38 +8,13 @@ import { jsx } from '@emotion/react'; // eslint-disable-line @atlaskit/ui-stylin
8
8
  import DockToolbarTopIcon from '@atlaskit/icon-lab/core/dock-toolbar-top';
9
9
  import MinusIcon from '@atlaskit/icon/core/minus';
10
10
  import CheckMarkIcon from '@atlaskit/icon/utility/check-mark';
11
- import ChevronRightIcon from '@atlaskit/icon/utility/migration/chevron-right';
12
11
  import { HeadingItem } from '@atlaskit/menu';
13
12
  // New editor controls
14
13
  export var getOverflowFloatingToolbarConfig = function getOverflowFloatingToolbarConfig(_ref) {
15
14
  var api = _ref.api,
16
15
  toolbarDocking = _ref.toolbarDocking;
17
- var dropdownOptions = [{
18
- title: 'Create Jira issue',
19
- onClick: function onClick() {
20
- return false;
21
- },
22
- elemAfter: jsx(ChevronRightIcon, {
23
- spacing: "spacious",
24
- label: ""
25
- })
26
- }, {
27
- title: 'Define',
28
- onClick: function onClick() {
29
- return false;
30
- }
31
- }, {
32
- title: 'Apps',
33
- onClick: function onClick() {
34
- return false;
35
- },
36
- elemAfter: jsx(ChevronRightIcon, {
37
- spacing: "spacious",
38
- label: ""
39
- })
40
- }];
41
16
  var isDockedToTop = toolbarDocking === 'top';
42
- dropdownOptions.push({
17
+ var dropdownOptions = [{
43
18
  type: 'overflow-dropdown-heading',
44
19
  title: 'Toolbar appears'
45
20
  }, {
@@ -68,7 +43,7 @@ export var getOverflowFloatingToolbarConfig = function getOverflowFloatingToolba
68
43
  elemAfter: isDockedToTop ? jsx(CheckMarkIcon, {
69
44
  label: ""
70
45
  }) : undefined
71
- });
46
+ }];
72
47
  return [{
73
48
  type: 'separator',
74
49
  fullHeight: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "2.2.0",
3
+ "version": "2.3.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",
@@ -33,15 +33,15 @@
33
33
  ".": "./src/index.ts"
34
34
  },
35
35
  "dependencies": {
36
- "@atlaskit/editor-common": "^102.12.0",
36
+ "@atlaskit/editor-common": "^102.13.0",
37
37
  "@atlaskit/editor-plugin-editor-viewmode": "^3.0.0",
38
38
  "@atlaskit/editor-plugin-primary-toolbar": "^3.1.0",
39
39
  "@atlaskit/editor-prosemirror": "7.0.0",
40
40
  "@atlaskit/icon": "^25.0.0",
41
- "@atlaskit/icon-lab": "^4.2.0",
41
+ "@atlaskit/icon-lab": "^4.3.0",
42
42
  "@atlaskit/menu": "^3.1.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
- "@atlaskit/tmp-editor-statsig": "^4.1.0",
44
+ "@atlaskit/tmp-editor-statsig": "^4.4.0",
45
45
  "@atlaskit/tokens": "^4.5.0",
46
46
  "@babel/runtime": "^7.0.0",
47
47
  "@emotion/react": "^11.7.1",