@atlaskit/editor-plugin-loom 5.1.3 → 5.1.5

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,21 @@
1
1
  # @atlaskit/editor-plugin-loom
2
2
 
3
+ ## 5.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a024ea6d25dc1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a024ea6d25dc1) -
8
+ [ED-29106] cleans up usages of sharedPluginStateHookMigratorFactory
9
+ - Updated dependencies
10
+
11
+ ## 5.1.4
12
+
13
+ ### Patch Changes
14
+
15
+ - [`4ef462fecb522`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4ef462fecb522) -
16
+ [ux] [ED-29003] Register loom component as a dropdown menu item in overflow menu
17
+ - Updated dependencies
18
+
3
19
  ## 5.1.3
4
20
 
5
21
  ### Patch Changes
@@ -5,15 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.loomPlugin = void 0;
7
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
8
9
  var _commands = require("./pm-plugins/commands");
9
10
  var _main = require("./pm-plugins/main");
10
11
  var _PrimaryToolbarButton = require("./ui/PrimaryToolbarButton");
11
12
  var _quickInsert = require("./ui/quickInsert");
13
+ var _toolbarComponents = require("./ui/toolbar-components");
12
14
  var loomPlugin = exports.loomPlugin = function loomPlugin(_ref) {
13
- var _api$analytics, _api$primaryToolbar;
15
+ var _api$analytics;
14
16
  var config = _ref.config,
15
17
  api = _ref.api;
16
18
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
19
+ var isNewToolbarEnabled = (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc', 'isEnabled', true) && (0, _expValEquals.expValEquals)('platform_editor_toolbar_migrate_loom', 'isEnabled', true);
17
20
 
18
21
  // Workaround since we want to insert a loom via the `hyperlink` plugin for now.
19
22
  // The hyperlink plugin (and the card plugin) are deeply tied into using the Prosemirror Command
@@ -22,10 +25,16 @@ var loomPlugin = exports.loomPlugin = function loomPlugin(_ref) {
22
25
  current: null
23
26
  };
24
27
  var primaryToolbarComponent = (0, _PrimaryToolbarButton.loomPrimaryToolbarComponent)(config, api);
25
- api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
26
- name: 'loom',
27
- component: primaryToolbarComponent
28
- });
28
+ if (isNewToolbarEnabled) {
29
+ var _api$toolbar;
30
+ api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(config, api));
31
+ } else {
32
+ var _api$primaryToolbar;
33
+ api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
34
+ name: 'loom',
35
+ component: primaryToolbarComponent
36
+ });
37
+ }
29
38
  return {
30
39
  name: 'loom',
31
40
  actions: {
@@ -81,6 +90,6 @@ var loomPlugin = exports.loomPlugin = function loomPlugin(_ref) {
81
90
  }
82
91
  },
83
92
  // Enable inserting Loom recordings through main toolbar
84
- primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
93
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && !isNewToolbarEnabled ? primaryToolbarComponent : undefined
85
94
  };
86
95
  };
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.LoomMenuItem = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _reactIntlNext = require("react-intl-next");
10
+ var _hooks = require("@atlaskit/editor-common/hooks");
11
+ var _messages = require("@atlaskit/editor-common/messages");
12
+ var _toolbar = require("@atlaskit/editor-common/toolbar");
13
+ var _editorToolbar = require("@atlaskit/editor-toolbar");
14
+ var _commands = require("../pm-plugins/commands");
15
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
16
+ var useLoomEnabled = function useLoomEnabled(api) {
17
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['loom'], function (states) {
18
+ var _states$loomState;
19
+ return {
20
+ loomEnabled: (_states$loomState = states.loomState) === null || _states$loomState === void 0 ? void 0 : _states$loomState.isEnabled
21
+ };
22
+ }),
23
+ loomEnabled = _useSharedPluginState.loomEnabled;
24
+ return loomEnabled;
25
+ };
26
+ var LoomMenuItem = exports.LoomMenuItem = function LoomMenuItem(_ref) {
27
+ var api = _ref.api,
28
+ renderButton = _ref.renderButton;
29
+ var loomEnabled = useLoomEnabled(api);
30
+ if (renderButton) {
31
+ return renderButton(CustomisableLoomMenuItem(api));
32
+ } else if (loomEnabled !== undefined) {
33
+ return /*#__PURE__*/_react.default.createElement(DefaultLoomMenuItem, {
34
+ api: api
35
+ });
36
+ }
37
+ };
38
+ var CustomisableLoomMenuItem = function CustomisableLoomMenuItem(api) {
39
+ return /*#__PURE__*/_react.default.forwardRef(function (_ref2, ref) {
40
+ var _ref2$isDisabled = _ref2.isDisabled,
41
+ isDisabled = _ref2$isDisabled === void 0 ? false : _ref2$isDisabled,
42
+ onClickBeforeInit = _ref2.onClickBeforeInit,
43
+ href = _ref2.href,
44
+ target = _ref2.target,
45
+ rel = _ref2.rel;
46
+ var loomEnabled = !!useLoomEnabled(api);
47
+ var handleOnClick = (0, _react.useCallback)(function (e) {
48
+ if (loomEnabled) {
49
+ (0, _commands.executeRecordVideo)(api);
50
+ } else if (onClickBeforeInit && e.type === 'click' && e.target instanceof HTMLElement) {
51
+ onClickBeforeInit(e);
52
+ }
53
+ }, [loomEnabled, onClickBeforeInit]);
54
+ return /*#__PURE__*/_react.default.createElement(MenuItemComponent, {
55
+ ref: ref
56
+ // Ignore href if Loom is enabled so that it doesn't interfere with recording
57
+ ,
58
+ href: loomEnabled ? undefined : href,
59
+ disabled: isDisabled,
60
+ onClick: handleOnClick,
61
+ target: target,
62
+ rel: rel
63
+ });
64
+ });
65
+ };
66
+ var DefaultLoomMenuItem = function DefaultLoomMenuItem(_ref3) {
67
+ var api = _ref3.api;
68
+ var loomEnabled = useLoomEnabled(api);
69
+ var handleOnClick = (0, _react.useCallback)(function () {
70
+ return (0, _commands.executeRecordVideo)(api);
71
+ }, [api]);
72
+ return /*#__PURE__*/_react.default.createElement(MenuItemComponent, {
73
+ disabled: !loomEnabled,
74
+ onClick: handleOnClick
75
+ });
76
+ };
77
+ var MenuItemComponent = /*#__PURE__*/_react.default.forwardRef(function (_ref4, ref) {
78
+ var disabled = _ref4.disabled,
79
+ _onClick = _ref4.onClick,
80
+ href = _ref4.href,
81
+ target = _ref4.target,
82
+ rel = _ref4.rel;
83
+ var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
84
+ editorAppearance = _useEditorToolbar.editorAppearance;
85
+ var _useIntl = (0, _reactIntlNext.useIntl)(),
86
+ formatMessage = _useIntl.formatMessage;
87
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
88
+ elemBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.LoomIcon, {
89
+ label: ""
90
+ }),
91
+ isDisabled: disabled,
92
+ href: href,
93
+ target: target,
94
+ rel: rel,
95
+ onClick: function onClick(e) {
96
+ return _onClick(e);
97
+ }
98
+ }, formatMessage(editorAppearance === 'comment' ? _messages.toolbarInsertBlockMessages.addLoomVideoComment : _messages.toolbarInsertBlockMessages.addLoomVideo));
99
+ });
@@ -27,17 +27,6 @@ var selector = function selector(states) {
27
27
  connectivityMode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
28
28
  };
29
29
  };
30
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
31
- return (0, _hooks.useSharedPluginStateWithSelector)(api, ['loom', 'connectivity'], selector);
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
- });
41
30
  var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disabled, appearance, api) {
42
31
  return /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
43
32
  var onClickBeforeInit = props.onClickBeforeInit,
@@ -45,9 +34,9 @@ var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disab
45
34
  isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
46
35
  href = props.href,
47
36
  restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
48
- var _useSharedState = useSharedState(api),
49
- loomEnabled = _useSharedState.loomEnabled,
50
- connectivityMode = _useSharedState.connectivityMode;
37
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['loom', 'connectivity'], selector),
38
+ loomEnabled = _useSharedPluginState.loomEnabled,
39
+ connectivityMode = _useSharedPluginState.connectivityMode;
51
40
  var isLoomEnabled = !!loomEnabled;
52
41
  var handleOnClick = (0, _react.useCallback)(function (e) {
53
42
  if (isLoomEnabled) {
@@ -80,9 +69,9 @@ var LoomToolbarButtonWrapper = function LoomToolbarButtonWrapper(_ref) {
80
69
  var handleOnClick = (0, _react.useCallback)(function () {
81
70
  return (0, _commands.executeRecordVideo)(api);
82
71
  }, [api]);
83
- var _useSharedState2 = useSharedState(api),
84
- loomEnabled = _useSharedState2.loomEnabled,
85
- connectivityMode = _useSharedState2.connectivityMode;
72
+ var _useSharedPluginState2 = (0, _hooks.useSharedPluginStateWithSelector)(api, ['loom', 'connectivity'], selector),
73
+ loomEnabled = _useSharedPluginState2.loomEnabled,
74
+ connectivityMode = _useSharedPluginState2.connectivityMode;
86
75
  if (loomEnabled === undefined) {
87
76
  return null;
88
77
  }
@@ -31,15 +31,6 @@ var selector = function selector(states) {
31
31
  width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width
32
32
  };
33
33
  };
34
- var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
35
- return (0, _hooks.useSharedPluginStateWithSelector)(api, ['width'], selector);
36
- }, function (api) {
37
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width']),
38
- widthState = _useSharedPluginState.widthState;
39
- return {
40
- width: widthState === null || widthState === void 0 ? void 0 : widthState.width
41
- };
42
- });
43
34
  var LoomToolbarButtonInternal = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
44
35
  var disabled = _ref.disabled,
45
36
  api = _ref.api,
@@ -60,8 +51,8 @@ var LoomToolbarButtonInternal = /*#__PURE__*/_react.default.forwardRef(function
60
51
  target = _ref.target,
61
52
  hideTooltip = _ref.hideTooltip,
62
53
  rel = _ref.rel;
63
- var _useSharedState = useSharedState(api),
64
- width = _useSharedState.width;
54
+ var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['width'], selector),
55
+ width = _useSharedPluginState.width;
65
56
  var label = formatMessage(appearance === 'comment' ? _messages.toolbarInsertBlockMessages.addLoomVideoComment : _messages.toolbarInsertBlockMessages.addLoomVideo);
66
57
  var shouldShowRecordText = (width || 0) > LOOM_BUTTON_WIDTH_BREAKPOINT;
67
58
  return (0, _react2.jsx)(_uiMenu.ToolbarButton, {
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getToolbarComponents = void 0;
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _toolbar = require("@atlaskit/editor-common/toolbar");
10
+ var _editorToolbar = require("@atlaskit/editor-toolbar");
11
+ var _LoomMenuItem = require("./LoomMenuItem");
12
+ var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(config, api) {
13
+ return [{
14
+ type: _toolbar.LOOM_MENU_SECTION.type,
15
+ key: _toolbar.LOOM_MENU_SECTION.key,
16
+ parents: [{
17
+ type: _toolbar.OVERFLOW_MENU.type,
18
+ key: _toolbar.OVERFLOW_MENU.key,
19
+ rank: _toolbar.OVERFLOW_MENU_RANK[_toolbar.LOOM_MENU_SECTION.key]
20
+ }, {
21
+ type: _toolbar.OVERFLOW_MENU_PRIMARY_TOOLBAR.type,
22
+ key: _toolbar.OVERFLOW_MENU_PRIMARY_TOOLBAR.key,
23
+ rank: _toolbar.OVERFLOW_MENU_PRIMARY_TOOLBAR_RANK[_toolbar.LOOM_MENU_SECTION.key]
24
+ }],
25
+ component: function component(_ref) {
26
+ var children = _ref.children;
27
+ return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, {
28
+ hasSeparator: true
29
+ }, children);
30
+ }
31
+ }, {
32
+ type: _toolbar.LOOM_MENU_ITEM.type,
33
+ key: _toolbar.LOOM_MENU_ITEM.key,
34
+ parents: [{
35
+ type: _toolbar.LOOM_MENU_SECTION.type,
36
+ key: _toolbar.LOOM_MENU_SECTION.key,
37
+ rank: _toolbar.LOOM_MENU_SECTION_RANK[_toolbar.LOOM_MENU_ITEM.key]
38
+ }],
39
+ component: function component() {
40
+ return /*#__PURE__*/_react.default.createElement(_LoomMenuItem.LoomMenuItem, {
41
+ api: api,
42
+ renderButton: config.renderButton
43
+ });
44
+ }
45
+ }];
46
+ };
@@ -1,14 +1,17 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { insertLoom, recordVideo, setupLoom } from './pm-plugins/commands';
3
4
  import { createPlugin, loomPluginKey } from './pm-plugins/main';
4
5
  import { loomPrimaryToolbarComponent } from './ui/PrimaryToolbarButton';
5
6
  import { getQuickInsertItem } from './ui/quickInsert';
7
+ import { getToolbarComponents } from './ui/toolbar-components';
6
8
  export const loomPlugin = ({
7
9
  config,
8
10
  api
9
11
  }) => {
10
- var _api$analytics, _api$primaryToolbar;
12
+ var _api$analytics;
11
13
  const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
14
+ const isNewToolbarEnabled = expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true) && expValEquals('platform_editor_toolbar_migrate_loom', 'isEnabled', true);
12
15
 
13
16
  // Workaround since we want to insert a loom via the `hyperlink` plugin for now.
14
17
  // The hyperlink plugin (and the card plugin) are deeply tied into using the Prosemirror Command
@@ -17,10 +20,16 @@ export const loomPlugin = ({
17
20
  current: null
18
21
  };
19
22
  const primaryToolbarComponent = loomPrimaryToolbarComponent(config, api);
20
- api === null || api === void 0 ? void 0 : (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.actions.registerComponent({
21
- name: 'loom',
22
- component: primaryToolbarComponent
23
- });
23
+ if (isNewToolbarEnabled) {
24
+ var _api$toolbar;
25
+ api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.registerComponents(getToolbarComponents(config, api));
26
+ } else {
27
+ var _api$primaryToolbar;
28
+ api === null || api === void 0 ? void 0 : (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.actions.registerComponent({
29
+ name: 'loom',
30
+ component: primaryToolbarComponent
31
+ });
32
+ }
24
33
  return {
25
34
  name: 'loom',
26
35
  actions: {
@@ -71,6 +80,6 @@ export const loomPlugin = ({
71
80
  }
72
81
  },
73
82
  // Enable inserting Loom recordings through main toolbar
74
- primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
83
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && !isNewToolbarEnabled ? primaryToolbarComponent : undefined
75
84
  };
76
85
  };
@@ -0,0 +1,91 @@
1
+ import React, { useCallback } from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
+ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
+ import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
6
+ import { LoomIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
7
+ import { executeRecordVideo } from '../pm-plugins/commands';
8
+ const useLoomEnabled = api => {
9
+ const {
10
+ loomEnabled
11
+ } = useSharedPluginStateWithSelector(api, ['loom'], states => {
12
+ var _states$loomState;
13
+ return {
14
+ loomEnabled: (_states$loomState = states.loomState) === null || _states$loomState === void 0 ? void 0 : _states$loomState.isEnabled
15
+ };
16
+ });
17
+ return loomEnabled;
18
+ };
19
+ export const LoomMenuItem = ({
20
+ api,
21
+ renderButton
22
+ }) => {
23
+ const loomEnabled = useLoomEnabled(api);
24
+ if (renderButton) {
25
+ return renderButton(CustomisableLoomMenuItem(api));
26
+ } else if (loomEnabled !== undefined) {
27
+ return /*#__PURE__*/React.createElement(DefaultLoomMenuItem, {
28
+ api: api
29
+ });
30
+ }
31
+ };
32
+ const CustomisableLoomMenuItem = api => /*#__PURE__*/React.forwardRef(({
33
+ isDisabled = false,
34
+ onClickBeforeInit,
35
+ href,
36
+ target,
37
+ rel
38
+ }, ref) => {
39
+ const loomEnabled = !!useLoomEnabled(api);
40
+ const handleOnClick = useCallback(e => {
41
+ if (loomEnabled) {
42
+ executeRecordVideo(api);
43
+ } else if (onClickBeforeInit && e.type === 'click' && e.target instanceof HTMLElement) {
44
+ onClickBeforeInit(e);
45
+ }
46
+ }, [loomEnabled, onClickBeforeInit]);
47
+ return /*#__PURE__*/React.createElement(MenuItemComponent, {
48
+ ref: ref
49
+ // Ignore href if Loom is enabled so that it doesn't interfere with recording
50
+ ,
51
+ href: loomEnabled ? undefined : href,
52
+ disabled: isDisabled,
53
+ onClick: handleOnClick,
54
+ target: target,
55
+ rel: rel
56
+ });
57
+ });
58
+ const DefaultLoomMenuItem = ({
59
+ api
60
+ }) => {
61
+ const loomEnabled = useLoomEnabled(api);
62
+ const handleOnClick = useCallback(() => executeRecordVideo(api), [api]);
63
+ return /*#__PURE__*/React.createElement(MenuItemComponent, {
64
+ disabled: !loomEnabled,
65
+ onClick: handleOnClick
66
+ });
67
+ };
68
+ const MenuItemComponent = /*#__PURE__*/React.forwardRef(({
69
+ disabled,
70
+ onClick,
71
+ href,
72
+ target,
73
+ rel
74
+ }, ref) => {
75
+ const {
76
+ editorAppearance
77
+ } = useEditorToolbar();
78
+ const {
79
+ formatMessage
80
+ } = useIntl();
81
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
82
+ elemBefore: /*#__PURE__*/React.createElement(LoomIcon, {
83
+ label: ""
84
+ }),
85
+ isDisabled: disabled,
86
+ href: href,
87
+ target: target,
88
+ rel: rel,
89
+ onClick: e => onClick(e)
90
+ }, formatMessage(editorAppearance === 'comment' ? messages.addLoomVideoComment : messages.addLoomVideo));
91
+ });
@@ -7,7 +7,7 @@ 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, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
10
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
11
11
  import { executeRecordVideo } from '../pm-plugins/commands';
12
12
  import ToolbarButtonComponent from './ToolbarButtonComponent';
13
13
  const selector = states => {
@@ -17,18 +17,6 @@ const selector = states => {
17
17
  connectivityMode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
18
18
  };
19
19
  };
20
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
21
- return useSharedPluginStateWithSelector(api, ['loom', 'connectivity'], selector);
22
- }, api => {
23
- const {
24
- loomState,
25
- connectivityState
26
- } = useSharedPluginState(api, ['loom', 'connectivity']);
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
- });
32
20
  const CustomisableLoomToolbarButton = (disabled, appearance, api) => /*#__PURE__*/React.forwardRef((props, ref) => {
33
21
  const {
34
22
  onClickBeforeInit,
@@ -39,7 +27,7 @@ const CustomisableLoomToolbarButton = (disabled, appearance, api) => /*#__PURE__
39
27
  const {
40
28
  loomEnabled,
41
29
  connectivityMode
42
- } = useSharedState(api);
30
+ } = useSharedPluginStateWithSelector(api, ['loom', 'connectivity'], selector);
43
31
  const isLoomEnabled = !!loomEnabled;
44
32
  const handleOnClick = useCallback(e => {
45
33
  if (isLoomEnabled) {
@@ -71,7 +59,7 @@ const LoomToolbarButtonWrapper = ({
71
59
  const {
72
60
  loomEnabled,
73
61
  connectivityMode
74
- } = useSharedState(api);
62
+ } = useSharedPluginStateWithSelector(api, ['loom', 'connectivity'], selector);
75
63
  if (loomEnabled === undefined) {
76
64
  return null;
77
65
  }
@@ -7,7 +7,7 @@ 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, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
10
+ import { useSharedPluginStateWithSelector } 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
13
  import VideoIcon from '@atlaskit/icon/core/video';
@@ -23,16 +23,6 @@ const selector = states => {
23
23
  width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width
24
24
  };
25
25
  };
26
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
27
- return useSharedPluginStateWithSelector(api, ['width'], selector);
28
- }, api => {
29
- const {
30
- widthState
31
- } = useSharedPluginState(api, ['width']);
32
- return {
33
- width: widthState === null || widthState === void 0 ? void 0 : widthState.width
34
- };
35
- });
36
26
  const LoomToolbarButtonInternal = /*#__PURE__*/React.forwardRef(({
37
27
  disabled,
38
28
  api,
@@ -58,7 +48,7 @@ const LoomToolbarButtonInternal = /*#__PURE__*/React.forwardRef(({
58
48
  }, ref) => {
59
49
  const {
60
50
  width
61
- } = useSharedState(api);
51
+ } = useSharedPluginStateWithSelector(api, ['width'], selector);
62
52
  const label = formatMessage(appearance === 'comment' ? toolbarInsertBlockMessages.addLoomVideoComment : toolbarInsertBlockMessages.addLoomVideo);
63
53
  const shouldShowRecordText = (width || 0) > LOOM_BUTTON_WIDTH_BREAKPOINT;
64
54
  return jsx(ToolbarButton, {
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { LOOM_MENU_SECTION, OVERFLOW_MENU_RANK, OVERFLOW_MENU, LOOM_MENU_ITEM, LOOM_MENU_SECTION_RANK, OVERFLOW_MENU_PRIMARY_TOOLBAR_RANK, OVERFLOW_MENU_PRIMARY_TOOLBAR } from '@atlaskit/editor-common/toolbar';
3
+ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
4
+ import { LoomMenuItem } from './LoomMenuItem';
5
+ export const getToolbarComponents = (config, api) => {
6
+ return [{
7
+ type: LOOM_MENU_SECTION.type,
8
+ key: LOOM_MENU_SECTION.key,
9
+ parents: [{
10
+ type: OVERFLOW_MENU.type,
11
+ key: OVERFLOW_MENU.key,
12
+ rank: OVERFLOW_MENU_RANK[LOOM_MENU_SECTION.key]
13
+ }, {
14
+ type: OVERFLOW_MENU_PRIMARY_TOOLBAR.type,
15
+ key: OVERFLOW_MENU_PRIMARY_TOOLBAR.key,
16
+ rank: OVERFLOW_MENU_PRIMARY_TOOLBAR_RANK[LOOM_MENU_SECTION.key]
17
+ }],
18
+ component: ({
19
+ children
20
+ }) => {
21
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
22
+ hasSeparator: true
23
+ }, children);
24
+ }
25
+ }, {
26
+ type: LOOM_MENU_ITEM.type,
27
+ key: LOOM_MENU_ITEM.key,
28
+ parents: [{
29
+ type: LOOM_MENU_SECTION.type,
30
+ key: LOOM_MENU_SECTION.key,
31
+ rank: LOOM_MENU_SECTION_RANK[LOOM_MENU_ITEM.key]
32
+ }],
33
+ component: () => {
34
+ return /*#__PURE__*/React.createElement(LoomMenuItem, {
35
+ api: api,
36
+ renderButton: config.renderButton
37
+ });
38
+ }
39
+ }];
40
+ };
@@ -1,13 +1,16 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
2
3
  import { insertLoom as _insertLoom, recordVideo, setupLoom } from './pm-plugins/commands';
3
4
  import { createPlugin, loomPluginKey } from './pm-plugins/main';
4
5
  import { loomPrimaryToolbarComponent } from './ui/PrimaryToolbarButton';
5
6
  import { getQuickInsertItem } from './ui/quickInsert';
7
+ import { getToolbarComponents } from './ui/toolbar-components';
6
8
  export var loomPlugin = function loomPlugin(_ref) {
7
- var _api$analytics, _api$primaryToolbar;
9
+ var _api$analytics;
8
10
  var config = _ref.config,
9
11
  api = _ref.api;
10
12
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
13
+ var isNewToolbarEnabled = expValEquals('platform_editor_toolbar_aifc', 'isEnabled', true) && expValEquals('platform_editor_toolbar_migrate_loom', 'isEnabled', true);
11
14
 
12
15
  // Workaround since we want to insert a loom via the `hyperlink` plugin for now.
13
16
  // The hyperlink plugin (and the card plugin) are deeply tied into using the Prosemirror Command
@@ -16,10 +19,16 @@ export var loomPlugin = function loomPlugin(_ref) {
16
19
  current: null
17
20
  };
18
21
  var primaryToolbarComponent = loomPrimaryToolbarComponent(config, api);
19
- api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
20
- name: 'loom',
21
- component: primaryToolbarComponent
22
- });
22
+ if (isNewToolbarEnabled) {
23
+ var _api$toolbar;
24
+ api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents(getToolbarComponents(config, api));
25
+ } else {
26
+ var _api$primaryToolbar;
27
+ api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
28
+ name: 'loom',
29
+ component: primaryToolbarComponent
30
+ });
31
+ }
23
32
  return {
24
33
  name: 'loom',
25
34
  actions: {
@@ -75,6 +84,6 @@ export var loomPlugin = function loomPlugin(_ref) {
75
84
  }
76
85
  },
77
86
  // Enable inserting Loom recordings through main toolbar
78
- primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
87
+ primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) && !isNewToolbarEnabled ? primaryToolbarComponent : undefined
79
88
  };
80
89
  };
@@ -0,0 +1,91 @@
1
+ import React, { useCallback } from 'react';
2
+ import { useIntl } from 'react-intl-next';
3
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
+ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
+ import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
6
+ import { LoomIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
7
+ import { executeRecordVideo } from '../pm-plugins/commands';
8
+ var useLoomEnabled = function useLoomEnabled(api) {
9
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['loom'], function (states) {
10
+ var _states$loomState;
11
+ return {
12
+ loomEnabled: (_states$loomState = states.loomState) === null || _states$loomState === void 0 ? void 0 : _states$loomState.isEnabled
13
+ };
14
+ }),
15
+ loomEnabled = _useSharedPluginState.loomEnabled;
16
+ return loomEnabled;
17
+ };
18
+ export var LoomMenuItem = function LoomMenuItem(_ref) {
19
+ var api = _ref.api,
20
+ renderButton = _ref.renderButton;
21
+ var loomEnabled = useLoomEnabled(api);
22
+ if (renderButton) {
23
+ return renderButton(CustomisableLoomMenuItem(api));
24
+ } else if (loomEnabled !== undefined) {
25
+ return /*#__PURE__*/React.createElement(DefaultLoomMenuItem, {
26
+ api: api
27
+ });
28
+ }
29
+ };
30
+ var CustomisableLoomMenuItem = function CustomisableLoomMenuItem(api) {
31
+ return /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
32
+ var _ref2$isDisabled = _ref2.isDisabled,
33
+ isDisabled = _ref2$isDisabled === void 0 ? false : _ref2$isDisabled,
34
+ onClickBeforeInit = _ref2.onClickBeforeInit,
35
+ href = _ref2.href,
36
+ target = _ref2.target,
37
+ rel = _ref2.rel;
38
+ var loomEnabled = !!useLoomEnabled(api);
39
+ var handleOnClick = useCallback(function (e) {
40
+ if (loomEnabled) {
41
+ executeRecordVideo(api);
42
+ } else if (onClickBeforeInit && e.type === 'click' && e.target instanceof HTMLElement) {
43
+ onClickBeforeInit(e);
44
+ }
45
+ }, [loomEnabled, onClickBeforeInit]);
46
+ return /*#__PURE__*/React.createElement(MenuItemComponent, {
47
+ ref: ref
48
+ // Ignore href if Loom is enabled so that it doesn't interfere with recording
49
+ ,
50
+ href: loomEnabled ? undefined : href,
51
+ disabled: isDisabled,
52
+ onClick: handleOnClick,
53
+ target: target,
54
+ rel: rel
55
+ });
56
+ });
57
+ };
58
+ var DefaultLoomMenuItem = function DefaultLoomMenuItem(_ref3) {
59
+ var api = _ref3.api;
60
+ var loomEnabled = useLoomEnabled(api);
61
+ var handleOnClick = useCallback(function () {
62
+ return executeRecordVideo(api);
63
+ }, [api]);
64
+ return /*#__PURE__*/React.createElement(MenuItemComponent, {
65
+ disabled: !loomEnabled,
66
+ onClick: handleOnClick
67
+ });
68
+ };
69
+ var MenuItemComponent = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
70
+ var disabled = _ref4.disabled,
71
+ _onClick = _ref4.onClick,
72
+ href = _ref4.href,
73
+ target = _ref4.target,
74
+ rel = _ref4.rel;
75
+ var _useEditorToolbar = useEditorToolbar(),
76
+ editorAppearance = _useEditorToolbar.editorAppearance;
77
+ var _useIntl = useIntl(),
78
+ formatMessage = _useIntl.formatMessage;
79
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
80
+ elemBefore: /*#__PURE__*/React.createElement(LoomIcon, {
81
+ label: ""
82
+ }),
83
+ isDisabled: disabled,
84
+ href: href,
85
+ target: target,
86
+ rel: rel,
87
+ onClick: function onClick(e) {
88
+ return _onClick(e);
89
+ }
90
+ }, formatMessage(editorAppearance === 'comment' ? messages.addLoomVideoComment : messages.addLoomVideo));
91
+ });
@@ -9,7 +9,7 @@ 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, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
12
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
13
13
  import { executeRecordVideo } from '../pm-plugins/commands';
14
14
  import ToolbarButtonComponent from './ToolbarButtonComponent';
15
15
  var selector = function selector(states) {
@@ -19,17 +19,6 @@ var selector = function selector(states) {
19
19
  connectivityMode: (_states$connectivityS = states.connectivityState) === null || _states$connectivityS === void 0 ? void 0 : _states$connectivityS.mode
20
20
  };
21
21
  };
22
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
23
- return useSharedPluginStateWithSelector(api, ['loom', 'connectivity'], selector);
24
- }, function (api) {
25
- var _useSharedPluginState = useSharedPluginState(api, ['loom', 'connectivity']),
26
- loomState = _useSharedPluginState.loomState,
27
- connectivityState = _useSharedPluginState.connectivityState;
28
- return {
29
- loomEnabled: loomState === null || loomState === void 0 ? void 0 : loomState.isEnabled,
30
- connectivityMode: connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode
31
- };
32
- });
33
22
  var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disabled, appearance, api) {
34
23
  return /*#__PURE__*/React.forwardRef(function (props, ref) {
35
24
  var onClickBeforeInit = props.onClickBeforeInit,
@@ -37,9 +26,9 @@ var CustomisableLoomToolbarButton = function CustomisableLoomToolbarButton(disab
37
26
  isDisabled = _props$isDisabled === void 0 ? false : _props$isDisabled,
38
27
  href = props.href,
39
28
  restProps = _objectWithoutProperties(props, _excluded);
40
- var _useSharedState = useSharedState(api),
41
- loomEnabled = _useSharedState.loomEnabled,
42
- connectivityMode = _useSharedState.connectivityMode;
29
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['loom', 'connectivity'], selector),
30
+ loomEnabled = _useSharedPluginState.loomEnabled,
31
+ connectivityMode = _useSharedPluginState.connectivityMode;
43
32
  var isLoomEnabled = !!loomEnabled;
44
33
  var handleOnClick = useCallback(function (e) {
45
34
  if (isLoomEnabled) {
@@ -72,9 +61,9 @@ var LoomToolbarButtonWrapper = function LoomToolbarButtonWrapper(_ref) {
72
61
  var handleOnClick = useCallback(function () {
73
62
  return executeRecordVideo(api);
74
63
  }, [api]);
75
- var _useSharedState2 = useSharedState(api),
76
- loomEnabled = _useSharedState2.loomEnabled,
77
- connectivityMode = _useSharedState2.connectivityMode;
64
+ var _useSharedPluginState2 = useSharedPluginStateWithSelector(api, ['loom', 'connectivity'], selector),
65
+ loomEnabled = _useSharedPluginState2.loomEnabled,
66
+ connectivityMode = _useSharedPluginState2.connectivityMode;
78
67
  if (loomEnabled === undefined) {
79
68
  return null;
80
69
  }
@@ -7,7 +7,7 @@ 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, sharedPluginStateHookMigratorFactory, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
10
+ import { useSharedPluginStateWithSelector } 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
13
  import VideoIcon from '@atlaskit/icon/core/video';
@@ -23,15 +23,6 @@ var selector = function selector(states) {
23
23
  width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width
24
24
  };
25
25
  };
26
- var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
27
- return useSharedPluginStateWithSelector(api, ['width'], selector);
28
- }, function (api) {
29
- var _useSharedPluginState = useSharedPluginState(api, ['width']),
30
- widthState = _useSharedPluginState.widthState;
31
- return {
32
- width: widthState === null || widthState === void 0 ? void 0 : widthState.width
33
- };
34
- });
35
26
  var LoomToolbarButtonInternal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
36
27
  var disabled = _ref.disabled,
37
28
  api = _ref.api,
@@ -52,8 +43,8 @@ var LoomToolbarButtonInternal = /*#__PURE__*/React.forwardRef(function (_ref, re
52
43
  target = _ref.target,
53
44
  hideTooltip = _ref.hideTooltip,
54
45
  rel = _ref.rel;
55
- var _useSharedState = useSharedState(api),
56
- width = _useSharedState.width;
46
+ var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['width'], selector),
47
+ width = _useSharedPluginState.width;
57
48
  var label = formatMessage(appearance === 'comment' ? toolbarInsertBlockMessages.addLoomVideoComment : toolbarInsertBlockMessages.addLoomVideo);
58
49
  var shouldShowRecordText = (width || 0) > LOOM_BUTTON_WIDTH_BREAKPOINT;
59
50
  return jsx(ToolbarButton, {
@@ -0,0 +1,39 @@
1
+ import React from 'react';
2
+ import { LOOM_MENU_SECTION, OVERFLOW_MENU_RANK, OVERFLOW_MENU, LOOM_MENU_ITEM, LOOM_MENU_SECTION_RANK, OVERFLOW_MENU_PRIMARY_TOOLBAR_RANK, OVERFLOW_MENU_PRIMARY_TOOLBAR } from '@atlaskit/editor-common/toolbar';
3
+ import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar';
4
+ import { LoomMenuItem } from './LoomMenuItem';
5
+ export var getToolbarComponents = function getToolbarComponents(config, api) {
6
+ return [{
7
+ type: LOOM_MENU_SECTION.type,
8
+ key: LOOM_MENU_SECTION.key,
9
+ parents: [{
10
+ type: OVERFLOW_MENU.type,
11
+ key: OVERFLOW_MENU.key,
12
+ rank: OVERFLOW_MENU_RANK[LOOM_MENU_SECTION.key]
13
+ }, {
14
+ type: OVERFLOW_MENU_PRIMARY_TOOLBAR.type,
15
+ key: OVERFLOW_MENU_PRIMARY_TOOLBAR.key,
16
+ rank: OVERFLOW_MENU_PRIMARY_TOOLBAR_RANK[LOOM_MENU_SECTION.key]
17
+ }],
18
+ component: function component(_ref) {
19
+ var children = _ref.children;
20
+ return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
21
+ hasSeparator: true
22
+ }, children);
23
+ }
24
+ }, {
25
+ type: LOOM_MENU_ITEM.type,
26
+ key: LOOM_MENU_ITEM.key,
27
+ parents: [{
28
+ type: LOOM_MENU_SECTION.type,
29
+ key: LOOM_MENU_SECTION.key,
30
+ rank: LOOM_MENU_SECTION_RANK[LOOM_MENU_ITEM.key]
31
+ }],
32
+ component: function component() {
33
+ return /*#__PURE__*/React.createElement(LoomMenuItem, {
34
+ api: api,
35
+ renderButton: config.renderButton
36
+ });
37
+ }
38
+ }];
39
+ };
@@ -6,6 +6,7 @@ import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
6
6
  import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
7
7
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
8
8
  import { type QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
9
+ import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
9
10
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
10
11
  import type { LoomPluginState } from './pm-plugins/main';
11
12
  import type { LoomPluginOptions, LoomProviderOptions, PositionType, VideoMeta } from './types';
@@ -39,7 +40,8 @@ export type LoomPlugin = NextEditorPlugin<'loom', {
39
40
  HyperlinkPlugin,
40
41
  OptionalPlugin<PrimaryToolbarPlugin>,
41
42
  OptionalPlugin<QuickInsertPlugin>,
42
- OptionalPlugin<ConnectivityPlugin>
43
+ OptionalPlugin<ConnectivityPlugin>,
44
+ OptionalPlugin<ToolbarPlugin>
43
45
  ];
44
46
  pluginConfiguration: LoomPluginOptions;
45
47
  sharedState: LoomPluginState | undefined;
@@ -0,0 +1,6 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { LoomPlugin } from '../loomPluginType';
3
+ import type { LoomPluginOptions } from '../types';
4
+ export declare const LoomMenuItem: ({ api, renderButton, }: {
5
+ api: ExtractInjectionAPI<LoomPlugin> | undefined;
6
+ } & Pick<LoomPluginOptions, "renderButton">) => JSX.Element | null | undefined;
@@ -0,0 +1,5 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
+ import type { LoomPlugin } from '../loomPluginType';
4
+ import type { LoomPluginOptions } from '../types';
5
+ export declare const getToolbarComponents: (config: LoomPluginOptions, api: ExtractInjectionAPI<LoomPlugin> | undefined) => RegisterComponent[];
@@ -6,6 +6,7 @@ import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
6
6
  import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
7
7
  import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
8
8
  import { type QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
9
+ import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
9
10
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
10
11
  import type { LoomPluginState } from './pm-plugins/main';
11
12
  import type { LoomPluginOptions, LoomProviderOptions, PositionType, VideoMeta } from './types';
@@ -39,7 +40,8 @@ export type LoomPlugin = NextEditorPlugin<'loom', {
39
40
  HyperlinkPlugin,
40
41
  OptionalPlugin<PrimaryToolbarPlugin>,
41
42
  OptionalPlugin<QuickInsertPlugin>,
42
- OptionalPlugin<ConnectivityPlugin>
43
+ OptionalPlugin<ConnectivityPlugin>,
44
+ OptionalPlugin<ToolbarPlugin>
43
45
  ];
44
46
  pluginConfiguration: LoomPluginOptions;
45
47
  sharedState: LoomPluginState | undefined;
@@ -0,0 +1,6 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { LoomPlugin } from '../loomPluginType';
3
+ import type { LoomPluginOptions } from '../types';
4
+ export declare const LoomMenuItem: ({ api, renderButton, }: {
5
+ api: ExtractInjectionAPI<LoomPlugin> | undefined;
6
+ } & Pick<LoomPluginOptions, "renderButton">) => JSX.Element | null | undefined;
@@ -0,0 +1,5 @@
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
+ import type { LoomPlugin } from '../loomPluginType';
4
+ import type { LoomPluginOptions } from '../types';
5
+ export declare const getToolbarComponents: (config: LoomPluginOptions, api: ExtractInjectionAPI<LoomPlugin> | undefined) => RegisterComponent[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-loom",
3
- "version": "5.1.3",
3
+ "version": "5.1.5",
4
4
  "description": "Loom plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,35 +31,35 @@
31
31
  "*.compiled.css"
32
32
  ],
33
33
  "atlaskit:src": "src/index.ts",
34
- "af:exports": {
35
- ".": "./src/index.ts"
36
- },
37
34
  "dependencies": {
38
35
  "@atlaskit/button": "^23.4.0",
39
36
  "@atlaskit/editor-plugin-analytics": "^3.0.0",
40
37
  "@atlaskit/editor-plugin-hyperlink": "^5.4.0",
41
38
  "@atlaskit/editor-plugin-primary-toolbar": "^4.1.0",
42
39
  "@atlaskit/editor-plugin-quick-insert": "^3.0.0",
40
+ "@atlaskit/editor-plugin-toolbar": "^0.4.0",
43
41
  "@atlaskit/editor-plugin-width": "^4.0.0",
44
42
  "@atlaskit/editor-prosemirror": "7.0.0",
45
- "@atlaskit/icon": "^28.0.0",
43
+ "@atlaskit/editor-toolbar": "^0.5.0",
44
+ "@atlaskit/icon": "^28.1.0",
46
45
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
- "@atlaskit/tokens": "^6.0.0",
46
+ "@atlaskit/tmp-editor-statsig": "^11.9.0",
47
+ "@atlaskit/tokens": "^6.1.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1",
50
50
  "@loomhq/record-sdk": "^2.36.18"
51
51
  },
52
52
  "peerDependencies": {
53
- "@atlaskit/editor-common": "^107.28.0",
53
+ "@atlaskit/editor-common": "^107.33.0",
54
54
  "react": "^18.2.0",
55
55
  "react-dom": "^18.2.0",
56
56
  "react-intl-next": "npm:react-intl@^5.18.1"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@atlaskit/editor-plugin-base": "^4.1.0",
60
- "@atlaskit/editor-plugin-card": "^7.4.0",
60
+ "@atlaskit/editor-plugin-card": "^7.6.0",
61
61
  "@atlaskit/editor-plugin-copy-button": "^3.0.0",
62
- "@atlaskit/editor-plugin-decorations": "^3.0.0",
62
+ "@atlaskit/editor-plugin-decorations": "^3.1.0",
63
63
  "@atlaskit/editor-plugin-editor-disabled": "^3.0.0",
64
64
  "@atlaskit/editor-plugin-feature-flags": "^2.0.0",
65
65
  "@atlaskit/editor-plugin-floating-toolbar": "^5.2.0",