@atlaskit/editor-plugin-breakout 1.0.5 → 1.0.7

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,18 @@
1
1
  # @atlaskit/editor-plugin-breakout
2
2
 
3
+ ## 1.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#88938](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88938) [`db547827ee45`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/db547827ee45) - [ux] Don't render LayoutButton when editor in 'view' mode
8
+ - Updated dependencies
9
+
10
+ ## 1.0.6
11
+
12
+ ### Patch Changes
13
+
14
+ - [#86724](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86724) [`718a9aa2424d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/718a9aa2424d) - [ED-22607] Remove references to maxFrames for multi bodied extensions and bump adf-schema from 35.7.0 to 35.8.0
15
+
3
16
  ## 1.0.5
4
17
 
5
18
  ### Patch Changes
@@ -156,15 +156,17 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref3) {
156
156
  scrollableElement = _ref3.scrollableElement,
157
157
  mountPoint = _ref3.mountPoint;
158
158
  // Re-render with `width` (but don't use state) due to https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/24272
159
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'breakout']),
160
- breakoutState = _useSharedPluginState.breakoutState;
161
- return /*#__PURE__*/_react.default.createElement(_LayoutButton.default, {
159
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'breakout', 'editorViewMode']),
160
+ breakoutState = _useSharedPluginState.breakoutState,
161
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
162
+ var isViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
163
+ return !isViewMode ? /*#__PURE__*/_react.default.createElement(_LayoutButton.default, {
162
164
  editorView: editorView,
163
165
  mountPoint: mountPoint,
164
166
  boundariesElement: boundariesElement,
165
167
  scrollableElement: scrollableElement,
166
168
  node: (_breakoutState$breako = breakoutState === null || breakoutState === void 0 || (_breakoutState$breako2 = breakoutState.breakoutNode) === null || _breakoutState$breako2 === void 0 ? void 0 : _breakoutState$breako2.node) !== null && _breakoutState$breako !== void 0 ? _breakoutState$breako : null
167
- });
169
+ }) : null;
168
170
  };
169
171
  var breakoutPlugin = exports.breakoutPlugin = function breakoutPlugin(_ref4) {
170
172
  var options = _ref4.config,
@@ -205,7 +207,7 @@ var breakoutPlugin = exports.breakoutPlugin = function breakoutPlugin(_ref4) {
205
207
  popupsBoundariesElement = _ref5.popupsBoundariesElement,
206
208
  popupsScrollableElement = _ref5.popupsScrollableElement;
207
209
  // This is a bit crappy, but should be resolved once we move to a static schema.
208
- if (options && !options.allowBreakoutButton) {
210
+ if (options && !options.allowBreakoutButton || !editorView.editable) {
209
211
  return null;
210
212
  }
211
213
  return /*#__PURE__*/_react.default.createElement(LayoutButtonWrapper, {
@@ -147,15 +147,17 @@ const LayoutButtonWrapper = ({
147
147
  var _breakoutState$breako, _breakoutState$breako2;
148
148
  // Re-render with `width` (but don't use state) due to https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/24272
149
149
  const {
150
- breakoutState
151
- } = useSharedPluginState(api, ['width', 'breakout']);
152
- return /*#__PURE__*/React.createElement(LayoutButton, {
150
+ breakoutState,
151
+ editorViewModeState
152
+ } = useSharedPluginState(api, ['width', 'breakout', 'editorViewMode']);
153
+ const isViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
154
+ return !isViewMode ? /*#__PURE__*/React.createElement(LayoutButton, {
153
155
  editorView: editorView,
154
156
  mountPoint: mountPoint,
155
157
  boundariesElement: boundariesElement,
156
158
  scrollableElement: scrollableElement,
157
159
  node: (_breakoutState$breako = breakoutState === null || breakoutState === void 0 ? void 0 : (_breakoutState$breako2 = breakoutState.breakoutNode) === null || _breakoutState$breako2 === void 0 ? void 0 : _breakoutState$breako2.node) !== null && _breakoutState$breako !== void 0 ? _breakoutState$breako : null
158
- });
160
+ }) : null;
159
161
  };
160
162
  export const breakoutPlugin = ({
161
163
  config: options,
@@ -195,7 +197,7 @@ export const breakoutPlugin = ({
195
197
  popupsScrollableElement
196
198
  }) {
197
199
  // This is a bit crappy, but should be resolved once we move to a static schema.
198
- if (options && !options.allowBreakoutButton) {
200
+ if (options && !options.allowBreakoutButton || !editorView.editable) {
199
201
  return null;
200
202
  }
201
203
  return /*#__PURE__*/React.createElement(LayoutButtonWrapper, {
@@ -149,15 +149,17 @@ var LayoutButtonWrapper = function LayoutButtonWrapper(_ref3) {
149
149
  scrollableElement = _ref3.scrollableElement,
150
150
  mountPoint = _ref3.mountPoint;
151
151
  // Re-render with `width` (but don't use state) due to https://bitbucket.org/atlassian/%7Bc8e2f021-38d2-46d0-9b7a-b3f7b428f724%7D/pull-requests/24272
152
- var _useSharedPluginState = useSharedPluginState(api, ['width', 'breakout']),
153
- breakoutState = _useSharedPluginState.breakoutState;
154
- return /*#__PURE__*/React.createElement(LayoutButton, {
152
+ var _useSharedPluginState = useSharedPluginState(api, ['width', 'breakout', 'editorViewMode']),
153
+ breakoutState = _useSharedPluginState.breakoutState,
154
+ editorViewModeState = _useSharedPluginState.editorViewModeState;
155
+ var isViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
156
+ return !isViewMode ? /*#__PURE__*/React.createElement(LayoutButton, {
155
157
  editorView: editorView,
156
158
  mountPoint: mountPoint,
157
159
  boundariesElement: boundariesElement,
158
160
  scrollableElement: scrollableElement,
159
161
  node: (_breakoutState$breako = breakoutState === null || breakoutState === void 0 || (_breakoutState$breako2 = breakoutState.breakoutNode) === null || _breakoutState$breako2 === void 0 ? void 0 : _breakoutState$breako2.node) !== null && _breakoutState$breako !== void 0 ? _breakoutState$breako : null
160
- });
162
+ }) : null;
161
163
  };
162
164
  export var breakoutPlugin = function breakoutPlugin(_ref4) {
163
165
  var options = _ref4.config,
@@ -198,7 +200,7 @@ export var breakoutPlugin = function breakoutPlugin(_ref4) {
198
200
  popupsBoundariesElement = _ref5.popupsBoundariesElement,
199
201
  popupsScrollableElement = _ref5.popupsScrollableElement;
200
202
  // This is a bit crappy, but should be resolved once we move to a static schema.
201
- if (options && !options.allowBreakoutButton) {
203
+ if (options && !options.allowBreakoutButton || !editorView.editable) {
202
204
  return null;
203
205
  }
204
206
  return /*#__PURE__*/React.createElement(LayoutButtonWrapper, {
@@ -1,4 +1,5 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
2
3
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
3
4
  import type { BreakoutPluginState } from './types';
4
5
  export interface BreakoutPluginOptions {
@@ -6,7 +7,7 @@ export interface BreakoutPluginOptions {
6
7
  }
7
8
  export type BreakoutPlugin = NextEditorPlugin<'breakout', {
8
9
  pluginConfiguration: BreakoutPluginOptions | undefined;
9
- dependencies: [WidthPlugin];
10
+ dependencies: [WidthPlugin, OptionalPlugin<EditorViewModePlugin>];
10
11
  sharedState: Partial<BreakoutPluginState>;
11
12
  }>;
12
13
  export declare const breakoutPlugin: BreakoutPlugin;
@@ -1,4 +1,5 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
2
3
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
3
4
  import type { BreakoutPluginState } from './types';
4
5
  export interface BreakoutPluginOptions {
@@ -7,7 +8,8 @@ export interface BreakoutPluginOptions {
7
8
  export type BreakoutPlugin = NextEditorPlugin<'breakout', {
8
9
  pluginConfiguration: BreakoutPluginOptions | undefined;
9
10
  dependencies: [
10
- WidthPlugin
11
+ WidthPlugin,
12
+ OptionalPlugin<EditorViewModePlugin>
11
13
  ];
12
14
  sharedState: Partial<BreakoutPluginState>;
13
15
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-breakout",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Breakout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,14 +31,15 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^35.7.0",
35
- "@atlaskit/editor-common": "^78.18.0",
34
+ "@atlaskit/adf-schema": "^35.8.0",
35
+ "@atlaskit/editor-common": "^78.26.0",
36
+ "@atlaskit/editor-plugin-editor-viewmode": "^1.0.0",
36
37
  "@atlaskit/editor-plugin-width": "^1.0.0",
37
38
  "@atlaskit/editor-prosemirror": "3.0.0",
38
39
  "@atlaskit/editor-shared-styles": "^2.9.0",
39
40
  "@atlaskit/icon": "^22.1.0",
40
- "@atlaskit/theme": "^12.6.0",
41
- "@atlaskit/tokens": "^1.42.0",
41
+ "@atlaskit/theme": "^12.7.0",
42
+ "@atlaskit/tokens": "^1.43.0",
42
43
  "@babel/runtime": "^7.0.0",
43
44
  "@emotion/react": "^11.7.1"
44
45
  },