@atlaskit/collab-provider 18.0.9 → 18.1.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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @atlaskit/collab-provider
2
2
 
3
+ ## 18.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 18.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`e6053f4348753`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e6053f4348753) -
14
+ Fix cc-markdown-mode duplication and stuck-loading issues on rich/markdown convert. Cache the
15
+ latest init payload on the native collab provider and expose it via an optional getInitPayload()
16
+ getter so editor-plugin-collab-edit can seed collabInitialised=true on a rebind (e.g. preset
17
+ rebuild) without re-running handleInit. Gate a synthetic-BE-step filter in
18
+ documentService.processSteps that neutralises NCS reconcile-generated steps tagged with the user's
19
+ userId but no clientId (prevents HelloHello duplication after a markdown-mode flip). Defensively
20
+ hide the WYSIWYG editor DOM in MarkdownModeContentComponent when the source view is active so the
21
+ floating toolbar/cursor doesn't leak through. All behaviour changes are behind the
22
+ cc-markdown-mode experiment.
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies
27
+
3
28
  ## 18.0.9
4
29
 
5
30
  ### Patch Changes
@@ -98,6 +98,14 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
98
98
  });
99
99
  _this.metadataService.updateMetadata(metadata);
100
100
  _this.isProviderInitialized = true;
101
+ // Cache the init payload so late subscribers (e.g. plugin views attached
102
+ // after an editor preset reconfigure) can be seeded via getInitPayload().
103
+ _this.lastInitPayload = {
104
+ doc: doc,
105
+ version: version,
106
+ metadata: metadata,
107
+ caller: caller
108
+ };
101
109
  } catch (e) {
102
110
  var _this$analyticsHelper;
103
111
  (_this$analyticsHelper = _this.analyticsHelper) === null || _this$analyticsHelper === void 0 || _this$analyticsHelper.sendErrorEvent(e, 'Failed to update with the init document, destroying provider');
@@ -270,6 +278,23 @@ var Provider = exports.Provider = /*#__PURE__*/function (_Emitter) {
270
278
  (0, _defineProperty2.default)(_this, "getMetadata", function () {
271
279
  return _this.metadataService.getMetaData();
272
280
  });
281
+ /**
282
+ * Returns the cached `init` payload if the provider has already initialised
283
+ * the document, otherwise `undefined`.
284
+ *
285
+ * Used by the collab plugin's `view()` factory to seed a freshly-attached
286
+ * plugin view (e.g. after editor preset reconfigure or full EditorView
287
+ * recreation) with the same `init` data the original subscribers received.
288
+ * Without this, late subscribers never receive `init` (it is emitted only
289
+ * once per session) and the editor stays in `!isReady`, silently dropping
290
+ * doc-changing transactions.
291
+ */
292
+ (0, _defineProperty2.default)(_this, "getInitPayload", function () {
293
+ if (!_this.isProviderInitialized) {
294
+ return undefined;
295
+ }
296
+ return _this.lastInitPayload;
297
+ });
273
298
  /**
274
299
  * Return the ADF version of the current draft document, together with it's title and the current step version.
275
300
  * Used for draft sync, a process running every 5s for the first editor of a document to sync the document to the Confluence back-end.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/collab-provider";
8
- var version = exports.version = "18.0.8";
8
+ var version = exports.version = "18.1.0";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -76,6 +76,14 @@ export class Provider extends Emitter {
76
76
  });
77
77
  this.metadataService.updateMetadata(metadata);
78
78
  this.isProviderInitialized = true;
79
+ // Cache the init payload so late subscribers (e.g. plugin views attached
80
+ // after an editor preset reconfigure) can be seeded via getInitPayload().
81
+ this.lastInitPayload = {
82
+ doc,
83
+ version,
84
+ metadata,
85
+ caller
86
+ };
79
87
  } catch (e) {
80
88
  var _this$analyticsHelper;
81
89
  (_this$analyticsHelper = this.analyticsHelper) === null || _this$analyticsHelper === void 0 ? void 0 : _this$analyticsHelper.sendErrorEvent(e, 'Failed to update with the init document, destroying provider');
@@ -234,6 +242,23 @@ export class Provider extends Emitter {
234
242
  _defineProperty(this, "getMetadata", () => {
235
243
  return this.metadataService.getMetaData();
236
244
  });
245
+ /**
246
+ * Returns the cached `init` payload if the provider has already initialised
247
+ * the document, otherwise `undefined`.
248
+ *
249
+ * Used by the collab plugin's `view()` factory to seed a freshly-attached
250
+ * plugin view (e.g. after editor preset reconfigure or full EditorView
251
+ * recreation) with the same `init` data the original subscribers received.
252
+ * Without this, late subscribers never receive `init` (it is emitted only
253
+ * once per session) and the editor stays in `!isReady`, silently dropping
254
+ * doc-changing transactions.
255
+ */
256
+ _defineProperty(this, "getInitPayload", () => {
257
+ if (!this.isProviderInitialized) {
258
+ return undefined;
259
+ }
260
+ return this.lastInitPayload;
261
+ });
237
262
  /**
238
263
  * Return the ADF version of the current draft document, together with it's title and the current step version.
239
264
  * Used for draft sync, a process running every 5s for the first editor of a document to sync the document to the Confluence back-end.
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/collab-provider";
2
- export const version = "18.0.8";
2
+ export const version = "18.1.0";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -92,6 +92,14 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
92
92
  });
93
93
  _this.metadataService.updateMetadata(metadata);
94
94
  _this.isProviderInitialized = true;
95
+ // Cache the init payload so late subscribers (e.g. plugin views attached
96
+ // after an editor preset reconfigure) can be seeded via getInitPayload().
97
+ _this.lastInitPayload = {
98
+ doc: doc,
99
+ version: version,
100
+ metadata: metadata,
101
+ caller: caller
102
+ };
95
103
  } catch (e) {
96
104
  var _this$analyticsHelper;
97
105
  (_this$analyticsHelper = _this.analyticsHelper) === null || _this$analyticsHelper === void 0 || _this$analyticsHelper.sendErrorEvent(e, 'Failed to update with the init document, destroying provider');
@@ -264,6 +272,23 @@ export var Provider = /*#__PURE__*/function (_Emitter) {
264
272
  _defineProperty(_this, "getMetadata", function () {
265
273
  return _this.metadataService.getMetaData();
266
274
  });
275
+ /**
276
+ * Returns the cached `init` payload if the provider has already initialised
277
+ * the document, otherwise `undefined`.
278
+ *
279
+ * Used by the collab plugin's `view()` factory to seed a freshly-attached
280
+ * plugin view (e.g. after editor preset reconfigure or full EditorView
281
+ * recreation) with the same `init` data the original subscribers received.
282
+ * Without this, late subscribers never receive `init` (it is emitted only
283
+ * once per session) and the editor stays in `!isReady`, silently dropping
284
+ * doc-changing transactions.
285
+ */
286
+ _defineProperty(_this, "getInitPayload", function () {
287
+ if (!_this.isProviderInitialized) {
288
+ return undefined;
289
+ }
290
+ return _this.lastInitPayload;
291
+ });
267
292
  /**
268
293
  * Return the ADF version of the current draft document, together with it's title and the current step version.
269
294
  * Used for draft sync, a process running every 5s for the first editor of a document to sync the document to the Confluence back-end.
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/collab-provider";
2
- export var version = "18.0.8";
2
+ export var version = "18.1.0";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -2,7 +2,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
2
2
  import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
3
3
  import { Emitter } from '../emitter';
4
4
  import type { Config } from '../types';
5
- import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, SyncUpErrorFunction, CollabPresenceActivityChangePayload, CollabActivityAIProviderChangedPayload, ProviderParticipant } from '@atlaskit/editor-common/collab';
5
+ import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, CollabInitPayload, SyncUpErrorFunction, CollabPresenceActivityChangePayload, CollabActivityAIProviderChangedPayload, ProviderParticipant } from '@atlaskit/editor-common/collab';
6
6
  import { Api } from '../api/api';
7
7
  import { NullApi } from '../api/null-api';
8
8
  import type { GetResolvedEditorStateReason } from '@atlaskit/editor-common/types';
@@ -17,6 +17,14 @@ export declare class Provider extends Emitter<CollabEvents> implements CollabEdi
17
17
  private initialDraft?;
18
18
  private isProviderInitialized;
19
19
  private isBuffered;
20
+ /**
21
+ * Cache of the last `init` payload, populated when the document and metadata
22
+ * are first applied. Returned by {@link getInitPayload} so that late
23
+ * subscribers (e.g. a freshly-attached collab plugin view after editor
24
+ * preset reconfigure) can be seeded without waiting for the `init` event
25
+ * which is only emitted once per session.
26
+ */
27
+ private lastInitPayload?;
20
28
  private permit;
21
29
  private isBufferingEnabled;
22
30
  private sessionId?;
@@ -146,6 +154,18 @@ export declare class Provider extends Emitter<CollabEvents> implements CollabEdi
146
154
  * Returns the documents metadata
147
155
  */
148
156
  getMetadata: () => Metadata;
157
+ /**
158
+ * Returns the cached `init` payload if the provider has already initialised
159
+ * the document, otherwise `undefined`.
160
+ *
161
+ * Used by the collab plugin's `view()` factory to seed a freshly-attached
162
+ * plugin view (e.g. after editor preset reconfigure or full EditorView
163
+ * recreation) with the same `init` data the original subscribers received.
164
+ * Without this, late subscribers never receive `init` (it is emitted only
165
+ * once per session) and the editor stays in `!isReady`, silently dropping
166
+ * doc-changing transactions.
167
+ */
168
+ getInitPayload: () => CollabInitPayload | undefined;
149
169
  /**
150
170
  * Return the ADF version of the current draft document, together with it's title and the current step version.
151
171
  * Used for draft sync, a process running every 5s for the first editor of a document to sync the document to the Confluence back-end.
@@ -2,7 +2,7 @@ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/stat
2
2
  import type { Step as ProseMirrorStep } from '@atlaskit/editor-prosemirror/transform';
3
3
  import { Emitter } from '../emitter';
4
4
  import type { Config } from '../types';
5
- import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, SyncUpErrorFunction, CollabPresenceActivityChangePayload, CollabActivityAIProviderChangedPayload, ProviderParticipant } from '@atlaskit/editor-common/collab';
5
+ import type { CollabEditProvider, CollabEvents, CollabTelepointerPayload, ResolvedEditorState, Metadata, CollabInitPayload, SyncUpErrorFunction, CollabPresenceActivityChangePayload, CollabActivityAIProviderChangedPayload, ProviderParticipant } from '@atlaskit/editor-common/collab';
6
6
  import { Api } from '../api/api';
7
7
  import { NullApi } from '../api/null-api';
8
8
  import type { GetResolvedEditorStateReason } from '@atlaskit/editor-common/types';
@@ -17,6 +17,14 @@ export declare class Provider extends Emitter<CollabEvents> implements CollabEdi
17
17
  private initialDraft?;
18
18
  private isProviderInitialized;
19
19
  private isBuffered;
20
+ /**
21
+ * Cache of the last `init` payload, populated when the document and metadata
22
+ * are first applied. Returned by {@link getInitPayload} so that late
23
+ * subscribers (e.g. a freshly-attached collab plugin view after editor
24
+ * preset reconfigure) can be seeded without waiting for the `init` event
25
+ * which is only emitted once per session.
26
+ */
27
+ private lastInitPayload?;
20
28
  private permit;
21
29
  private isBufferingEnabled;
22
30
  private sessionId?;
@@ -146,6 +154,18 @@ export declare class Provider extends Emitter<CollabEvents> implements CollabEdi
146
154
  * Returns the documents metadata
147
155
  */
148
156
  getMetadata: () => Metadata;
157
+ /**
158
+ * Returns the cached `init` payload if the provider has already initialised
159
+ * the document, otherwise `undefined`.
160
+ *
161
+ * Used by the collab plugin's `view()` factory to seed a freshly-attached
162
+ * plugin view (e.g. after editor preset reconfigure or full EditorView
163
+ * recreation) with the same `init` data the original subscribers received.
164
+ * Without this, late subscribers never receive `init` (it is emitted only
165
+ * once per session) and the editor stays in `!isReady`, silently dropping
166
+ * doc-changing transactions.
167
+ */
168
+ getInitPayload: () => CollabInitPayload | undefined;
149
169
  /**
150
170
  * Return the ADF version of the current draft document, together with it's title and the current step version.
151
171
  * Used for draft sync, a process running every 5s for the first editor of a document to sync the document to the Confluence back-end.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/collab-provider",
3
- "version": "18.0.9",
3
+ "version": "18.1.1",
4
4
  "description": "A provider for collaborative editing.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
38
  "@atlaskit/prosemirror-collab": "^0.22.0",
39
39
  "@atlaskit/react-ufo": "^5.16.0",
40
- "@atlaskit/tmp-editor-statsig": "^71.0.0",
40
+ "@atlaskit/tmp-editor-statsig": "^72.0.0",
41
41
  "@atlaskit/ufo": "^0.4.0",
42
42
  "@atlaskit/util-service-support": "^6.3.0",
43
43
  "@babel/runtime": "^7.0.0",
@@ -73,6 +73,6 @@
73
73
  }
74
74
  },
75
75
  "peerDependencies": {
76
- "@atlaskit/editor-common": "^114.12.0"
76
+ "@atlaskit/editor-common": "^114.13.0"
77
77
  }
78
78
  }