@atlaskit/editor-plugin-selection-toolbar 3.5.2 → 3.5.4

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,23 @@
1
1
  # @atlaskit/editor-plugin-selection-toolbar
2
2
 
3
+ ## 3.5.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#146885](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/146885)
8
+ [`0e54e7556bae4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0e54e7556bae4) -
9
+ [ux] Fix issue with toolbar initial docking preference not updating correctly when navigating
10
+ between live docs and classic pages
11
+ - Updated dependencies
12
+
13
+ ## 3.5.3
14
+
15
+ ### Patch Changes
16
+
17
+ - [#144882](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/144882)
18
+ [`0f6d28302bae7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0f6d28302bae7) -
19
+ ED-27414 update user pref feature gate to unify frontend and ssr changes.
20
+
3
21
  ## 3.5.2
4
22
 
5
23
  ### Patch Changes
@@ -10,6 +10,7 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
10
10
  var _react = require("react");
11
11
  var _bindEventListener = require("bind-event-listener");
12
12
  var _monitoring = require("@atlaskit/editor-common/monitoring");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var PageVisibilityWatcher = exports.PageVisibilityWatcher = function PageVisibilityWatcher(_ref) {
14
15
  var api = _ref.api,
15
16
  userPreferencesProvider = _ref.userPreferencesProvider;
@@ -17,43 +18,84 @@ var PageVisibilityWatcher = exports.PageVisibilityWatcher = function PageVisibil
17
18
  if (!userPreferencesProvider || !api) {
18
19
  return;
19
20
  }
20
- return (0, _bindEventListener.bind)(document, {
21
- type: 'visibilitychange',
22
- listener: function () {
23
- var _listener = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
24
- var _api$selectionToolbar, _api$selectionToolbar2;
25
- return _regenerator.default.wrap(function _callee$(_context) {
26
- while (1) switch (_context.prev = _context.next) {
27
- case 0:
28
- if (!(document.visibilityState === 'visible')) {
29
- _context.next = 10;
21
+ if (!(0, _platformFeatureFlags.fg)('platform_editor_controls_patch_6')) {
22
+ return (0, _bindEventListener.bind)(document, {
23
+ type: 'visibilitychange',
24
+ listener: function () {
25
+ var _listener = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
26
+ var _api$selectionToolbar, _api$selectionToolbar2;
27
+ return _regenerator.default.wrap(function _callee$(_context) {
28
+ while (1) switch (_context.prev = _context.next) {
29
+ case 0:
30
+ if (!(document.visibilityState === 'visible')) {
31
+ _context.next = 10;
32
+ break;
33
+ }
34
+ _context.prev = 1;
35
+ _context.next = 4;
36
+ return userPreferencesProvider.loadPreferences();
37
+ case 4:
38
+ _context.next = 9;
30
39
  break;
31
- }
32
- _context.prev = 1;
33
- _context.next = 4;
34
- return userPreferencesProvider.loadPreferences();
35
- case 4:
36
- _context.next = 9;
40
+ case 6:
41
+ _context.prev = 6;
42
+ _context.t0 = _context["catch"](1);
43
+ (0, _monitoring.logException)(_context.t0, {
44
+ location: 'editor-plugin-selection-toolbar/PageVisibilityWatcher'
45
+ });
46
+ case 9:
47
+ api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.actions) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar2 = _api$selectionToolbar.refreshToolbarDocking) === null || _api$selectionToolbar2 === void 0 || _api$selectionToolbar2.call(_api$selectionToolbar);
48
+ case 10:
49
+ case "end":
50
+ return _context.stop();
51
+ }
52
+ }, _callee, null, [[1, 6]]);
53
+ }));
54
+ function listener() {
55
+ return _listener.apply(this, arguments);
56
+ }
57
+ return listener;
58
+ }()
59
+ });
60
+ }
61
+ var refreshPrefrerence = /*#__PURE__*/function () {
62
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
63
+ var _api$selectionToolbar3, _api$selectionToolbar4;
64
+ return _regenerator.default.wrap(function _callee2$(_context2) {
65
+ while (1) switch (_context2.prev = _context2.next) {
66
+ case 0:
67
+ if (!(document.visibilityState === 'visible')) {
68
+ _context2.next = 10;
37
69
  break;
38
- case 6:
39
- _context.prev = 6;
40
- _context.t0 = _context["catch"](1);
41
- (0, _monitoring.logException)(_context.t0, {
42
- location: 'editor-plugin-selection-toolbar/PageVisibilityWatcher'
43
- });
44
- case 9:
45
- api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.actions) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar2 = _api$selectionToolbar.refreshToolbarDocking) === null || _api$selectionToolbar2 === void 0 || _api$selectionToolbar2.call(_api$selectionToolbar);
46
- case 10:
47
- case "end":
48
- return _context.stop();
49
- }
50
- }, _callee, null, [[1, 6]]);
51
- }));
52
- function listener() {
53
- return _listener.apply(this, arguments);
54
- }
55
- return listener;
56
- }()
70
+ }
71
+ _context2.prev = 1;
72
+ _context2.next = 4;
73
+ return userPreferencesProvider.loadPreferences();
74
+ case 4:
75
+ _context2.next = 9;
76
+ break;
77
+ case 6:
78
+ _context2.prev = 6;
79
+ _context2.t0 = _context2["catch"](1);
80
+ (0, _monitoring.logException)(_context2.t0, {
81
+ location: 'editor-plugin-selection-toolbar/PageVisibilityWatcher'
82
+ });
83
+ case 9:
84
+ api === null || api === void 0 || (_api$selectionToolbar3 = api.selectionToolbar) === null || _api$selectionToolbar3 === void 0 || (_api$selectionToolbar3 = _api$selectionToolbar3.actions) === null || _api$selectionToolbar3 === void 0 || (_api$selectionToolbar4 = _api$selectionToolbar3.refreshToolbarDocking) === null || _api$selectionToolbar4 === void 0 || _api$selectionToolbar4.call(_api$selectionToolbar3);
85
+ case 10:
86
+ case "end":
87
+ return _context2.stop();
88
+ }
89
+ }, _callee2, null, [[1, 6]]);
90
+ }));
91
+ return function refreshPrefrerence() {
92
+ return _ref2.apply(this, arguments);
93
+ };
94
+ }();
95
+ refreshPrefrerence();
96
+ return (0, _bindEventListener.bind)(document, {
97
+ type: 'visibilitychange',
98
+ listener: refreshPrefrerence
57
99
  });
58
100
  }, [api, userPreferencesProvider]);
59
101
  return null;
@@ -1,6 +1,7 @@
1
1
  import { useEffect } from 'react';
2
2
  import { bind } from 'bind-event-listener';
3
3
  import { logException } from '@atlaskit/editor-common/monitoring';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  export const PageVisibilityWatcher = ({
5
6
  api,
6
7
  userPreferencesProvider
@@ -9,21 +10,41 @@ export const PageVisibilityWatcher = ({
9
10
  if (!userPreferencesProvider || !api) {
10
11
  return;
11
12
  }
12
- return bind(document, {
13
- type: 'visibilitychange',
14
- listener: async () => {
15
- if (document.visibilityState === 'visible') {
16
- var _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
17
- try {
18
- await userPreferencesProvider.loadPreferences();
19
- } catch (error) {
20
- logException(error, {
21
- location: 'editor-plugin-selection-toolbar/PageVisibilityWatcher'
22
- });
13
+ if (!fg('platform_editor_controls_patch_6')) {
14
+ return bind(document, {
15
+ type: 'visibilitychange',
16
+ listener: async () => {
17
+ if (document.visibilityState === 'visible') {
18
+ var _api$selectionToolbar, _api$selectionToolbar2, _api$selectionToolbar3;
19
+ try {
20
+ await userPreferencesProvider.loadPreferences();
21
+ } catch (error) {
22
+ logException(error, {
23
+ location: 'editor-plugin-selection-toolbar/PageVisibilityWatcher'
24
+ });
25
+ }
26
+ api === null || api === void 0 ? void 0 : (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 ? void 0 : (_api$selectionToolbar2 = _api$selectionToolbar.actions) === null || _api$selectionToolbar2 === void 0 ? void 0 : (_api$selectionToolbar3 = _api$selectionToolbar2.refreshToolbarDocking) === null || _api$selectionToolbar3 === void 0 ? void 0 : _api$selectionToolbar3.call(_api$selectionToolbar2);
23
27
  }
24
- api === null || api === void 0 ? void 0 : (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 ? void 0 : (_api$selectionToolbar2 = _api$selectionToolbar.actions) === null || _api$selectionToolbar2 === void 0 ? void 0 : (_api$selectionToolbar3 = _api$selectionToolbar2.refreshToolbarDocking) === null || _api$selectionToolbar3 === void 0 ? void 0 : _api$selectionToolbar3.call(_api$selectionToolbar2);
25
28
  }
29
+ });
30
+ }
31
+ const refreshPrefrerence = async () => {
32
+ if (document.visibilityState === 'visible') {
33
+ var _api$selectionToolbar4, _api$selectionToolbar5, _api$selectionToolbar6;
34
+ try {
35
+ await userPreferencesProvider.loadPreferences();
36
+ } catch (error) {
37
+ logException(error, {
38
+ location: 'editor-plugin-selection-toolbar/PageVisibilityWatcher'
39
+ });
40
+ }
41
+ api === null || api === void 0 ? void 0 : (_api$selectionToolbar4 = api.selectionToolbar) === null || _api$selectionToolbar4 === void 0 ? void 0 : (_api$selectionToolbar5 = _api$selectionToolbar4.actions) === null || _api$selectionToolbar5 === void 0 ? void 0 : (_api$selectionToolbar6 = _api$selectionToolbar5.refreshToolbarDocking) === null || _api$selectionToolbar6 === void 0 ? void 0 : _api$selectionToolbar6.call(_api$selectionToolbar5);
26
42
  }
43
+ };
44
+ refreshPrefrerence();
45
+ return bind(document, {
46
+ type: 'visibilitychange',
47
+ listener: refreshPrefrerence
27
48
  });
28
49
  }, [api, userPreferencesProvider]);
29
50
  return null;
@@ -3,6 +3,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
3
  import { useEffect } from 'react';
4
4
  import { bind } from 'bind-event-listener';
5
5
  import { logException } from '@atlaskit/editor-common/monitoring';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  export var PageVisibilityWatcher = function PageVisibilityWatcher(_ref) {
7
8
  var api = _ref.api,
8
9
  userPreferencesProvider = _ref.userPreferencesProvider;
@@ -10,43 +11,84 @@ export var PageVisibilityWatcher = function PageVisibilityWatcher(_ref) {
10
11
  if (!userPreferencesProvider || !api) {
11
12
  return;
12
13
  }
13
- return bind(document, {
14
- type: 'visibilitychange',
15
- listener: function () {
16
- var _listener = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
17
- var _api$selectionToolbar, _api$selectionToolbar2;
18
- return _regeneratorRuntime.wrap(function _callee$(_context) {
19
- while (1) switch (_context.prev = _context.next) {
20
- case 0:
21
- if (!(document.visibilityState === 'visible')) {
22
- _context.next = 10;
14
+ if (!fg('platform_editor_controls_patch_6')) {
15
+ return bind(document, {
16
+ type: 'visibilitychange',
17
+ listener: function () {
18
+ var _listener = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
19
+ var _api$selectionToolbar, _api$selectionToolbar2;
20
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
21
+ while (1) switch (_context.prev = _context.next) {
22
+ case 0:
23
+ if (!(document.visibilityState === 'visible')) {
24
+ _context.next = 10;
25
+ break;
26
+ }
27
+ _context.prev = 1;
28
+ _context.next = 4;
29
+ return userPreferencesProvider.loadPreferences();
30
+ case 4:
31
+ _context.next = 9;
23
32
  break;
24
- }
25
- _context.prev = 1;
26
- _context.next = 4;
27
- return userPreferencesProvider.loadPreferences();
28
- case 4:
29
- _context.next = 9;
33
+ case 6:
34
+ _context.prev = 6;
35
+ _context.t0 = _context["catch"](1);
36
+ logException(_context.t0, {
37
+ location: 'editor-plugin-selection-toolbar/PageVisibilityWatcher'
38
+ });
39
+ case 9:
40
+ api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.actions) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar2 = _api$selectionToolbar.refreshToolbarDocking) === null || _api$selectionToolbar2 === void 0 || _api$selectionToolbar2.call(_api$selectionToolbar);
41
+ case 10:
42
+ case "end":
43
+ return _context.stop();
44
+ }
45
+ }, _callee, null, [[1, 6]]);
46
+ }));
47
+ function listener() {
48
+ return _listener.apply(this, arguments);
49
+ }
50
+ return listener;
51
+ }()
52
+ });
53
+ }
54
+ var refreshPrefrerence = /*#__PURE__*/function () {
55
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
56
+ var _api$selectionToolbar3, _api$selectionToolbar4;
57
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
58
+ while (1) switch (_context2.prev = _context2.next) {
59
+ case 0:
60
+ if (!(document.visibilityState === 'visible')) {
61
+ _context2.next = 10;
30
62
  break;
31
- case 6:
32
- _context.prev = 6;
33
- _context.t0 = _context["catch"](1);
34
- logException(_context.t0, {
35
- location: 'editor-plugin-selection-toolbar/PageVisibilityWatcher'
36
- });
37
- case 9:
38
- api === null || api === void 0 || (_api$selectionToolbar = api.selectionToolbar) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar = _api$selectionToolbar.actions) === null || _api$selectionToolbar === void 0 || (_api$selectionToolbar2 = _api$selectionToolbar.refreshToolbarDocking) === null || _api$selectionToolbar2 === void 0 || _api$selectionToolbar2.call(_api$selectionToolbar);
39
- case 10:
40
- case "end":
41
- return _context.stop();
42
- }
43
- }, _callee, null, [[1, 6]]);
44
- }));
45
- function listener() {
46
- return _listener.apply(this, arguments);
47
- }
48
- return listener;
49
- }()
63
+ }
64
+ _context2.prev = 1;
65
+ _context2.next = 4;
66
+ return userPreferencesProvider.loadPreferences();
67
+ case 4:
68
+ _context2.next = 9;
69
+ break;
70
+ case 6:
71
+ _context2.prev = 6;
72
+ _context2.t0 = _context2["catch"](1);
73
+ logException(_context2.t0, {
74
+ location: 'editor-plugin-selection-toolbar/PageVisibilityWatcher'
75
+ });
76
+ case 9:
77
+ api === null || api === void 0 || (_api$selectionToolbar3 = api.selectionToolbar) === null || _api$selectionToolbar3 === void 0 || (_api$selectionToolbar3 = _api$selectionToolbar3.actions) === null || _api$selectionToolbar3 === void 0 || (_api$selectionToolbar4 = _api$selectionToolbar3.refreshToolbarDocking) === null || _api$selectionToolbar4 === void 0 || _api$selectionToolbar4.call(_api$selectionToolbar3);
78
+ case 10:
79
+ case "end":
80
+ return _context2.stop();
81
+ }
82
+ }, _callee2, null, [[1, 6]]);
83
+ }));
84
+ return function refreshPrefrerence() {
85
+ return _ref2.apply(this, arguments);
86
+ };
87
+ }();
88
+ refreshPrefrerence();
89
+ return bind(document, {
90
+ type: 'visibilitychange',
91
+ listener: refreshPrefrerence
50
92
  });
51
93
  }, [api, userPreferencesProvider]);
52
94
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-toolbar",
3
- "version": "3.5.2",
3
+ "version": "3.5.4",
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": "^103.15.0",
37
+ "@atlaskit/editor-common": "^103.18.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
39
39
  "@atlaskit/editor-plugin-block-controls": "^3.11.0",
40
40
  "@atlaskit/editor-plugin-editor-viewmode": "^3.1.0",
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/icon-lab": "^4.9.0",
45
45
  "@atlaskit/menu": "^3.2.0",
46
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
- "@atlaskit/tmp-editor-statsig": "^4.13.0",
47
+ "@atlaskit/tmp-editor-statsig": "^4.14.0",
48
48
  "@atlaskit/tokens": "^4.8.0",
49
49
  "@babel/runtime": "^7.0.0",
50
50
  "bind-event-listener": "^3.0.0"
@@ -55,9 +55,9 @@
55
55
  "react-intl-next": "npm:react-intl@^5.18.1"
56
56
  },
57
57
  "devDependencies": {
58
- "@af/visual-regression": "^1.3.0",
59
- "@atlaskit/ssr": "^0.4.0",
60
- "@atlaskit/visual-regression": "^0.10.0",
58
+ "@af/visual-regression": "workspace:^",
59
+ "@atlaskit/ssr": "workspace:^",
60
+ "@atlaskit/visual-regression": "workspace:^",
61
61
  "@testing-library/react": "^13.4.0",
62
62
  "typescript": "~5.4.2",
63
63
  "wait-for-expect": "^1.2.0"