@ckeditor/ckeditor5-real-time-collaboration 48.2.0 → 48.3.0-alpha.0

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.
Files changed (171) hide show
  1. package/dist/augmentation.d.ts +67 -67
  2. package/dist/common-translations.d.ts +6 -6
  3. package/dist/config.d.ts +43 -43
  4. package/dist/index.d.ts +19 -19
  5. package/dist/index.js +6 -6
  6. package/dist/presencelist/presencelistui.d.ts +54 -54
  7. package/dist/presencelist/view/presencecounterview.d.ts +10 -10
  8. package/dist/presencelist/view/presencedropdownlistitemview.d.ts +14 -14
  9. package/dist/presencelist/view/presencedropdownlistview.d.ts +0 -4
  10. package/dist/presencelist/view/presenceinlinelistitemview.d.ts +15 -15
  11. package/dist/presencelist/view/presenceinlinelistview.d.ts +34 -34
  12. package/dist/presencelist/view/presencelistview.d.ts +5 -4
  13. package/dist/presencelist.d.ts +32 -32
  14. package/dist/realtimecollaborativecomments/cloudservicescommentsadapter.d.ts +56 -56
  15. package/dist/realtimecollaborativecomments.d.ts +40 -40
  16. package/dist/realtimecollaborativeediting/realtimecollaborationclient.d.ts +129 -140
  17. package/dist/realtimecollaborativeediting/sessions.d.ts +115 -117
  18. package/dist/realtimecollaborativeediting/usermarkers.d.ts +46 -46
  19. package/dist/realtimecollaborativeediting/websocketgateway.d.ts +59 -59
  20. package/dist/realtimecollaborativeediting.d.ts +29 -29
  21. package/dist/realtimecollaborativerevisionhistory/cloudservicesrevisionhistoryadapter.d.ts +53 -53
  22. package/dist/realtimecollaborativerevisionhistory.d.ts +33 -33
  23. package/dist/realtimecollaborativetrackchanges/cloudservicestrackchangesadapter.d.ts +47 -47
  24. package/dist/realtimecollaborativetrackchanges.d.ts +31 -31
  25. package/dist/translations/af.js +1 -1
  26. package/dist/translations/af.umd.js +1 -1
  27. package/dist/translations/ar.js +1 -1
  28. package/dist/translations/ar.umd.js +1 -1
  29. package/dist/translations/ast.js +1 -1
  30. package/dist/translations/ast.umd.js +1 -1
  31. package/dist/translations/az.js +1 -1
  32. package/dist/translations/az.umd.js +1 -1
  33. package/dist/translations/be.js +1 -1
  34. package/dist/translations/be.umd.js +1 -1
  35. package/dist/translations/bg.js +1 -1
  36. package/dist/translations/bg.umd.js +1 -1
  37. package/dist/translations/bn.js +1 -1
  38. package/dist/translations/bn.umd.js +1 -1
  39. package/dist/translations/bs.js +1 -1
  40. package/dist/translations/bs.umd.js +1 -1
  41. package/dist/translations/ca.js +1 -1
  42. package/dist/translations/ca.umd.js +1 -1
  43. package/dist/translations/cs.js +1 -1
  44. package/dist/translations/cs.umd.js +1 -1
  45. package/dist/translations/da.js +1 -1
  46. package/dist/translations/da.umd.js +1 -1
  47. package/dist/translations/de-ch.js +1 -1
  48. package/dist/translations/de-ch.umd.js +1 -1
  49. package/dist/translations/de.js +1 -1
  50. package/dist/translations/de.umd.js +1 -1
  51. package/dist/translations/el.js +1 -1
  52. package/dist/translations/el.umd.js +1 -1
  53. package/dist/translations/en-au.js +1 -1
  54. package/dist/translations/en-au.umd.js +1 -1
  55. package/dist/translations/en-gb.js +1 -1
  56. package/dist/translations/en-gb.umd.js +1 -1
  57. package/dist/translations/en.js +1 -1
  58. package/dist/translations/en.umd.js +1 -1
  59. package/dist/translations/eo.js +1 -1
  60. package/dist/translations/eo.umd.js +1 -1
  61. package/dist/translations/es-co.js +1 -1
  62. package/dist/translations/es-co.umd.js +1 -1
  63. package/dist/translations/es.js +1 -1
  64. package/dist/translations/es.umd.js +1 -1
  65. package/dist/translations/et.js +1 -1
  66. package/dist/translations/et.umd.js +1 -1
  67. package/dist/translations/eu.js +1 -1
  68. package/dist/translations/eu.umd.js +1 -1
  69. package/dist/translations/fa.js +1 -1
  70. package/dist/translations/fa.umd.js +1 -1
  71. package/dist/translations/fi.js +1 -1
  72. package/dist/translations/fi.umd.js +1 -1
  73. package/dist/translations/fr.js +1 -1
  74. package/dist/translations/fr.umd.js +1 -1
  75. package/dist/translations/gl.js +1 -1
  76. package/dist/translations/gl.umd.js +1 -1
  77. package/dist/translations/gu.js +1 -1
  78. package/dist/translations/gu.umd.js +1 -1
  79. package/dist/translations/he.js +1 -1
  80. package/dist/translations/he.umd.js +1 -1
  81. package/dist/translations/hi.js +1 -1
  82. package/dist/translations/hi.umd.js +1 -1
  83. package/dist/translations/hr.js +1 -1
  84. package/dist/translations/hr.umd.js +1 -1
  85. package/dist/translations/hu.js +1 -1
  86. package/dist/translations/hu.umd.js +1 -1
  87. package/dist/translations/hy.js +1 -1
  88. package/dist/translations/hy.umd.js +1 -1
  89. package/dist/translations/id.js +1 -1
  90. package/dist/translations/id.umd.js +1 -1
  91. package/dist/translations/it.js +1 -1
  92. package/dist/translations/it.umd.js +1 -1
  93. package/dist/translations/ja.js +1 -1
  94. package/dist/translations/ja.umd.js +1 -1
  95. package/dist/translations/jv.js +1 -1
  96. package/dist/translations/jv.umd.js +1 -1
  97. package/dist/translations/kk.js +1 -1
  98. package/dist/translations/kk.umd.js +1 -1
  99. package/dist/translations/km.js +1 -1
  100. package/dist/translations/km.umd.js +1 -1
  101. package/dist/translations/kn.js +1 -1
  102. package/dist/translations/kn.umd.js +1 -1
  103. package/dist/translations/ko.js +1 -1
  104. package/dist/translations/ko.umd.js +1 -1
  105. package/dist/translations/ku.js +1 -1
  106. package/dist/translations/ku.umd.js +1 -1
  107. package/dist/translations/lt.js +1 -1
  108. package/dist/translations/lt.umd.js +1 -1
  109. package/dist/translations/lv.js +1 -1
  110. package/dist/translations/lv.umd.js +1 -1
  111. package/dist/translations/ms.js +1 -1
  112. package/dist/translations/ms.umd.js +1 -1
  113. package/dist/translations/nb.js +1 -1
  114. package/dist/translations/nb.umd.js +1 -1
  115. package/dist/translations/ne.js +1 -1
  116. package/dist/translations/ne.umd.js +1 -1
  117. package/dist/translations/nl.js +1 -1
  118. package/dist/translations/nl.umd.js +1 -1
  119. package/dist/translations/no.js +1 -1
  120. package/dist/translations/no.umd.js +1 -1
  121. package/dist/translations/oc.js +1 -1
  122. package/dist/translations/oc.umd.js +1 -1
  123. package/dist/translations/pl.js +1 -1
  124. package/dist/translations/pl.umd.js +1 -1
  125. package/dist/translations/pt-br.js +1 -1
  126. package/dist/translations/pt-br.umd.js +1 -1
  127. package/dist/translations/pt.js +1 -1
  128. package/dist/translations/pt.umd.js +1 -1
  129. package/dist/translations/ro.js +1 -1
  130. package/dist/translations/ro.umd.js +1 -1
  131. package/dist/translations/ru.js +1 -1
  132. package/dist/translations/ru.umd.js +1 -1
  133. package/dist/translations/si.js +1 -1
  134. package/dist/translations/si.umd.js +1 -1
  135. package/dist/translations/sk.js +1 -1
  136. package/dist/translations/sk.umd.js +1 -1
  137. package/dist/translations/sl.js +1 -1
  138. package/dist/translations/sl.umd.js +1 -1
  139. package/dist/translations/sq.js +1 -1
  140. package/dist/translations/sq.umd.js +1 -1
  141. package/dist/translations/sr-latn.js +1 -1
  142. package/dist/translations/sr-latn.umd.js +1 -1
  143. package/dist/translations/sr.js +1 -1
  144. package/dist/translations/sr.umd.js +1 -1
  145. package/dist/translations/sv.js +1 -1
  146. package/dist/translations/sv.umd.js +1 -1
  147. package/dist/translations/th.js +1 -1
  148. package/dist/translations/th.umd.js +1 -1
  149. package/dist/translations/ti.js +1 -1
  150. package/dist/translations/ti.umd.js +1 -1
  151. package/dist/translations/tk.js +1 -1
  152. package/dist/translations/tk.umd.js +1 -1
  153. package/dist/translations/tr.js +1 -1
  154. package/dist/translations/tr.umd.js +1 -1
  155. package/dist/translations/tt.js +1 -1
  156. package/dist/translations/tt.umd.js +1 -1
  157. package/dist/translations/ug.js +1 -1
  158. package/dist/translations/ug.umd.js +1 -1
  159. package/dist/translations/uk.js +1 -1
  160. package/dist/translations/uk.umd.js +1 -1
  161. package/dist/translations/ur.js +1 -1
  162. package/dist/translations/ur.umd.js +1 -1
  163. package/dist/translations/uz.js +1 -1
  164. package/dist/translations/uz.umd.js +1 -1
  165. package/dist/translations/vi.js +1 -1
  166. package/dist/translations/vi.umd.js +1 -1
  167. package/dist/translations/zh-cn.js +1 -1
  168. package/dist/translations/zh-cn.umd.js +1 -1
  169. package/dist/translations/zh.js +1 -1
  170. package/dist/translations/zh.umd.js +1 -1
  171. package/package.json +13 -13
@@ -1,145 +1,134 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module real-time-collaboration/realtimecollaborativeediting/realtimecollaborationclient
7
- * @publicApi
8
- */
9
- import { Plugin, PendingActions, type Editor } from '@ckeditor/ckeditor5-core';
10
- import { Notification } from '@ckeditor/ckeditor5-ui';
11
- import { WebSocketGateway } from './websocketgateway.js';
12
- import { Sessions } from './sessions.js';
13
- import { UserMarkers } from './usermarkers.js';
14
- import { Users, type CollaborationHistory } from '@ckeditor/ckeditor5-collaboration-core';
15
- import { CollaborativeEditingService } from '@ckeditor/ckeditor-cloud-services-collaboration';
6
+ * @module real-time-collaboration/realtimecollaborativeediting/realtimecollaborationclient
7
+ * @publicApi
8
+ */
9
+ import { Plugin, PendingActions, type Editor, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
10
+ import { Notification } from "@ckeditor/ckeditor5-ui";
11
+ import { WebSocketGateway } from "./websocketgateway.js";
12
+ import { Sessions } from "./sessions.js";
13
+ import { UserMarkers } from "./usermarkers.js";
14
+ import { Users, type CollaborationHistory } from "@ckeditor/ckeditor5-collaboration-core";
15
+ import { CollaborativeEditingService } from "@ckeditor/ckeditor-cloud-services-collaboration";
16
16
  /**
17
- * Handles the real-time collaborative editing.
18
- */
17
+ * Handles the real-time collaborative editing.
18
+ */
19
19
  export declare class RealTimeCollaborationClient extends Plugin {
20
- static CollaborativeEditingService: typeof CollaborativeEditingService;
21
- /**
22
- * The ID of the current editing session to which the client is connected (or was connected before losing the connection).
23
- */
24
- sessionId: string | null;
25
- /**
26
- * Holds the history of operations that have been applied on the collaboration server.
27
- *
28
- * Contains only these operations, that have been already synchronized. It is exactly the same for all clients
29
- * connected to the same editing session.
30
- *
31
- * All original operations are cloned.
32
- */
33
- serverHistory: CollaborationHistory;
34
- /**
35
- * @inheritDoc
36
- */
37
- static get requires(): readonly [typeof WebSocketGateway, typeof Sessions, typeof UserMarkers, typeof PendingActions, typeof Users, typeof Notification];
38
- /**
39
- * @inheritDoc
40
- */
41
- static get pluginName(): "RealTimeCollaborationClient";
42
- /**
43
- * @inheritDoc
44
- */
45
- static get isOfficialPlugin(): true;
46
- /**
47
- * @inheritDoc
48
- */
49
- static get isPremiumPlugin(): true;
50
- /**
51
- * Incremented every time the document is synchronized with Cloud Services server. It can be treated as the server's current document
52
- * version. This number is stored between editing sessions, so even when all clients disconnect, the editing session is closed, the
53
- * next time the document is initialized, the version number will stay the same and will continue to be incremented with
54
- * subsequent document changes.
55
- *
56
- * Use this version to compare which client has a newer version of the document. It is recommended to save it together with the
57
- * document content in the database. Comparing `cloudDocumentVersion` can be used to prevent overwriting a newer content with
58
- * an older one from another client.
59
- */
60
- get cloudDocumentVersion(): number;
61
- /**
62
- * The last document version synchronized with the server during current real-time collaboration session.
63
- *
64
- * Equals to `0` when the client is not connected to the server yet.
65
- *
66
- * This includes only operations created by this or other clients. Notably, user selection markers operations created by
67
- * the server are excluded.
68
- */
69
- get lastSyncVersion(): number;
70
- constructor(editor: Editor);
71
- /**
72
- * @inheritDoc
73
- */
74
- init(): void;
75
- /**
76
- * Reconnects the client to the document.
77
- *
78
- * If the document has been flushed (editing session for that document was closed) in the meantime, the editing session is recreated
79
- * using the local operations history.
80
- *
81
- * There are several scenarios where the reconnection can fail because it is impossible to synchronize local document state with the
82
- * server editing session or with the document state saved in the database. In those situations, the editor switches to read-only
83
- * mode and a {@link module:ui/notification/notification~Notification `Notification`} is created.
84
- */
85
- reconnect(): Promise<void>;
86
- /**
87
- * @inheritDoc
88
- */
89
- destroy(): void;
90
- /**
91
- * Handles the server response after the reconnection.
92
- */
93
- private _handleReconnectionResponse;
94
- /**
95
- * Connects the client to the editing session.
96
- *
97
- * If this client is the first one that tries connecting to the session, the session will be created based on its
98
- * local operations. Otherwise, the server will respond with server operations that are already stored on the server for the
99
- * existing session and those operations will replace this client's editor content.
100
- *
101
- * @param isReconnectionProcess Set to `true` when reconnecting to the document after the document has been flushed.
102
- */
103
- private _connectService;
104
- /**
105
- * Handles operations received from the server. Callback for the `CollaborativeEditingService#event:operationsReceived`.
106
- */
107
- private _handleReceivedOperations;
108
- /**
109
- * Connects the client to the editing session after it has been flushed. The client will use the local operations history to re-create
110
- * the editing session on the server.
111
- */
112
- private _connectAfterSessionHasBeenFlushed;
113
- /**
114
- * Fetches missing users based on author IDs of the given operations.
115
- */
116
- private _fetchMissingUsers;
117
- /**
118
- * Performs root loading in a way that is safe for real-time collaboration. Synchronizes with the server and use the local data only
119
- * if the given root has not been loaded on any other client yet. Returns a promise which resolves after the root is ready.
120
- *
121
- * It transforms given data and root attributes into operations and tries to send them to the server. The operations are sent in
122
- * a regular way. The root is ready after they are finally applied on the server.
123
- *
124
- * @private
125
- */
126
- private _loadRoot;
127
- /**
128
- * Handles the initial connection.
129
- */
130
- private _handleInitialConnectionData;
131
- private _sendBufferedOperations;
132
- /**
133
- * Handles a response from the server for the following actions:
134
- * - connection
135
- * - reconnection
136
- * - sending buffered operations.
137
- *
138
- * @param sentOperations Operations sent to the server.
139
- * @param response The server's response.
140
- * @param requestId
141
- * @returns Resolves to `true` if the updates process has finished,
142
- * resolves to `false` if next batch of updates was sent to the server.
143
- */
144
- private _handleServerResponse;
20
+ static CollaborativeEditingService: typeof CollaborativeEditingService;
21
+ /**
22
+ * The ID of the current editing session to which the client is connected (or was connected before losing the connection).
23
+ */
24
+ sessionId: string | null;
25
+ /**
26
+ * Holds the history of operations that have been applied on the collaboration server.
27
+ *
28
+ * Contains only these operations, that have been already synchronized. It is exactly the same for all clients
29
+ * connected to the same editing session.
30
+ *
31
+ * All original operations are cloned.
32
+ */
33
+ serverHistory: CollaborationHistory;
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ static get requires(): PluginDependenciesOf<[WebSocketGateway, Sessions, UserMarkers, PendingActions, Users, Notification]>;
38
+ /**
39
+ * @inheritDoc
40
+ */
41
+ static get pluginName(): "RealTimeCollaborationClient";
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ static override get isOfficialPlugin(): true;
46
+ /**
47
+ * @inheritDoc
48
+ */
49
+ static override get isPremiumPlugin(): true;
50
+ /**
51
+ * Incremented every time the document is synchronized with Cloud Services server. It can be treated as the server's current document
52
+ * version. This number is stored between editing sessions, so even when all clients disconnect, the editing session is closed, the
53
+ * next time the document is initialized, the version number will stay the same and will continue to be incremented with
54
+ * subsequent document changes.
55
+ *
56
+ * Use this version to compare which client has a newer version of the document. It is recommended to save it together with the
57
+ * document content in the database. Comparing `cloudDocumentVersion` can be used to prevent overwriting a newer content with
58
+ * an older one from another client.
59
+ */
60
+ get cloudDocumentVersion(): number;
61
+ /**
62
+ * The last document version synchronized with the server during current real-time collaboration session.
63
+ *
64
+ * Equals to `0` when the client is not connected to the server yet.
65
+ *
66
+ * This includes only operations created by this or other clients. Notably, user selection markers operations created by
67
+ * the server are excluded.
68
+ */
69
+ get lastSyncVersion(): number;
70
+ constructor(editor: Editor);
71
+ /**
72
+ * @inheritDoc
73
+ */
74
+ init(): void;
75
+ /**
76
+ * @inheritDoc
77
+ */
78
+ override destroy(): void;
79
+ /**
80
+ * Handles the server response after the reconnection.
81
+ */
82
+ private _handleReconnectionResponse;
83
+ /**
84
+ * Connects the client to the editing session.
85
+ *
86
+ * If this client is the first one that tries connecting to the session, the session will be created based on its
87
+ * local operations. Otherwise, the server will respond with server operations that are already stored on the server for the
88
+ * existing session and those operations will replace this client's editor content.
89
+ *
90
+ * @param isReconnectionProcess Set to `true` when reconnecting to the document after the document has been flushed.
91
+ */
92
+ private _connectService;
93
+ /**
94
+ * Handles operations received from the server. Callback for the `CollaborativeEditingService#event:operationsReceived`.
95
+ */
96
+ private _handleReceivedOperations;
97
+ /**
98
+ * Connects the client to the editing session after it has been flushed. The client will use the local operations history to re-create
99
+ * the editing session on the server.
100
+ */
101
+ private _connectAfterSessionHasBeenFlushed;
102
+ /**
103
+ * Fetches missing users based on author IDs of the given operations.
104
+ */
105
+ private _fetchMissingUsers;
106
+ /**
107
+ * Performs root loading in a way that is safe for real-time collaboration. Synchronizes with the server and use the local data only
108
+ * if the given root has not been loaded on any other client yet. Returns a promise which resolves after the root is ready.
109
+ *
110
+ * It transforms given data and root attributes into operations and tries to send them to the server. The operations are sent in
111
+ * a regular way. The root is ready after they are finally applied on the server.
112
+ *
113
+ * @private
114
+ */
115
+ private _loadRoot;
116
+ /**
117
+ * Handles the initial connection.
118
+ */
119
+ private _handleInitialConnectionData;
120
+ private _sendBufferedOperations;
121
+ /**
122
+ * Handles a response from the server for the following actions:
123
+ * - connection
124
+ * - reconnection
125
+ * - sending buffered operations.
126
+ *
127
+ * @param sentOperations Operations sent to the server.
128
+ * @param response The server's response.
129
+ * @param requestId
130
+ * @returns Resolves to `true` if the updates process has finished,
131
+ * resolves to `false` if next batch of updates was sent to the server.
132
+ */
133
+ private _handleServerResponse;
145
134
  }
@@ -1,126 +1,124 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module real-time-collaboration/realtimecollaborativeediting/sessions
7
- * @publicApi
8
- */
9
- import { ContextPlugin, type Editor, type Context } from '@ckeditor/ckeditor5-core';
10
- import { Collection } from '@ckeditor/ckeditor5-utils';
11
- import { WebSocketGateway } from './websocketgateway.js';
12
- import { Users, type User } from '@ckeditor/ckeditor5-collaboration-core';
13
- import type { User as ServerUserModel, SessionCollection, ISocket } from '@ckeditor/ckeditor-cloud-services-collaboration';
6
+ * @module real-time-collaboration/realtimecollaborativeediting/sessions
7
+ * @publicApi
8
+ */
9
+ import { ContextPlugin, type Editor, type Context, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
10
+ import { Collection } from "@ckeditor/ckeditor5-utils";
11
+ import { WebSocketGateway } from "./websocketgateway.js";
12
+ import { Users, type User } from "@ckeditor/ckeditor5-collaboration-core";
13
+ import type { User as ServerUserModel, SessionCollection, ISocket } from "@ckeditor/ckeditor-cloud-services-collaboration";
14
14
  export type RtcServerUser = ServerUserModel & User;
15
15
  /**
16
- *
17
- * The `Sessions` plugin stores the information about the users and sessions connected to the rich text editor.
18
- *
19
- * The difference between the sessions plugin and the {@link module:collaboration-core/users~Users `Users` plugin} is that
20
- * `Users` also keeps information about the users who are not currently connected to the editor (for example, a comment
21
- * author who is currently offline).
22
- *
23
- * If your integration uses {@link module:core/context~Context} and there are multiple channels used, the `Sessions` plugin
24
- * aggregates users connected to all the channels.
25
- *
26
- * There are two types of entries in the sessions plugin: connected users and sessions.
27
- *
28
- * There is one session for each connection to a given channel. For example, for each open editor instance connecting
29
- * to a given channel ID, there will be a session. Every session has a user. However, the same user can be linked
30
- * with multiple sessions (for example, the same user opened the same URL in multiple tabs).
31
- *
32
- * In other words, if the same user (with the same user ID) opens the same document in two different tabs, they will create
33
- * two sessions but only one user will be connected. You will be able to see two selections in the same document, both in
34
- * the same color, but only a single user in the {@link module:real-time-collaboration/presencelist~PresenceList user presence list}.
35
- */
16
+ *
17
+ * The `Sessions` plugin stores the information about the users and sessions connected to the rich text editor.
18
+ *
19
+ * The difference between the sessions plugin and the {@link module:collaboration-core/users~Users `Users` plugin} is that
20
+ * `Users` also keeps information about the users who are not currently connected to the editor (for example, a comment
21
+ * author who is currently offline).
22
+ *
23
+ * If your integration uses {@link module:core/context~Context} and there are multiple channels used, the `Sessions` plugin
24
+ * aggregates users connected to all the channels.
25
+ *
26
+ * There are two types of entries in the sessions plugin: connected users and sessions.
27
+ *
28
+ * There is one session for each connection to a given channel. For example, for each open editor instance connecting
29
+ * to a given channel ID, there will be a session. Every session has a user. However, the same user can be linked
30
+ * with multiple sessions (for example, the same user opened the same URL in multiple tabs).
31
+ *
32
+ * In other words, if the same user (with the same user ID) opens the same document in two different tabs, they will create
33
+ * two sessions but only one user will be connected. You will be able to see two selections in the same document, both in
34
+ * the same color, but only a single user in the {@link module:real-time-collaboration/presencelist~PresenceList user presence list}.
35
+ */
36
36
  export declare class Sessions extends ContextPlugin {
37
- /**
38
- * A map of session collections connected to the separate channels.
39
- *
40
- * The keys of the map are channel IDs and the values are collections of sessions.
41
- *
42
- * A session is represented by an object with the following properties:
43
- * * `id` - A unique session ID.
44
- * * `user` - A reference to the user.
45
- */
46
- channelSessions: Map<string, Collection<ISocket>>;
47
- /**
48
- * A map of user collections connected to the separate channels.
49
- *
50
- * The keys of the map are channel IDs and the values are collections of users.
51
- */
52
- channelConnectedUsers: Map<string, Collection<ISocket>>;
53
- /**
54
- * A collection of users currently connected to all channels.
55
- *
56
- * A local user is always the first element in this collection.
57
- */
58
- allConnectedUsers: Collection<User>;
59
- /**
60
- * @inheritDoc
61
- */
62
- static get pluginName(): "Sessions";
63
- /**
64
- * @inheritDoc
65
- */
66
- static get isOfficialPlugin(): true;
67
- /**
68
- * @inheritDoc
69
- */
70
- static get isPremiumPlugin(): true;
71
- /**
72
- * @inheritDoc
73
- */
74
- static get requires(): readonly [typeof WebSocketGateway, typeof Users];
75
- /**
76
- * @inheritDoc
77
- */
78
- constructor(context: Editor | Context);
79
- /**
80
- * @inheritDoc
81
- */
82
- init(): void;
83
- /**
84
- * Observes given service sessions and updates session and users according to it.
85
- */
86
- register(channelId: string, serviceSessions: SessionCollection): void;
87
- /**
88
- * Stops observing given service sessions and remove all related sessions and users.
89
- */
90
- unregister(channelId: string): void;
91
- /**
92
- * Session id of the current client.
93
- */
94
- get mySessionId(): string;
95
- /**
96
- * Returns a reference to the user connected with a session with the given ID.
97
- */
98
- getUserBySessionId(sessionId: string): RtcServerUser | undefined;
99
- /**
100
- * Returns a set of ids of all currently connected sessions for the given user.
101
- *
102
- * When one user is connected to the same document in two separate browser tabs
103
- * then this users belongs to the two sessions.
104
- *
105
- * Optionally the result can be limited to the given channelId.
106
- */
107
- getUserSessions(user: RtcServerUser, channelId?: string): Set<string>;
108
- /**
109
- * Returns the role of a given user.
110
- */
111
- getUserRole(user: RtcServerUser): string | undefined;
37
+ /**
38
+ * A map of session collections connected to the separate channels.
39
+ *
40
+ * The keys of the map are channel IDs and the values are collections of sessions.
41
+ *
42
+ * A session is represented by an object with the following properties:
43
+ * * `id` - A unique session ID.
44
+ * * `user` - A reference to the user.
45
+ */
46
+ channelSessions: Map<string, Collection<ISocket>>;
47
+ /**
48
+ * A map of user collections connected to the separate channels.
49
+ *
50
+ * The keys of the map are channel IDs and the values are collections of users.
51
+ */
52
+ channelConnectedUsers: Map<string, Collection<ISocket>>;
53
+ /**
54
+ * A collection of users currently connected to all channels.
55
+ *
56
+ * A local user is always the first element in this collection.
57
+ */
58
+ allConnectedUsers: Collection<User>;
59
+ /**
60
+ * @inheritDoc
61
+ */
62
+ static get pluginName(): "Sessions";
63
+ /**
64
+ * @inheritDoc
65
+ */
66
+ static override get isOfficialPlugin(): true;
67
+ /**
68
+ * @inheritDoc
69
+ */
70
+ static override get isPremiumPlugin(): true;
71
+ /**
72
+ * @inheritDoc
73
+ */
74
+ static get requires(): PluginDependenciesOf<[WebSocketGateway, Users]>;
75
+ /**
76
+ * @inheritDoc
77
+ */
78
+ constructor(context: Editor | Context);
79
+ /**
80
+ * @inheritDoc
81
+ */
82
+ init(): void;
83
+ /**
84
+ * Observes given service sessions and updates session and users according to it.
85
+ */
86
+ register(channelId: string, serviceSessions: SessionCollection): void;
87
+ /**
88
+ * Stops observing given service sessions and remove all related sessions and users.
89
+ */
90
+ unregister(channelId: string): void;
91
+ /**
92
+ * Session id of the current client.
93
+ */
94
+ get mySessionId(): string;
95
+ /**
96
+ * Returns a reference to the user connected with a session with the given ID.
97
+ */
98
+ getUserBySessionId(sessionId: string): RtcServerUser | undefined;
99
+ /**
100
+ * Returns a set of ids of all currently connected sessions for the given user.
101
+ *
102
+ * When one user is connected to the same document in two separate browser tabs
103
+ * then this users belongs to the two sessions.
104
+ *
105
+ * Optionally the result can be limited to the given channelId.
106
+ */
107
+ getUserSessions(user: RtcServerUser, channelId?: string): Set<string>;
108
+ /**
109
+ * Returns the role of a given user.
110
+ */
111
+ getUserRole(user: RtcServerUser): string | undefined;
112
112
  }
113
113
  /**
114
- * Fired when the new user session is added.
115
- *
116
- * @eventName ~Sessions#sessionAdd:channelId
117
- */
114
+ * Fired when the new user session is added.
115
+ *
116
+ * @eventName ~Sessions#sessionAdd:channelId
117
+ */
118
118
  export type RtcSessionAddEvent = {
119
- name: 'sessionAdd' | `sessionAdd:${string}`;
120
- args: [
121
- {
122
- channelId: string;
123
- session: ISocket;
124
- }
125
- ];
119
+ name: "sessionAdd" | `sessionAdd:${string}`;
120
+ args: [{
121
+ channelId: string;
122
+ session: ISocket;
123
+ }];
126
124
  };
@@ -1,51 +1,51 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
- */
2
+ * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
5
  /**
6
- * @module real-time-collaboration/realtimecollaborativeediting/usermarkers
7
- */
8
- import { Plugin } from '@ckeditor/ckeditor5-core';
9
- import { Sessions } from './sessions.js';
10
- import '../../theme/usermarkers.css';
6
+ * @module real-time-collaboration/realtimecollaborativeediting/usermarkers
7
+ */
8
+ import { Plugin, type PluginDependenciesOf } from "@ckeditor/ckeditor5-core";
9
+ import { Sessions } from "./sessions.js";
10
+ import "../../theme/usermarkers.css";
11
11
  /**
12
- * This plugin:
13
- *
14
- * 1. Creates marker operations with current user selection on demand.
15
- * 2. Renders clients selection markers.
16
- *
17
- * This plugin does not create markers automatically, instead it provides an API for it {@link #createUserMarkerOperations}.
18
- * {@link RealTimeCollaborationClient} uses this API to create user selection operations in the most optimal moment
19
- * (as the last operation in the operations package) - this is to reach the best compression result.
20
- */
12
+ * This plugin:
13
+ *
14
+ * 1. Creates marker operations with current user selection on demand.
15
+ * 2. Renders clients selection markers.
16
+ *
17
+ * This plugin does not create markers automatically, instead it provides an API for it {@link #createUserMarkerOperations}.
18
+ * {@link RealTimeCollaborationClient} uses this API to create user selection operations in the most optimal moment
19
+ * (as the last operation in the operations package) - this is to reach the best compression result.
20
+ */
21
21
  export declare class UserMarkers extends Plugin {
22
- /**
23
- * @inheritDoc
24
- */
25
- static get requires(): readonly [typeof Sessions];
26
- /**
27
- * @inheritDoc
28
- */
29
- static get pluginName(): "UserMarkers";
30
- /**
31
- * @inheritDoc
32
- */
33
- static get isOfficialPlugin(): true;
34
- /**
35
- * @inheritDoc
36
- */
37
- static get isPremiumPlugin(): true;
38
- /**
39
- * @inheritDoc
40
- */
41
- init(): void;
42
- afterInit(): void;
43
- /**
44
- * @inheritDoc
45
- */
46
- destroy(): void;
47
- /**
48
- * Creates marker operations with current user selection.
49
- */
50
- createUserMarkerOperations(): void;
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get requires(): PluginDependenciesOf<[Sessions]>;
26
+ /**
27
+ * @inheritDoc
28
+ */
29
+ static get pluginName(): "UserMarkers";
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ static override get isOfficialPlugin(): true;
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ static override get isPremiumPlugin(): true;
38
+ /**
39
+ * @inheritDoc
40
+ */
41
+ init(): void;
42
+ afterInit(): void;
43
+ /**
44
+ * @inheritDoc
45
+ */
46
+ override destroy(): void;
47
+ /**
48
+ * Creates marker operations with current user selection.
49
+ */
50
+ createUserMarkerOperations(): void;
51
51
  }