@atlaskit/editor-plugin-toolbar 0.2.3 → 0.2.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,13 @@
1
1
  # @atlaskit/editor-plugin-toolbar
2
2
 
3
+ ## 0.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`03b0204b5eb82`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/03b0204b5eb82) -
8
+ ED=28738 Disable toolbar when editor is offline
9
+ - Updated dependencies
10
+
3
11
  ## 0.2.3
4
12
 
5
13
  ### Patch Changes
@@ -17,6 +17,9 @@
17
17
  "../src/**/examples.*"
18
18
  ],
19
19
  "references": [
20
+ {
21
+ "path": "../../editor-plugin-connectivity/afm-cc/tsconfig.json"
22
+ },
20
23
  {
21
24
  "path": "../../editor-plugin-editor-viewmode/afm-cc/tsconfig.json"
22
25
  },
@@ -29,6 +29,8 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
29
29
  return isToolbarComponent(component);
30
30
  });
31
31
  var currentUserIntent = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'userIntent.currentUserIntent');
32
+ var connectivityStateMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'connectivity.mode');
33
+ var isOffline = connectivityStateMode === 'offline';
32
34
  // TODO: ED-28735 - figure out a better way to control this - needed to re-render on selection change
33
35
  // @ts-expect-error
34
36
  var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
@@ -50,7 +52,8 @@ var SelectionToolbar = exports.SelectionToolbar = function SelectionToolbar(_ref
50
52
  }, /*#__PURE__*/_react.default.createElement(_toolbar.EditorToolbarProvider, {
51
53
  editorView: editorView
52
54
  }, /*#__PURE__*/_react.default.createElement(_toolbar.EditorToolbarUIProvider, {
53
- api: api
55
+ api: api,
56
+ isDisabled: isOffline
54
57
  }, /*#__PURE__*/_react.default.createElement(_editorToolbarModel.ToolbarModelRenderer, {
55
58
  toolbar: toolbar,
56
59
  components: components,
@@ -21,6 +21,8 @@ export const SelectionToolbar = ({
21
21
  const components = api === null || api === void 0 ? void 0 : api.toolbar.actions.getComponents();
22
22
  const toolbar = components === null || components === void 0 ? void 0 : components.find(component => isToolbarComponent(component));
23
23
  const currentUserIntent = useSharedPluginStateSelector(api, 'userIntent.currentUserIntent');
24
+ const connectivityStateMode = useSharedPluginStateSelector(api, 'connectivity.mode');
25
+ const isOffline = connectivityStateMode === 'offline';
24
26
  // TODO: ED-28735 - figure out a better way to control this - needed to re-render on selection change
25
27
  // @ts-expect-error
26
28
  const selection = useSharedPluginStateSelector(api, 'selection.selection');
@@ -40,7 +42,8 @@ export const SelectionToolbar = ({
40
42
  }, /*#__PURE__*/React.createElement(EditorToolbarProvider, {
41
43
  editorView: editorView
42
44
  }, /*#__PURE__*/React.createElement(EditorToolbarUIProvider, {
43
- api: api
45
+ api: api,
46
+ isDisabled: isOffline
44
47
  }, /*#__PURE__*/React.createElement(ToolbarModelRenderer, {
45
48
  toolbar: toolbar,
46
49
  components: components,
@@ -22,6 +22,8 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
22
22
  return isToolbarComponent(component);
23
23
  });
24
24
  var currentUserIntent = useSharedPluginStateSelector(api, 'userIntent.currentUserIntent');
25
+ var connectivityStateMode = useSharedPluginStateSelector(api, 'connectivity.mode');
26
+ var isOffline = connectivityStateMode === 'offline';
25
27
  // TODO: ED-28735 - figure out a better way to control this - needed to re-render on selection change
26
28
  // @ts-expect-error
27
29
  var selection = useSharedPluginStateSelector(api, 'selection.selection');
@@ -43,7 +45,8 @@ export var SelectionToolbar = function SelectionToolbar(_ref) {
43
45
  }, /*#__PURE__*/React.createElement(EditorToolbarProvider, {
44
46
  editorView: editorView
45
47
  }, /*#__PURE__*/React.createElement(EditorToolbarUIProvider, {
46
- api: api
48
+ api: api,
49
+ isDisabled: isOffline
47
50
  }, /*#__PURE__*/React.createElement(ToolbarModelRenderer, {
48
51
  toolbar: toolbar,
49
52
  components: components,
@@ -1,4 +1,5 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
2
3
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
3
4
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
4
5
  import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
@@ -9,7 +10,8 @@ export type ToolbarPlugin = NextEditorPlugin<'toolbar', {
9
10
  OptionalPlugin<UserIntentPlugin>,
10
11
  OptionalPlugin<SelectionPlugin>,
11
12
  OptionalPlugin<UserPreferencesPlugin>,
12
- OptionalPlugin<EditorViewModePlugin>
13
+ OptionalPlugin<EditorViewModePlugin>,
14
+ OptionalPlugin<ConnectivityPlugin>
13
15
  ];
14
16
  actions: {
15
17
  registerComponents: (toolbarComponents: Array<RegisterComponent>) => void;
@@ -1,4 +1,5 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
2
3
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
3
4
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
4
5
  import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
@@ -9,7 +10,8 @@ export type ToolbarPlugin = NextEditorPlugin<'toolbar', {
9
10
  OptionalPlugin<UserIntentPlugin>,
10
11
  OptionalPlugin<SelectionPlugin>,
11
12
  OptionalPlugin<UserPreferencesPlugin>,
12
- OptionalPlugin<EditorViewModePlugin>
13
+ OptionalPlugin<EditorViewModePlugin>,
14
+ OptionalPlugin<ConnectivityPlugin>
13
15
  ];
14
16
  actions: {
15
17
  registerComponents: (toolbarComponents: Array<RegisterComponent>) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-toolbar",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,6 +31,7 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
+ "@atlaskit/editor-plugin-connectivity": "^3.1.0",
34
35
  "@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
35
36
  "@atlaskit/editor-plugin-selection": "^3.0.0",
36
37
  "@atlaskit/editor-plugin-user-intent": "^1.1.0",
@@ -38,12 +39,12 @@
38
39
  "@atlaskit/editor-prosemirror": "7.0.0",
39
40
  "@atlaskit/editor-toolbar": "^0.3.0",
40
41
  "@atlaskit/editor-toolbar-model": "^0.1.0",
41
- "@atlaskit/tmp-editor-statsig": "^11.0.0",
42
+ "@atlaskit/tmp-editor-statsig": "^11.3.0",
42
43
  "@babel/runtime": "^7.0.0",
43
44
  "react-intl-next": "npm:react-intl@^5.18.1"
44
45
  },
45
46
  "peerDependencies": {
46
- "@atlaskit/editor-common": "^107.25.0",
47
+ "@atlaskit/editor-common": "^107.26.0",
47
48
  "react": "^18.2.0"
48
49
  },
49
50
  "techstack": {