@atlaskit/editor-common 107.7.3 → 107.7.5

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,20 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 107.7.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#183739](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/183739)
8
+ [`4d5f2ac280ef0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d5f2ac280ef0) -
9
+ fix: use ref to store selector reference in useSharedPluginStateWithSelector
10
+ - Updated dependencies
11
+
12
+ ## 107.7.4
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 107.7.3
4
19
 
5
20
  ### Patch Changes
@@ -81,6 +81,7 @@ function useStaticPlugins(plugins) {
81
81
  */
82
82
  function useSharedPluginStateWithSelector(injectionApi, plugins, selector) {
83
83
  var pluginNames = useStaticPlugins(plugins);
84
+ var selectorRef = (0, _react.useRef)(selector);
84
85
 
85
86
  // Create a memoized object containing the named plugins
86
87
  var namedExternalPlugins = (0, _react.useMemo)(function () {
@@ -88,14 +89,14 @@ function useSharedPluginStateWithSelector(injectionApi, plugins, selector) {
88
89
  return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, "".concat(String(pluginName), "State"), injectionApi === null || injectionApi === void 0 ? void 0 : injectionApi[pluginName]));
89
90
  }, {});
90
91
  }, [injectionApi, pluginNames]);
91
- return useSharedPluginStateInternal(namedExternalPlugins, selector);
92
+ return useSharedPluginStateInternal(namedExternalPlugins, selectorRef);
92
93
  }
93
94
  function useSharedPluginStateInternal(externalPlugins, selector) {
94
95
  var refStates = (0, _react.useRef)(mapValues(externalPlugins, function (value) {
95
96
  return value === null || value === void 0 ? void 0 : value.sharedState.currentState();
96
97
  }));
97
98
  var _useState = (0, _react.useState)(function () {
98
- return selector(refStates.current);
99
+ return selector.current(refStates.current);
99
100
  }),
100
101
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
101
102
  pluginStates = _useState2[0],
@@ -104,8 +105,7 @@ function useSharedPluginStateInternal(externalPlugins, selector) {
104
105
  (0, _react.useLayoutEffect)(function () {
105
106
  var debouncedPluginStateUpdate = (0, _debounce.default)(function () {
106
107
  setPluginState(function (currentPluginStates) {
107
- // This is to avoid changing behaviour of the hook when selector is not provided.
108
- var nextStates = selector(_objectSpread({}, refStates.current));
108
+ var nextStates = selector.current(_objectSpread({}, refStates.current));
109
109
  if (shallowEqual(nextStates, currentPluginStates)) {
110
110
  return currentPluginStates;
111
111
  }
@@ -143,9 +143,6 @@ function useSharedPluginStateInternal(externalPlugins, selector) {
143
143
  return cb === null || cb === void 0 ? void 0 : cb();
144
144
  });
145
145
  };
146
- // Do not re-render due to state changes, we only need to check this when
147
- // setting up the initial subscription.
148
- // eslint-disable-next-line react-hooks/exhaustive-deps
149
146
  }, [externalPlugins, selector]);
150
147
  return pluginStates;
151
148
  }
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
16
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "107.7.2";
19
+ var packageVersion = "107.7.4";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // Ignored via go/ees007
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "107.7.2";
26
+ var packageVersion = "107.7.4";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -66,23 +66,23 @@ function useStaticPlugins(plugins) {
66
66
  */
67
67
  export function useSharedPluginStateWithSelector(injectionApi, plugins, selector) {
68
68
  const pluginNames = useStaticPlugins(plugins);
69
+ const selectorRef = useRef(selector);
69
70
 
70
71
  // Create a memoized object containing the named plugins
71
72
  const namedExternalPlugins = useMemo(() => pluginNames.reduce((acc, pluginName) => ({
72
73
  ...acc,
73
74
  [`${String(pluginName)}State`]: injectionApi === null || injectionApi === void 0 ? void 0 : injectionApi[pluginName]
74
75
  }), {}), [injectionApi, pluginNames]);
75
- return useSharedPluginStateInternal(namedExternalPlugins, selector);
76
+ return useSharedPluginStateInternal(namedExternalPlugins, selectorRef);
76
77
  }
77
78
  function useSharedPluginStateInternal(externalPlugins, selector) {
78
79
  const refStates = useRef(mapValues(externalPlugins, value => value === null || value === void 0 ? void 0 : value.sharedState.currentState()));
79
- const [pluginStates, setPluginState] = useState(() => selector(refStates.current));
80
+ const [pluginStates, setPluginState] = useState(() => selector.current(refStates.current));
80
81
  const mounted = useRef(false);
81
82
  useLayoutEffect(() => {
82
83
  const debouncedPluginStateUpdate = debounce(() => {
83
84
  setPluginState(currentPluginStates => {
84
- // This is to avoid changing behaviour of the hook when selector is not provided.
85
- const nextStates = selector({
85
+ const nextStates = selector.current({
86
86
  ...refStates.current
87
87
  });
88
88
  if (shallowEqual(nextStates, currentPluginStates)) {
@@ -116,9 +116,6 @@ function useSharedPluginStateInternal(externalPlugins, selector) {
116
116
  refStates.current = {};
117
117
  unsubs.forEach(cb => cb === null || cb === void 0 ? void 0 : cb());
118
118
  };
119
- // Do not re-render due to state changes, we only need to check this when
120
- // setting up the initial subscription.
121
- // eslint-disable-next-line react-hooks/exhaustive-deps
122
119
  }, [externalPlugins, selector]);
123
120
  return pluginStates;
124
121
  }
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "107.7.2";
4
+ const packageVersion = "107.7.4";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "107.7.2";
16
+ const packageVersion = "107.7.4";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -75,6 +75,7 @@ function useStaticPlugins(plugins) {
75
75
  */
76
76
  export function useSharedPluginStateWithSelector(injectionApi, plugins, selector) {
77
77
  var pluginNames = useStaticPlugins(plugins);
78
+ var selectorRef = useRef(selector);
78
79
 
79
80
  // Create a memoized object containing the named plugins
80
81
  var namedExternalPlugins = useMemo(function () {
@@ -82,14 +83,14 @@ export function useSharedPluginStateWithSelector(injectionApi, plugins, selector
82
83
  return _objectSpread(_objectSpread({}, acc), {}, _defineProperty({}, "".concat(String(pluginName), "State"), injectionApi === null || injectionApi === void 0 ? void 0 : injectionApi[pluginName]));
83
84
  }, {});
84
85
  }, [injectionApi, pluginNames]);
85
- return useSharedPluginStateInternal(namedExternalPlugins, selector);
86
+ return useSharedPluginStateInternal(namedExternalPlugins, selectorRef);
86
87
  }
87
88
  function useSharedPluginStateInternal(externalPlugins, selector) {
88
89
  var refStates = useRef(mapValues(externalPlugins, function (value) {
89
90
  return value === null || value === void 0 ? void 0 : value.sharedState.currentState();
90
91
  }));
91
92
  var _useState = useState(function () {
92
- return selector(refStates.current);
93
+ return selector.current(refStates.current);
93
94
  }),
94
95
  _useState2 = _slicedToArray(_useState, 2),
95
96
  pluginStates = _useState2[0],
@@ -98,8 +99,7 @@ function useSharedPluginStateInternal(externalPlugins, selector) {
98
99
  useLayoutEffect(function () {
99
100
  var debouncedPluginStateUpdate = debounce(function () {
100
101
  setPluginState(function (currentPluginStates) {
101
- // This is to avoid changing behaviour of the hook when selector is not provided.
102
- var nextStates = selector(_objectSpread({}, refStates.current));
102
+ var nextStates = selector.current(_objectSpread({}, refStates.current));
103
103
  if (shallowEqual(nextStates, currentPluginStates)) {
104
104
  return currentPluginStates;
105
105
  }
@@ -137,9 +137,6 @@ function useSharedPluginStateInternal(externalPlugins, selector) {
137
137
  return cb === null || cb === void 0 ? void 0 : cb();
138
138
  });
139
139
  };
140
- // Do not re-render due to state changes, we only need to check this when
141
- // setting up the initial subscription.
142
- // eslint-disable-next-line react-hooks/exhaustive-deps
143
140
  }, [externalPlugins, selector]);
144
141
  return pluginStates;
145
142
  }
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "107.7.2";
10
+ var packageVersion = "107.7.4";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "107.7.2";
23
+ var packageVersion = "107.7.4";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "107.7.3",
3
+ "version": "107.7.5",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -122,7 +122,7 @@
122
122
  },
123
123
  "dependencies": {
124
124
  "@atlaskit/activity-provider": "^2.5.0",
125
- "@atlaskit/adf-schema": "^47.6.0",
125
+ "@atlaskit/adf-schema": "^49.0.5",
126
126
  "@atlaskit/adf-utils": "^19.20.0",
127
127
  "@atlaskit/analytics-listeners": "^9.0.0",
128
128
  "@atlaskit/analytics-namespaced-context": "^7.0.0",
@@ -169,8 +169,8 @@
169
169
  "@atlaskit/status": "^3.0.0",
170
170
  "@atlaskit/task-decision": "^19.2.0",
171
171
  "@atlaskit/textfield": "^8.0.0",
172
- "@atlaskit/theme": "^18.0.0",
173
- "@atlaskit/tmp-editor-statsig": "^9.1.0",
172
+ "@atlaskit/theme": "^19.0.0",
173
+ "@atlaskit/tmp-editor-statsig": "^9.3.0",
174
174
  "@atlaskit/tokens": "^5.4.0",
175
175
  "@atlaskit/tooltip": "^20.3.0",
176
176
  "@atlaskit/width-detector": "^5.0.0",