@atlaskit/editor-plugin-loom 1.0.2 → 2.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 +16 -0
- package/dist/cjs/plugin.js +6 -2
- package/dist/cjs/pm-plugin.js +41 -75
- package/dist/cjs/types.js +1 -0
- package/dist/cjs/ui/ToolbarButton.js +5 -4
- package/dist/es2019/plugin.js +5 -1
- package/dist/es2019/pm-plugin.js +32 -45
- package/dist/es2019/types.js +0 -0
- package/dist/es2019/ui/ToolbarButton.js +5 -4
- package/dist/esm/plugin.js +6 -2
- package/dist/esm/pm-plugin.js +41 -70
- package/dist/esm/types.js +0 -0
- package/dist/esm/ui/ToolbarButton.js +5 -4
- package/dist/types/commands.d.ts +4 -3
- package/dist/types/index.d.ts +1 -0
- package/dist/types/plugin.d.ts +2 -0
- package/dist/types/pm-plugin.d.ts +5 -1
- package/dist/types/types.d.ts +27 -0
- package/dist/types/ui/ToolbarButton.d.ts +4 -2
- package/dist/types-ts4.5/commands.d.ts +4 -3
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/plugin.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugin.d.ts +5 -1
- package/dist/types-ts4.5/types.d.ts +27 -0
- package/dist/types-ts4.5/ui/ToolbarButton.d.ts +4 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-loom
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#90526](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/90526) [`2f75eb73984f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2f75eb73984f) - [ux] Update toolbar icon to Loom
|
|
8
|
+
|
|
9
|
+
## 2.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- [#85470](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/85470) [`32cb4d4ca34f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/32cb4d4ca34f) - Update loom plugin to take in interface and remove SDK references
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 1.0.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -15,7 +15,8 @@ var _pmPlugin = require("./pm-plugin");
|
|
|
15
15
|
var _ToolbarButton = _interopRequireDefault(require("./ui/ToolbarButton"));
|
|
16
16
|
var loomPlugin = exports.loomPlugin = function loomPlugin(_ref) {
|
|
17
17
|
var _api$analytics;
|
|
18
|
-
var
|
|
18
|
+
var config = _ref.config,
|
|
19
|
+
api = _ref.api;
|
|
19
20
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
20
21
|
return {
|
|
21
22
|
name: 'loom',
|
|
@@ -23,7 +24,10 @@ var loomPlugin = exports.loomPlugin = function loomPlugin(_ref) {
|
|
|
23
24
|
return [{
|
|
24
25
|
name: 'loom',
|
|
25
26
|
plugin: function plugin() {
|
|
26
|
-
return (0, _pmPlugin.createPlugin)(
|
|
27
|
+
return (0, _pmPlugin.createPlugin)({
|
|
28
|
+
config: config,
|
|
29
|
+
api: api
|
|
30
|
+
});
|
|
27
31
|
}
|
|
28
32
|
}];
|
|
29
33
|
},
|
package/dist/cjs/pm-plugin.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -14,8 +13,6 @@ var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
|
14
13
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
15
14
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
15
|
var _commands = require("./commands");
|
|
17
|
-
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); }
|
|
18
|
-
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 && Object.prototype.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; }
|
|
19
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
18
|
var LoomPluginAction = exports.LoomPluginAction = /*#__PURE__*/function (LoomPluginAction) {
|
|
@@ -26,9 +23,10 @@ var LoomPluginAction = exports.LoomPluginAction = /*#__PURE__*/function (LoomPlu
|
|
|
26
23
|
return LoomPluginAction;
|
|
27
24
|
}({});
|
|
28
25
|
var loomPluginKey = exports.loomPluginKey = new _state.PluginKey('loom');
|
|
29
|
-
var
|
|
30
|
-
var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
26
|
+
var createPlugin = exports.createPlugin = function createPlugin(_ref) {
|
|
31
27
|
var _api$analytics;
|
|
28
|
+
var config = _ref.config,
|
|
29
|
+
api = _ref.api;
|
|
32
30
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
33
31
|
return new _safePlugin.SafePlugin({
|
|
34
32
|
key: loomPluginKey,
|
|
@@ -77,89 +75,55 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
77
75
|
},
|
|
78
76
|
view: function view(editorView) {
|
|
79
77
|
var setupLoom = /*#__PURE__*/function () {
|
|
80
|
-
var
|
|
78
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
81
79
|
var _api$core3, _api$analytics3;
|
|
82
|
-
var
|
|
83
|
-
return _regenerator.default.wrap(function
|
|
84
|
-
while (1) switch (
|
|
80
|
+
var clientResult, _api$core, _api$analytics2, attachToButton, loomButton;
|
|
81
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
82
|
+
while (1) switch (_context.prev = _context.next) {
|
|
85
83
|
case 0:
|
|
86
|
-
|
|
87
|
-
return
|
|
88
|
-
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-loom-sdk" */'@loomhq/record-sdk'));
|
|
89
|
-
});
|
|
84
|
+
_context.next = 2;
|
|
85
|
+
return config.loomProvider.getClient();
|
|
90
86
|
case 2:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
_context2.next = 7;
|
|
95
|
-
return isSupported();
|
|
96
|
-
case 7:
|
|
97
|
-
_yield$isSupported = _context2.sent;
|
|
98
|
-
supported = _yield$isSupported.supported;
|
|
99
|
-
error = _yield$isSupported.error;
|
|
100
|
-
if (supported) {
|
|
101
|
-
_context2.next = 15;
|
|
87
|
+
clientResult = _context.sent;
|
|
88
|
+
if (!(clientResult.status === 'error')) {
|
|
89
|
+
_context.next = 8;
|
|
102
90
|
break;
|
|
103
91
|
}
|
|
104
|
-
// Keep plugin state update and analytics separate to avoid accidentally not updating
|
|
105
|
-
// plugin state due to collab-edit filtering out transactions with steps
|
|
106
92
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute((0, _commands.disableLoom)({
|
|
107
|
-
error:
|
|
93
|
+
error: clientResult.message
|
|
108
94
|
}));
|
|
109
|
-
(0, _monitoring.logException)(new Error(
|
|
95
|
+
(0, _monitoring.logException)(new Error(clientResult.message), {
|
|
110
96
|
location: 'editor-plugin-loom/sdk-initialisation'
|
|
111
97
|
});
|
|
112
|
-
// We're not combining the analytics steps into the enable / disable commands because the collab-edit plugin
|
|
113
|
-
// filters out any transactions with steps (even analytics) when it's initialising
|
|
114
98
|
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.fireAnalyticsEvent({
|
|
115
99
|
action: _analytics.ACTION.ERRORED,
|
|
116
100
|
actionSubject: _analytics.ACTION_SUBJECT.LOOM,
|
|
117
101
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
118
102
|
attributes: {
|
|
119
|
-
error:
|
|
103
|
+
error: clientResult.message
|
|
120
104
|
}
|
|
121
105
|
});
|
|
122
|
-
return
|
|
123
|
-
case
|
|
124
|
-
|
|
125
|
-
return setup({
|
|
126
|
-
publicAppId: LOOM_SDK_PUBLIC_APP_ID
|
|
127
|
-
});
|
|
128
|
-
case 17:
|
|
129
|
-
_yield$setup = _context2.sent;
|
|
130
|
-
configureButton = _yield$setup.configureButton;
|
|
131
|
-
// Hidden element to work around the SDK API
|
|
106
|
+
return _context.abrupt("return");
|
|
107
|
+
case 8:
|
|
108
|
+
attachToButton = clientResult.client.attachToButton; // Hidden element to work around the SDK API
|
|
132
109
|
loomButton = document.createElement('button');
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
sdkButton.on('insert-click', /*#__PURE__*/function () {
|
|
137
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(video) {
|
|
110
|
+
attachToButton({
|
|
111
|
+
button: loomButton,
|
|
112
|
+
onInsert: function onInsert(video) {
|
|
138
113
|
var _api$hyperlink, _api$core2;
|
|
139
|
-
var state
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}));
|
|
153
|
-
case 4:
|
|
154
|
-
case "end":
|
|
155
|
-
return _context.stop();
|
|
156
|
-
}
|
|
157
|
-
}, _callee);
|
|
158
|
-
}));
|
|
159
|
-
return function (_x) {
|
|
160
|
-
return _ref2.apply(this, arguments);
|
|
161
|
-
};
|
|
162
|
-
}());
|
|
114
|
+
var state = editorView.state,
|
|
115
|
+
dispatch = editorView.dispatch;
|
|
116
|
+
var pos = editorView.state.selection.from;
|
|
117
|
+
api === null || api === void 0 || (_api$hyperlink = api.hyperlink) === null || _api$hyperlink === void 0 || _api$hyperlink.actions.insertLink(_analytics.INPUT_METHOD.TYPEAHEAD, pos,
|
|
118
|
+
// from === to, don't replace text to avoid accidental content loss
|
|
119
|
+
pos, video.sharedUrl, video.title, undefined, undefined, undefined, 'embed' // Convert to embed card instead of inline
|
|
120
|
+
)(state, dispatch);
|
|
121
|
+
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute((0, _commands.insertVideo)({
|
|
122
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
123
|
+
video: video
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
});
|
|
163
127
|
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute((0, _commands.enableLoom)({
|
|
164
128
|
loomButton: loomButton
|
|
165
129
|
}));
|
|
@@ -170,17 +134,19 @@ var createPlugin = exports.createPlugin = function createPlugin(api) {
|
|
|
170
134
|
actionSubject: _analytics.ACTION_SUBJECT.LOOM,
|
|
171
135
|
eventType: _analytics.EVENT_TYPE.OPERATIONAL
|
|
172
136
|
});
|
|
173
|
-
case
|
|
137
|
+
case 13:
|
|
174
138
|
case "end":
|
|
175
|
-
return
|
|
139
|
+
return _context.stop();
|
|
176
140
|
}
|
|
177
|
-
},
|
|
141
|
+
}, _callee);
|
|
178
142
|
}));
|
|
179
143
|
return function setupLoom() {
|
|
180
|
-
return
|
|
144
|
+
return _ref2.apply(this, arguments);
|
|
181
145
|
};
|
|
182
146
|
}();
|
|
183
|
-
|
|
147
|
+
if (config) {
|
|
148
|
+
setupLoom();
|
|
149
|
+
}
|
|
184
150
|
return {};
|
|
185
151
|
}
|
|
186
152
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -11,7 +11,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
|
|
|
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
|
|
14
|
+
var _logo = require("@atlaskit/logo");
|
|
15
15
|
var _commands = require("../commands");
|
|
16
16
|
var LoomToolbarButton = function LoomToolbarButton(_ref) {
|
|
17
17
|
var disabled = _ref.disabled,
|
|
@@ -22,7 +22,7 @@ var LoomToolbarButton = function LoomToolbarButton(_ref) {
|
|
|
22
22
|
if (!loomState) {
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
|
-
var label = formatMessage(_messages.toolbarInsertBlockMessages.
|
|
25
|
+
var label = formatMessage(_messages.toolbarInsertBlockMessages.addLoomVideo);
|
|
26
26
|
return /*#__PURE__*/_react.default.createElement(_uiMenu.ToolbarButton, {
|
|
27
27
|
buttonId: _uiMenu.TOOLBAR_BUTTON.RECORD_VIDEO,
|
|
28
28
|
onClick: function onClick() {
|
|
@@ -36,8 +36,9 @@ var LoomToolbarButton = function LoomToolbarButton(_ref) {
|
|
|
36
36
|
,
|
|
37
37
|
disabled: disabled || !(loomState !== null && loomState !== void 0 && loomState.isEnabled),
|
|
38
38
|
title: label,
|
|
39
|
-
iconBefore: /*#__PURE__*/_react.default.createElement(
|
|
40
|
-
label: label
|
|
39
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_logo.LoomIcon, {
|
|
40
|
+
label: label,
|
|
41
|
+
size: "small"
|
|
41
42
|
})
|
|
42
43
|
});
|
|
43
44
|
};
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -7,6 +7,7 @@ import { recordVideo, recordVideoFailed } from './commands';
|
|
|
7
7
|
import { createPlugin, loomPluginKey } from './pm-plugin';
|
|
8
8
|
import LoomToolbarButton from './ui/ToolbarButton';
|
|
9
9
|
export const loomPlugin = ({
|
|
10
|
+
config,
|
|
10
11
|
api
|
|
11
12
|
}) => {
|
|
12
13
|
var _api$analytics;
|
|
@@ -15,7 +16,10 @@ export const loomPlugin = ({
|
|
|
15
16
|
name: 'loom',
|
|
16
17
|
pmPlugins: () => [{
|
|
17
18
|
name: 'loom',
|
|
18
|
-
plugin: () => createPlugin(
|
|
19
|
+
plugin: () => createPlugin({
|
|
20
|
+
config,
|
|
21
|
+
api
|
|
22
|
+
})
|
|
19
23
|
}],
|
|
20
24
|
getSharedState(editorState) {
|
|
21
25
|
if (!editorState) {
|
package/dist/es2019/pm-plugin.js
CHANGED
|
@@ -11,8 +11,10 @@ export let LoomPluginAction = /*#__PURE__*/function (LoomPluginAction) {
|
|
|
11
11
|
return LoomPluginAction;
|
|
12
12
|
}({});
|
|
13
13
|
export const loomPluginKey = new PluginKey('loom');
|
|
14
|
-
const
|
|
15
|
-
|
|
14
|
+
export const createPlugin = ({
|
|
15
|
+
config,
|
|
16
|
+
api
|
|
17
|
+
}) => {
|
|
16
18
|
var _api$analytics;
|
|
17
19
|
const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
18
20
|
return new SafePlugin({
|
|
@@ -67,66 +69,49 @@ export const createPlugin = api => {
|
|
|
67
69
|
view(editorView) {
|
|
68
70
|
const setupLoom = async () => {
|
|
69
71
|
var _api$core3, _api$analytics3;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const {
|
|
73
|
-
isSupported,
|
|
74
|
-
setup
|
|
75
|
-
} = await import( /* webpackChunkName: "@atlaskit-internal_editor-loom-sdk" */'@loomhq/record-sdk');
|
|
76
|
-
const {
|
|
77
|
-
supported,
|
|
78
|
-
error
|
|
79
|
-
} = await isSupported();
|
|
80
|
-
if (!supported) {
|
|
72
|
+
const clientResult = await config.loomProvider.getClient();
|
|
73
|
+
if (clientResult.status === 'error') {
|
|
81
74
|
var _api$core, _api$analytics2;
|
|
82
|
-
// Keep plugin state update and analytics separate to avoid accidentally not updating
|
|
83
|
-
// plugin state due to collab-edit filtering out transactions with steps
|
|
84
75
|
api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(disableLoom({
|
|
85
|
-
error
|
|
76
|
+
error: clientResult.message
|
|
86
77
|
}));
|
|
87
|
-
logException(new Error(
|
|
78
|
+
logException(new Error(clientResult.message), {
|
|
88
79
|
location: 'editor-plugin-loom/sdk-initialisation'
|
|
89
80
|
});
|
|
90
|
-
// We're not combining the analytics steps into the enable / disable commands because the collab-edit plugin
|
|
91
|
-
// filters out any transactions with steps (even analytics) when it's initialising
|
|
92
81
|
api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions.fireAnalyticsEvent({
|
|
93
82
|
action: ACTION.ERRORED,
|
|
94
83
|
actionSubject: ACTION_SUBJECT.LOOM,
|
|
95
84
|
eventType: EVENT_TYPE.OPERATIONAL,
|
|
96
85
|
attributes: {
|
|
97
|
-
error
|
|
86
|
+
error: clientResult.message
|
|
98
87
|
}
|
|
99
88
|
});
|
|
100
89
|
return;
|
|
101
90
|
}
|
|
102
91
|
const {
|
|
103
|
-
|
|
104
|
-
} =
|
|
105
|
-
publicAppId: LOOM_SDK_PUBLIC_APP_ID
|
|
106
|
-
});
|
|
92
|
+
attachToButton
|
|
93
|
+
} = clientResult.client;
|
|
107
94
|
|
|
108
95
|
// Hidden element to work around the SDK API
|
|
109
96
|
const loomButton = document.createElement('button');
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
state
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
video
|
|
129
|
-
}));
|
|
97
|
+
attachToButton({
|
|
98
|
+
button: loomButton,
|
|
99
|
+
onInsert: video => {
|
|
100
|
+
var _api$hyperlink, _api$core2;
|
|
101
|
+
const {
|
|
102
|
+
state,
|
|
103
|
+
dispatch
|
|
104
|
+
} = editorView;
|
|
105
|
+
const pos = editorView.state.selection.from;
|
|
106
|
+
api === null || api === void 0 ? void 0 : (_api$hyperlink = api.hyperlink) === null || _api$hyperlink === void 0 ? void 0 : _api$hyperlink.actions.insertLink(INPUT_METHOD.TYPEAHEAD, pos,
|
|
107
|
+
// from === to, don't replace text to avoid accidental content loss
|
|
108
|
+
pos, video.sharedUrl, video.title, undefined, undefined, undefined, 'embed' // Convert to embed card instead of inline
|
|
109
|
+
)(state, dispatch);
|
|
110
|
+
api === null || api === void 0 ? void 0 : (_api$core2 = api.core) === null || _api$core2 === void 0 ? void 0 : _api$core2.actions.execute(insertVideo({
|
|
111
|
+
editorAnalyticsAPI,
|
|
112
|
+
video
|
|
113
|
+
}));
|
|
114
|
+
}
|
|
130
115
|
});
|
|
131
116
|
api === null || api === void 0 ? void 0 : (_api$core3 = api.core) === null || _api$core3 === void 0 ? void 0 : _api$core3.actions.execute(enableLoom({
|
|
132
117
|
loomButton
|
|
@@ -139,7 +124,9 @@ export const createPlugin = api => {
|
|
|
139
124
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
140
125
|
});
|
|
141
126
|
};
|
|
142
|
-
|
|
127
|
+
if (config) {
|
|
128
|
+
setupLoom();
|
|
129
|
+
}
|
|
143
130
|
return {};
|
|
144
131
|
}
|
|
145
132
|
});
|
|
File without changes
|
|
@@ -4,7 +4,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
7
|
-
import
|
|
7
|
+
import { LoomIcon } from '@atlaskit/logo';
|
|
8
8
|
import { recordVideo } from '../commands';
|
|
9
9
|
const LoomToolbarButton = ({
|
|
10
10
|
disabled,
|
|
@@ -19,7 +19,7 @@ const LoomToolbarButton = ({
|
|
|
19
19
|
if (!loomState) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
const label = formatMessage(toolbarInsertBlockMessages.
|
|
22
|
+
const label = formatMessage(toolbarInsertBlockMessages.addLoomVideo);
|
|
23
23
|
return /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
24
24
|
buttonId: TOOLBAR_BUTTON.RECORD_VIDEO,
|
|
25
25
|
onClick: () => {
|
|
@@ -33,8 +33,9 @@ const LoomToolbarButton = ({
|
|
|
33
33
|
,
|
|
34
34
|
disabled: disabled || !(loomState !== null && loomState !== void 0 && loomState.isEnabled),
|
|
35
35
|
title: label,
|
|
36
|
-
iconBefore: /*#__PURE__*/React.createElement(
|
|
37
|
-
label: label
|
|
36
|
+
iconBefore: /*#__PURE__*/React.createElement(LoomIcon, {
|
|
37
|
+
label: label,
|
|
38
|
+
size: "small"
|
|
38
39
|
})
|
|
39
40
|
});
|
|
40
41
|
};
|
package/dist/esm/plugin.js
CHANGED
|
@@ -8,7 +8,8 @@ import { createPlugin, loomPluginKey } from './pm-plugin';
|
|
|
8
8
|
import LoomToolbarButton from './ui/ToolbarButton';
|
|
9
9
|
export var loomPlugin = function loomPlugin(_ref) {
|
|
10
10
|
var _api$analytics;
|
|
11
|
-
var
|
|
11
|
+
var config = _ref.config,
|
|
12
|
+
api = _ref.api;
|
|
12
13
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
13
14
|
return {
|
|
14
15
|
name: 'loom',
|
|
@@ -16,7 +17,10 @@ export var loomPlugin = function loomPlugin(_ref) {
|
|
|
16
17
|
return [{
|
|
17
18
|
name: 'loom',
|
|
18
19
|
plugin: function plugin() {
|
|
19
|
-
return createPlugin(
|
|
20
|
+
return createPlugin({
|
|
21
|
+
config: config,
|
|
22
|
+
api: api
|
|
23
|
+
});
|
|
20
24
|
}
|
|
21
25
|
}];
|
|
22
26
|
},
|
package/dist/esm/pm-plugin.js
CHANGED
|
@@ -16,9 +16,10 @@ export var LoomPluginAction = /*#__PURE__*/function (LoomPluginAction) {
|
|
|
16
16
|
return LoomPluginAction;
|
|
17
17
|
}({});
|
|
18
18
|
export var loomPluginKey = new PluginKey('loom');
|
|
19
|
-
var
|
|
20
|
-
export var createPlugin = function createPlugin(api) {
|
|
19
|
+
export var createPlugin = function createPlugin(_ref) {
|
|
21
20
|
var _api$analytics;
|
|
21
|
+
var config = _ref.config,
|
|
22
|
+
api = _ref.api;
|
|
22
23
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
23
24
|
return new SafePlugin({
|
|
24
25
|
key: loomPluginKey,
|
|
@@ -67,87 +68,55 @@ export var createPlugin = function createPlugin(api) {
|
|
|
67
68
|
},
|
|
68
69
|
view: function view(editorView) {
|
|
69
70
|
var setupLoom = /*#__PURE__*/function () {
|
|
70
|
-
var
|
|
71
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
71
72
|
var _api$core3, _api$analytics3;
|
|
72
|
-
var
|
|
73
|
-
return _regeneratorRuntime.wrap(function
|
|
74
|
-
while (1) switch (
|
|
73
|
+
var clientResult, _api$core, _api$analytics2, attachToButton, loomButton;
|
|
74
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
75
|
+
while (1) switch (_context.prev = _context.next) {
|
|
75
76
|
case 0:
|
|
76
|
-
|
|
77
|
-
return
|
|
77
|
+
_context.next = 2;
|
|
78
|
+
return config.loomProvider.getClient();
|
|
78
79
|
case 2:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
_context2.next = 7;
|
|
83
|
-
return isSupported();
|
|
84
|
-
case 7:
|
|
85
|
-
_yield$isSupported = _context2.sent;
|
|
86
|
-
supported = _yield$isSupported.supported;
|
|
87
|
-
error = _yield$isSupported.error;
|
|
88
|
-
if (supported) {
|
|
89
|
-
_context2.next = 15;
|
|
80
|
+
clientResult = _context.sent;
|
|
81
|
+
if (!(clientResult.status === 'error')) {
|
|
82
|
+
_context.next = 8;
|
|
90
83
|
break;
|
|
91
84
|
}
|
|
92
|
-
// Keep plugin state update and analytics separate to avoid accidentally not updating
|
|
93
|
-
// plugin state due to collab-edit filtering out transactions with steps
|
|
94
85
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(disableLoom({
|
|
95
|
-
error:
|
|
86
|
+
error: clientResult.message
|
|
96
87
|
}));
|
|
97
|
-
logException(new Error(
|
|
88
|
+
logException(new Error(clientResult.message), {
|
|
98
89
|
location: 'editor-plugin-loom/sdk-initialisation'
|
|
99
90
|
});
|
|
100
|
-
// We're not combining the analytics steps into the enable / disable commands because the collab-edit plugin
|
|
101
|
-
// filters out any transactions with steps (even analytics) when it's initialising
|
|
102
91
|
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || _api$analytics2.actions.fireAnalyticsEvent({
|
|
103
92
|
action: ACTION.ERRORED,
|
|
104
93
|
actionSubject: ACTION_SUBJECT.LOOM,
|
|
105
94
|
eventType: EVENT_TYPE.OPERATIONAL,
|
|
106
95
|
attributes: {
|
|
107
|
-
error:
|
|
96
|
+
error: clientResult.message
|
|
108
97
|
}
|
|
109
98
|
});
|
|
110
|
-
return
|
|
111
|
-
case
|
|
112
|
-
|
|
113
|
-
return setup({
|
|
114
|
-
publicAppId: LOOM_SDK_PUBLIC_APP_ID
|
|
115
|
-
});
|
|
116
|
-
case 17:
|
|
117
|
-
_yield$setup = _context2.sent;
|
|
118
|
-
configureButton = _yield$setup.configureButton;
|
|
119
|
-
// Hidden element to work around the SDK API
|
|
99
|
+
return _context.abrupt("return");
|
|
100
|
+
case 8:
|
|
101
|
+
attachToButton = clientResult.client.attachToButton; // Hidden element to work around the SDK API
|
|
120
102
|
loomButton = document.createElement('button');
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
sdkButton.on('insert-click', /*#__PURE__*/function () {
|
|
125
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(video) {
|
|
103
|
+
attachToButton({
|
|
104
|
+
button: loomButton,
|
|
105
|
+
onInsert: function onInsert(video) {
|
|
126
106
|
var _api$hyperlink, _api$core2;
|
|
127
|
-
var state
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}));
|
|
141
|
-
case 4:
|
|
142
|
-
case "end":
|
|
143
|
-
return _context.stop();
|
|
144
|
-
}
|
|
145
|
-
}, _callee);
|
|
146
|
-
}));
|
|
147
|
-
return function (_x) {
|
|
148
|
-
return _ref2.apply(this, arguments);
|
|
149
|
-
};
|
|
150
|
-
}());
|
|
107
|
+
var state = editorView.state,
|
|
108
|
+
dispatch = editorView.dispatch;
|
|
109
|
+
var pos = editorView.state.selection.from;
|
|
110
|
+
api === null || api === void 0 || (_api$hyperlink = api.hyperlink) === null || _api$hyperlink === void 0 || _api$hyperlink.actions.insertLink(INPUT_METHOD.TYPEAHEAD, pos,
|
|
111
|
+
// from === to, don't replace text to avoid accidental content loss
|
|
112
|
+
pos, video.sharedUrl, video.title, undefined, undefined, undefined, 'embed' // Convert to embed card instead of inline
|
|
113
|
+
)(state, dispatch);
|
|
114
|
+
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(insertVideo({
|
|
115
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
116
|
+
video: video
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
});
|
|
151
120
|
api === null || api === void 0 || (_api$core3 = api.core) === null || _api$core3 === void 0 || _api$core3.actions.execute(enableLoom({
|
|
152
121
|
loomButton: loomButton
|
|
153
122
|
}));
|
|
@@ -158,17 +127,19 @@ export var createPlugin = function createPlugin(api) {
|
|
|
158
127
|
actionSubject: ACTION_SUBJECT.LOOM,
|
|
159
128
|
eventType: EVENT_TYPE.OPERATIONAL
|
|
160
129
|
});
|
|
161
|
-
case
|
|
130
|
+
case 13:
|
|
162
131
|
case "end":
|
|
163
|
-
return
|
|
132
|
+
return _context.stop();
|
|
164
133
|
}
|
|
165
|
-
},
|
|
134
|
+
}, _callee);
|
|
166
135
|
}));
|
|
167
136
|
return function setupLoom() {
|
|
168
|
-
return
|
|
137
|
+
return _ref2.apply(this, arguments);
|
|
169
138
|
};
|
|
170
139
|
}();
|
|
171
|
-
|
|
140
|
+
if (config) {
|
|
141
|
+
setupLoom();
|
|
142
|
+
}
|
|
172
143
|
return {};
|
|
173
144
|
}
|
|
174
145
|
});
|
|
File without changes
|
|
@@ -4,7 +4,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { toolbarInsertBlockMessages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { TOOLBAR_BUTTON, ToolbarButton } from '@atlaskit/editor-common/ui-menu';
|
|
7
|
-
import
|
|
7
|
+
import { LoomIcon } from '@atlaskit/logo';
|
|
8
8
|
import { recordVideo } from '../commands';
|
|
9
9
|
var LoomToolbarButton = function LoomToolbarButton(_ref) {
|
|
10
10
|
var disabled = _ref.disabled,
|
|
@@ -15,7 +15,7 @@ var LoomToolbarButton = function LoomToolbarButton(_ref) {
|
|
|
15
15
|
if (!loomState) {
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
|
-
var label = formatMessage(toolbarInsertBlockMessages.
|
|
18
|
+
var label = formatMessage(toolbarInsertBlockMessages.addLoomVideo);
|
|
19
19
|
return /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
20
20
|
buttonId: TOOLBAR_BUTTON.RECORD_VIDEO,
|
|
21
21
|
onClick: function onClick() {
|
|
@@ -29,8 +29,9 @@ var LoomToolbarButton = function LoomToolbarButton(_ref) {
|
|
|
29
29
|
,
|
|
30
30
|
disabled: disabled || !(loomState !== null && loomState !== void 0 && loomState.isEnabled),
|
|
31
31
|
title: label,
|
|
32
|
-
iconBefore: /*#__PURE__*/React.createElement(
|
|
33
|
-
label: label
|
|
32
|
+
iconBefore: /*#__PURE__*/React.createElement(LoomIcon, {
|
|
33
|
+
label: label,
|
|
34
|
+
size: "small"
|
|
34
35
|
})
|
|
35
36
|
});
|
|
36
37
|
};
|
package/dist/types/commands.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SDKUnsupportedReasons } from '@loomhq/record-sdk';
|
|
2
2
|
import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { VideoMeta } from './types';
|
|
4
5
|
export declare const enableLoom: ({ loomButton }: {
|
|
5
6
|
loomButton: HTMLButtonElement;
|
|
6
7
|
}) => EditorCommand;
|
|
7
8
|
export declare const disableLoom: ({ error }: {
|
|
8
|
-
error:
|
|
9
|
+
error: string;
|
|
9
10
|
}) => EditorCommand;
|
|
10
11
|
export declare const recordVideo: ({ inputMethod, editorAnalyticsAPI, }: {
|
|
11
12
|
inputMethod: INPUT_METHOD;
|
|
@@ -18,5 +19,5 @@ export declare const recordVideoFailed: ({ inputMethod, error, editorAnalyticsAP
|
|
|
18
19
|
}) => EditorCommand;
|
|
19
20
|
export declare const insertVideo: ({ editorAnalyticsAPI, video, }: {
|
|
20
21
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
21
|
-
video:
|
|
22
|
+
video: VideoMeta;
|
|
22
23
|
}) => EditorCommand;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { loomPlugin } from './plugin';
|
|
2
2
|
export type { LoomPlugin } from './plugin';
|
|
3
3
|
export type { LoomPluginState } from './pm-plugin';
|
|
4
|
+
export type { LoomPluginOptions, VideoMeta, GetClient, GetClientResult, LoomPluginErrorMessages, LoomSDKErrorMessages, } from './types';
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
|
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
4
4
|
import type { LoomPluginState } from './pm-plugin';
|
|
5
|
+
import type { LoomPluginOptions } from './types';
|
|
5
6
|
export type LoomPlugin = NextEditorPlugin<'loom', {
|
|
7
|
+
pluginConfiguration: LoomPluginOptions;
|
|
6
8
|
dependencies: [
|
|
7
9
|
OptionalPlugin<AnalyticsPlugin>,
|
|
8
10
|
HyperlinkPlugin
|
|
@@ -3,6 +3,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { LoomPlugin } from './plugin';
|
|
6
|
+
import type { LoomPluginOptions } from './types';
|
|
6
7
|
export interface LoomPluginState {
|
|
7
8
|
isEnabled: boolean;
|
|
8
9
|
loomButton: HTMLButtonElement | null;
|
|
@@ -16,4 +17,7 @@ export declare enum LoomPluginAction {
|
|
|
16
17
|
INSERT_VIDEO = 3
|
|
17
18
|
}
|
|
18
19
|
export declare const loomPluginKey: PluginKey<LoomPluginState>;
|
|
19
|
-
export declare const createPlugin: (
|
|
20
|
+
export declare const createPlugin: ({ config, api, }: {
|
|
21
|
+
config: LoomPluginOptions;
|
|
22
|
+
api: ExtractInjectionAPI<LoomPlugin> | undefined;
|
|
23
|
+
}) => SafePlugin<LoomPluginState>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type VideoMeta = {
|
|
2
|
+
sharedUrl: string;
|
|
3
|
+
title: string;
|
|
4
|
+
duration?: number;
|
|
5
|
+
};
|
|
6
|
+
type LoomClient = {
|
|
7
|
+
attachToButton: (options: {
|
|
8
|
+
button: HTMLElement;
|
|
9
|
+
onInsert: (videoMeta: VideoMeta) => void;
|
|
10
|
+
}) => void;
|
|
11
|
+
};
|
|
12
|
+
export type LoomPluginErrorMessages = 'is-supported-failure' | 'failed-to-initialise' | 'api-key-not-provided';
|
|
13
|
+
export type LoomSDKErrorMessages = 'incompatible-browser' | 'third-party-cookies-disabled' | 'no-media-streams-support';
|
|
14
|
+
export type GetClientResult = {
|
|
15
|
+
status: 'loaded';
|
|
16
|
+
client: LoomClient;
|
|
17
|
+
} | {
|
|
18
|
+
status: 'error';
|
|
19
|
+
message: LoomPluginErrorMessages | LoomSDKErrorMessages;
|
|
20
|
+
};
|
|
21
|
+
export type GetClient = Promise<GetClientResult>;
|
|
22
|
+
export type LoomPluginOptions = {
|
|
23
|
+
loomProvider: {
|
|
24
|
+
getClient: () => GetClient;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -3,6 +3,7 @@ import type { WrappedComponentProps } from 'react-intl-next';
|
|
|
3
3
|
declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
|
|
4
4
|
disabled: boolean;
|
|
5
5
|
api: import("@atlaskit/editor-common/types").PublicPluginAPI<[import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"loom", {
|
|
6
|
+
pluginConfiguration: import("..").LoomPluginOptions;
|
|
6
7
|
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
7
8
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
8
9
|
sharedState: {
|
|
@@ -42,7 +43,7 @@ declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
|
|
|
42
43
|
sharedState: import("@atlaskit/editor-common/link").HyperlinkState | undefined;
|
|
43
44
|
}, import("@atlaskit/editor-common/types").HyperlinkPluginOptions | undefined>];
|
|
44
45
|
sharedState: import("..").LoomPluginState | undefined;
|
|
45
|
-
},
|
|
46
|
+
}, import("..").LoomPluginOptions>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
46
47
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
47
48
|
sharedState: {
|
|
48
49
|
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
@@ -84,6 +85,7 @@ declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
|
|
|
84
85
|
WrappedComponent: React.ComponentType<{
|
|
85
86
|
disabled: boolean;
|
|
86
87
|
api: import("@atlaskit/editor-common/types").PublicPluginAPI<[import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"loom", {
|
|
88
|
+
pluginConfiguration: import("..").LoomPluginOptions;
|
|
87
89
|
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
88
90
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
89
91
|
sharedState: {
|
|
@@ -123,7 +125,7 @@ declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
|
|
|
123
125
|
sharedState: import("@atlaskit/editor-common/link").HyperlinkState | undefined;
|
|
124
126
|
}, import("@atlaskit/editor-common/types").HyperlinkPluginOptions | undefined>];
|
|
125
127
|
sharedState: import("..").LoomPluginState | undefined;
|
|
126
|
-
},
|
|
128
|
+
}, import("..").LoomPluginOptions>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
127
129
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
128
130
|
sharedState: {
|
|
129
131
|
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SDKUnsupportedReasons } from '@loomhq/record-sdk';
|
|
2
2
|
import type { EditorAnalyticsAPI, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
4
|
+
import type { VideoMeta } from './types';
|
|
4
5
|
export declare const enableLoom: ({ loomButton }: {
|
|
5
6
|
loomButton: HTMLButtonElement;
|
|
6
7
|
}) => EditorCommand;
|
|
7
8
|
export declare const disableLoom: ({ error }: {
|
|
8
|
-
error:
|
|
9
|
+
error: string;
|
|
9
10
|
}) => EditorCommand;
|
|
10
11
|
export declare const recordVideo: ({ inputMethod, editorAnalyticsAPI, }: {
|
|
11
12
|
inputMethod: INPUT_METHOD;
|
|
@@ -18,5 +19,5 @@ export declare const recordVideoFailed: ({ inputMethod, error, editorAnalyticsAP
|
|
|
18
19
|
}) => EditorCommand;
|
|
19
20
|
export declare const insertVideo: ({ editorAnalyticsAPI, video, }: {
|
|
20
21
|
editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
|
|
21
|
-
video:
|
|
22
|
+
video: VideoMeta;
|
|
22
23
|
}) => EditorCommand;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { loomPlugin } from './plugin';
|
|
2
2
|
export type { LoomPlugin } from './plugin';
|
|
3
3
|
export type { LoomPluginState } from './pm-plugin';
|
|
4
|
+
export type { LoomPluginOptions, VideoMeta, GetClient, GetClientResult, LoomPluginErrorMessages, LoomSDKErrorMessages, } from './types';
|
|
@@ -2,7 +2,9 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
|
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { HyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
4
4
|
import type { LoomPluginState } from './pm-plugin';
|
|
5
|
+
import type { LoomPluginOptions } from './types';
|
|
5
6
|
export type LoomPlugin = NextEditorPlugin<'loom', {
|
|
7
|
+
pluginConfiguration: LoomPluginOptions;
|
|
6
8
|
dependencies: [
|
|
7
9
|
OptionalPlugin<AnalyticsPlugin>,
|
|
8
10
|
HyperlinkPlugin
|
|
@@ -3,6 +3,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
3
3
|
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
4
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { LoomPlugin } from './plugin';
|
|
6
|
+
import type { LoomPluginOptions } from './types';
|
|
6
7
|
export interface LoomPluginState {
|
|
7
8
|
isEnabled: boolean;
|
|
8
9
|
loomButton: HTMLButtonElement | null;
|
|
@@ -16,4 +17,7 @@ export declare enum LoomPluginAction {
|
|
|
16
17
|
INSERT_VIDEO = 3
|
|
17
18
|
}
|
|
18
19
|
export declare const loomPluginKey: PluginKey<LoomPluginState>;
|
|
19
|
-
export declare const createPlugin: (
|
|
20
|
+
export declare const createPlugin: ({ config, api, }: {
|
|
21
|
+
config: LoomPluginOptions;
|
|
22
|
+
api: ExtractInjectionAPI<LoomPlugin> | undefined;
|
|
23
|
+
}) => SafePlugin<LoomPluginState>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type VideoMeta = {
|
|
2
|
+
sharedUrl: string;
|
|
3
|
+
title: string;
|
|
4
|
+
duration?: number;
|
|
5
|
+
};
|
|
6
|
+
type LoomClient = {
|
|
7
|
+
attachToButton: (options: {
|
|
8
|
+
button: HTMLElement;
|
|
9
|
+
onInsert: (videoMeta: VideoMeta) => void;
|
|
10
|
+
}) => void;
|
|
11
|
+
};
|
|
12
|
+
export type LoomPluginErrorMessages = 'is-supported-failure' | 'failed-to-initialise' | 'api-key-not-provided';
|
|
13
|
+
export type LoomSDKErrorMessages = 'incompatible-browser' | 'third-party-cookies-disabled' | 'no-media-streams-support';
|
|
14
|
+
export type GetClientResult = {
|
|
15
|
+
status: 'loaded';
|
|
16
|
+
client: LoomClient;
|
|
17
|
+
} | {
|
|
18
|
+
status: 'error';
|
|
19
|
+
message: LoomPluginErrorMessages | LoomSDKErrorMessages;
|
|
20
|
+
};
|
|
21
|
+
export type GetClient = Promise<GetClientResult>;
|
|
22
|
+
export type LoomPluginOptions = {
|
|
23
|
+
loomProvider: {
|
|
24
|
+
getClient: () => GetClient;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -4,6 +4,7 @@ declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
|
|
|
4
4
|
disabled: boolean;
|
|
5
5
|
api: import("@atlaskit/editor-common/types").PublicPluginAPI<[
|
|
6
6
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"loom", {
|
|
7
|
+
pluginConfiguration: import("..").LoomPluginOptions;
|
|
7
8
|
dependencies: [
|
|
8
9
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
9
10
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
@@ -52,7 +53,7 @@ declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
|
|
|
52
53
|
}, import("@atlaskit/editor-common/types").HyperlinkPluginOptions | undefined>
|
|
53
54
|
];
|
|
54
55
|
sharedState: import("..").LoomPluginState | undefined;
|
|
55
|
-
},
|
|
56
|
+
}, import("..").LoomPluginOptions>,
|
|
56
57
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
57
58
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
58
59
|
sharedState: {
|
|
@@ -104,6 +105,7 @@ declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
|
|
|
104
105
|
disabled: boolean;
|
|
105
106
|
api: import("@atlaskit/editor-common/types").PublicPluginAPI<[
|
|
106
107
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"loom", {
|
|
108
|
+
pluginConfiguration: import("..").LoomPluginOptions;
|
|
107
109
|
dependencies: [
|
|
108
110
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
109
111
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
@@ -152,7 +154,7 @@ declare const _default: React.FC<import("react-intl-next").WithIntlProps<{
|
|
|
152
154
|
}, import("@atlaskit/editor-common/types").HyperlinkPluginOptions | undefined>
|
|
153
155
|
];
|
|
154
156
|
sharedState: import("..").LoomPluginState | undefined;
|
|
155
|
-
},
|
|
157
|
+
}, import("..").LoomPluginOptions>,
|
|
156
158
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
157
159
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
158
160
|
sharedState: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-loom",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Loom plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
".": "./src/index.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atlaskit/editor-common": "^78.
|
|
39
|
+
"@atlaskit/editor-common": "^78.26.0",
|
|
40
40
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
41
|
-
"@atlaskit/editor-plugin-hyperlink": "^1.
|
|
41
|
+
"@atlaskit/editor-plugin-hyperlink": "^1.4.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "3.0.0",
|
|
43
|
-
"@atlaskit/
|
|
43
|
+
"@atlaskit/logo": "^13.15.1",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
45
45
|
"@loomhq/record-sdk": "^2.36.18"
|
|
46
46
|
},
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@atlaskit/editor-plugin-base": "^1.0.0",
|
|
53
|
-
"@atlaskit/editor-plugin-card": "^1.
|
|
53
|
+
"@atlaskit/editor-plugin-card": "^1.6.0",
|
|
54
54
|
"@atlaskit/editor-plugin-copy-button": "^1.0.0",
|
|
55
55
|
"@atlaskit/editor-plugin-decorations": "^1.0.0",
|
|
56
56
|
"@atlaskit/editor-plugin-editor-disabled": "^1.0.0",
|