@ckeditor/ckeditor5-collaboration-core 41.2.1 → 41.3.0-alpha.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/dist/content-index.css +332 -0
- package/dist/editor-index.css +312 -0
- package/dist/index.css +951 -0
- package/dist/translations/af.d.ts +8 -0
- package/dist/translations/af.js +23 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +23 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +23 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +23 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +23 -0
- package/dist/translations/bs.d.ts +8 -0
- package/dist/translations/bs.js +23 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +23 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +23 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +23 -0
- package/dist/translations/de-ch.d.ts +8 -0
- package/dist/translations/de-ch.js +23 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +23 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +23 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +23 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +23 -0
- package/dist/translations/es-co.d.ts +8 -0
- package/dist/translations/es-co.js +23 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +23 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +23 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +23 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +23 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +23 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +23 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +23 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +23 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +23 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +23 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +23 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +23 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +23 -0
- package/dist/translations/jv.d.ts +8 -0
- package/dist/translations/jv.js +23 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +23 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +23 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +23 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +23 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +23 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +23 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +23 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +23 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +23 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +23 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +23 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +23 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +23 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +23 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +23 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +23 -0
- package/dist/translations/tk.d.ts +8 -0
- package/dist/translations/tk.js +23 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +23 -0
- package/dist/translations/tt.d.ts +8 -0
- package/dist/translations/tt.js +23 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +23 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +23 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +23 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +23 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +23 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +23 -0
- package/dist/types/augmentation.d.ts +42 -0
- package/dist/types/collaborationhistory.d.ts +25 -0
- package/dist/types/collaborationoperation.d.ts +32 -0
- package/dist/types/config.d.ts +106 -0
- package/dist/types/index.d.ts +23 -0
- package/dist/types/permissions.d.ts +50 -0
- package/dist/types/suggestionstyles.d.ts +16 -0
- package/dist/types/users/view/userview.d.ts +20 -0
- package/dist/types/users.d.ts +169 -0
- package/dist/types/utils/common-translations.d.ts +13 -0
- package/dist/types/utils/confirmmixin.d.ts +24 -0
- package/dist/types/utils/confirmview.d.ts +17 -0
- package/dist/types/utils/getdatetimeformatter.d.ts +33 -0
- package/dist/types/utils/getmarkerdomelement.d.ts +26 -0
- package/dist/types/utils/hashobject.d.ts +12 -0
- package/dist/types/utils/sanitizeEditorConfig.d.ts +19 -0
- package/dist/types/utils/surroundingmarkersdetector.d.ts +20 -0
- package/dist/types/utils/trim-html.d.ts +20 -0
- package/package.json +3 -2
- package/src/index.d.ts +2 -2
- package/src/index.js +1 -1
- package/src/permissions.js +1 -1
- package/src/suggestionstyles.js +1 -1
- package/src/users/view/userview.js +1 -1
- package/src/users.js +1 -1
- package/src/utils/common-translations.js +1 -1
- package/src/utils/confirmmixin.js +1 -1
- package/src/utils/confirmview.js +1 -1
- package/src/utils/getdatetimeformatter.js +1 -1
- package/src/utils/getmarkerdomelement.js +1 -1
- package/src/utils/hashobject.js +1 -1
- package/src/utils/sanitizeEditorConfig.js +1 -1
- package/src/utils/surroundingmarkersdetector.js +1 -1
- package/src/utils/trim-html.js +1 -1
@@ -0,0 +1,42 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
import type { LocaleConfig, Users } from './index.js';
|
10
|
+
import type { RealTimeCollaborationConfig } from './config.js';
|
11
|
+
declare module '@ckeditor/ckeditor5-core' {
|
12
|
+
interface EditorConfig {
|
13
|
+
/**
|
14
|
+
* The locale configuration of the editor.
|
15
|
+
*/
|
16
|
+
locale?: LocaleConfig;
|
17
|
+
/**
|
18
|
+
* The users plugin configuration.
|
19
|
+
*/
|
20
|
+
users?: {
|
21
|
+
/**
|
22
|
+
* User ID value that will be used for the anonymous user.
|
23
|
+
*/
|
24
|
+
anonymousUserId?: string;
|
25
|
+
/**
|
26
|
+
* Number of defined colors that are randomly assigned to users.
|
27
|
+
*/
|
28
|
+
colorsCount?: number;
|
29
|
+
};
|
30
|
+
/**
|
31
|
+
* The configuration of the real time collaboration feature.
|
32
|
+
*
|
33
|
+
* Read more in {@link module:collaboration-core/config~RealTimeCollaborationConfig}.
|
34
|
+
*
|
35
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
36
|
+
*/
|
37
|
+
collaboration?: RealTimeCollaborationConfig;
|
38
|
+
}
|
39
|
+
interface PluginsMap {
|
40
|
+
[Users.pluginName]: Users;
|
41
|
+
}
|
42
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module collaboration-core/collaborationhistory
|
11
|
+
* @publicApi
|
12
|
+
*/
|
13
|
+
import type { default as CollaborationOperation } from './collaborationoperation.js';
|
14
|
+
/**
|
15
|
+
* Interface compatible with {@link module:engine/model/history~History} with the difference that it uses
|
16
|
+
* {@link module:collaboration-core/collaborationoperation~CollaborationOperation} instead of regular model operations.
|
17
|
+
*/
|
18
|
+
export default interface CollaborationHistory {
|
19
|
+
_operations: Array<CollaborationOperation>;
|
20
|
+
version: number;
|
21
|
+
getOperations(fromBaseVersion?: number, toBaseVersion?: number): Array<CollaborationOperation>;
|
22
|
+
getOperation(baseVersion: number): CollaborationOperation | undefined;
|
23
|
+
addOperation(operation: CollaborationOperation): void;
|
24
|
+
reset(): void;
|
25
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module collaboration-core/collaborationoperation
|
11
|
+
* @publicApi
|
12
|
+
*/
|
13
|
+
import type { Operation, InsertOperation, MergeOperation, MoveOperation, SplitOperation, MarkerOperation, RootOperation, RootAttributeOperation } from 'ckeditor5/src/engine.js';
|
14
|
+
/**
|
15
|
+
* Extends the {@link module:engine/model/operation/operation operation}.
|
16
|
+
*/
|
17
|
+
export default interface CollaborationOperation extends Operation {
|
18
|
+
_isInit?: boolean;
|
19
|
+
_authorId?: null | string;
|
20
|
+
_isDisconnection?: boolean;
|
21
|
+
createdAt?: Date;
|
22
|
+
wasUndone?: boolean;
|
23
|
+
affectsData?: Record<string, any>;
|
24
|
+
clone(): CollaborationOperation;
|
25
|
+
}
|
26
|
+
export type InsertCollaborationOperation = CollaborationOperation & InsertOperation;
|
27
|
+
export type MoveCollaborationOperation = CollaborationOperation & MoveOperation;
|
28
|
+
export type MergeCollaborationOperation = CollaborationOperation & MergeOperation;
|
29
|
+
export type SplitCollaborationOperation = CollaborationOperation & SplitOperation;
|
30
|
+
export type MarkerCollaborationOperation = CollaborationOperation & MarkerOperation;
|
31
|
+
export type RootCollaborationOperation = CollaborationOperation & RootOperation;
|
32
|
+
export type RootAttributeCollaborationOperation = CollaborationOperation & RootAttributeOperation;
|
@@ -0,0 +1,106 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module collaboration-core/config
|
11
|
+
* @publicApi
|
12
|
+
*/
|
13
|
+
/**
|
14
|
+
* The locale configuration.
|
15
|
+
*
|
16
|
+
* ```ts
|
17
|
+
* ClassicEditor
|
18
|
+
* .create( {
|
19
|
+
* locale: {
|
20
|
+
* // The localization configuration.
|
21
|
+
* }
|
22
|
+
* } )
|
23
|
+
* .then( ... )
|
24
|
+
* .catch( ... );
|
25
|
+
* ```
|
26
|
+
*
|
27
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
|
28
|
+
*/
|
29
|
+
export interface LocaleConfig {
|
30
|
+
/**
|
31
|
+
* A function that formats date to the custom format. It is used in dates in annotations (balloons) displaying
|
32
|
+
* comments and suggestions details.
|
33
|
+
*
|
34
|
+
* The default formatting can be changed by setting a custom formatting function to `config.locale.dateTimeFormat`.
|
35
|
+
*
|
36
|
+
* ```ts
|
37
|
+
* import format from 'date-fns/format';
|
38
|
+
*
|
39
|
+
* ClassicEditor
|
40
|
+
* .create( document.querySelector( '#editor' ), {
|
41
|
+
* toolbar: {
|
42
|
+
* items: [ 'bold', 'italic', '|', 'comment' ]
|
43
|
+
* },
|
44
|
+
* sidebar: {
|
45
|
+
* container: document.querySelector( '#sidebar' )
|
46
|
+
* },
|
47
|
+
* locale: {
|
48
|
+
* dateTimeFormat: date => format( date, 'dd/MM/yyyy' )
|
49
|
+
* }
|
50
|
+
* } )
|
51
|
+
* .catch( error => console.error( error ) );
|
52
|
+
* ```
|
53
|
+
*
|
54
|
+
* @returns The generated date.
|
55
|
+
*/
|
56
|
+
dateTimeFormat?: (date: Date) => string;
|
57
|
+
}
|
58
|
+
/**
|
59
|
+
* The configuration of the real-time collaboration features.
|
60
|
+
*
|
61
|
+
* ```ts
|
62
|
+
* ClassicEditor
|
63
|
+
* .create( {
|
64
|
+
* collaboration: ... // Collaboration features configuration.
|
65
|
+
* } )
|
66
|
+
* .then( ... )
|
67
|
+
* .catch( ... );
|
68
|
+
* ```
|
69
|
+
*
|
70
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
71
|
+
*/
|
72
|
+
export interface RealTimeCollaborationConfig {
|
73
|
+
/**
|
74
|
+
* The channel ID is a unique ID that identifies the data loaded in the editor instance or used by
|
75
|
+
* the context instance.
|
76
|
+
*
|
77
|
+
* If specified for the editor, it is the document ID.
|
78
|
+
*
|
79
|
+
* If you are using multiple editors instances at the same time, each of them should use a different
|
80
|
+
* channel ID to connect to a specific document.
|
81
|
+
*
|
82
|
+
* If specified for context, it is the ID for all the data related to context instance.
|
83
|
+
* This ID will be used for data that is not related to an editor instance, for example comments
|
84
|
+
* outside the editor.
|
85
|
+
*
|
86
|
+
* In the case of context, the ID can be an ID of a subpage or a form, or a different entity accordingly
|
87
|
+
* to your application.
|
88
|
+
*
|
89
|
+
* The channel ID can be used to recognize entity to which piece of data belongs in integrations that use `Context`
|
90
|
+
* and context plugins. For example, if you are preparing a custom integration using the comments API,
|
91
|
+
* you can use the channel ID to recognize whether the comment was added to an editor instance
|
92
|
+
* (and which one) or to the context.
|
93
|
+
*
|
94
|
+
* ```ts
|
95
|
+
* ClassicEditor
|
96
|
+
* .create( {
|
97
|
+
* collaboration: {
|
98
|
+
* channelId: 'your-channel-id'
|
99
|
+
* }
|
100
|
+
* } )
|
101
|
+
* .then( ... )
|
102
|
+
* .catch( ... );
|
103
|
+
* ```
|
104
|
+
*/
|
105
|
+
channelId?: string;
|
106
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
export { default as Permissions } from './permissions.js';
|
10
|
+
export { default as Users, type User } from './users.js';
|
11
|
+
export { default as UserView } from './users/view/userview.js';
|
12
|
+
export { default as getDateTimeFormatter } from './utils/getdatetimeformatter.js';
|
13
|
+
export { default as getMarkerDomElement, getAllMarkersDomElementsSorted } from './utils/getmarkerdomelement.js';
|
14
|
+
export { default as trimHtml } from './utils/trim-html.js';
|
15
|
+
export { default as ConfirmMixin } from './utils/confirmmixin.js';
|
16
|
+
export { default as hashObject } from './utils/hashobject.js';
|
17
|
+
export { default as sanitizeEditorConfig } from './utils/sanitizeEditorConfig.js';
|
18
|
+
export { default as surroundingMarkersDetector } from './utils/surroundingmarkersdetector.js';
|
19
|
+
export type { default as CollaborationOperation, InsertCollaborationOperation, SplitCollaborationOperation, MarkerCollaborationOperation, MoveCollaborationOperation, MergeCollaborationOperation, RootCollaborationOperation, RootAttributeCollaborationOperation } from './collaborationoperation.js';
|
20
|
+
export type { default as CollaborationHistory } from './collaborationhistory.js';
|
21
|
+
export type { LocaleConfig, RealTimeCollaborationConfig } from './config.js';
|
22
|
+
export * from './suggestionstyles.js';
|
23
|
+
import './augmentation.js';
|
@@ -0,0 +1,50 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module collaboration-core/permissions
|
11
|
+
* @publicApi
|
12
|
+
*/
|
13
|
+
import { ContextPlugin } from 'ckeditor5/src/core.js';
|
14
|
+
/**
|
15
|
+
* The `Permissions` plugin manages permissions set for the local user.
|
16
|
+
*
|
17
|
+
* Following is the list of all defined permissions:
|
18
|
+
*
|
19
|
+
* * `document:write` - modify the content of the document, and resolve comment threads created by any user,
|
20
|
+
* * `comment:write` - create, edit and remove own comments and create, remove own comment threads,
|
21
|
+
* and resolve comment threads created by any user,
|
22
|
+
* * `comment:admin` - resolve and remove comment threads created by other users (enables `comment:write`).
|
23
|
+
* * `comment:modify_all` - edit and remove any comments created by other users.
|
24
|
+
*
|
25
|
+
* For example, a user with `comment:write` permission but with no `document:write` permission will be able to add
|
26
|
+
* comments but will not be able to change the document data (comments-only mode).
|
27
|
+
*
|
28
|
+
* By default, the following permissions are set: `document:write`, `comment:write`, `comment:admin`.
|
29
|
+
*
|
30
|
+
* Permissions are handled separately for each channel id (for each editor instance and context instance).
|
31
|
+
*
|
32
|
+
* See also the {@glink features/collaboration/users#user-permissions User permissions} guide to learn how to use this plugin.
|
33
|
+
*/
|
34
|
+
export default class Permissions extends ContextPlugin {
|
35
|
+
/**
|
36
|
+
* @inheritDoc
|
37
|
+
*/
|
38
|
+
static get pluginName(): "Permissions";
|
39
|
+
/**
|
40
|
+
* Sets permissions for editor/context instance with given `channelId`.
|
41
|
+
*
|
42
|
+
* If `channelId` is not set, the channel id of the editor/context to which the plugin was added will be used.
|
43
|
+
* This means that it is not required if the plugin is added to the editor configuration and {@link module:core/context~Context}
|
44
|
+
* is not used.
|
45
|
+
*
|
46
|
+
* @param permissions Permissions to set.
|
47
|
+
* @param channelId The channel ID.
|
48
|
+
*/
|
49
|
+
setPermissions(permissions: Array<string>, channelId?: string): void;
|
50
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
import '../theme/suggestion.css';
|
10
|
+
import '../theme/suggestionmarker.css';
|
11
|
+
import '../theme/integrations/image.css';
|
12
|
+
import '../theme/integrations/horizontalline.css';
|
13
|
+
import '../theme/integrations/mediaembed.css';
|
14
|
+
import '../theme/integrations/pagebreak.css';
|
15
|
+
import '../theme/integrations/table.css';
|
16
|
+
import '../theme/integrations/codeblock.css';
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module collaboration-core/users/view/userview
|
11
|
+
*/
|
12
|
+
import { View, type TemplateDefinition } from 'ckeditor5/src/ui.js';
|
13
|
+
import type { Locale } from 'ckeditor5/src/utils.js';
|
14
|
+
import type { User } from '../../users.js';
|
15
|
+
import '../../../theme/users.css';
|
16
|
+
export default class UserView extends View {
|
17
|
+
name: string;
|
18
|
+
notificationView: TemplateDefinition | null;
|
19
|
+
constructor(locale: Locale, user: User, notificationText?: null | string);
|
20
|
+
}
|
@@ -0,0 +1,169 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module collaboration-core/users
|
11
|
+
* @publicApi
|
12
|
+
*/
|
13
|
+
import { ContextPlugin, type Context, type Editor } from 'ckeditor5/src/core.js';
|
14
|
+
import { Collection } from 'ckeditor5/src/utils.js';
|
15
|
+
import Permissions from './permissions.js';
|
16
|
+
import '../theme/usercolors.css';
|
17
|
+
/**
|
18
|
+
* The `Users` plugin provides the basic interface for setting and getting users involved in the document editing process.
|
19
|
+
*/
|
20
|
+
export default class Users extends ContextPlugin {
|
21
|
+
licenseKey: string;
|
22
|
+
/**
|
23
|
+
* Holds all {@link module:collaboration-core/users~User users} added to the editor.
|
24
|
+
*
|
25
|
+
* Note, that the {@link module:collaboration-core/users~User#isAnonymous anonymous user} is always present in the editor.
|
26
|
+
* You may want to filter it out when processing the users lists.
|
27
|
+
*
|
28
|
+
* ```ts
|
29
|
+
* for ( const user of editor.plugins.get( 'Users' ).users ) {
|
30
|
+
* if ( !user.isAnonymous ) {
|
31
|
+
* console.log( user.name );
|
32
|
+
* }
|
33
|
+
* }
|
34
|
+
* ```
|
35
|
+
*
|
36
|
+
* Use {@link #addUser} to add a new user.
|
37
|
+
*/
|
38
|
+
readonly users: Collection<User>;
|
39
|
+
/**
|
40
|
+
* @inheritDoc
|
41
|
+
*/
|
42
|
+
static get pluginName(): "Users";
|
43
|
+
/**
|
44
|
+
* @inheritDoc
|
45
|
+
*/
|
46
|
+
static get requires(): readonly [typeof Permissions];
|
47
|
+
/**
|
48
|
+
* @inheritDoc
|
49
|
+
*/
|
50
|
+
constructor(context: Context | Editor);
|
51
|
+
/**
|
52
|
+
* @inheritDoc
|
53
|
+
*/
|
54
|
+
init(): void;
|
55
|
+
/**
|
56
|
+
* A reference to the local user or `null` if it has not been set.
|
57
|
+
*/
|
58
|
+
get me(): User | null;
|
59
|
+
/**
|
60
|
+
* Adds a new user to the list of users.
|
61
|
+
*/
|
62
|
+
addUser({ id, name, ...additionalData }: Partial<UserData>): User;
|
63
|
+
/**
|
64
|
+
* Returns the user with a given ID.
|
65
|
+
*/
|
66
|
+
getUser(id: string): User | null;
|
67
|
+
/**
|
68
|
+
* Sets an {@link module:collaboration-core/users~User#isAnonymous anonymous user} as {@link #me the local user}.
|
69
|
+
*
|
70
|
+
* The local user ID will be set to the value of `config.users.anonymousUserId` property. All actions performed by the local user
|
71
|
+
* will be contributed to the anonymous user.
|
72
|
+
*/
|
73
|
+
useAnonymousUser(): void;
|
74
|
+
/**
|
75
|
+
* Sets the user with the given ID as the local user ({@link #me}).
|
76
|
+
*
|
77
|
+
* The local user can be only set once (this includes setting anonymous as the local user).
|
78
|
+
*/
|
79
|
+
defineMe(userId: string): void;
|
80
|
+
/**
|
81
|
+
* Returns the author of the operation. It returns {@link #me} by default if it is not overwritten.
|
82
|
+
*/
|
83
|
+
getOperationAuthor(): User | null;
|
84
|
+
/**
|
85
|
+
* @inheritDoc
|
86
|
+
*/
|
87
|
+
destroy(): void;
|
88
|
+
}
|
89
|
+
/**
|
90
|
+
* The representation of a single user that is involved in document editing.
|
91
|
+
*/
|
92
|
+
export declare class User {
|
93
|
+
/**
|
94
|
+
* The ID of the user.
|
95
|
+
*/
|
96
|
+
id: string;
|
97
|
+
/**
|
98
|
+
* CSS colors classes object for the user.
|
99
|
+
*/
|
100
|
+
color: Color;
|
101
|
+
/**
|
102
|
+
* The name of the user.
|
103
|
+
*/
|
104
|
+
name: string;
|
105
|
+
/**
|
106
|
+
* The URL pointing to the image with the avatar of the user.
|
107
|
+
*
|
108
|
+
* If avatar is not set, default avatar is used.
|
109
|
+
*/
|
110
|
+
avatar: string | undefined;
|
111
|
+
/**
|
112
|
+
* @param data User data.
|
113
|
+
* @param data.id The ID of the user.
|
114
|
+
* @param data.color A helper object to generate CSS classes with the user color in the UI.
|
115
|
+
* @param data.name The name of the user.
|
116
|
+
* @param data.avatar The URL to the user avatar.
|
117
|
+
*/
|
118
|
+
constructor(data: UserData);
|
119
|
+
/**
|
120
|
+
* Is `true` for the anonymous user, `false` otherwise.
|
121
|
+
*
|
122
|
+
* The anonymous user is used when there is no defined user for given resource.
|
123
|
+
*
|
124
|
+
* The situations when the anonymous user is used will depend on your application. For example, it can be used when the editor can be
|
125
|
+
* used by "guest" users of your application, or when the original user's account was removed.
|
126
|
+
*/
|
127
|
+
get isAnonymous(): boolean;
|
128
|
+
/**
|
129
|
+
* Is `true` for the {@link module:collaboration-core/users~Users#me local user}.
|
130
|
+
*/
|
131
|
+
get isMe(): boolean;
|
132
|
+
/**
|
133
|
+
* The initials of the user.
|
134
|
+
*
|
135
|
+
* The initials are composed from the user name's first and last words:
|
136
|
+
*
|
137
|
+
* * for `Joe Doe`, the initials are `JD`,
|
138
|
+
* * for `Anonymous` the initials are `A`,
|
139
|
+
* * for `Katie John-Newman` the initials are `KJ`,
|
140
|
+
* * for `Adam Daniel Smith` the initials are `AS`.
|
141
|
+
*/
|
142
|
+
get initials(): string;
|
143
|
+
}
|
144
|
+
/**
|
145
|
+
* The color object used to generate specified CSS classes with an individual color number assigned to the user.
|
146
|
+
*/
|
147
|
+
declare class Color {
|
148
|
+
constructor(colorId: number);
|
149
|
+
/**
|
150
|
+
* Returns CSS class for user avatar background color.
|
151
|
+
*/
|
152
|
+
getBackgroundColorClass(): string;
|
153
|
+
/**
|
154
|
+
* Returns CSS class for user selection highlight (the selected range).
|
155
|
+
*/
|
156
|
+
getSelectionClass(): string;
|
157
|
+
/**
|
158
|
+
* Returns CSS class for user caret position element (the pipe).
|
159
|
+
*/
|
160
|
+
getMarkerClass(): string;
|
161
|
+
}
|
162
|
+
type UserData = {
|
163
|
+
id: string;
|
164
|
+
color: Color;
|
165
|
+
name: string;
|
166
|
+
avatar?: string;
|
167
|
+
_isAnonymous?: boolean;
|
168
|
+
};
|
169
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module collaboration-core/utils/common-translations
|
11
|
+
*/
|
12
|
+
import type { Locale } from 'ckeditor5/src/utils.js';
|
13
|
+
export declare function getTranslation(locale: Locale, id: string): string;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module comments/comments/ui/view/confirmmixin
|
11
|
+
*/
|
12
|
+
import type { View } from 'ckeditor5/src/ui.js';
|
13
|
+
import type { Locale, Mixed } from 'ckeditor5/src/utils.js';
|
14
|
+
/**
|
15
|
+
* Adds interface for showing confirmation view in the specific for `CommentThreadView` and `CommentView` structure
|
16
|
+
* Confirm is always set to the `content` collection at the last position.
|
17
|
+
*/
|
18
|
+
export default function ConfirmMixin<Base extends new (...args: Array<any>) => View>(base: Base): Mixed<Base, ConfirmApi>;
|
19
|
+
export interface ConfirmApi {
|
20
|
+
isConfirm: boolean;
|
21
|
+
locale: Locale;
|
22
|
+
showConfirm(message: string, element: Element): Promise<unknown>;
|
23
|
+
cancelConfirm(): void;
|
24
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module comments/comments/ui/view/confirmview
|
11
|
+
*/
|
12
|
+
import { View } from 'ckeditor5/src/ui.js';
|
13
|
+
import type { Locale } from 'ckeditor5/src/utils.js';
|
14
|
+
export default class ConfirmView extends View {
|
15
|
+
message: string;
|
16
|
+
constructor(locale: Locale);
|
17
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
import type { LocaleConfig } from '../config.js';
|
10
|
+
/**
|
11
|
+
* Returns a function that formats the date to the set format.
|
12
|
+
*
|
13
|
+
* The default formatting can be changed by setting a custom formatting function to `config.locale.dateTimeFormat`.
|
14
|
+
*
|
15
|
+
* ```ts
|
16
|
+
* import format from 'date-fns/format';
|
17
|
+
*
|
18
|
+
* ClassicEditor
|
19
|
+
* .create( document.querySelector( '#editor' ), {
|
20
|
+
* toolbar: {
|
21
|
+
* items: [ 'bold', 'italic', '|', 'comment' ]
|
22
|
+
* },
|
23
|
+
* sidebar: {
|
24
|
+
* container: document.querySelector( '#sidebar' )
|
25
|
+
* },
|
26
|
+
* locale: {
|
27
|
+
* dateTimeFormat: date => format( date, 'dd/MM/yyyy' )
|
28
|
+
* }
|
29
|
+
* } )
|
30
|
+
* .catch( error => console.error( error ) );
|
31
|
+
* ```
|
32
|
+
*/
|
33
|
+
export default function getDateTimeFormatter(localeConfig?: LocaleConfig): (date: Date | string) => string;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
import type { EditingController, Marker } from 'ckeditor5/src/engine.js';
|
10
|
+
/**
|
11
|
+
* Returns a first DOM element mapped with the marker.
|
12
|
+
*
|
13
|
+
* @param editing Editing controller instance.
|
14
|
+
* @param marker Marker instance.
|
15
|
+
*/
|
16
|
+
export default function getMarkerDomElement(editing: EditingController, marker: Marker): HTMLElement | null;
|
17
|
+
/**
|
18
|
+
* Returns all DOM elements mapped with all given markers. DOM elements are sorted by their client rects in top-most, left-most order.
|
19
|
+
* Returns `null` if `markers` is empty or there are no DOM elements bound with the markers.
|
20
|
+
*
|
21
|
+
* Note, that markers should not intersect.
|
22
|
+
*
|
23
|
+
* @param editing Editing controller instance.
|
24
|
+
* @param markers Markers instances.
|
25
|
+
*/
|
26
|
+
export declare function getAllMarkersDomElementsSorted(editing: EditingController, markers: Array<Marker>): Array<HTMLElement> | null;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module track-changes/utils/hashobject
|
11
|
+
*/
|
12
|
+
export default function hashObject(obj: Record<string, unknown>): string;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module collaboration-core/utils/common-translations
|
11
|
+
*/
|
12
|
+
import type { Editor, EditorConfig } from 'ckeditor5/src/core.js';
|
13
|
+
/**
|
14
|
+
* A function that prepares config for internal editors removing all unnecessary plugins like RTC.
|
15
|
+
*
|
16
|
+
* @param editor The instance of the source editor.
|
17
|
+
* @param extraBlackListedPlugins Additional list of plugins that should not be added to the config.
|
18
|
+
*/
|
19
|
+
export default function sanitizeEditorConfig(editor: Editor, extraBlackListedPlugins?: Array<string>): EditorConfig;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
7
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
8
|
+
*/
|
9
|
+
/**
|
10
|
+
* @module collaboration-core/utils/surroundingmarkersdetector
|
11
|
+
*/
|
12
|
+
import type { Marker, Model } from 'ckeditor5/src/engine.js';
|
13
|
+
/**
|
14
|
+
* A utility that responds to range changes in the document selection and detects which markers' ranges
|
15
|
+
* touch or contain (surround) the document selection's focus.
|
16
|
+
*/
|
17
|
+
export default function surroundingMarkersDetector(model: Model, onMarkersChange: (changedMarkers: {
|
18
|
+
left: Array<Marker>;
|
19
|
+
entered: Array<Marker>;
|
20
|
+
}) => void): void;
|