@ckeditor/ckeditor5-collaboration-core 38.1.1 → 38.2.0-alpha.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/package.json +3 -2
- package/src/augmentation.d.ts +34 -34
- package/src/collaborationhistory.d.ts +17 -17
- package/src/collaborationoperation.d.ts +24 -24
- package/src/config.d.ts +98 -98
- package/src/index.d.ts +14 -13
- package/src/index.js +1 -1
- package/src/permissions.d.ts +41 -41
- package/src/permissions.js +1 -1
- package/src/suggestionstyles.d.ts +8 -8
- package/src/users/view/userview.d.ts +12 -12
- package/src/users/view/userview.js +1 -1
- package/src/users.d.ts +146 -146
- package/src/users.js +1 -1
- package/src/utils/common-translations.d.ts +5 -5
- package/src/utils/common-translations.js +1 -1
- package/src/utils/confirmmixin.d.ts +16 -16
- package/src/utils/confirmmixin.js +1 -1
- package/src/utils/confirmview.d.ts +9 -9
- package/src/utils/confirmview.js +1 -1
- package/src/utils/getdatetimeformatter.d.ts +29 -29
- package/src/utils/getdatetimeformatter.js +1 -1
- package/src/utils/getmarkerdomelement.d.ts +21 -21
- package/src/utils/getmarkerdomelement.js +1 -1
- package/src/utils/hashobject.d.ts +4 -4
- package/src/utils/hashobject.js +1 -1
- package/src/utils/sanitizeEditorConfig.d.ts +11 -0
- package/src/utils/sanitizeEditorConfig.js +23 -0
- package/src/utils/trim-html.d.ts +12 -12
- package/src/utils/trim-html.js +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ckeditor/ckeditor5-collaboration-core",
|
3
|
-
"version": "38.
|
3
|
+
"version": "38.2.0-alpha.1",
|
4
4
|
"description": "Base utilities used by CKEditor 5 collaboration features to support multiple users working together in a rich text editor.",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
@@ -30,8 +30,9 @@
|
|
30
30
|
"framework"
|
31
31
|
],
|
32
32
|
"main": "src/index.js",
|
33
|
+
"type": "module",
|
33
34
|
"dependencies": {
|
34
|
-
"ckeditor5": "38.
|
35
|
+
"ckeditor5": "38.2.0-alpha.1",
|
35
36
|
"date-fns": "^2.17.0"
|
36
37
|
},
|
37
38
|
"engines": {
|
package/src/augmentation.d.ts
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
import type { LocaleConfig, Users } from './index';
|
2
|
-
import type { RealTimeCollaborationConfig } from './config';
|
3
|
-
declare module '@ckeditor/ckeditor5-core' {
|
4
|
-
interface EditorConfig {
|
5
|
-
/**
|
6
|
-
* The locale configuration of the editor.
|
7
|
-
*/
|
8
|
-
locale?: LocaleConfig;
|
9
|
-
/**
|
10
|
-
* The users plugin configuration.
|
11
|
-
*/
|
12
|
-
users?: {
|
13
|
-
/**
|
14
|
-
* User ID value that will be used for the anonymous user.
|
15
|
-
*/
|
16
|
-
anonymousUserId?: string;
|
17
|
-
/**
|
18
|
-
* Number of defined colors that are randomly assigned to users.
|
19
|
-
*/
|
20
|
-
colorsCount?: number;
|
21
|
-
};
|
22
|
-
/**
|
23
|
-
* The configuration of the real time collaboration feature.
|
24
|
-
*
|
25
|
-
* Read more in {@link module:collaboration-core/config~RealTimeCollaborationConfig}.
|
26
|
-
*
|
27
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
28
|
-
*/
|
29
|
-
collaboration?: RealTimeCollaborationConfig;
|
30
|
-
}
|
31
|
-
interface PluginsMap {
|
32
|
-
[Users.pluginName]: Users;
|
33
|
-
}
|
34
|
-
}
|
1
|
+
import type { LocaleConfig, Users } from './index.js';
|
2
|
+
import type { RealTimeCollaborationConfig } from './config.js';
|
3
|
+
declare module '@ckeditor/ckeditor5-core' {
|
4
|
+
interface EditorConfig {
|
5
|
+
/**
|
6
|
+
* The locale configuration of the editor.
|
7
|
+
*/
|
8
|
+
locale?: LocaleConfig;
|
9
|
+
/**
|
10
|
+
* The users plugin configuration.
|
11
|
+
*/
|
12
|
+
users?: {
|
13
|
+
/**
|
14
|
+
* User ID value that will be used for the anonymous user.
|
15
|
+
*/
|
16
|
+
anonymousUserId?: string;
|
17
|
+
/**
|
18
|
+
* Number of defined colors that are randomly assigned to users.
|
19
|
+
*/
|
20
|
+
colorsCount?: number;
|
21
|
+
};
|
22
|
+
/**
|
23
|
+
* The configuration of the real time collaboration feature.
|
24
|
+
*
|
25
|
+
* Read more in {@link module:collaboration-core/config~RealTimeCollaborationConfig}.
|
26
|
+
*
|
27
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
28
|
+
*/
|
29
|
+
collaboration?: RealTimeCollaborationConfig;
|
30
|
+
}
|
31
|
+
interface PluginsMap {
|
32
|
+
[Users.pluginName]: Users;
|
33
|
+
}
|
34
|
+
}
|
@@ -1,17 +1,17 @@
|
|
1
|
-
/**
|
2
|
-
* @module collaboration-core/collaborationhistory
|
3
|
-
* @publicApi
|
4
|
-
*/
|
5
|
-
import type { default as CollaborationOperation } from './collaborationoperation';
|
6
|
-
/**
|
7
|
-
* Interface compatible with {@link module:engine/model/history~History} with the difference that it uses
|
8
|
-
* {@link module:collaboration-core/collaborationoperation~CollaborationOperation} instead of regular model operations.
|
9
|
-
*/
|
10
|
-
export default interface CollaborationHistory {
|
11
|
-
_operations: Array<CollaborationOperation>;
|
12
|
-
version: number;
|
13
|
-
getOperations(fromBaseVersion?: number, toBaseVersion?: number): Array<CollaborationOperation>;
|
14
|
-
getOperation(baseVersion: number): CollaborationOperation | undefined;
|
15
|
-
addOperation(operation: CollaborationOperation): void;
|
16
|
-
reset(): void;
|
17
|
-
}
|
1
|
+
/**
|
2
|
+
* @module collaboration-core/collaborationhistory
|
3
|
+
* @publicApi
|
4
|
+
*/
|
5
|
+
import type { default as CollaborationOperation } from './collaborationoperation.js';
|
6
|
+
/**
|
7
|
+
* Interface compatible with {@link module:engine/model/history~History} with the difference that it uses
|
8
|
+
* {@link module:collaboration-core/collaborationoperation~CollaborationOperation} instead of regular model operations.
|
9
|
+
*/
|
10
|
+
export default interface CollaborationHistory {
|
11
|
+
_operations: Array<CollaborationOperation>;
|
12
|
+
version: number;
|
13
|
+
getOperations(fromBaseVersion?: number, toBaseVersion?: number): Array<CollaborationOperation>;
|
14
|
+
getOperation(baseVersion: number): CollaborationOperation | undefined;
|
15
|
+
addOperation(operation: CollaborationOperation): void;
|
16
|
+
reset(): void;
|
17
|
+
}
|
@@ -1,24 +1,24 @@
|
|
1
|
-
/**
|
2
|
-
* @module collaboration-core/collaborationoperation
|
3
|
-
* @publicApi
|
4
|
-
*/
|
5
|
-
import type { Operation, InsertOperation, MergeOperation, MoveOperation, SplitOperation, MarkerOperation, RootOperation, RootAttributeOperation } from 'ckeditor5/src/engine';
|
6
|
-
/**
|
7
|
-
* Extends the {@link module:engine/model/operation/operation operation}.
|
8
|
-
*/
|
9
|
-
export default interface CollaborationOperation extends Operation {
|
10
|
-
_isInit?: boolean;
|
11
|
-
_authorId?: null | string;
|
12
|
-
_isDisconnection?: boolean;
|
13
|
-
createdAt?: Date;
|
14
|
-
wasUndone?: boolean;
|
15
|
-
affectsData?: Record<string, any>;
|
16
|
-
clone(): CollaborationOperation;
|
17
|
-
}
|
18
|
-
export type InsertCollaborationOperation = CollaborationOperation & InsertOperation;
|
19
|
-
export type MoveCollaborationOperation = CollaborationOperation & MoveOperation;
|
20
|
-
export type MergeCollaborationOperation = CollaborationOperation & MergeOperation;
|
21
|
-
export type SplitCollaborationOperation = CollaborationOperation & SplitOperation;
|
22
|
-
export type MarkerCollaborationOperation = CollaborationOperation & MarkerOperation;
|
23
|
-
export type RootCollaborationOperation = CollaborationOperation & RootOperation;
|
24
|
-
export type RootAttributeCollaborationOperation = CollaborationOperation & RootAttributeOperation;
|
1
|
+
/**
|
2
|
+
* @module collaboration-core/collaborationoperation
|
3
|
+
* @publicApi
|
4
|
+
*/
|
5
|
+
import type { Operation, InsertOperation, MergeOperation, MoveOperation, SplitOperation, MarkerOperation, RootOperation, RootAttributeOperation } from 'ckeditor5/src/engine.js';
|
6
|
+
/**
|
7
|
+
* Extends the {@link module:engine/model/operation/operation operation}.
|
8
|
+
*/
|
9
|
+
export default interface CollaborationOperation extends Operation {
|
10
|
+
_isInit?: boolean;
|
11
|
+
_authorId?: null | string;
|
12
|
+
_isDisconnection?: boolean;
|
13
|
+
createdAt?: Date;
|
14
|
+
wasUndone?: boolean;
|
15
|
+
affectsData?: Record<string, any>;
|
16
|
+
clone(): CollaborationOperation;
|
17
|
+
}
|
18
|
+
export type InsertCollaborationOperation = CollaborationOperation & InsertOperation;
|
19
|
+
export type MoveCollaborationOperation = CollaborationOperation & MoveOperation;
|
20
|
+
export type MergeCollaborationOperation = CollaborationOperation & MergeOperation;
|
21
|
+
export type SplitCollaborationOperation = CollaborationOperation & SplitOperation;
|
22
|
+
export type MarkerCollaborationOperation = CollaborationOperation & MarkerOperation;
|
23
|
+
export type RootCollaborationOperation = CollaborationOperation & RootOperation;
|
24
|
+
export type RootAttributeCollaborationOperation = CollaborationOperation & RootAttributeOperation;
|
package/src/config.d.ts
CHANGED
@@ -1,98 +1,98 @@
|
|
1
|
-
/**
|
2
|
-
* @module collaboration-core/config
|
3
|
-
* @publicApi
|
4
|
-
*/
|
5
|
-
/**
|
6
|
-
* The locale configuration.
|
7
|
-
*
|
8
|
-
* ```ts
|
9
|
-
* ClassicEditor
|
10
|
-
* .create( {
|
11
|
-
* locale: {
|
12
|
-
* // The localization configuration.
|
13
|
-
* }
|
14
|
-
* } )
|
15
|
-
* .then( ... )
|
16
|
-
* .catch( ... );
|
17
|
-
* ```
|
18
|
-
*
|
19
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
|
20
|
-
*/
|
21
|
-
export interface LocaleConfig {
|
22
|
-
/**
|
23
|
-
* A function that formats date to the custom format. It is used in dates in annotations (balloons) displaying
|
24
|
-
* comments and suggestions details.
|
25
|
-
*
|
26
|
-
* The default formatting can be changed by setting a custom formatting function to `config.locale.dateTimeFormat`.
|
27
|
-
*
|
28
|
-
* ```ts
|
29
|
-
* import format from 'date-fns/format'
|
30
|
-
*
|
31
|
-
* ClassicEditor
|
32
|
-
* .create( document.querySelector( '#editor' ), {
|
33
|
-
* toolbar: {
|
34
|
-
* items: [ 'bold', 'italic', '|', 'comment' ]
|
35
|
-
* },
|
36
|
-
* sidebar: {
|
37
|
-
* container: document.querySelector( '#sidebar' )
|
38
|
-
* },
|
39
|
-
* locale: {
|
40
|
-
* dateTimeFormat: date => format( date, 'dd/MM/yyyy' )
|
41
|
-
* }
|
42
|
-
* } )
|
43
|
-
* .catch( error => console.error( error ) );
|
44
|
-
* ```
|
45
|
-
*
|
46
|
-
* @returns The generated date.
|
47
|
-
*/
|
48
|
-
dateTimeFormat?: (date: Date) => string;
|
49
|
-
}
|
50
|
-
/**
|
51
|
-
* The configuration of the real-time collaboration features.
|
52
|
-
*
|
53
|
-
* ```ts
|
54
|
-
* ClassicEditor
|
55
|
-
* .create( {
|
56
|
-
* collaboration: ... // Collaboration features configuration.
|
57
|
-
* } )
|
58
|
-
* .then( ... )
|
59
|
-
* .catch( ... );
|
60
|
-
* ```
|
61
|
-
*
|
62
|
-
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
63
|
-
*/
|
64
|
-
export interface RealTimeCollaborationConfig {
|
65
|
-
/**
|
66
|
-
* The channel ID is a unique ID that identifies the data loaded in the editor instance or used by
|
67
|
-
* the context instance.
|
68
|
-
*
|
69
|
-
* If specified for the editor, it is the document ID.
|
70
|
-
*
|
71
|
-
* If you are using multiple editors instances at the same time, each of them should use a different
|
72
|
-
* channel ID to connect to a specific document.
|
73
|
-
*
|
74
|
-
* If specified for context, it is the ID for all the data related to context instance.
|
75
|
-
* This ID will be used for data that is not related to an editor instance, for example comments
|
76
|
-
* outside the editor.
|
77
|
-
*
|
78
|
-
* In the case of context, the ID can be an ID of a subpage or a form, or a different entity accordingly
|
79
|
-
* to your application.
|
80
|
-
*
|
81
|
-
* The channel ID can be used to recognize entity to which piece of data belongs in integrations that use `Context`
|
82
|
-
* and context plugins. For example, if you are preparing a custom integration using the comments API,
|
83
|
-
* you can use the channel ID to recognize whether the comment was added to an editor instance
|
84
|
-
* (and which one) or to the context.
|
85
|
-
*
|
86
|
-
* ```ts
|
87
|
-
* ClassicEditor
|
88
|
-
* .create( {
|
89
|
-
* collaboration: {
|
90
|
-
* channelId: 'your-channel-id'
|
91
|
-
* }
|
92
|
-
* } )
|
93
|
-
* .then( ... )
|
94
|
-
* .catch( ... );
|
95
|
-
* ```
|
96
|
-
*/
|
97
|
-
channelId?: string;
|
98
|
-
}
|
1
|
+
/**
|
2
|
+
* @module collaboration-core/config
|
3
|
+
* @publicApi
|
4
|
+
*/
|
5
|
+
/**
|
6
|
+
* The locale configuration.
|
7
|
+
*
|
8
|
+
* ```ts
|
9
|
+
* ClassicEditor
|
10
|
+
* .create( {
|
11
|
+
* locale: {
|
12
|
+
* // The localization configuration.
|
13
|
+
* }
|
14
|
+
* } )
|
15
|
+
* .then( ... )
|
16
|
+
* .catch( ... );
|
17
|
+
* ```
|
18
|
+
*
|
19
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor configuration options}.
|
20
|
+
*/
|
21
|
+
export interface LocaleConfig {
|
22
|
+
/**
|
23
|
+
* A function that formats date to the custom format. It is used in dates in annotations (balloons) displaying
|
24
|
+
* comments and suggestions details.
|
25
|
+
*
|
26
|
+
* The default formatting can be changed by setting a custom formatting function to `config.locale.dateTimeFormat`.
|
27
|
+
*
|
28
|
+
* ```ts
|
29
|
+
* import format from 'date-fns/esm/format/index.js'
|
30
|
+
*
|
31
|
+
* ClassicEditor
|
32
|
+
* .create( document.querySelector( '#editor' ), {
|
33
|
+
* toolbar: {
|
34
|
+
* items: [ 'bold', 'italic', '|', 'comment' ]
|
35
|
+
* },
|
36
|
+
* sidebar: {
|
37
|
+
* container: document.querySelector( '#sidebar' )
|
38
|
+
* },
|
39
|
+
* locale: {
|
40
|
+
* dateTimeFormat: date => format( date, 'dd/MM/yyyy' )
|
41
|
+
* }
|
42
|
+
* } )
|
43
|
+
* .catch( error => console.error( error ) );
|
44
|
+
* ```
|
45
|
+
*
|
46
|
+
* @returns The generated date.
|
47
|
+
*/
|
48
|
+
dateTimeFormat?: (date: Date) => string;
|
49
|
+
}
|
50
|
+
/**
|
51
|
+
* The configuration of the real-time collaboration features.
|
52
|
+
*
|
53
|
+
* ```ts
|
54
|
+
* ClassicEditor
|
55
|
+
* .create( {
|
56
|
+
* collaboration: ... // Collaboration features configuration.
|
57
|
+
* } )
|
58
|
+
* .then( ... )
|
59
|
+
* .catch( ... );
|
60
|
+
* ```
|
61
|
+
*
|
62
|
+
* See {@link module:core/editor/editorconfig~EditorConfig all editor options}.
|
63
|
+
*/
|
64
|
+
export interface RealTimeCollaborationConfig {
|
65
|
+
/**
|
66
|
+
* The channel ID is a unique ID that identifies the data loaded in the editor instance or used by
|
67
|
+
* the context instance.
|
68
|
+
*
|
69
|
+
* If specified for the editor, it is the document ID.
|
70
|
+
*
|
71
|
+
* If you are using multiple editors instances at the same time, each of them should use a different
|
72
|
+
* channel ID to connect to a specific document.
|
73
|
+
*
|
74
|
+
* If specified for context, it is the ID for all the data related to context instance.
|
75
|
+
* This ID will be used for data that is not related to an editor instance, for example comments
|
76
|
+
* outside the editor.
|
77
|
+
*
|
78
|
+
* In the case of context, the ID can be an ID of a subpage or a form, or a different entity accordingly
|
79
|
+
* to your application.
|
80
|
+
*
|
81
|
+
* The channel ID can be used to recognize entity to which piece of data belongs in integrations that use `Context`
|
82
|
+
* and context plugins. For example, if you are preparing a custom integration using the comments API,
|
83
|
+
* you can use the channel ID to recognize whether the comment was added to an editor instance
|
84
|
+
* (and which one) or to the context.
|
85
|
+
*
|
86
|
+
* ```ts
|
87
|
+
* ClassicEditor
|
88
|
+
* .create( {
|
89
|
+
* collaboration: {
|
90
|
+
* channelId: 'your-channel-id'
|
91
|
+
* }
|
92
|
+
* } )
|
93
|
+
* .then( ... )
|
94
|
+
* .catch( ... );
|
95
|
+
* ```
|
96
|
+
*/
|
97
|
+
channelId?: string;
|
98
|
+
}
|
package/src/index.d.ts
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
-
export { default as Permissions } from './permissions';
|
2
|
-
export { default as Users, type User } from './users';
|
3
|
-
export { default as UserView } from './users/view/userview';
|
4
|
-
export { default as getDateTimeFormatter } from './utils/getdatetimeformatter';
|
5
|
-
export { default as getMarkerDomElement, getAllMarkersDomElementsSorted } from './utils/getmarkerdomelement';
|
6
|
-
export { default as trimHtml } from './utils/trim-html';
|
7
|
-
export { default as ConfirmMixin } from './utils/confirmmixin';
|
8
|
-
export { default as hashObject } from './utils/hashobject';
|
9
|
-
export { default as
|
10
|
-
export { default as
|
11
|
-
export type {
|
12
|
-
export
|
13
|
-
|
1
|
+
export { default as Permissions } from './permissions.js';
|
2
|
+
export { default as Users, type User } from './users.js';
|
3
|
+
export { default as UserView } from './users/view/userview.js';
|
4
|
+
export { default as getDateTimeFormatter } from './utils/getdatetimeformatter.js';
|
5
|
+
export { default as getMarkerDomElement, getAllMarkersDomElementsSorted } from './utils/getmarkerdomelement.js';
|
6
|
+
export { default as trimHtml } from './utils/trim-html.js';
|
7
|
+
export { default as ConfirmMixin } from './utils/confirmmixin.js';
|
8
|
+
export { default as hashObject } from './utils/hashobject.js';
|
9
|
+
export { default as sanitizeEditorConfig } from './utils/sanitizeEditorConfig.js';
|
10
|
+
export type { default as CollaborationOperation, InsertCollaborationOperation, SplitCollaborationOperation, MarkerCollaborationOperation, MoveCollaborationOperation, MergeCollaborationOperation, RootCollaborationOperation, RootAttributeCollaborationOperation } from './collaborationoperation.js';
|
11
|
+
export type { default as CollaborationHistory } from './collaborationhistory.js';
|
12
|
+
export type { LocaleConfig, RealTimeCollaborationConfig } from './config.js';
|
13
|
+
export * from './suggestionstyles.js';
|
14
|
+
import './augmentation.js';
|
package/src/index.js
CHANGED
@@ -20,4 +20,4 @@
|
|
20
20
|
*
|
21
21
|
*
|
22
22
|
*/
|
23
|
-
export{default as Permissions}from'./permissions';export{default as Users}from'./users';export{default as UserView}from'./users/view/userview';export{default as getDateTimeFormatter}from'./utils/getdatetimeformatter';export{default as getMarkerDomElement,getAllMarkersDomElementsSorted}from'./utils/getmarkerdomelement';export{default as trimHtml}from'./utils/trim-html';export{default as ConfirmMixin}from'./utils/confirmmixin';export{default as hashObject}from'./utils/hashobject';export*from'./suggestionstyles';import'./augmentation';
|
23
|
+
export{default as Permissions}from'./permissions.js';export{default as Users}from'./users.js';export{default as UserView}from'./users/view/userview.js';export{default as getDateTimeFormatter}from'./utils/getdatetimeformatter.js';export{default as getMarkerDomElement,getAllMarkersDomElementsSorted}from'./utils/getmarkerdomelement.js';export{default as trimHtml}from'./utils/trim-html.js';export{default as ConfirmMixin}from'./utils/confirmmixin.js';export{default as hashObject}from'./utils/hashobject.js';export{default as sanitizeEditorConfig}from'./utils/sanitizeEditorConfig.js';export*from'./suggestionstyles.js';import'./augmentation.js';
|
package/src/permissions.d.ts
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
/**
|
2
|
-
* @module collaboration-core/permissions
|
3
|
-
* @publicApi
|
4
|
-
*/
|
5
|
-
import { ContextPlugin } from 'ckeditor5/src/core';
|
6
|
-
/**
|
7
|
-
* The `Permissions` plugin manages permissions set for the local user.
|
8
|
-
*
|
9
|
-
* Following is the list of all defined permissions:
|
10
|
-
*
|
11
|
-
* * `document:write` - modify the content of the document,
|
12
|
-
* * `comment:write` - create, edit and remove own comments and create, resolve and remove own comment threads,
|
13
|
-
* * `comment:admin` - resolve and remove comment threads created by other users (enables `comment:write`).
|
14
|
-
* * `comment:modify_all` - edit and remove any comments created by other users.
|
15
|
-
*
|
16
|
-
* For example, a user with `comment:write` permission but with no `document:write` permission will be able to add
|
17
|
-
* comments but will not be able to change the document data (comments-only mode).
|
18
|
-
*
|
19
|
-
* By default, the following permissions are set: `document:write`, `comment:write`, `comment:admin`.
|
20
|
-
*
|
21
|
-
* Permissions are handled separately for each channel id (for each editor instance and context instance).
|
22
|
-
*
|
23
|
-
* See also the {@glink features/collaboration/users#user-permissions User permissions} guide to learn how to use this plugin.
|
24
|
-
*/
|
25
|
-
export default class Permissions extends ContextPlugin {
|
26
|
-
/**
|
27
|
-
* @inheritDoc
|
28
|
-
*/
|
29
|
-
static get pluginName(): "Permissions";
|
30
|
-
/**
|
31
|
-
* Sets permissions for editor/context instance with given `channelId`.
|
32
|
-
*
|
33
|
-
* If `channelId` is not set, the channel id of the editor/context to which the plugin was added will be used.
|
34
|
-
* This means that it is not required if the plugin is added to the editor configuration and {@link module:core/context~Context}
|
35
|
-
* is not used.
|
36
|
-
*
|
37
|
-
* @param permissions Permissions to set.
|
38
|
-
* @param channelId The channel ID.
|
39
|
-
*/
|
40
|
-
setPermissions(permissions: Array<string>, channelId?: string): void;
|
41
|
-
}
|
1
|
+
/**
|
2
|
+
* @module collaboration-core/permissions
|
3
|
+
* @publicApi
|
4
|
+
*/
|
5
|
+
import { ContextPlugin } from 'ckeditor5/src/core.js';
|
6
|
+
/**
|
7
|
+
* The `Permissions` plugin manages permissions set for the local user.
|
8
|
+
*
|
9
|
+
* Following is the list of all defined permissions:
|
10
|
+
*
|
11
|
+
* * `document:write` - modify the content of the document,
|
12
|
+
* * `comment:write` - create, edit and remove own comments and create, resolve and remove own comment threads,
|
13
|
+
* * `comment:admin` - resolve and remove comment threads created by other users (enables `comment:write`).
|
14
|
+
* * `comment:modify_all` - edit and remove any comments created by other users.
|
15
|
+
*
|
16
|
+
* For example, a user with `comment:write` permission but with no `document:write` permission will be able to add
|
17
|
+
* comments but will not be able to change the document data (comments-only mode).
|
18
|
+
*
|
19
|
+
* By default, the following permissions are set: `document:write`, `comment:write`, `comment:admin`.
|
20
|
+
*
|
21
|
+
* Permissions are handled separately for each channel id (for each editor instance and context instance).
|
22
|
+
*
|
23
|
+
* See also the {@glink features/collaboration/users#user-permissions User permissions} guide to learn how to use this plugin.
|
24
|
+
*/
|
25
|
+
export default class Permissions extends ContextPlugin {
|
26
|
+
/**
|
27
|
+
* @inheritDoc
|
28
|
+
*/
|
29
|
+
static get pluginName(): "Permissions";
|
30
|
+
/**
|
31
|
+
* Sets permissions for editor/context instance with given `channelId`.
|
32
|
+
*
|
33
|
+
* If `channelId` is not set, the channel id of the editor/context to which the plugin was added will be used.
|
34
|
+
* This means that it is not required if the plugin is added to the editor configuration and {@link module:core/context~Context}
|
35
|
+
* is not used.
|
36
|
+
*
|
37
|
+
* @param permissions Permissions to set.
|
38
|
+
* @param channelId The channel ID.
|
39
|
+
*/
|
40
|
+
setPermissions(permissions: Array<string>, channelId?: string): void;
|
41
|
+
}
|
package/src/permissions.js
CHANGED
@@ -20,4 +20,4 @@
|
|
20
20
|
*
|
21
21
|
*
|
22
22
|
*/
|
23
|
-
const
|
23
|
+
const _0x5bf1=['permissions-set-permissions-invalid-channel-id','no-permissions','CommentsOnly','editors','includes','context','disableReadOnlyMode','forceDisabled','pluginName','has','plugins','find','addCommentThread','setPermissions','get','collaboration.channelId','CommentsRepository','comment:modify_all','config','noPermissions','comment:admin','isEnabled'];(function(_0x22c44e,_0x5bf136){const _0x4a11b0=function(_0x314f12){while(--_0x314f12){_0x22c44e['push'](_0x22c44e['shift']());}};_0x4a11b0(++_0x5bf136);}(_0x5bf1,0xf6));const _0x4a11=function(_0x22c44e,_0x5bf136){_0x22c44e=_0x22c44e-0x0;let _0x4a11b0=_0x5bf1[_0x22c44e];return _0x4a11b0;};import{ContextPlugin as _0x5225f1,Editor as _0x2f8aea}from'ckeditor5/src/core.js';import{CKEditorError as _0x1e7373}from'ckeditor5/src/utils.js';export default class n extends _0x5225f1{static get[_0x4a11('0x4')](){return'Permissions';}[_0x4a11('0x9')](_0x5db67a,_0x27cfc){let _0x5daf3c;if(_0x27cfc||(_0x27cfc=this[_0x4a11('0x1')]['config'][_0x4a11('0xa')](_0x4a11('0xb'))),this[_0x4a11('0x1')][_0x4a11('0xe')][_0x4a11('0xa')]('collaboration.channelId')==_0x27cfc?_0x5daf3c=this[_0x4a11('0x1')]:_0x4a11('0x15')in this[_0x4a11('0x1')]&&this[_0x4a11('0x1')]['editors']&&(_0x5daf3c=this['context'][_0x4a11('0x15')][_0x4a11('0x7')](_0x3712e7=>_0x3712e7[_0x4a11('0xe')][_0x4a11('0xa')](_0x4a11('0xb'))==_0x27cfc)),!_0x5daf3c)throw new _0x1e7373(_0x4a11('0x12'),null);const _0x10b54b=_0x5daf3c[_0x4a11('0x6')],_0x2863cd=_0x10b54b[_0x4a11('0x5')](_0x4a11('0xc'))?_0x10b54b['get'](_0x4a11('0xc')):void 0x0,_0xfa6b9e=_0x10b54b[_0x4a11('0x5')](_0x4a11('0x14'))&&_0x10b54b[_0x4a11('0xa')]('CommentsOnly'),_0x1df945=_0x5db67a[_0x4a11('0x0')]('document:write'),_0x2940fb=_0x5db67a['includes'](_0x4a11('0xd')),_0x5245b3=_0x5db67a[_0x4a11('0x0')](_0x4a11('0x10')),_0x5715f0=_0x5db67a[_0x4a11('0x0')]('comment:write'),_0xc717a6=_0x5715f0||_0x5245b3,_0x21acb3=_0xc717a6||_0x2940fb,_0x58ae0d=_0x1df945||_0xc717a6;(_0xfa6b9e&&(_0xfa6b9e[_0x4a11('0x11')]=!_0x1df945&&_0x21acb3),_0x5daf3c instanceof _0x2f8aea)&&(!(_0x1df945||_0x21acb3&&_0x2863cd)?_0x5daf3c['enableReadOnlyMode'](_0x4a11('0x13')):_0x5daf3c[_0x4a11('0x2')](_0x4a11('0x13')));if(_0x2863cd){_0x2863cd['setPermissions']({'admin':_0x5245b3,'modifyAll':_0x2940fb,'write':_0x5715f0,'resolve':_0x58ae0d},_0x27cfc);const _0x5d4a67=_0x5daf3c instanceof _0x2f8aea&&_0x5daf3c['commands'][_0x4a11('0xa')](_0x4a11('0x8'));_0x5d4a67&&(_0xc717a6?_0x5d4a67['clearForceDisabled']('noPermissions'):_0x5d4a67[_0x4a11('0x3')](_0x4a11('0xf')));}}}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import '../theme/suggestion.css';
|
2
|
-
import '../theme/suggestionmarker.css';
|
3
|
-
import '../theme/integrations/image.css';
|
4
|
-
import '../theme/integrations/horizontalline.css';
|
5
|
-
import '../theme/integrations/mediaembed.css';
|
6
|
-
import '../theme/integrations/pagebreak.css';
|
7
|
-
import '../theme/integrations/table.css';
|
8
|
-
import '../theme/integrations/codeblock.css';
|
1
|
+
import '../theme/suggestion.css';
|
2
|
+
import '../theme/suggestionmarker.css';
|
3
|
+
import '../theme/integrations/image.css';
|
4
|
+
import '../theme/integrations/horizontalline.css';
|
5
|
+
import '../theme/integrations/mediaembed.css';
|
6
|
+
import '../theme/integrations/pagebreak.css';
|
7
|
+
import '../theme/integrations/table.css';
|
8
|
+
import '../theme/integrations/codeblock.css';
|
@@ -1,12 +1,12 @@
|
|
1
|
-
/**
|
2
|
-
* @module collaboration-core/users/view/userview
|
3
|
-
*/
|
4
|
-
import { View, type TemplateDefinition } from 'ckeditor5/src/ui';
|
5
|
-
import type { Locale } from 'ckeditor5/src/utils';
|
6
|
-
import type { User } from '../../users';
|
7
|
-
import '../../../theme/users.css';
|
8
|
-
export default class UserView extends View {
|
9
|
-
name: string;
|
10
|
-
notificationView: TemplateDefinition | null;
|
11
|
-
constructor(locale: Locale, user: User, notificationText?: null | string);
|
12
|
-
}
|
1
|
+
/**
|
2
|
+
* @module collaboration-core/users/view/userview
|
3
|
+
*/
|
4
|
+
import { View, type TemplateDefinition } from 'ckeditor5/src/ui.js';
|
5
|
+
import type { Locale } from 'ckeditor5/src/utils.js';
|
6
|
+
import type { User } from '../../users.js';
|
7
|
+
import '../../../theme/users.css';
|
8
|
+
export default class UserView extends View {
|
9
|
+
name: string;
|
10
|
+
notificationView: TemplateDefinition | null;
|
11
|
+
constructor(locale: Locale, user: User, notificationText?: null | string);
|
12
|
+
}
|
@@ -20,4 +20,4 @@
|
|
20
20
|
*
|
21
21
|
*
|
22
22
|
*/
|
23
|
-
const
|
23
|
+
const _0x425d=['isAnonymous','ck\x20ck-user__name','setTemplate','div','content','url(\x27','ck\x20ck-user__name\x20ck-user__name--hidden','notificationView','ck-user__icon','ck-user','ck-user__img','ck-user__notification','name','avatar','ck-user__avatar','push','ck-user__anonymous'];(function(_0xf85366,_0x425df2){const _0x4b6686=function(_0x16c3d3){while(--_0x16c3d3){_0xf85366['push'](_0xf85366['shift']());}};_0x4b6686(++_0x425df2);}(_0x425d,0xa5));const _0x4b66=function(_0xf85366,_0x425df2){_0xf85366=_0xf85366-0x0;let _0x4b6686=_0x425d[_0xf85366];return _0x4b6686;};import{View as _0x57cbee,IconView as _0x38ff5c}from'ckeditor5/src/ui.js';import _0x396c5d from'../../../theme/icons/notification.svg';import'../../../theme/users.css';export default class C extends _0x57cbee{constructor(_0x57d85,_0x24867b,_0x2f24d8){super(_0x57d85),this[_0x4b66('0x0')]=_0x24867b[_0x4b66('0x0')],this[_0x4b66('0xc')]=null;const _0x568897=['ck',_0x4b66('0xf')];if(_0x24867b[_0x4b66('0x5')]&&_0x568897[_0x4b66('0x3')](_0x4b66('0x4')),_0x24867b[_0x4b66('0x1')]&&_0x568897[_0x4b66('0x3')](_0x4b66('0x2')),_0x2f24d8){const _0x39c688=new _0x38ff5c();_0x39c688['extendTemplate']({'attributes':{'class':[_0x4b66('0xd')]}}),_0x39c688[_0x4b66('0x9')]=_0x396c5d,this[_0x4b66('0xc')]={'tag':_0x4b66('0x8'),'attributes':{'class':['ck',_0x4b66('0x10')],'data-cke-tooltip-position':'n','data-cke-tooltip-text':_0x2f24d8},'children':[_0x39c688]};}const _0x374617=[{'tag':_0x4b66('0x8'),'attributes':{'class':_0x568897,'style':{'background-image':_0x24867b['avatar']?_0x4b66('0xa')+_0x24867b['avatar']+'\x27)':''}}},{'tag':_0x4b66('0x8'),'attributes':{'class':_0x24867b[_0x4b66('0x1')]?_0x4b66('0xb'):_0x4b66('0x6')},'children':[{'text':_0x24867b['initials']}]}];this[_0x4b66('0xc')]&&_0x374617[_0x4b66('0x3')](this['notificationView']),this[_0x4b66('0x7')]({'tag':_0x4b66('0x8'),'attributes':{'class':['ck',_0x4b66('0xe')],'data-user-id':_0x24867b['id']},'children':_0x374617});}}
|