@atlaskit/editor-plugin-loom 15.0.0 → 15.0.1
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 +8 -0
- package/dist/cjs/loomPlugin.js +10 -1
- package/dist/cjs/ui/quick-insert/LoomQuickInsertMenuItem.js +68 -0
- package/dist/cjs/ui/quick-insert/getLoomQuickInsertComponents.js +28 -0
- package/dist/es2019/loomPlugin.js +10 -1
- package/dist/es2019/ui/quick-insert/LoomQuickInsertMenuItem.js +62 -0
- package/dist/es2019/ui/quick-insert/getLoomQuickInsertComponents.js +18 -0
- package/dist/esm/loomPlugin.js +10 -1
- package/dist/esm/ui/quick-insert/LoomQuickInsertMenuItem.js +59 -0
- package/dist/esm/ui/quick-insert/getLoomQuickInsertComponents.js +21 -0
- package/dist/types/loomPluginType.d.ts +4 -2
- package/dist/types/ui/quick-insert/LoomQuickInsertMenuItem.d.ts +6 -0
- package/dist/types/ui/quick-insert/getLoomQuickInsertComponents.d.ts +6 -0
- package/package.json +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-loom
|
|
2
2
|
|
|
3
|
+
## 15.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`7087f393ec725`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7087f393ec725) -
|
|
8
|
+
Add the categorized registered Quick Insert browse experience with representative native elements
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 15.0.0
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/cjs/loomPlugin.js
CHANGED
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.loomPlugin = void 0;
|
|
7
7
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
8
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
8
9
|
var _commands = require("./pm-plugins/commands");
|
|
9
10
|
var _main = require("./pm-plugins/main");
|
|
10
11
|
var _PrimaryToolbarButton = require("./ui/PrimaryToolbarButton");
|
|
12
|
+
var _getLoomQuickInsertComponents = require("./ui/quick-insert/getLoomQuickInsertComponents");
|
|
11
13
|
var _quickInsert = require("./ui/quickInsert");
|
|
12
14
|
var _toolbarComponents = require("./ui/toolbar-components");
|
|
13
15
|
var loomPlugin = exports.loomPlugin = function loomPlugin(_ref) {
|
|
@@ -24,6 +26,13 @@ var loomPlugin = exports.loomPlugin = function loomPlugin(_ref) {
|
|
|
24
26
|
current: null
|
|
25
27
|
};
|
|
26
28
|
var primaryToolbarComponent = (0, _PrimaryToolbarButton.loomPrimaryToolbarComponent)(config, api);
|
|
29
|
+
var isRegisteredSlashCommandEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command');
|
|
30
|
+
if (config.loomProvider && isRegisteredSlashCommandEnabled) {
|
|
31
|
+
var _api$uiControlRegistr;
|
|
32
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register((0, _getLoomQuickInsertComponents.getLoomQuickInsertComponents)({
|
|
33
|
+
api: api
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
27
36
|
if (isNewToolbarEnabled) {
|
|
28
37
|
var _api$toolbar;
|
|
29
38
|
api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)(config, api));
|
|
@@ -79,7 +88,7 @@ var loomPlugin = exports.loomPlugin = function loomPlugin(_ref) {
|
|
|
79
88
|
}
|
|
80
89
|
return _main.loomPluginKey.getState(editorState);
|
|
81
90
|
},
|
|
82
|
-
pluginsOptions: {
|
|
91
|
+
pluginsOptions: isRegisteredSlashCommandEnabled ? {} : {
|
|
83
92
|
// Enable inserting Loom recordings through the slash command
|
|
84
93
|
quickInsert: function quickInsert(intl) {
|
|
85
94
|
if (config.loomProvider) {
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.LoomQuickInsertMenuItem = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactIntl = require("react-intl");
|
|
11
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
|
+
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
15
|
+
var _menuItem = require("@atlaskit/editor-common/quick-insert/menu-item");
|
|
16
|
+
var _connectivityPluginType = require("@atlaskit/editor-plugin-connectivity/connectivityPluginType");
|
|
17
|
+
var _video = _interopRequireDefault(require("@atlaskit/icon/core/video"));
|
|
18
|
+
var _commands = require("../../pm-plugins/commands");
|
|
19
|
+
var _main = require("../../pm-plugins/main");
|
|
20
|
+
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); }
|
|
21
|
+
var LoomQuickInsertMenuItem = exports.LoomQuickInsertMenuItem = function LoomQuickInsertMenuItem(_ref) {
|
|
22
|
+
var api = _ref.api;
|
|
23
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
24
|
+
formatMessage = _useIntl.formatMessage;
|
|
25
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['connectivity'], function (_ref2) {
|
|
26
|
+
var connectivityState = _ref2.connectivityState;
|
|
27
|
+
return {
|
|
28
|
+
isOffline: (0, _connectivityPluginType.isOfflineMode)(connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode)
|
|
29
|
+
};
|
|
30
|
+
}),
|
|
31
|
+
isOffline = _useSharedPluginState.isOffline;
|
|
32
|
+
var onSelect = (0, _react.useCallback)(function (_ref3) {
|
|
33
|
+
var _recordVideo, _api$analytics2;
|
|
34
|
+
var editorView = _ref3.editorView,
|
|
35
|
+
insert = _ref3.insert;
|
|
36
|
+
var tr = insert(undefined);
|
|
37
|
+
var loomState = _main.loomPluginKey.getState(editorView.state);
|
|
38
|
+
if (!(loomState !== null && loomState !== void 0 && loomState.isEnabled)) {
|
|
39
|
+
var _recordVideoFailed, _api$analytics;
|
|
40
|
+
(0, _monitoring.logException)(new Error(loomState === null || loomState === void 0 ? void 0 : loomState.error), {
|
|
41
|
+
location: 'editor-plugin-loom/quick-insert-record-video'
|
|
42
|
+
});
|
|
43
|
+
return (_recordVideoFailed = (0, _commands.recordVideoFailed)({
|
|
44
|
+
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT,
|
|
45
|
+
error: loomState === null || loomState === void 0 ? void 0 : loomState.error,
|
|
46
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
47
|
+
})({
|
|
48
|
+
tr: tr
|
|
49
|
+
})) !== null && _recordVideoFailed !== void 0 ? _recordVideoFailed : false;
|
|
50
|
+
}
|
|
51
|
+
return (_recordVideo = (0, _commands.recordVideo)({
|
|
52
|
+
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT,
|
|
53
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions
|
|
54
|
+
})({
|
|
55
|
+
tr: tr
|
|
56
|
+
})) !== null && _recordVideo !== void 0 ? _recordVideo : false;
|
|
57
|
+
}, [api]);
|
|
58
|
+
return /*#__PURE__*/_react.default.createElement(_menuItem.QuickInsertMenuItem, {
|
|
59
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_video.default, {
|
|
60
|
+
label: "",
|
|
61
|
+
color: "var(--ds-icon-subtle, #505258)",
|
|
62
|
+
spacing: "spacious"
|
|
63
|
+
}),
|
|
64
|
+
isDisabled: isOffline,
|
|
65
|
+
onSelect: onSelect,
|
|
66
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.recordVideo)
|
|
67
|
+
});
|
|
68
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getLoomQuickInsertComponents = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _keys = require("@atlaskit/editor-common/quick-insert/keys");
|
|
10
|
+
var _rank = require("@atlaskit/editor-common/quick-insert/rank");
|
|
11
|
+
var _LoomQuickInsertMenuItem = require("./LoomQuickInsertMenuItem");
|
|
12
|
+
var getLoomQuickInsertComponents = exports.getLoomQuickInsertComponents = function getLoomQuickInsertComponents(_ref) {
|
|
13
|
+
var api = _ref.api;
|
|
14
|
+
return [{
|
|
15
|
+
key: _keys.LOOM_MENU_ITEM.key,
|
|
16
|
+
type: _keys.LOOM_MENU_ITEM.type,
|
|
17
|
+
parents: [{
|
|
18
|
+
key: _keys.MEDIA_SECTION.key,
|
|
19
|
+
type: _keys.MEDIA_SECTION.type,
|
|
20
|
+
rank: _rank.MEDIA_SECTION_RANK[_keys.LOOM_MENU_ITEM.key]
|
|
21
|
+
}],
|
|
22
|
+
component: function component() {
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_LoomQuickInsertMenuItem.LoomQuickInsertMenuItem, {
|
|
24
|
+
api: api
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}];
|
|
28
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
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';
|
|
6
|
+
import { getLoomQuickInsertComponents } from './ui/quick-insert/getLoomQuickInsertComponents';
|
|
5
7
|
import { getQuickInsertItem } from './ui/quickInsert';
|
|
6
8
|
import { getToolbarComponents } from './ui/toolbar-components';
|
|
7
9
|
export const loomPlugin = ({
|
|
@@ -19,6 +21,13 @@ export const loomPlugin = ({
|
|
|
19
21
|
current: null
|
|
20
22
|
};
|
|
21
23
|
const primaryToolbarComponent = loomPrimaryToolbarComponent(config, api);
|
|
24
|
+
const isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
25
|
+
if (config.loomProvider && isRegisteredSlashCommandEnabled) {
|
|
26
|
+
var _api$uiControlRegistr;
|
|
27
|
+
api === null || api === void 0 ? void 0 : (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 ? void 0 : _api$uiControlRegistr.actions.register(getLoomQuickInsertComponents({
|
|
28
|
+
api
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
22
31
|
if (isNewToolbarEnabled) {
|
|
23
32
|
var _api$toolbar;
|
|
24
33
|
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));
|
|
@@ -69,7 +78,7 @@ export const loomPlugin = ({
|
|
|
69
78
|
}
|
|
70
79
|
return loomPluginKey.getState(editorState);
|
|
71
80
|
},
|
|
72
|
-
pluginsOptions: {
|
|
81
|
+
pluginsOptions: isRegisteredSlashCommandEnabled ? {} : {
|
|
73
82
|
// Enable inserting Loom recordings through the slash command
|
|
74
83
|
quickInsert: intl => {
|
|
75
84
|
if (config.loomProvider) {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
7
|
+
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
8
|
+
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity/connectivityPluginType';
|
|
9
|
+
import VideoIcon from '@atlaskit/icon/core/video';
|
|
10
|
+
import { recordVideo, recordVideoFailed } from '../../pm-plugins/commands';
|
|
11
|
+
import { loomPluginKey } from '../../pm-plugins/main';
|
|
12
|
+
export const LoomQuickInsertMenuItem = ({
|
|
13
|
+
api
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
formatMessage
|
|
17
|
+
} = useIntl();
|
|
18
|
+
const {
|
|
19
|
+
isOffline
|
|
20
|
+
} = useSharedPluginStateWithSelector(api, ['connectivity'], ({
|
|
21
|
+
connectivityState
|
|
22
|
+
}) => ({
|
|
23
|
+
isOffline: isOfflineMode(connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode)
|
|
24
|
+
}));
|
|
25
|
+
const onSelect = useCallback(({
|
|
26
|
+
editorView,
|
|
27
|
+
insert
|
|
28
|
+
}) => {
|
|
29
|
+
var _recordVideo, _api$analytics2;
|
|
30
|
+
const tr = insert(undefined);
|
|
31
|
+
const loomState = loomPluginKey.getState(editorView.state);
|
|
32
|
+
if (!(loomState !== null && loomState !== void 0 && loomState.isEnabled)) {
|
|
33
|
+
var _recordVideoFailed, _api$analytics;
|
|
34
|
+
logException(new Error(loomState === null || loomState === void 0 ? void 0 : loomState.error), {
|
|
35
|
+
location: 'editor-plugin-loom/quick-insert-record-video'
|
|
36
|
+
});
|
|
37
|
+
return (_recordVideoFailed = recordVideoFailed({
|
|
38
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT,
|
|
39
|
+
error: loomState === null || loomState === void 0 ? void 0 : loomState.error,
|
|
40
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
41
|
+
})({
|
|
42
|
+
tr
|
|
43
|
+
})) !== null && _recordVideoFailed !== void 0 ? _recordVideoFailed : false;
|
|
44
|
+
}
|
|
45
|
+
return (_recordVideo = recordVideo({
|
|
46
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT,
|
|
47
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions
|
|
48
|
+
})({
|
|
49
|
+
tr
|
|
50
|
+
})) !== null && _recordVideo !== void 0 ? _recordVideo : false;
|
|
51
|
+
}, [api]);
|
|
52
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
53
|
+
iconBefore: /*#__PURE__*/React.createElement(VideoIcon, {
|
|
54
|
+
label: "",
|
|
55
|
+
color: "var(--ds-icon-subtle, #505258)",
|
|
56
|
+
spacing: "spacious"
|
|
57
|
+
}),
|
|
58
|
+
isDisabled: isOffline,
|
|
59
|
+
onSelect: onSelect,
|
|
60
|
+
title: formatMessage(messages.recordVideo)
|
|
61
|
+
});
|
|
62
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LOOM_MENU_ITEM, MEDIA_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
3
|
+
import { MEDIA_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
4
|
+
import { LoomQuickInsertMenuItem } from './LoomQuickInsertMenuItem';
|
|
5
|
+
export const getLoomQuickInsertComponents = ({
|
|
6
|
+
api
|
|
7
|
+
}) => [{
|
|
8
|
+
key: LOOM_MENU_ITEM.key,
|
|
9
|
+
type: LOOM_MENU_ITEM.type,
|
|
10
|
+
parents: [{
|
|
11
|
+
key: MEDIA_SECTION.key,
|
|
12
|
+
type: MEDIA_SECTION.type,
|
|
13
|
+
rank: MEDIA_SECTION_RANK[LOOM_MENU_ITEM.key]
|
|
14
|
+
}],
|
|
15
|
+
component: () => /*#__PURE__*/React.createElement(LoomQuickInsertMenuItem, {
|
|
16
|
+
api: api
|
|
17
|
+
})
|
|
18
|
+
}];
|
package/dist/esm/loomPlugin.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
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';
|
|
6
|
+
import { getLoomQuickInsertComponents } from './ui/quick-insert/getLoomQuickInsertComponents';
|
|
5
7
|
import { getQuickInsertItem } from './ui/quickInsert';
|
|
6
8
|
import { getToolbarComponents } from './ui/toolbar-components';
|
|
7
9
|
export var loomPlugin = function loomPlugin(_ref) {
|
|
@@ -18,6 +20,13 @@ export var loomPlugin = function loomPlugin(_ref) {
|
|
|
18
20
|
current: null
|
|
19
21
|
};
|
|
20
22
|
var primaryToolbarComponent = loomPrimaryToolbarComponent(config, api);
|
|
23
|
+
var isRegisteredSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
|
|
24
|
+
if (config.loomProvider && isRegisteredSlashCommandEnabled) {
|
|
25
|
+
var _api$uiControlRegistr;
|
|
26
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register(getLoomQuickInsertComponents({
|
|
27
|
+
api: api
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
21
30
|
if (isNewToolbarEnabled) {
|
|
22
31
|
var _api$toolbar;
|
|
23
32
|
api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents(getToolbarComponents(config, api));
|
|
@@ -73,7 +82,7 @@ export var loomPlugin = function loomPlugin(_ref) {
|
|
|
73
82
|
}
|
|
74
83
|
return loomPluginKey.getState(editorState);
|
|
75
84
|
},
|
|
76
|
-
pluginsOptions: {
|
|
85
|
+
pluginsOptions: isRegisteredSlashCommandEnabled ? {} : {
|
|
77
86
|
// Enable inserting Loom recordings through the slash command
|
|
78
87
|
quickInsert: function quickInsert(intl) {
|
|
79
88
|
if (config.loomProvider) {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
|
+
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
+
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
7
|
+
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
8
|
+
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity/connectivityPluginType';
|
|
9
|
+
import VideoIcon from '@atlaskit/icon/core/video';
|
|
10
|
+
import { recordVideo, recordVideoFailed } from '../../pm-plugins/commands';
|
|
11
|
+
import { loomPluginKey } from '../../pm-plugins/main';
|
|
12
|
+
export var LoomQuickInsertMenuItem = function LoomQuickInsertMenuItem(_ref) {
|
|
13
|
+
var api = _ref.api;
|
|
14
|
+
var _useIntl = useIntl(),
|
|
15
|
+
formatMessage = _useIntl.formatMessage;
|
|
16
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['connectivity'], function (_ref2) {
|
|
17
|
+
var connectivityState = _ref2.connectivityState;
|
|
18
|
+
return {
|
|
19
|
+
isOffline: isOfflineMode(connectivityState === null || connectivityState === void 0 ? void 0 : connectivityState.mode)
|
|
20
|
+
};
|
|
21
|
+
}),
|
|
22
|
+
isOffline = _useSharedPluginState.isOffline;
|
|
23
|
+
var onSelect = useCallback(function (_ref3) {
|
|
24
|
+
var _recordVideo, _api$analytics2;
|
|
25
|
+
var editorView = _ref3.editorView,
|
|
26
|
+
insert = _ref3.insert;
|
|
27
|
+
var tr = insert(undefined);
|
|
28
|
+
var loomState = loomPluginKey.getState(editorView.state);
|
|
29
|
+
if (!(loomState !== null && loomState !== void 0 && loomState.isEnabled)) {
|
|
30
|
+
var _recordVideoFailed, _api$analytics;
|
|
31
|
+
logException(new Error(loomState === null || loomState === void 0 ? void 0 : loomState.error), {
|
|
32
|
+
location: 'editor-plugin-loom/quick-insert-record-video'
|
|
33
|
+
});
|
|
34
|
+
return (_recordVideoFailed = recordVideoFailed({
|
|
35
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT,
|
|
36
|
+
error: loomState === null || loomState === void 0 ? void 0 : loomState.error,
|
|
37
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
|
|
38
|
+
})({
|
|
39
|
+
tr: tr
|
|
40
|
+
})) !== null && _recordVideoFailed !== void 0 ? _recordVideoFailed : false;
|
|
41
|
+
}
|
|
42
|
+
return (_recordVideo = recordVideo({
|
|
43
|
+
inputMethod: INPUT_METHOD.QUICK_INSERT,
|
|
44
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions
|
|
45
|
+
})({
|
|
46
|
+
tr: tr
|
|
47
|
+
})) !== null && _recordVideo !== void 0 ? _recordVideo : false;
|
|
48
|
+
}, [api]);
|
|
49
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuItem, {
|
|
50
|
+
iconBefore: /*#__PURE__*/React.createElement(VideoIcon, {
|
|
51
|
+
label: "",
|
|
52
|
+
color: "var(--ds-icon-subtle, #505258)",
|
|
53
|
+
spacing: "spacious"
|
|
54
|
+
}),
|
|
55
|
+
isDisabled: isOffline,
|
|
56
|
+
onSelect: onSelect,
|
|
57
|
+
title: formatMessage(messages.recordVideo)
|
|
58
|
+
});
|
|
59
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LOOM_MENU_ITEM, MEDIA_SECTION } from '@atlaskit/editor-common/quick-insert/keys';
|
|
3
|
+
import { MEDIA_SECTION_RANK } from '@atlaskit/editor-common/quick-insert/rank';
|
|
4
|
+
import { LoomQuickInsertMenuItem } from './LoomQuickInsertMenuItem';
|
|
5
|
+
export var getLoomQuickInsertComponents = function getLoomQuickInsertComponents(_ref) {
|
|
6
|
+
var api = _ref.api;
|
|
7
|
+
return [{
|
|
8
|
+
key: LOOM_MENU_ITEM.key,
|
|
9
|
+
type: LOOM_MENU_ITEM.type,
|
|
10
|
+
parents: [{
|
|
11
|
+
key: MEDIA_SECTION.key,
|
|
12
|
+
type: MEDIA_SECTION.type,
|
|
13
|
+
rank: MEDIA_SECTION_RANK[LOOM_MENU_ITEM.key]
|
|
14
|
+
}],
|
|
15
|
+
component: function component() {
|
|
16
|
+
return /*#__PURE__*/React.createElement(LoomQuickInsertMenuItem, {
|
|
17
|
+
api: api
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}];
|
|
21
|
+
};
|
|
@@ -2,12 +2,13 @@ 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
|
+
import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity/connectivityPluginType';
|
|
6
6
|
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
7
7
|
import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
8
8
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
9
9
|
import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
|
|
10
10
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
11
|
+
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry/ui-control-registry-plugin-type';
|
|
11
12
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
12
13
|
import type { LoomPluginState } from './pm-plugins/main';
|
|
13
14
|
import type { LoomPluginOptions, LoomProviderOptions, PositionType, VideoMeta } from './types';
|
|
@@ -43,7 +44,8 @@ export type LoomPlugin = NextEditorPlugin<'loom', {
|
|
|
43
44
|
OptionalPlugin<QuickInsertPlugin>,
|
|
44
45
|
OptionalPlugin<ConnectivityPlugin>,
|
|
45
46
|
OptionalPlugin<ToolbarPlugin>,
|
|
46
|
-
OptionalPlugin<EditorViewModePlugin
|
|
47
|
+
OptionalPlugin<EditorViewModePlugin>,
|
|
48
|
+
OptionalPlugin<UiControlRegistryPlugin>
|
|
47
49
|
];
|
|
48
50
|
pluginConfiguration: LoomPluginOptions;
|
|
49
51
|
sharedState: LoomPluginState | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { LoomPlugin } from '../../loomPluginType';
|
|
4
|
+
export declare const LoomQuickInsertMenuItem: ({ api, }: {
|
|
5
|
+
api: ExtractInjectionAPI<LoomPlugin> | undefined;
|
|
6
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { RegisterMenuItem } from '@atlaskit/editor-ui-control-model/types';
|
|
3
|
+
import type { LoomPlugin } from '../../loomPluginType';
|
|
4
|
+
export declare const getLoomQuickInsertComponents: ({ api, }: {
|
|
5
|
+
api: ExtractInjectionAPI<LoomPlugin> | undefined;
|
|
6
|
+
}) => RegisterMenuItem[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-loom",
|
|
3
|
-
"version": "15.0.
|
|
3
|
+
"version": "15.0.1",
|
|
4
4
|
"description": "Loom plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,12 +30,15 @@
|
|
|
30
30
|
"@atlaskit/editor-plugin-editor-viewmode": "^15.0.0",
|
|
31
31
|
"@atlaskit/editor-plugin-hyperlink": "^15.0.0",
|
|
32
32
|
"@atlaskit/editor-plugin-primary-toolbar": "^14.0.0",
|
|
33
|
-
"@atlaskit/editor-plugin-quick-insert": "^13.
|
|
33
|
+
"@atlaskit/editor-plugin-quick-insert": "^13.1.0",
|
|
34
34
|
"@atlaskit/editor-plugin-toolbar": "^10.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^7.0.0",
|
|
35
36
|
"@atlaskit/editor-plugin-width": "^14.0.0",
|
|
36
37
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
37
38
|
"@atlaskit/editor-toolbar": "^2.4.0",
|
|
38
|
-
"@atlaskit/
|
|
39
|
+
"@atlaskit/editor-ui-control-model": "^2.4.0",
|
|
40
|
+
"@atlaskit/icon": "^37.3.0",
|
|
41
|
+
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
39
42
|
"@atlaskit/platform-feature-flags": "^2.1.0",
|
|
40
43
|
"@atlaskit/tokens": "^16.3.0",
|
|
41
44
|
"@babel/runtime": "^7.0.0",
|
|
@@ -43,7 +46,7 @@
|
|
|
43
46
|
"@loomhq/record-sdk": "^4.12.4"
|
|
44
47
|
},
|
|
45
48
|
"peerDependencies": {
|
|
46
|
-
"@atlaskit/editor-common": "^117.
|
|
49
|
+
"@atlaskit/editor-common": "^117.2.0",
|
|
47
50
|
"react": "^18.2.0 || ^19.2.0",
|
|
48
51
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
49
52
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|