@atlaskit/editor-plugin-loom 3.0.1 → 3.0.2

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,14 @@
1
1
  # @atlaskit/editor-plugin-loom
2
2
 
3
+ ## 3.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#145206](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/145206)
8
+ [`cca8cc490ec20`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/cca8cc490ec20) -
9
+ [ED-25135] Fix: loom is not initialised correctly if `initLoom` is called when collab-edit plugin
10
+ is not ready
11
+
3
12
  ## 3.0.1
4
13
 
5
14
  ### Patch Changes
@@ -130,9 +130,9 @@ var executeRecordVideo = exports.executeRecordVideo = function executeRecordVide
130
130
  }));
131
131
  };
132
132
  var setupLoom = exports.setupLoom = /*#__PURE__*/function () {
133
- var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(loomProvider, api, editorView, isAfterEditorLoaded) {
134
- var _api$core4;
135
- var clientResult, _api$core2, _api$analytics2, attachToButton, loomButton, _api$analytics6;
133
+ var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(loomProvider, api, editorView, initViaCommand) {
134
+ var _api$core4, _api$analytics5;
135
+ var clientResult, _api$core2, _api$analytics2, attachToButton, loomButton;
136
136
  return _regenerator.default.wrap(function _callee$(_context) {
137
137
  while (1) switch (_context.prev = _context.next) {
138
138
  case 0:
@@ -191,28 +191,24 @@ var setupLoom = exports.setupLoom = /*#__PURE__*/function () {
191
191
  })({
192
192
  tr: tr
193
193
  });
194
- if (isAfterEditorLoaded) {
195
- var _api$quickInsert, _api$analytics4, _api$analytics5;
194
+ if (initViaCommand) {
195
+ var _api$quickInsert, _api$analytics4;
196
196
  api === null || api === void 0 || (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 || _api$quickInsert.commands.addQuickInsertItem((0, _quickInsert.getQuickInsertItem)(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions))({
197
197
  tr: tr
198
198
  });
199
- api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || _api$analytics5.actions.attachAnalyticsEvent({
200
- action: _analytics.ACTION.INITIALISED,
201
- actionSubject: _analytics.ACTION_SUBJECT.LOOM,
202
- eventType: _analytics.EVENT_TYPE.OPERATIONAL
203
- })(tr);
204
199
  }
205
200
  return tr;
206
201
  });
207
- if (!isAfterEditorLoaded) {
208
- // We're not combining the analytics steps into the enable / disable commands because the collab-edit plugin
209
- // filters out any transactions with steps (even analytics) when it's initialising
210
- api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 || _api$analytics6.actions.fireAnalyticsEvent({
211
- action: _analytics.ACTION.INITIALISED,
212
- actionSubject: _analytics.ACTION_SUBJECT.LOOM,
213
- eventType: _analytics.EVENT_TYPE.OPERATIONAL
214
- });
215
- }
202
+
203
+ // We're not combining the analytics steps into the enable / disable commands because the collab-edit plugin
204
+ // filters out any transactions with steps (even analytics) when it's initialising.
205
+ // Even if `initViaCommand` is true, collab-edit might not be ready depending on when `initLoom` is called,
206
+ // hence the analytics step is added separately in both cases
207
+ api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || _api$analytics5.actions.fireAnalyticsEvent({
208
+ action: _analytics.ACTION.INITIALISED,
209
+ actionSubject: _analytics.ACTION_SUBJECT.LOOM,
210
+ eventType: _analytics.EVENT_TYPE.OPERATIONAL
211
+ });
216
212
  return _context.abrupt("return", {});
217
213
  case 14:
218
214
  case "end":
@@ -123,8 +123,8 @@ export const executeRecordVideo = api => {
123
123
  editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions
124
124
  }));
125
125
  };
126
- export const setupLoom = async (loomProvider, api, editorView, isAfterEditorLoaded) => {
127
- var _api$core4;
126
+ export const setupLoom = async (loomProvider, api, editorView, initViaCommand) => {
127
+ var _api$core4, _api$analytics5;
128
128
  const clientResult = await loomProvider.getClient();
129
129
  if (clientResult.status === 'error') {
130
130
  var _api$core2, _api$analytics2;
@@ -182,28 +182,23 @@ export const setupLoom = async (loomProvider, api, editorView, isAfterEditorLoad
182
182
  })({
183
183
  tr
184
184
  });
185
- if (isAfterEditorLoaded) {
186
- var _api$quickInsert, _api$analytics4, _api$analytics5;
185
+ if (initViaCommand) {
186
+ var _api$quickInsert, _api$analytics4;
187
187
  api === null || api === void 0 ? void 0 : (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 ? void 0 : _api$quickInsert.commands.addQuickInsertItem(getQuickInsertItem(api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions))({
188
188
  tr
189
189
  });
190
- api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions.attachAnalyticsEvent({
191
- action: ACTION.INITIALISED,
192
- actionSubject: ACTION_SUBJECT.LOOM,
193
- eventType: EVENT_TYPE.OPERATIONAL
194
- })(tr);
195
190
  }
196
191
  return tr;
197
192
  });
198
- if (!isAfterEditorLoaded) {
199
- var _api$analytics6;
200
- // We're not combining the analytics steps into the enable / disable commands because the collab-edit plugin
201
- // filters out any transactions with steps (even analytics) when it's initialising
202
- api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions.fireAnalyticsEvent({
203
- action: ACTION.INITIALISED,
204
- actionSubject: ACTION_SUBJECT.LOOM,
205
- eventType: EVENT_TYPE.OPERATIONAL
206
- });
207
- }
193
+
194
+ // We're not combining the analytics steps into the enable / disable commands because the collab-edit plugin
195
+ // filters out any transactions with steps (even analytics) when it's initialising.
196
+ // Even if `initViaCommand` is true, collab-edit might not be ready depending on when `initLoom` is called,
197
+ // hence the analytics step is added separately in both cases
198
+ api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions.fireAnalyticsEvent({
199
+ action: ACTION.INITIALISED,
200
+ actionSubject: ACTION_SUBJECT.LOOM,
201
+ eventType: EVENT_TYPE.OPERATIONAL
202
+ });
208
203
  return {};
209
204
  };
@@ -123,9 +123,9 @@ export var executeRecordVideo = function executeRecordVideo(api) {
123
123
  }));
124
124
  };
125
125
  export var setupLoom = /*#__PURE__*/function () {
126
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(loomProvider, api, editorView, isAfterEditorLoaded) {
127
- var _api$core4;
128
- var clientResult, _api$core2, _api$analytics2, attachToButton, loomButton, _api$analytics6;
126
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(loomProvider, api, editorView, initViaCommand) {
127
+ var _api$core4, _api$analytics5;
128
+ var clientResult, _api$core2, _api$analytics2, attachToButton, loomButton;
129
129
  return _regeneratorRuntime.wrap(function _callee$(_context) {
130
130
  while (1) switch (_context.prev = _context.next) {
131
131
  case 0:
@@ -184,28 +184,24 @@ export var setupLoom = /*#__PURE__*/function () {
184
184
  })({
185
185
  tr: tr
186
186
  });
187
- if (isAfterEditorLoaded) {
188
- var _api$quickInsert, _api$analytics4, _api$analytics5;
187
+ if (initViaCommand) {
188
+ var _api$quickInsert, _api$analytics4;
189
189
  api === null || api === void 0 || (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 || _api$quickInsert.commands.addQuickInsertItem(getQuickInsertItem(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions))({
190
190
  tr: tr
191
191
  });
192
- api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || _api$analytics5.actions.attachAnalyticsEvent({
193
- action: ACTION.INITIALISED,
194
- actionSubject: ACTION_SUBJECT.LOOM,
195
- eventType: EVENT_TYPE.OPERATIONAL
196
- })(tr);
197
192
  }
198
193
  return tr;
199
194
  });
200
- if (!isAfterEditorLoaded) {
201
- // We're not combining the analytics steps into the enable / disable commands because the collab-edit plugin
202
- // filters out any transactions with steps (even analytics) when it's initialising
203
- api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 || _api$analytics6.actions.fireAnalyticsEvent({
204
- action: ACTION.INITIALISED,
205
- actionSubject: ACTION_SUBJECT.LOOM,
206
- eventType: EVENT_TYPE.OPERATIONAL
207
- });
208
- }
195
+
196
+ // We're not combining the analytics steps into the enable / disable commands because the collab-edit plugin
197
+ // filters out any transactions with steps (even analytics) when it's initialising.
198
+ // Even if `initViaCommand` is true, collab-edit might not be ready depending on when `initLoom` is called,
199
+ // hence the analytics step is added separately in both cases
200
+ api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 || _api$analytics5.actions.fireAnalyticsEvent({
201
+ action: ACTION.INITIALISED,
202
+ actionSubject: ACTION_SUBJECT.LOOM,
203
+ eventType: EVENT_TYPE.OPERATIONAL
204
+ });
209
205
  return _context.abrupt("return", {});
210
206
  case 14:
211
207
  case "end":
@@ -26,6 +26,6 @@ export declare const insertVideo: ({ editorAnalyticsAPI, video, }: {
26
26
  }) => EditorCommand;
27
27
  export declare const insertLoom: (editorView: EditorView | null, api: ExtractInjectionAPI<LoomPlugin> | undefined, video: VideoMeta, positionType: PositionType) => boolean;
28
28
  export declare const executeRecordVideo: (api: ExtractInjectionAPI<LoomPlugin> | undefined) => void;
29
- export declare const setupLoom: (loomProvider: LoomProviderOptions, api: ExtractInjectionAPI<LoomPlugin> | undefined, editorView: EditorView | null, isAfterEditorLoaded?: boolean) => Promise<{
29
+ export declare const setupLoom: (loomProvider: LoomProviderOptions, api: ExtractInjectionAPI<LoomPlugin> | undefined, editorView: EditorView | null, initViaCommand?: boolean) => Promise<{
30
30
  error?: string;
31
31
  }>;
@@ -26,6 +26,6 @@ export declare const insertVideo: ({ editorAnalyticsAPI, video, }: {
26
26
  }) => EditorCommand;
27
27
  export declare const insertLoom: (editorView: EditorView | null, api: ExtractInjectionAPI<LoomPlugin> | undefined, video: VideoMeta, positionType: PositionType) => boolean;
28
28
  export declare const executeRecordVideo: (api: ExtractInjectionAPI<LoomPlugin> | undefined) => void;
29
- export declare const setupLoom: (loomProvider: LoomProviderOptions, api: ExtractInjectionAPI<LoomPlugin> | undefined, editorView: EditorView | null, isAfterEditorLoaded?: boolean) => Promise<{
29
+ export declare const setupLoom: (loomProvider: LoomProviderOptions, api: ExtractInjectionAPI<LoomPlugin> | undefined, editorView: EditorView | null, initViaCommand?: boolean) => Promise<{
30
30
  error?: string;
31
31
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-loom",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Loom plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,8 +34,8 @@
34
34
  ".": "./src/index.ts"
35
35
  },
36
36
  "dependencies": {
37
- "@atlaskit/button": "^20.1.0",
38
- "@atlaskit/editor-common": "^91.0.0",
37
+ "@atlaskit/button": "^20.2.0",
38
+ "@atlaskit/editor-common": "^91.1.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
40
40
  "@atlaskit/editor-plugin-hyperlink": "^2.9.0",
41
41
  "@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@atlaskit/editor-plugin-base": "^1.11.0",
62
- "@atlaskit/editor-plugin-card": "^3.0.0",
62
+ "@atlaskit/editor-plugin-card": "^3.2.0",
63
63
  "@atlaskit/editor-plugin-copy-button": "^1.3.0",
64
64
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
65
65
  "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",