@atlaskit/editor-plugin-loom 4.1.1 → 4.1.3
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 +15 -0
- package/dist/cjs/ui/PrimaryToolbarButton.js +27 -10
- package/dist/cjs/ui/ToolbarButtonComponent.js +16 -3
- package/dist/es2019/ui/PrimaryToolbarButton.js +29 -11
- package/dist/es2019/ui/ToolbarButtonComponent.js +18 -4
- package/dist/esm/ui/PrimaryToolbarButton.js +28 -11
- package/dist/esm/ui/ToolbarButtonComponent.js +17 -4
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-loom
|
|
2
2
|
|
|
3
|
+
## 4.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#152768](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/152768)
|
|
8
|
+
[`2e80bc703b181`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2e80bc703b181) -
|
|
9
|
+
[ED-27555] Migrate to useSharedPluginStateSelector for insert-block, layout, loom plugins
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 4.1.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 4.1.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -11,6 +11,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _react2 = require("@emotion/react");
|
|
13
13
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
14
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
14
15
|
var _commands = require("../pm-plugins/commands");
|
|
15
16
|
var _ToolbarButtonComponent = _interopRequireDefault(require("./ToolbarButtonComponent"));
|
|
16
17
|
var _excluded = ["onClickBeforeInit", "isDisabled", "href"];
|
|
@@ -21,6 +22,22 @@ var _excluded = ["onClickBeforeInit", "isDisabled", "href"];
|
|
|
21
22
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
22
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
24
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
26
|
+
var loomEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'loom.isEnabled');
|
|
27
|
+
var connectivityMode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'connectivity.mode');
|
|
28
|
+
return {
|
|
29
|
+
loomEnabled: loomEnabled,
|
|
30
|
+
connectivityMode: connectivityMode
|
|
31
|
+
};
|
|
32
|
+
}, function (api) {
|
|
33
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['loom', 'connectivity']),
|
|
34
|
+
loomState = _useSharedPluginState.loomState,
|
|
35
|
+
connectivityState = _useSharedPluginState.connectivityState;
|
|
36
|
+
return {
|
|
37
|
+
loomEnabled: loomState === null || loomState === void 0 ? void 0 : loomState.isEnabled,
|
|
38
|
+
connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode
|
|
39
|
+
};
|
|
40
|
+
});
|
|
24
41
|
var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disabled, appearance, api) {
|
|
25
42
|
return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
26
43
|
var onClickBeforeInit = props.onClickBeforeInit,
|
|
@@ -28,10 +45,10 @@ var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disab
|
|
|
28
45
|
isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
|
|
29
46
|
href = props.href,
|
|
30
47
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var isLoomEnabled = !!
|
|
48
|
+
var _useSharedState = useSharedState(api),
|
|
49
|
+
loomEnabled = _useSharedState.loomEnabled,
|
|
50
|
+
connectivityMode = _useSharedState.connectivityMode;
|
|
51
|
+
var isLoomEnabled = !!loomEnabled;
|
|
35
52
|
var handleOnClick = (0, _react.useCallback)(function (e) {
|
|
36
53
|
if (isLoomEnabled) {
|
|
37
54
|
(0, _commands.executeRecordVideo)(api);
|
|
@@ -45,7 +62,7 @@ var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disab
|
|
|
45
62
|
// Ignore href if Loom is enabled so that it doesn't interfere with recording
|
|
46
63
|
,
|
|
47
64
|
href: isLoomEnabled ? undefined : href,
|
|
48
|
-
disabled: disabled || isDisabled ||
|
|
65
|
+
disabled: disabled || isDisabled || connectivityMode === 'offline',
|
|
49
66
|
api: api,
|
|
50
67
|
appearance: appearance,
|
|
51
68
|
onClick: function onClick(e) {
|
|
@@ -63,16 +80,16 @@ var LoomToolbarButtonWrapper = function LoomToolbarButtonWrapper(_ref) {
|
|
|
63
80
|
var handleOnClick = (0, _react.useCallback)(function () {
|
|
64
81
|
return (0, _commands.executeRecordVideo)(api);
|
|
65
82
|
}, [api]);
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (
|
|
83
|
+
var _useSharedState2 = useSharedState(api),
|
|
84
|
+
loomEnabled = _useSharedState2.loomEnabled,
|
|
85
|
+
connectivityMode = _useSharedState2.connectivityMode;
|
|
86
|
+
if (loomEnabled === undefined) {
|
|
70
87
|
return null;
|
|
71
88
|
}
|
|
72
89
|
return (0, _react2.jsx)(_ToolbarButtonComponent.default
|
|
73
90
|
// Disable the icon while the SDK isn't initialised
|
|
74
91
|
, {
|
|
75
|
-
disabled: disabled || !
|
|
92
|
+
disabled: disabled || !loomEnabled || connectivityMode === 'offline',
|
|
76
93
|
api: api,
|
|
77
94
|
appearance: appearance,
|
|
78
95
|
onClick: handleOnClick
|
|
@@ -11,6 +11,7 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
11
11
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
12
12
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
13
|
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
14
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
14
15
|
var _video = _interopRequireDefault(require("@atlaskit/icon/core/video"));
|
|
15
16
|
/**
|
|
16
17
|
* @jsxRuntime classic
|
|
@@ -25,6 +26,18 @@ var LOOM_BUTTON_WIDTH_BREAKPOINT = 1076;
|
|
|
25
26
|
var iconMinWidthStyle = (0, _react2.css)({
|
|
26
27
|
minWidth: 24
|
|
27
28
|
});
|
|
29
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
30
|
+
var width = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.width');
|
|
31
|
+
return {
|
|
32
|
+
width: width
|
|
33
|
+
};
|
|
34
|
+
}, function (api) {
|
|
35
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width']),
|
|
36
|
+
widthState = _useSharedPluginState.widthState;
|
|
37
|
+
return {
|
|
38
|
+
width: widthState === null || widthState === void 0 ? void 0 : widthState.width
|
|
39
|
+
};
|
|
40
|
+
});
|
|
28
41
|
var LoomToolbarButtonInternal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
29
42
|
var disabled = _ref.disabled,
|
|
30
43
|
api = _ref.api,
|
|
@@ -45,10 +58,10 @@ var LoomToolbarButtonInternal = /*#__PURE__*/_react.default.forwardRef(function
|
|
|
45
58
|
target = _ref.target,
|
|
46
59
|
hideTooltip = _ref.hideTooltip,
|
|
47
60
|
rel = _ref.rel;
|
|
48
|
-
var
|
|
49
|
-
|
|
61
|
+
var _useSharedState = useSharedState(api),
|
|
62
|
+
width = _useSharedState.width;
|
|
50
63
|
var label = formatMessage(appearance === 'comment' ? _messages.toolbarInsertBlockMessages.addLoomVideoComment : _messages.toolbarInsertBlockMessages.addLoomVideo);
|
|
51
|
-
var shouldShowRecordText = (
|
|
64
|
+
var shouldShowRecordText = (width || 0) > LOOM_BUTTON_WIDTH_BREAKPOINT;
|
|
52
65
|
return (0, _react2.jsx)(_uiMenu.ToolbarButton, {
|
|
53
66
|
hideTooltip: hideTooltip,
|
|
54
67
|
ref: ref,
|
|
@@ -7,9 +7,27 @@ import React, { useCallback } from 'react';
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
11
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
11
12
|
import { executeRecordVideo } from '../pm-plugins/commands';
|
|
12
13
|
import ToolbarButtonComponent from './ToolbarButtonComponent';
|
|
14
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
15
|
+
const loomEnabled = useSharedPluginStateSelector(api, 'loom.isEnabled');
|
|
16
|
+
const connectivityMode = useSharedPluginStateSelector(api, 'connectivity.mode');
|
|
17
|
+
return {
|
|
18
|
+
loomEnabled,
|
|
19
|
+
connectivityMode
|
|
20
|
+
};
|
|
21
|
+
}, api => {
|
|
22
|
+
const {
|
|
23
|
+
loomState,
|
|
24
|
+
connectivityState
|
|
25
|
+
} = useSharedPluginState(api, ['loom', 'connectivity']);
|
|
26
|
+
return {
|
|
27
|
+
loomEnabled: loomState === null || loomState === void 0 ? void 0 : loomState.isEnabled,
|
|
28
|
+
connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode
|
|
29
|
+
};
|
|
30
|
+
});
|
|
13
31
|
const CustomisableLoomToolbarButton = (disabled, appearance, api) => /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
14
32
|
const {
|
|
15
33
|
onClickBeforeInit,
|
|
@@ -18,10 +36,10 @@ const CustomisableLoomToolbarButton = (disabled, appearance, api) => /*#__PURE__
|
|
|
18
36
|
...restProps
|
|
19
37
|
} = props;
|
|
20
38
|
const {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} =
|
|
24
|
-
const isLoomEnabled = !!
|
|
39
|
+
loomEnabled,
|
|
40
|
+
connectivityMode
|
|
41
|
+
} = useSharedState(api);
|
|
42
|
+
const isLoomEnabled = !!loomEnabled;
|
|
25
43
|
const handleOnClick = useCallback(e => {
|
|
26
44
|
if (isLoomEnabled) {
|
|
27
45
|
executeRecordVideo(api);
|
|
@@ -35,7 +53,7 @@ const CustomisableLoomToolbarButton = (disabled, appearance, api) => /*#__PURE__
|
|
|
35
53
|
// Ignore href if Loom is enabled so that it doesn't interfere with recording
|
|
36
54
|
,
|
|
37
55
|
href: isLoomEnabled ? undefined : href,
|
|
38
|
-
disabled: disabled || isDisabled ||
|
|
56
|
+
disabled: disabled || isDisabled || connectivityMode === 'offline',
|
|
39
57
|
api: api,
|
|
40
58
|
appearance: appearance,
|
|
41
59
|
onClick: e => handleOnClick(e)
|
|
@@ -50,16 +68,16 @@ const LoomToolbarButtonWrapper = ({
|
|
|
50
68
|
}) => {
|
|
51
69
|
const handleOnClick = useCallback(() => executeRecordVideo(api), [api]);
|
|
52
70
|
const {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} =
|
|
56
|
-
if (
|
|
71
|
+
loomEnabled,
|
|
72
|
+
connectivityMode
|
|
73
|
+
} = useSharedState(api);
|
|
74
|
+
if (loomEnabled === undefined) {
|
|
57
75
|
return null;
|
|
58
76
|
}
|
|
59
77
|
return jsx(ToolbarButtonComponent
|
|
60
78
|
// Disable the icon while the SDK isn't initialised
|
|
61
79
|
, {
|
|
62
|
-
disabled: disabled || !
|
|
80
|
+
disabled: disabled || !loomEnabled || connectivityMode === 'offline',
|
|
63
81
|
api: api,
|
|
64
82
|
appearance: appearance,
|
|
65
83
|
onClick: handleOnClick
|
|
@@ -7,9 +7,10 @@ import React from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { jsx, css } from '@emotion/react';
|
|
9
9
|
import { injectIntl } from 'react-intl-next';
|
|
10
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
12
12
|
import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
13
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
13
14
|
import VideoIcon from '@atlaskit/icon/core/video';
|
|
14
15
|
// This const is derived from the breakpoint where the toolbar hides its icons. It is used to hide the text in the AI button.
|
|
15
16
|
// Derived from values from platform/packages/editor/editor-core/src/ui/Appearance/FullPage/MainToolbar.tsx
|
|
@@ -17,6 +18,19 @@ const LOOM_BUTTON_WIDTH_BREAKPOINT = 1076;
|
|
|
17
18
|
const iconMinWidthStyle = css({
|
|
18
19
|
minWidth: 24
|
|
19
20
|
});
|
|
21
|
+
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
22
|
+
const width = useSharedPluginStateSelector(api, 'width.width');
|
|
23
|
+
return {
|
|
24
|
+
width
|
|
25
|
+
};
|
|
26
|
+
}, api => {
|
|
27
|
+
const {
|
|
28
|
+
widthState
|
|
29
|
+
} = useSharedPluginState(api, ['width']);
|
|
30
|
+
return {
|
|
31
|
+
width: widthState === null || widthState === void 0 ? void 0 : widthState.width
|
|
32
|
+
};
|
|
33
|
+
});
|
|
20
34
|
const LoomToolbarButtonInternal = /*#__PURE__*/React.forwardRef(({
|
|
21
35
|
disabled,
|
|
22
36
|
api,
|
|
@@ -41,10 +55,10 @@ const LoomToolbarButtonInternal = /*#__PURE__*/React.forwardRef(({
|
|
|
41
55
|
rel
|
|
42
56
|
}, ref) => {
|
|
43
57
|
const {
|
|
44
|
-
|
|
45
|
-
} =
|
|
58
|
+
width
|
|
59
|
+
} = useSharedState(api);
|
|
46
60
|
const label = formatMessage(appearance === 'comment' ? toolbarInsertBlockMessages.addLoomVideoComment : toolbarInsertBlockMessages.addLoomVideo);
|
|
47
|
-
const shouldShowRecordText = (
|
|
61
|
+
const shouldShowRecordText = (width || 0) > LOOM_BUTTON_WIDTH_BREAKPOINT;
|
|
48
62
|
return jsx(ToolbarButton, {
|
|
49
63
|
hideTooltip: hideTooltip,
|
|
50
64
|
ref: ref,
|
|
@@ -9,9 +9,26 @@ import React, { useCallback } from 'react';
|
|
|
9
9
|
|
|
10
10
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
11
11
|
import { jsx } from '@emotion/react';
|
|
12
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
12
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
13
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
13
14
|
import { executeRecordVideo } from '../pm-plugins/commands';
|
|
14
15
|
import ToolbarButtonComponent from './ToolbarButtonComponent';
|
|
16
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
17
|
+
var loomEnabled = useSharedPluginStateSelector(api, 'loom.isEnabled');
|
|
18
|
+
var connectivityMode = useSharedPluginStateSelector(api, 'connectivity.mode');
|
|
19
|
+
return {
|
|
20
|
+
loomEnabled: loomEnabled,
|
|
21
|
+
connectivityMode: connectivityMode
|
|
22
|
+
};
|
|
23
|
+
}, function (api) {
|
|
24
|
+
var _useSharedPluginState = useSharedPluginState(api, ['loom', 'connectivity']),
|
|
25
|
+
loomState = _useSharedPluginState.loomState,
|
|
26
|
+
connectivityState = _useSharedPluginState.connectivityState;
|
|
27
|
+
return {
|
|
28
|
+
loomEnabled: loomState === null || loomState === void 0 ? void 0 : loomState.isEnabled,
|
|
29
|
+
connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode
|
|
30
|
+
};
|
|
31
|
+
});
|
|
15
32
|
var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disabled, appearance, api) {
|
|
16
33
|
return /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
17
34
|
var onClickBeforeInit = props.onClickBeforeInit,
|
|
@@ -19,10 +36,10 @@ var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disab
|
|
|
19
36
|
isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
|
|
20
37
|
href = props.href,
|
|
21
38
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var isLoomEnabled = !!
|
|
39
|
+
var _useSharedState = useSharedState(api),
|
|
40
|
+
loomEnabled = _useSharedState.loomEnabled,
|
|
41
|
+
connectivityMode = _useSharedState.connectivityMode;
|
|
42
|
+
var isLoomEnabled = !!loomEnabled;
|
|
26
43
|
var handleOnClick = useCallback(function (e) {
|
|
27
44
|
if (isLoomEnabled) {
|
|
28
45
|
executeRecordVideo(api);
|
|
@@ -36,7 +53,7 @@ var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disab
|
|
|
36
53
|
// Ignore href if Loom is enabled so that it doesn't interfere with recording
|
|
37
54
|
,
|
|
38
55
|
href: isLoomEnabled ? undefined : href,
|
|
39
|
-
disabled: disabled || isDisabled ||
|
|
56
|
+
disabled: disabled || isDisabled || connectivityMode === 'offline',
|
|
40
57
|
api: api,
|
|
41
58
|
appearance: appearance,
|
|
42
59
|
onClick: function onClick(e) {
|
|
@@ -54,16 +71,16 @@ var LoomToolbarButtonWrapper = function LoomToolbarButtonWrapper(_ref) {
|
|
|
54
71
|
var handleOnClick = useCallback(function () {
|
|
55
72
|
return executeRecordVideo(api);
|
|
56
73
|
}, [api]);
|
|
57
|
-
var
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (
|
|
74
|
+
var _useSharedState2 = useSharedState(api),
|
|
75
|
+
loomEnabled = _useSharedState2.loomEnabled,
|
|
76
|
+
connectivityMode = _useSharedState2.connectivityMode;
|
|
77
|
+
if (loomEnabled === undefined) {
|
|
61
78
|
return null;
|
|
62
79
|
}
|
|
63
80
|
return jsx(ToolbarButtonComponent
|
|
64
81
|
// Disable the icon while the SDK isn't initialised
|
|
65
82
|
, {
|
|
66
|
-
disabled: disabled || !
|
|
83
|
+
disabled: disabled || !loomEnabled || connectivityMode === 'offline',
|
|
67
84
|
api: api,
|
|
68
85
|
appearance: appearance,
|
|
69
86
|
onClick: handleOnClick
|
|
@@ -7,9 +7,10 @@ import React from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { jsx, css } from '@emotion/react';
|
|
9
9
|
import { injectIntl } from 'react-intl-next';
|
|
10
|
-
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
import { useSharedPluginState, sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
12
12
|
import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
13
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
13
14
|
import VideoIcon from '@atlaskit/icon/core/video';
|
|
14
15
|
// This const is derived from the breakpoint where the toolbar hides its icons. It is used to hide the text in the AI button.
|
|
15
16
|
// Derived from values from platform/packages/editor/editor-core/src/ui/Appearance/FullPage/MainToolbar.tsx
|
|
@@ -17,6 +18,18 @@ var LOOM_BUTTON_WIDTH_BREAKPOINT = 1076;
|
|
|
17
18
|
var iconMinWidthStyle = css({
|
|
18
19
|
minWidth: 24
|
|
19
20
|
});
|
|
21
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
22
|
+
var width = useSharedPluginStateSelector(api, 'width.width');
|
|
23
|
+
return {
|
|
24
|
+
width: width
|
|
25
|
+
};
|
|
26
|
+
}, function (api) {
|
|
27
|
+
var _useSharedPluginState = useSharedPluginState(api, ['width']),
|
|
28
|
+
widthState = _useSharedPluginState.widthState;
|
|
29
|
+
return {
|
|
30
|
+
width: widthState === null || widthState === void 0 ? void 0 : widthState.width
|
|
31
|
+
};
|
|
32
|
+
});
|
|
20
33
|
var LoomToolbarButtonInternal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
21
34
|
var disabled = _ref.disabled,
|
|
22
35
|
api = _ref.api,
|
|
@@ -37,10 +50,10 @@ var LoomToolbarButtonInternal = /*#__PURE__*/React.forwardRef(function (_ref, re
|
|
|
37
50
|
target = _ref.target,
|
|
38
51
|
hideTooltip = _ref.hideTooltip,
|
|
39
52
|
rel = _ref.rel;
|
|
40
|
-
var
|
|
41
|
-
|
|
53
|
+
var _useSharedState = useSharedState(api),
|
|
54
|
+
width = _useSharedState.width;
|
|
42
55
|
var label = formatMessage(appearance === 'comment' ? toolbarInsertBlockMessages.addLoomVideoComment : toolbarInsertBlockMessages.addLoomVideo);
|
|
43
|
-
var shouldShowRecordText = (
|
|
56
|
+
var shouldShowRecordText = (width || 0) > LOOM_BUTTON_WIDTH_BREAKPOINT;
|
|
44
57
|
return jsx(ToolbarButton, {
|
|
45
58
|
hideTooltip: hideTooltip,
|
|
46
59
|
ref: ref,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-loom",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"description": "Loom plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@atlaskit/button": "^23.0.0",
|
|
40
|
-
"@atlaskit/editor-common": "^
|
|
40
|
+
"@atlaskit/editor-common": "^105.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
42
42
|
"@atlaskit/editor-plugin-hyperlink": "^4.4.0",
|
|
43
43
|
"@atlaskit/editor-plugin-primary-toolbar": "^3.2.0",
|
|
44
|
-
"@atlaskit/editor-plugin-quick-insert": "^2.
|
|
44
|
+
"@atlaskit/editor-plugin-quick-insert": "^2.5.0",
|
|
45
45
|
"@atlaskit/editor-plugin-width": "^3.0.0",
|
|
46
46
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
47
|
-
"@atlaskit/icon": "^
|
|
47
|
+
"@atlaskit/icon": "^26.0.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
49
|
"@atlaskit/tokens": "^4.8.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@atlaskit/editor-plugin-base": "^
|
|
60
|
+
"@atlaskit/editor-plugin-base": "^3.0.0",
|
|
61
61
|
"@atlaskit/editor-plugin-card": "^5.4.0",
|
|
62
62
|
"@atlaskit/editor-plugin-copy-button": "^2.0.0",
|
|
63
63
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|