@atlaskit/editor-plugin-breakout 3.0.0 → 3.0.2

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-plugin-breakout
2
2
 
3
+ ## 3.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#183109](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/183109)
8
+ [`3fd4ff5c71ef7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3fd4ff5c71ef7) -
9
+ Migrate to useSharedPluginStateWithSelector
10
+ - Updated dependencies
11
+
12
+ ## 3.0.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 3.0.0
4
19
 
5
20
  ### Major Changes
@@ -122,13 +122,34 @@ function createPlugin(api, _ref, appearance) {
122
122
  }
123
123
  });
124
124
  }
125
- var useOldHook = function useOldHook(api) {
125
+ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
126
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['editorViewMode', 'editorDisabled', 'blockControls'], function (states) {
127
+ var _states$blockControls, _states$blockControls2, _states$editorViewMod, _states$editorDisable;
128
+ return {
129
+ isDragging: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.isDragging,
130
+ isPMDragging: (_states$blockControls2 = states.blockControlsState) === null || _states$blockControls2 === void 0 ? void 0 : _states$blockControls2.isPMDragging,
131
+ mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
132
+ editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled
133
+ };
134
+ }),
135
+ editorDisabled = _useSharedPluginState.editorDisabled,
136
+ isDragging = _useSharedPluginState.isDragging,
137
+ isPMDragging = _useSharedPluginState.isPMDragging,
138
+ mode = _useSharedPluginState.mode;
139
+ return {
140
+ breakoutNode: undefined,
141
+ isDragging: isDragging,
142
+ isPMDragging: isPMDragging,
143
+ mode: mode,
144
+ editorDisabled: editorDisabled
145
+ };
146
+ }, function (api) {
126
147
  // Re-render with `width` (but don't use state) due to https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/24272
127
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'breakout', 'editorViewMode', 'editorDisabled', 'blockControls']),
128
- breakoutState = _useSharedPluginState.breakoutState,
129
- editorViewModeState = _useSharedPluginState.editorViewModeState,
130
- editorDisabledState = _useSharedPluginState.editorDisabledState,
131
- blockControlsState = _useSharedPluginState.blockControlsState;
148
+ var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['width', 'breakout', 'editorViewMode', 'editorDisabled', 'blockControls']),
149
+ breakoutState = _useSharedPluginState2.breakoutState,
150
+ editorViewModeState = _useSharedPluginState2.editorViewModeState,
151
+ editorDisabledState = _useSharedPluginState2.editorDisabledState,
152
+ blockControlsState = _useSharedPluginState2.blockControlsState;
132
153
  return {
133
154
  breakoutNode: breakoutState === null || breakoutState === void 0 ? void 0 : breakoutState.breakoutNode,
134
155
  isDragging: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isDragging,
@@ -136,21 +157,7 @@ var useOldHook = function useOldHook(api) {
136
157
  mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
137
158
  editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
138
159
  };
139
- };
140
- var useNewHook = function useNewHook(api) {
141
- var isDragging = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockControls.isDragging');
142
- var isPMDragging = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'blockControls.isPMDragging');
143
- var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
144
- var editorDisabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorDisabled.editorDisabled');
145
- return {
146
- breakoutNode: undefined,
147
- isDragging: isDragging,
148
- isPMDragging: isPMDragging,
149
- mode: mode,
150
- editorDisabled: editorDisabled
151
- };
152
- };
153
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(useNewHook, useOldHook);
160
+ });
154
161
  var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
155
162
  var _breakoutNode$node;
156
163
  var api = _ref2.api,
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { breakout } from '@atlaskit/adf-schema';
3
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
3
+ import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import { BreakoutCssClassName } from '@atlaskit/editor-common/styles';
6
6
  import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
@@ -110,7 +110,29 @@ function createPlugin(api, {
110
110
  }
111
111
  });
112
112
  }
113
- const useOldHook = api => {
113
+ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
114
+ const {
115
+ editorDisabled,
116
+ isDragging,
117
+ isPMDragging,
118
+ mode
119
+ } = useSharedPluginStateWithSelector(api, ['editorViewMode', 'editorDisabled', 'blockControls'], states => {
120
+ var _states$blockControls, _states$blockControls2, _states$editorViewMod, _states$editorDisable;
121
+ return {
122
+ isDragging: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.isDragging,
123
+ isPMDragging: (_states$blockControls2 = states.blockControlsState) === null || _states$blockControls2 === void 0 ? void 0 : _states$blockControls2.isPMDragging,
124
+ mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
125
+ editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled
126
+ };
127
+ });
128
+ return {
129
+ breakoutNode: undefined,
130
+ isDragging,
131
+ isPMDragging,
132
+ mode,
133
+ editorDisabled
134
+ };
135
+ }, api => {
114
136
  // Re-render with `width` (but don't use state) due to https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/24272
115
137
  const {
116
138
  breakoutState,
@@ -125,21 +147,7 @@ const useOldHook = api => {
125
147
  mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
126
148
  editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
127
149
  };
128
- };
129
- const useNewHook = api => {
130
- const isDragging = useSharedPluginStateSelector(api, 'blockControls.isDragging');
131
- const isPMDragging = useSharedPluginStateSelector(api, 'blockControls.isPMDragging');
132
- const mode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
133
- const editorDisabled = useSharedPluginStateSelector(api, 'editorDisabled.editorDisabled');
134
- return {
135
- breakoutNode: undefined,
136
- isDragging,
137
- isPMDragging,
138
- mode,
139
- editorDisabled
140
- };
141
- };
142
- const useSharedState = sharedPluginStateHookMigratorFactory(useNewHook, useOldHook);
150
+ });
143
151
  const LayoutButtonWrapper = ({
144
152
  api,
145
153
  editorView,
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  import React, { useState } from 'react';
8
8
  import { breakout } from '@atlaskit/adf-schema';
9
- import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
9
+ import { useSharedPluginState, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
10
10
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
11
11
  import { BreakoutCssClassName } from '@atlaskit/editor-common/styles';
12
12
  import { usePluginStateEffect } from '@atlaskit/editor-common/use-plugin-state-effect';
@@ -113,13 +113,34 @@ function createPlugin(api, _ref, appearance) {
113
113
  }
114
114
  });
115
115
  }
116
- var useOldHook = function useOldHook(api) {
116
+ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
117
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['editorViewMode', 'editorDisabled', 'blockControls'], function (states) {
118
+ var _states$blockControls, _states$blockControls2, _states$editorViewMod, _states$editorDisable;
119
+ return {
120
+ isDragging: (_states$blockControls = states.blockControlsState) === null || _states$blockControls === void 0 ? void 0 : _states$blockControls.isDragging,
121
+ isPMDragging: (_states$blockControls2 = states.blockControlsState) === null || _states$blockControls2 === void 0 ? void 0 : _states$blockControls2.isPMDragging,
122
+ mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
123
+ editorDisabled: (_states$editorDisable = states.editorDisabledState) === null || _states$editorDisable === void 0 ? void 0 : _states$editorDisable.editorDisabled
124
+ };
125
+ }),
126
+ editorDisabled = _useSharedPluginState.editorDisabled,
127
+ isDragging = _useSharedPluginState.isDragging,
128
+ isPMDragging = _useSharedPluginState.isPMDragging,
129
+ mode = _useSharedPluginState.mode;
130
+ return {
131
+ breakoutNode: undefined,
132
+ isDragging: isDragging,
133
+ isPMDragging: isPMDragging,
134
+ mode: mode,
135
+ editorDisabled: editorDisabled
136
+ };
137
+ }, function (api) {
117
138
  // Re-render with `width` (but don't use state) due to https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/24272
118
- var _useSharedPluginState = useSharedPluginState(api, ['width', 'breakout', 'editorViewMode', 'editorDisabled', 'blockControls']),
119
- breakoutState = _useSharedPluginState.breakoutState,
120
- editorViewModeState = _useSharedPluginState.editorViewModeState,
121
- editorDisabledState = _useSharedPluginState.editorDisabledState,
122
- blockControlsState = _useSharedPluginState.blockControlsState;
139
+ var _useSharedPluginState2 = useSharedPluginState(api, ['width', 'breakout', 'editorViewMode', 'editorDisabled', 'blockControls']),
140
+ breakoutState = _useSharedPluginState2.breakoutState,
141
+ editorViewModeState = _useSharedPluginState2.editorViewModeState,
142
+ editorDisabledState = _useSharedPluginState2.editorDisabledState,
143
+ blockControlsState = _useSharedPluginState2.blockControlsState;
123
144
  return {
124
145
  breakoutNode: breakoutState === null || breakoutState === void 0 ? void 0 : breakoutState.breakoutNode,
125
146
  isDragging: blockControlsState === null || blockControlsState === void 0 ? void 0 : blockControlsState.isDragging,
@@ -127,21 +148,7 @@ var useOldHook = function useOldHook(api) {
127
148
  mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
128
149
  editorDisabled: editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled
129
150
  };
130
- };
131
- var useNewHook = function useNewHook(api) {
132
- var isDragging = useSharedPluginStateSelector(api, 'blockControls.isDragging');
133
- var isPMDragging = useSharedPluginStateSelector(api, 'blockControls.isPMDragging');
134
- var mode = useSharedPluginStateSelector(api, 'editorViewMode.mode');
135
- var editorDisabled = useSharedPluginStateSelector(api, 'editorDisabled.editorDisabled');
136
- return {
137
- breakoutNode: undefined,
138
- isDragging: isDragging,
139
- isPMDragging: isPMDragging,
140
- mode: mode,
141
- editorDisabled: editorDisabled
142
- };
143
- };
144
- var useSharedState = sharedPluginStateHookMigratorFactory(useNewHook, useOldHook);
151
+ });
145
152
  var LayoutButtonWrapper = function LayoutButtonWrapper(_ref2) {
146
153
  var _breakoutNode$node;
147
154
  var api = _ref2.api,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-breakout",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Breakout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -42,11 +42,11 @@
42
42
  "@atlaskit/editor-plugin-width": "^4.0.0",
43
43
  "@atlaskit/editor-prosemirror": "7.0.0",
44
44
  "@atlaskit/editor-shared-styles": "^3.4.0",
45
- "@atlaskit/icon": "^27.2.0",
45
+ "@atlaskit/icon": "^27.3.0",
46
46
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
47
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
48
48
  "@atlaskit/theme": "^18.0.0",
49
- "@atlaskit/tmp-editor-statsig": "^8.7.0",
49
+ "@atlaskit/tmp-editor-statsig": "^9.1.0",
50
50
  "@atlaskit/tokens": "^5.4.0",
51
51
  "@atlaskit/tooltip": "^20.3.0",
52
52
  "@babel/runtime": "^7.0.0",
@@ -56,7 +56,7 @@
56
56
  "uuid": "^3.1.0"
57
57
  },
58
58
  "peerDependencies": {
59
- "@atlaskit/editor-common": "^107.6.0",
59
+ "@atlaskit/editor-common": "^107.7.0",
60
60
  "react": "^18.2.0",
61
61
  "react-dom": "^18.2.0",
62
62
  "react-intl-next": "npm:react-intl@^5.18.1"