@atlaskit/editor-plugin-loom 3.1.21 → 3.1.23

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-loom
2
2
 
3
+ ## 3.1.23
4
+
5
+ ### Patch Changes
6
+
7
+ - [#174866](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/174866)
8
+ [`f942caa52a5dd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f942caa52a5dd) -
9
+ [ux] Disable the loom plugin while offline.
10
+ - Updated dependencies
11
+
12
+ ## 3.1.22
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 3.1.21
4
19
 
5
20
  ### Patch Changes
@@ -28,8 +28,9 @@ var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disab
28
28
  isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
29
29
  href = props.href,
30
30
  restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
31
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['loom']),
32
- loomState = _useSharedPluginState.loomState;
31
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['loom', 'connectivity']),
32
+ loomState = _useSharedPluginState.loomState,
33
+ connectivityState = _useSharedPluginState.connectivityState;
33
34
  var isLoomEnabled = !!(loomState !== null && loomState !== void 0 && loomState.isEnabled);
34
35
  var handleOnClick = (0, _react.useCallback)(function (e) {
35
36
  if (isLoomEnabled) {
@@ -44,7 +45,7 @@ var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disab
44
45
  // Ignore href if Loom is enabled so that it doesn't interfere with recording
45
46
  ,
46
47
  href: isLoomEnabled ? undefined : href,
47
- disabled: disabled || isDisabled,
48
+ disabled: disabled || isDisabled || (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline',
48
49
  api: api,
49
50
  appearance: appearance,
50
51
  onClick: function onClick(e) {
@@ -60,15 +61,16 @@ var LoomToolbarButtonWrapper = function LoomToolbarButtonWrapper(_ref) {
60
61
  var handleOnClick = (0, _react.useCallback)(function () {
61
62
  return (0, _commands.executeRecordVideo)(api);
62
63
  }, [api]);
63
- var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['loom']),
64
- loomState = _useSharedPluginState2.loomState;
64
+ var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['loom', 'connectivity']),
65
+ loomState = _useSharedPluginState2.loomState,
66
+ connectivityState = _useSharedPluginState2.connectivityState;
65
67
  if (!loomState) {
66
68
  return null;
67
69
  }
68
70
  return (0, _react2.jsx)(_ToolbarButtonComponent.default
69
71
  // Disable the icon while the SDK isn't initialised
70
72
  , {
71
- disabled: disabled || !(loomState !== null && loomState !== void 0 && loomState.isEnabled),
73
+ disabled: disabled || !(loomState !== null && loomState !== void 0 && loomState.isEnabled) || (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline',
72
74
  api: api,
73
75
  appearance: appearance,
74
76
  onClick: handleOnClick
@@ -21,6 +21,7 @@ var getQuickInsertItem = exports.getQuickInsertItem = function getQuickInsertIte
21
21
  description: formatMessage(_messages.toolbarInsertBlockMessages.recordVideoDescription),
22
22
  keywords: ['loom', 'record', 'video'],
23
23
  priority: 800,
24
+ isDisabledOffline: true,
24
25
  icon: function icon() {
25
26
  return /*#__PURE__*/_react.default.createElement(_video.default, {
26
27
  label: "",
@@ -18,8 +18,9 @@ const CustomisableLoomToolbarButton = (disabled, appearance, api) => /*#__PURE__
18
18
  ...restProps
19
19
  } = props;
20
20
  const {
21
- loomState
22
- } = useSharedPluginState(api, ['loom']);
21
+ loomState,
22
+ connectivityState
23
+ } = useSharedPluginState(api, ['loom', 'connectivity']);
23
24
  const isLoomEnabled = !!(loomState !== null && loomState !== void 0 && loomState.isEnabled);
24
25
  const handleOnClick = useCallback(e => {
25
26
  if (isLoomEnabled) {
@@ -34,7 +35,7 @@ const CustomisableLoomToolbarButton = (disabled, appearance, api) => /*#__PURE__
34
35
  // Ignore href if Loom is enabled so that it doesn't interfere with recording
35
36
  ,
36
37
  href: isLoomEnabled ? undefined : href,
37
- disabled: disabled || isDisabled,
38
+ disabled: disabled || isDisabled || (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline',
38
39
  api: api,
39
40
  appearance: appearance,
40
41
  onClick: e => handleOnClick(e)
@@ -47,15 +48,16 @@ const LoomToolbarButtonWrapper = ({
47
48
  }) => {
48
49
  const handleOnClick = useCallback(() => executeRecordVideo(api), [api]);
49
50
  const {
50
- loomState
51
- } = useSharedPluginState(api, ['loom']);
51
+ loomState,
52
+ connectivityState
53
+ } = useSharedPluginState(api, ['loom', 'connectivity']);
52
54
  if (!loomState) {
53
55
  return null;
54
56
  }
55
57
  return jsx(ToolbarButtonComponent
56
58
  // Disable the icon while the SDK isn't initialised
57
59
  , {
58
- disabled: disabled || !(loomState !== null && loomState !== void 0 && loomState.isEnabled),
60
+ disabled: disabled || !(loomState !== null && loomState !== void 0 && loomState.isEnabled) || (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline',
59
61
  api: api,
60
62
  appearance: appearance,
61
63
  onClick: handleOnClick
@@ -13,6 +13,7 @@ export const getQuickInsertItem = editorAnalyticsAPI => ({
13
13
  description: formatMessage(toolbarInsertBlockMessages.recordVideoDescription),
14
14
  keywords: ['loom', 'record', 'video'],
15
15
  priority: 800,
16
+ isDisabledOffline: true,
16
17
  icon: () => /*#__PURE__*/React.createElement(VideoIcon, {
17
18
  label: "",
18
19
  color: "var(--ds-text, #172B4D)",
@@ -19,8 +19,9 @@ var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disab
19
19
  isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
20
20
  href = props.href,
21
21
  restProps = _objectWithoutProperties(props, _excluded);
22
- var _useSharedPluginState = useSharedPluginState(api, ['loom']),
23
- loomState = _useSharedPluginState.loomState;
22
+ var _useSharedPluginState = useSharedPluginState(api, ['loom', 'connectivity']),
23
+ loomState = _useSharedPluginState.loomState,
24
+ connectivityState = _useSharedPluginState.connectivityState;
24
25
  var isLoomEnabled = !!(loomState !== null && loomState !== void 0 && loomState.isEnabled);
25
26
  var handleOnClick = useCallback(function (e) {
26
27
  if (isLoomEnabled) {
@@ -35,7 +36,7 @@ var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disab
35
36
  // Ignore href if Loom is enabled so that it doesn't interfere with recording
36
37
  ,
37
38
  href: isLoomEnabled ? undefined : href,
38
- disabled: disabled || isDisabled,
39
+ disabled: disabled || isDisabled || (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline',
39
40
  api: api,
40
41
  appearance: appearance,
41
42
  onClick: function onClick(e) {
@@ -51,15 +52,16 @@ var LoomToolbarButtonWrapper = function LoomToolbarButtonWrapper(_ref) {
51
52
  var handleOnClick = useCallback(function () {
52
53
  return executeRecordVideo(api);
53
54
  }, [api]);
54
- var _useSharedPluginState2 = useSharedPluginState(api, ['loom']),
55
- loomState = _useSharedPluginState2.loomState;
55
+ var _useSharedPluginState2 = useSharedPluginState(api, ['loom', 'connectivity']),
56
+ loomState = _useSharedPluginState2.loomState,
57
+ connectivityState = _useSharedPluginState2.connectivityState;
56
58
  if (!loomState) {
57
59
  return null;
58
60
  }
59
61
  return jsx(ToolbarButtonComponent
60
62
  // Disable the icon while the SDK isn't initialised
61
63
  , {
62
- disabled: disabled || !(loomState !== null && loomState !== void 0 && loomState.isEnabled),
64
+ disabled: disabled || !(loomState !== null && loomState !== void 0 && loomState.isEnabled) || (connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode) === 'offline',
63
65
  api: api,
64
66
  appearance: appearance,
65
67
  onClick: handleOnClick
@@ -14,6 +14,7 @@ export var getQuickInsertItem = function getQuickInsertItem(editorAnalyticsAPI)
14
14
  description: formatMessage(toolbarInsertBlockMessages.recordVideoDescription),
15
15
  keywords: ['loom', 'record', 'video'],
16
16
  priority: 800,
17
+ isDisabledOffline: true,
17
18
  icon: function icon() {
18
19
  return /*#__PURE__*/React.createElement(VideoIcon, {
19
20
  label: "",
@@ -2,6 +2,7 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { type INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
5
6
  import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
6
7
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
7
8
  import { type QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
@@ -15,7 +16,8 @@ export type LoomPlugin = NextEditorPlugin<'loom', {
15
16
  WidthPlugin,
16
17
  HyperlinkPlugin,
17
18
  OptionalPlugin<PrimaryToolbarPlugin>,
18
- OptionalPlugin<QuickInsertPlugin>
19
+ OptionalPlugin<QuickInsertPlugin>,
20
+ OptionalPlugin<ConnectivityPlugin>
19
21
  ];
20
22
  sharedState: LoomPluginState | undefined;
21
23
  actions: {
@@ -2,6 +2,7 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import { type INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import type { EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
4
4
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
+ import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
5
6
  import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
6
7
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
7
8
  import { type QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
@@ -15,7 +16,8 @@ export type LoomPlugin = NextEditorPlugin<'loom', {
15
16
  WidthPlugin,
16
17
  HyperlinkPlugin,
17
18
  OptionalPlugin<PrimaryToolbarPlugin>,
18
- OptionalPlugin<QuickInsertPlugin>
19
+ OptionalPlugin<QuickInsertPlugin>,
20
+ OptionalPlugin<ConnectivityPlugin>
19
21
  ];
20
22
  sharedState: LoomPluginState | undefined;
21
23
  actions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-loom",
3
- "version": "3.1.21",
3
+ "version": "3.1.23",
4
4
  "description": "Loom plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,16 +35,16 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@atlaskit/button": "^20.3.0",
38
- "@atlaskit/editor-common": "^95.10.0",
38
+ "@atlaskit/editor-common": "^96.3.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
40
40
  "@atlaskit/editor-plugin-hyperlink": "^3.2.0",
41
41
  "@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
42
- "@atlaskit/editor-plugin-quick-insert": "^1.7.0",
42
+ "@atlaskit/editor-plugin-quick-insert": "^1.8.0",
43
43
  "@atlaskit/editor-plugin-width": "^1.3.0",
44
44
  "@atlaskit/editor-prosemirror": "6.2.1",
45
- "@atlaskit/icon": "23.0.0",
45
+ "@atlaskit/icon": "23.1.0",
46
46
  "@atlaskit/platform-feature-flags": "0.3.0",
47
- "@atlaskit/tokens": "2.4.0",
47
+ "@atlaskit/tokens": "2.4.1",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1",
50
50
  "@loomhq/record-sdk": "^2.36.18"
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "devDependencies": {
58
58
  "@atlaskit/editor-plugin-base": "^2.0.0",
59
- "@atlaskit/editor-plugin-card": "^4.4.0",
59
+ "@atlaskit/editor-plugin-card": "^4.5.0",
60
60
  "@atlaskit/editor-plugin-copy-button": "^1.3.0",
61
61
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
62
62
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",