@ckeditor/ckeditor5-revision-history 40.0.0 → 40.2.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.
- package/LICENSE.md +3 -3
- package/README.md +11 -11
- package/build/revision-history.js +1 -1
- package/package.json +6 -6
- package/src/augmentation.d.ts +29 -29
- package/src/changeitem.d.ts +58 -58
- package/src/changeitem.js +1 -1
- package/src/editor/revisionviewereditor.d.ts +27 -27
- package/src/editor/revisionviewereditor.js +1 -1
- package/src/editor/revisionviewereditorui.d.ts +28 -28
- package/src/editor/revisionviewereditorui.js +1 -1
- package/src/editor/revisionviewereditoruiview.d.ts +43 -43
- package/src/editor/revisionviewereditoruiview.js +1 -1
- package/src/index.d.ts +15 -15
- package/src/revision.d.ts +153 -153
- package/src/revision.js +1 -1
- package/src/revisiondiff.d.ts +24 -24
- package/src/revisiondiff.js +1 -1
- package/src/revisionhistory.d.ts +99 -99
- package/src/revisionhistory.js +1 -1
- package/src/revisionhistoryadapter.d.ts +64 -64
- package/src/revisionhistoryconfig.d.ts +60 -60
- package/src/revisionsrepository.d.ts +52 -52
- package/src/revisionsrepository.js +1 -1
- package/src/revisiontracker.d.ts +81 -81
- package/src/revisiontracker.js +1 -1
- package/src/revisionviewer.d.ts +25 -25
- package/src/revisionviewer.js +1 -1
- package/src/ui/revision/createrevisionactionsdropdown.d.ts +10 -10
- package/src/ui/revision/createrevisionactionsdropdown.js +1 -1
- package/src/ui/revision/revisionauthorview.d.ts +5 -5
- package/src/ui/revision/revisionauthorview.js +1 -1
- package/src/ui/revision/revisionnameview.d.ts +5 -5
- package/src/ui/revision/revisionnameview.js +1 -1
- package/src/ui/revision/revisionview.d.ts +95 -95
- package/src/ui/revision/revisionview.js +1 -1
- package/src/ui/revision/subrevisioncollapserview.d.ts +21 -21
- package/src/ui/revision/subrevisioncollapserview.js +1 -1
- package/src/ui/revision/subrevisionview.d.ts +34 -34
- package/src/ui/revision/subrevisionview.js +1 -1
- package/src/ui/revision/utils.d.ts +5 -5
- package/src/ui/revision/utils.js +1 -1
- package/src/ui/revisionhistory/revisionhistorysaverevisionformview.d.ts +81 -81
- package/src/ui/revisionhistory/revisionhistorysaverevisionformview.js +1 -1
- package/src/ui/revisionhistory/revisionhistoryui.d.ts +26 -26
- package/src/ui/revisionhistory/revisionhistoryui.js +1 -1
- package/src/ui/revisionssidebar/revisionssidebar.d.ts +44 -44
- package/src/ui/revisionssidebar/revisionssidebar.js +1 -1
- package/src/ui/revisionssidebar/revisionssidebarheaderview.d.ts +5 -5
- package/src/ui/revisionssidebar/revisionssidebarheaderview.js +1 -1
- package/src/ui/revisionssidebar/revisionssidebartimeperiodview.d.ts +29 -29
- package/src/ui/revisionssidebar/revisionssidebartimeperiodview.js +1 -1
- package/src/ui/revisionssidebar/revisionssidebarview.d.ts +44 -44
- package/src/ui/revisionssidebar/revisionssidebarview.js +1 -1
- package/src/ui/revisionssidebar/utils.d.ts +9 -9
- package/src/ui/revisionssidebar/utils.js +1 -1
- package/src/ui/revisionviewer/changedetailsview.d.ts +22 -22
- package/src/ui/revisionviewer/changedetailsview.js +1 -1
- package/src/ui/revisionviewer/changesnavigationview.d.ts +40 -40
- package/src/ui/revisionviewer/changesnavigationview.js +1 -1
- package/src/ui/revisionviewer/revisionviewerloadingoverlay.d.ts +26 -26
- package/src/ui/revisionviewer/revisionviewerloadingoverlay.js +1 -1
- package/src/ui/revisionviewer/revisionviewerui.d.ts +28 -28
- package/src/ui/revisionviewer/revisionviewerui.js +1 -1
- package/src/utils/common-translations.d.ts +11 -11
- package/src/utils/common-translations.js +1 -1
package/src/revision.d.ts
CHANGED
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, 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
|
-
import type { User } from 'ckeditor5-collaboration/src/collaboration-core';
|
|
6
|
-
declare const Revision_base: {
|
|
7
|
-
new (): import("ckeditor5/src/utils").Observable;
|
|
8
|
-
prototype: import("ckeditor5/src/utils").Observable;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Represents a revision.
|
|
12
|
-
*/
|
|
13
|
-
export default class Revision extends Revision_base {
|
|
14
|
-
/**
|
|
15
|
-
* Unique revision id.
|
|
16
|
-
*/
|
|
17
|
-
id: string;
|
|
18
|
-
/**
|
|
19
|
-
* The user who created the revision.
|
|
20
|
-
*
|
|
21
|
-
* The `null` value means the revision was created automatically.
|
|
22
|
-
*/
|
|
23
|
-
creator: User | null;
|
|
24
|
-
/**
|
|
25
|
-
* All users who contributed to this revision.
|
|
26
|
-
*
|
|
27
|
-
* This value can be empty if there are no changes in the revision.
|
|
28
|
-
*/
|
|
29
|
-
authors: Array<User>;
|
|
30
|
-
/**
|
|
31
|
-
* Contains data describing changes saved in this revision.
|
|
32
|
-
*
|
|
33
|
-
* An object, where the keys are the names of roots and the values are strings with the revision data for those roots.
|
|
34
|
-
*/
|
|
35
|
-
diffData: any;
|
|
36
|
-
/**
|
|
37
|
-
* Document version at which the revision ends.
|
|
38
|
-
*
|
|
39
|
-
* The revision includes changes introduced by {@link module:engine/model/operation/operation~Operation operations}
|
|
40
|
-
* with base versions starting from {@link module:revision-history/revision~Revision#fromVersion `fromVersion`} (inclusive) up to
|
|
41
|
-
* {@link module:revision-history/revision~Revision#toVersion `toVersion`} (exclusive).
|
|
42
|
-
*/
|
|
43
|
-
toVersion: number;
|
|
44
|
-
/**
|
|
45
|
-
* Document version from which the revision starts.
|
|
46
|
-
*
|
|
47
|
-
* The revision includes changes introduced by {@link module:engine/model/operation/operation~Operation operations}
|
|
48
|
-
* with base versions starting from {@link module:revision-history/revision~Revision#fromVersion `fromVersion`} (inclusive) up to
|
|
49
|
-
* {@link module:revision-history/revision~Revision#toVersion `toVersion`} (exclusive).
|
|
50
|
-
*/
|
|
51
|
-
fromVersion: number;
|
|
52
|
-
/**
|
|
53
|
-
* The revision name.
|
|
54
|
-
*
|
|
55
|
-
* If revision has not been named yet, this is an empty string.
|
|
56
|
-
*
|
|
57
|
-
* @observable
|
|
58
|
-
*/
|
|
59
|
-
name: string;
|
|
60
|
-
/**
|
|
61
|
-
* The date when the revision was created or most recently updated.
|
|
62
|
-
*
|
|
63
|
-
* @observable
|
|
64
|
-
*/
|
|
65
|
-
createdAt: Date;
|
|
66
|
-
/**
|
|
67
|
-
* Revision custom attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
|
|
68
|
-
*
|
|
69
|
-
* @observable
|
|
70
|
-
*/
|
|
71
|
-
attributes: Record<string, unknown>;
|
|
72
|
-
constructor(data: RevisionData);
|
|
73
|
-
/**
|
|
74
|
-
* Sets the revision name.
|
|
75
|
-
*/
|
|
76
|
-
setName(name: string): void;
|
|
77
|
-
/**
|
|
78
|
-
* Adds revision attribute.
|
|
79
|
-
*
|
|
80
|
-
* Revision attributes are custom data that can be set and used by features built around revisions.
|
|
81
|
-
* Use it to store your feature data together with other revision data.
|
|
82
|
-
*
|
|
83
|
-
* ```ts
|
|
84
|
-
* revision.setAttribute( 'isImportant', true );
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
87
|
-
* You can group multiple values in an object, using the dot notation:
|
|
88
|
-
*
|
|
89
|
-
* ```ts
|
|
90
|
-
* revision.setAttribute( 'customData.type', 'image' );
|
|
91
|
-
* revision.setAttribute( 'customData.src', 'foo.jpg' );
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
* The attributes set on the revision can be accessed through the `attribute` property:
|
|
95
|
-
*
|
|
96
|
-
* ```ts
|
|
97
|
-
* const isImportant = revision.attributes.isImportant;
|
|
98
|
-
* const type = revision.attributes.customData.type;
|
|
99
|
-
* ```
|
|
100
|
-
*
|
|
101
|
-
* You can also observe the `attributes` property or bind other properties to it:
|
|
102
|
-
*
|
|
103
|
-
* ```ts
|
|
104
|
-
* myObj.bind( 'customData' ).to( revision, 'attributes', attributes => attributes.customData );
|
|
105
|
-
* revision.on( 'change:attributes', ( evt, propName, newValue, oldValue ) => { ... } );
|
|
106
|
-
* ```
|
|
107
|
-
*
|
|
108
|
-
* Whenever `setAttribute()` or `removeAttribute()` is called, the `attributes` property
|
|
109
|
-
* is re-set and the observables are refreshed.
|
|
110
|
-
*/
|
|
111
|
-
setAttribute(name: string, value: unknown): void;
|
|
112
|
-
/**
|
|
113
|
-
* Removes the revision attribute.
|
|
114
|
-
*
|
|
115
|
-
* See also {@link #setAttribute}
|
|
116
|
-
*/
|
|
117
|
-
removeAttribute(name: string): void;
|
|
118
|
-
toJSON(): RevisionJSON;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* @eventName _update
|
|
122
|
-
*/
|
|
123
|
-
export interface RevisionUpdateEvent {
|
|
124
|
-
name: '_update';
|
|
125
|
-
args: [RevisionJSON, boolean];
|
|
126
|
-
}
|
|
127
|
-
export interface RevisionJSON {
|
|
128
|
-
id: string;
|
|
129
|
-
name: string;
|
|
130
|
-
creatorId: string | null;
|
|
131
|
-
authorsIds: Array<string>;
|
|
132
|
-
diffData: any;
|
|
133
|
-
createdAt: Date;
|
|
134
|
-
attributes: Record<string, unknown>;
|
|
135
|
-
fromVersion: number;
|
|
136
|
-
toVersion: number;
|
|
137
|
-
}
|
|
138
|
-
export interface RevisionData {
|
|
139
|
-
id?: string;
|
|
140
|
-
name?: string | null;
|
|
141
|
-
creator?: User | null;
|
|
142
|
-
creatorId?: string | null;
|
|
143
|
-
authors?: Array<User>;
|
|
144
|
-
authorsIds?: Array<string>;
|
|
145
|
-
diffData?: any;
|
|
146
|
-
data?: any;
|
|
147
|
-
createdAt?: Date;
|
|
148
|
-
attributes?: Record<string, unknown>;
|
|
149
|
-
fromVersion?: number;
|
|
150
|
-
toVersion?: number;
|
|
151
|
-
isEmptyCurrent?: boolean;
|
|
152
|
-
}
|
|
153
|
-
export {};
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
import type { User } from 'ckeditor5-collaboration/src/collaboration-core';
|
|
6
|
+
declare const Revision_base: {
|
|
7
|
+
new (): import("ckeditor5/src/utils").Observable;
|
|
8
|
+
prototype: import("ckeditor5/src/utils").Observable;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Represents a revision.
|
|
12
|
+
*/
|
|
13
|
+
export default class Revision extends Revision_base {
|
|
14
|
+
/**
|
|
15
|
+
* Unique revision id.
|
|
16
|
+
*/
|
|
17
|
+
id: string;
|
|
18
|
+
/**
|
|
19
|
+
* The user who created the revision.
|
|
20
|
+
*
|
|
21
|
+
* The `null` value means the revision was created automatically.
|
|
22
|
+
*/
|
|
23
|
+
creator: User | null;
|
|
24
|
+
/**
|
|
25
|
+
* All users who contributed to this revision.
|
|
26
|
+
*
|
|
27
|
+
* This value can be empty if there are no changes in the revision.
|
|
28
|
+
*/
|
|
29
|
+
authors: Array<User>;
|
|
30
|
+
/**
|
|
31
|
+
* Contains data describing changes saved in this revision.
|
|
32
|
+
*
|
|
33
|
+
* An object, where the keys are the names of roots and the values are strings with the revision data for those roots.
|
|
34
|
+
*/
|
|
35
|
+
diffData: any;
|
|
36
|
+
/**
|
|
37
|
+
* Document version at which the revision ends.
|
|
38
|
+
*
|
|
39
|
+
* The revision includes changes introduced by {@link module:engine/model/operation/operation~Operation operations}
|
|
40
|
+
* with base versions starting from {@link module:revision-history/revision~Revision#fromVersion `fromVersion`} (inclusive) up to
|
|
41
|
+
* {@link module:revision-history/revision~Revision#toVersion `toVersion`} (exclusive).
|
|
42
|
+
*/
|
|
43
|
+
toVersion: number;
|
|
44
|
+
/**
|
|
45
|
+
* Document version from which the revision starts.
|
|
46
|
+
*
|
|
47
|
+
* The revision includes changes introduced by {@link module:engine/model/operation/operation~Operation operations}
|
|
48
|
+
* with base versions starting from {@link module:revision-history/revision~Revision#fromVersion `fromVersion`} (inclusive) up to
|
|
49
|
+
* {@link module:revision-history/revision~Revision#toVersion `toVersion`} (exclusive).
|
|
50
|
+
*/
|
|
51
|
+
fromVersion: number;
|
|
52
|
+
/**
|
|
53
|
+
* The revision name.
|
|
54
|
+
*
|
|
55
|
+
* If revision has not been named yet, this is an empty string.
|
|
56
|
+
*
|
|
57
|
+
* @observable
|
|
58
|
+
*/
|
|
59
|
+
name: string;
|
|
60
|
+
/**
|
|
61
|
+
* The date when the revision was created or most recently updated.
|
|
62
|
+
*
|
|
63
|
+
* @observable
|
|
64
|
+
*/
|
|
65
|
+
createdAt: Date;
|
|
66
|
+
/**
|
|
67
|
+
* Revision custom attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
|
|
68
|
+
*
|
|
69
|
+
* @observable
|
|
70
|
+
*/
|
|
71
|
+
attributes: Record<string, unknown>;
|
|
72
|
+
constructor(data: RevisionData);
|
|
73
|
+
/**
|
|
74
|
+
* Sets the revision name.
|
|
75
|
+
*/
|
|
76
|
+
setName(name: string): void;
|
|
77
|
+
/**
|
|
78
|
+
* Adds revision attribute.
|
|
79
|
+
*
|
|
80
|
+
* Revision attributes are custom data that can be set and used by features built around revisions.
|
|
81
|
+
* Use it to store your feature data together with other revision data.
|
|
82
|
+
*
|
|
83
|
+
* ```ts
|
|
84
|
+
* revision.setAttribute( 'isImportant', true );
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* You can group multiple values in an object, using the dot notation:
|
|
88
|
+
*
|
|
89
|
+
* ```ts
|
|
90
|
+
* revision.setAttribute( 'customData.type', 'image' );
|
|
91
|
+
* revision.setAttribute( 'customData.src', 'foo.jpg' );
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* The attributes set on the revision can be accessed through the `attribute` property:
|
|
95
|
+
*
|
|
96
|
+
* ```ts
|
|
97
|
+
* const isImportant = revision.attributes.isImportant;
|
|
98
|
+
* const type = revision.attributes.customData.type;
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* You can also observe the `attributes` property or bind other properties to it:
|
|
102
|
+
*
|
|
103
|
+
* ```ts
|
|
104
|
+
* myObj.bind( 'customData' ).to( revision, 'attributes', attributes => attributes.customData );
|
|
105
|
+
* revision.on( 'change:attributes', ( evt, propName, newValue, oldValue ) => { ... } );
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* Whenever `setAttribute()` or `removeAttribute()` is called, the `attributes` property
|
|
109
|
+
* is re-set and the observables are refreshed.
|
|
110
|
+
*/
|
|
111
|
+
setAttribute(name: string, value: unknown): void;
|
|
112
|
+
/**
|
|
113
|
+
* Removes the revision attribute.
|
|
114
|
+
*
|
|
115
|
+
* See also {@link #setAttribute}
|
|
116
|
+
*/
|
|
117
|
+
removeAttribute(name: string): void;
|
|
118
|
+
toJSON(): RevisionJSON;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* @eventName _update
|
|
122
|
+
*/
|
|
123
|
+
export interface RevisionUpdateEvent {
|
|
124
|
+
name: '_update';
|
|
125
|
+
args: [RevisionJSON, boolean];
|
|
126
|
+
}
|
|
127
|
+
export interface RevisionJSON {
|
|
128
|
+
id: string;
|
|
129
|
+
name: string;
|
|
130
|
+
creatorId: string | null;
|
|
131
|
+
authorsIds: Array<string>;
|
|
132
|
+
diffData: any;
|
|
133
|
+
createdAt: Date;
|
|
134
|
+
attributes: Record<string, unknown>;
|
|
135
|
+
fromVersion: number;
|
|
136
|
+
toVersion: number;
|
|
137
|
+
}
|
|
138
|
+
export interface RevisionData {
|
|
139
|
+
id?: string;
|
|
140
|
+
name?: string | null;
|
|
141
|
+
creator?: User | null;
|
|
142
|
+
creatorId?: string | null;
|
|
143
|
+
authors?: Array<User>;
|
|
144
|
+
authorsIds?: Array<string>;
|
|
145
|
+
diffData?: any;
|
|
146
|
+
data?: any;
|
|
147
|
+
createdAt?: Date;
|
|
148
|
+
attributes?: Record<string, unknown>;
|
|
149
|
+
fromVersion?: number;
|
|
150
|
+
toVersion?: number;
|
|
151
|
+
isEmptyCurrent?: boolean;
|
|
152
|
+
}
|
|
153
|
+
export {};
|
package/src/revision.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x2b5b=['diffData','creatorId','fire','_update','removeAttribute','authors','attributes','toVersion','creator','createdAt','toJSON','setAttribute','set','fromVersion','name'];(function(_0xfce36f,_0x2b5b81){const _0x157577=function(_0x409324){while(--_0x409324){_0xfce36f['push'](_0xfce36f['shift']());}};_0x157577(++_0x2b5b81);}(_0x2b5b,0xa6));const _0x1575=function(_0xfce36f,_0x2b5b81){_0xfce36f=_0xfce36f-0x0;let _0x157577=_0x2b5b[_0xfce36f];return _0x157577;};import{ObservableMixin as _0x2a3fdf,uid as _0x56c07c}from'ckeditor5/src/utils';import{cloneDeep as _0x68d77,set as _0x1f172e,unset as _0x34aa97}from'lodash-es';export default class a extends _0x2a3fdf(){constructor(_0x36843f){super(),this['id']=_0x36843f['id']||_0x56c07c(),this[_0x1575('0x7')]=_0x36843f[_0x1575('0x7')]||null,this[_0x1575('0x4')]=_0x36843f[_0x1575('0x4')]||[],this['diffData']=_0x36843f['diffData']||null,this['toVersion']=_0x36843f['toVersion']||0x0,this[_0x1575('0xc')]=_0x36843f[_0x1575('0xc')]||0x0,this[_0x1575('0xb')](_0x1575('0xd'),_0x36843f[_0x1575('0xd')]||''),this[_0x1575('0xb')](_0x1575('0x8'),_0x36843f['createdAt']||new Date()),this[_0x1575('0xb')]('attributes',_0x36843f[_0x1575('0x5')]||{});}['setName'](_0x451de8){this['_update']({'name':_0x451de8});}[_0x1575('0xa')](_0x1f3560,_0x4afe15){const _0x19f5af=_0x68d77(this['attributes']);_0x1f172e(_0x19f5af,_0x1f3560,_0x4afe15),this[_0x1575('0x2')]({'attributes':_0x19f5af});}[_0x1575('0x3')](_0x581927){const _0x304f54=_0x68d77(this[_0x1575('0x5')]);_0x34aa97(_0x304f54,_0x581927),this[_0x1575('0x2')]({'attributes':_0x304f54});}['_update'](_0x3bf8d0,_0x2efb6f=!0x1){let _0x50043f=!0x1;const _0x33c628={'id':this['id']},_0x574b68=[_0x1575('0xd'),'createdAt',_0x1575('0xe'),_0x1575('0x4'),_0x1575('0x5'),'toVersion',_0x1575('0xc'),_0x1575('0x0')];for(const _0x5bbf71 of _0x574b68){const _0x510be8=_0x3bf8d0[_0x5bbf71];void 0x0!==_0x510be8&&_0x510be8!==this[_0x5bbf71]&&(this[_0x5bbf71]=_0x510be8,_0x33c628[_0x5bbf71]=_0x510be8,_0x50043f=!0x0);}_0x50043f&&(_0x33c628[_0x1575('0x4')]&&(_0x33c628['authorsIds']=_0x33c628[_0x1575('0x4')]['map'](_0x19ca2a=>_0x19ca2a['id']),delete _0x33c628[_0x1575('0x4')]),this[_0x1575('0x1')](_0x1575('0x2'),_0x33c628,_0x2efb6f));}[_0x1575('0x9')](){return{'id':this['id'],'name':this[_0x1575('0xd')],'creatorId':this[_0x1575('0x7')]?this[_0x1575('0x7')]['id']:null,'authorsIds':this[_0x1575('0x4')]['map'](_0x4e22da=>_0x4e22da['id']),'diffData':this[_0x1575('0xe')],'createdAt':this['createdAt'],'attributes':this[_0x1575('0x5')],'fromVersion':this['fromVersion'],'toVersion':this[_0x1575('0x6')]};}}
|
package/src/revisiondiff.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, 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
|
-
* @module revision-history/revisiondiff
|
|
7
|
-
*/
|
|
8
|
-
import { Collection } from 'ckeditor5/src/utils';
|
|
9
|
-
import type { DocumentFragment } from 'ckeditor5/src/engine';
|
|
10
|
-
import type ChangeItem from './changeitem';
|
|
11
|
-
/**
|
|
12
|
-
* Represents a difference between two document revisions.
|
|
13
|
-
*/
|
|
14
|
-
export default class RevisionDiff {
|
|
15
|
-
readonly newRevisionId: string;
|
|
16
|
-
readonly oldRevisionId: string;
|
|
17
|
-
readonly changes: Collection<ChangeItem>;
|
|
18
|
-
constructor(newRevisionId: string, oldRevisionId: string);
|
|
19
|
-
}
|
|
20
|
-
export interface DiffData {
|
|
21
|
-
model: Record<string, DocumentFragment>;
|
|
22
|
-
attributes: Record<string, Record<string, unknown>>;
|
|
23
|
-
changes: Array<ChangeItem>;
|
|
24
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
* @module revision-history/revisiondiff
|
|
7
|
+
*/
|
|
8
|
+
import { Collection } from 'ckeditor5/src/utils';
|
|
9
|
+
import type { DocumentFragment } from 'ckeditor5/src/engine';
|
|
10
|
+
import type ChangeItem from './changeitem';
|
|
11
|
+
/**
|
|
12
|
+
* Represents a difference between two document revisions.
|
|
13
|
+
*/
|
|
14
|
+
export default class RevisionDiff {
|
|
15
|
+
readonly newRevisionId: string;
|
|
16
|
+
readonly oldRevisionId: string;
|
|
17
|
+
readonly changes: Collection<ChangeItem>;
|
|
18
|
+
constructor(newRevisionId: string, oldRevisionId: string);
|
|
19
|
+
}
|
|
20
|
+
export interface DiffData {
|
|
21
|
+
model: Record<string, DocumentFragment>;
|
|
22
|
+
attributes: Record<string, Record<string, unknown>>;
|
|
23
|
+
changes: Array<ChangeItem>;
|
|
24
|
+
}
|
package/src/revisiondiff.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0xb93c=['oldRevisionId','newRevisionId','add','changes'];(function(_0x44dd5d,_0xb93c31){const _0x59c144=function(_0x4a8761){while(--_0x4a8761){_0x44dd5d['push'](_0x44dd5d['shift']());}};_0x59c144(++_0xb93c31);}(_0xb93c,0x185));const _0x59c1=function(_0x44dd5d,_0xb93c31){_0x44dd5d=_0x44dd5d-0x0;let _0x59c144=_0xb93c[_0x44dd5d];return _0x59c144;};import{Collection as _0x58b5ee}from'ckeditor5/src/utils';export default class f{constructor(_0x11e8f8,_0x352efa){this[_0x59c1('0x0')]=_0x11e8f8,this[_0x59c1('0x3')]=_0x352efa,this[_0x59c1('0x2')]=new _0x58b5ee();}['_setChanges'](_0x241f8b){for(const _0x50a83b of _0x241f8b)this['changes'][_0x59c1('0x1')](_0x50a83b);}}
|
package/src/revisionhistory.d.ts
CHANGED
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2023, 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
|
-
* @module revision-history/revisionhistory
|
|
7
|
-
* @publicApi
|
|
8
|
-
*/
|
|
9
|
-
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
10
|
-
import type { Item, Position } from 'ckeditor5/src/engine';
|
|
11
|
-
import RevisionTracker from './revisiontracker';
|
|
12
|
-
import RevisionHistoryUI from './ui/revisionhistory/revisionhistoryui';
|
|
13
|
-
import type { default as Revision, RevisionJSON } from './revision';
|
|
14
|
-
import type { RevisionHistoryAdapter } from './revisionhistoryadapter';
|
|
15
|
-
/**
|
|
16
|
-
* The revision history feature.
|
|
17
|
-
*
|
|
18
|
-
* Enables tracking and bundling changes into revisions as well as provides the default UI for browsing revisions.
|
|
19
|
-
*
|
|
20
|
-
* To learn more about the revision history feature refer to the
|
|
21
|
-
* {@glink features/collaboration/revision-history/revision-history Revision history} guide.
|
|
22
|
-
*/
|
|
23
|
-
export default class RevisionHistory extends Plugin {
|
|
24
|
-
static get pluginName(): "RevisionHistory";
|
|
25
|
-
static get requires(): readonly [typeof RevisionTracker, typeof RevisionHistoryUI];
|
|
26
|
-
constructor(editor: Editor);
|
|
27
|
-
/**
|
|
28
|
-
* An adapter object that should communicate with the data source to fetch or save the revisions data.
|
|
29
|
-
*/
|
|
30
|
-
set adapter(adapter: RevisionHistoryAdapter | null);
|
|
31
|
-
get adapter(): RevisionHistoryAdapter | null;
|
|
32
|
-
/**
|
|
33
|
-
* Creates a revision basing on given revision data and adds it to the revision tracker and revision repository.
|
|
34
|
-
*
|
|
35
|
-
* The parameter of this method should be an object with revision data. You can receive such an object by calling
|
|
36
|
-
* {@link module:revision-history/revisionhistory~RevisionHistory#getRevisions `RevisionHistory#getRevisions( { toJSON: true } )`}
|
|
37
|
-
* or {@link module:revision-history/revision~Revision#toJSON `Revision#toJSON()`}.
|
|
38
|
-
*
|
|
39
|
-
* ```ts
|
|
40
|
-
* // Get revisions data in an appropriate format.
|
|
41
|
-
* // You can save it in your database.
|
|
42
|
-
* const revisionsData = revisionHistory.getRevisions( { toJSON: true } );
|
|
43
|
-
* // ...
|
|
44
|
-
* // Use revisions data.
|
|
45
|
-
* // That revisions data might be loaded from your database.
|
|
46
|
-
* revisionsData.forEach( revisionData => revisionHistory.addRevisionData( revisionData ) );
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
addRevisionData(revisionData: RevisionJSON): Revision;
|
|
50
|
-
/**
|
|
51
|
-
* Returns the revision with a given revision id or at a given index.
|
|
52
|
-
*/
|
|
53
|
-
getRevision(revisionIdOrIndex: string | number): Revision | null;
|
|
54
|
-
getRevisions(options: {
|
|
55
|
-
toJSON: true;
|
|
56
|
-
}): Array<RevisionJSON>;
|
|
57
|
-
getRevisions(options: {
|
|
58
|
-
toJSON: false;
|
|
59
|
-
}): Array<Revision>;
|
|
60
|
-
getRevisions(options: {
|
|
61
|
-
toJSON: boolean;
|
|
62
|
-
}): Array<Revision> | Array<RevisionJSON>;
|
|
63
|
-
}
|
|
64
|
-
export interface TapeValue {
|
|
65
|
-
id?: number;
|
|
66
|
-
type: 'elementStart' | 'elementEnd' | 'text';
|
|
67
|
-
item: TapeItem;
|
|
68
|
-
previousPosition?: Position;
|
|
69
|
-
nextPosition?: Position;
|
|
70
|
-
isAdded?: {
|
|
71
|
-
userId: string;
|
|
72
|
-
} | boolean;
|
|
73
|
-
isRemoved?: {
|
|
74
|
-
userId: string;
|
|
75
|
-
};
|
|
76
|
-
pairId?: number | null;
|
|
77
|
-
markersStart?: Array<string>;
|
|
78
|
-
markersEnd?: Array<string>;
|
|
79
|
-
isIncorrect?: boolean;
|
|
80
|
-
distance?: number;
|
|
81
|
-
isAddSuggestion?: {
|
|
82
|
-
userId: string;
|
|
83
|
-
type: string;
|
|
84
|
-
name: string;
|
|
85
|
-
};
|
|
86
|
-
isRemoveSuggestion?: {
|
|
87
|
-
userId: string;
|
|
88
|
-
type: string;
|
|
89
|
-
name: string;
|
|
90
|
-
};
|
|
91
|
-
side?: number;
|
|
92
|
-
level?: number;
|
|
93
|
-
index?: number;
|
|
94
|
-
}
|
|
95
|
-
export type TapeItem = Item & {
|
|
96
|
-
name: string;
|
|
97
|
-
startIndex?: number;
|
|
98
|
-
endIndex?: number;
|
|
99
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, 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
|
+
* @module revision-history/revisionhistory
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
10
|
+
import type { Item, Position } from 'ckeditor5/src/engine';
|
|
11
|
+
import RevisionTracker from './revisiontracker';
|
|
12
|
+
import RevisionHistoryUI from './ui/revisionhistory/revisionhistoryui';
|
|
13
|
+
import type { default as Revision, RevisionJSON } from './revision';
|
|
14
|
+
import type { RevisionHistoryAdapter } from './revisionhistoryadapter';
|
|
15
|
+
/**
|
|
16
|
+
* The revision history feature.
|
|
17
|
+
*
|
|
18
|
+
* Enables tracking and bundling changes into revisions as well as provides the default UI for browsing revisions.
|
|
19
|
+
*
|
|
20
|
+
* To learn more about the revision history feature refer to the
|
|
21
|
+
* {@glink features/collaboration/revision-history/revision-history Revision history} guide.
|
|
22
|
+
*/
|
|
23
|
+
export default class RevisionHistory extends Plugin {
|
|
24
|
+
static get pluginName(): "RevisionHistory";
|
|
25
|
+
static get requires(): readonly [typeof RevisionTracker, typeof RevisionHistoryUI];
|
|
26
|
+
constructor(editor: Editor);
|
|
27
|
+
/**
|
|
28
|
+
* An adapter object that should communicate with the data source to fetch or save the revisions data.
|
|
29
|
+
*/
|
|
30
|
+
set adapter(adapter: RevisionHistoryAdapter | null);
|
|
31
|
+
get adapter(): RevisionHistoryAdapter | null;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a revision basing on given revision data and adds it to the revision tracker and revision repository.
|
|
34
|
+
*
|
|
35
|
+
* The parameter of this method should be an object with revision data. You can receive such an object by calling
|
|
36
|
+
* {@link module:revision-history/revisionhistory~RevisionHistory#getRevisions `RevisionHistory#getRevisions( { toJSON: true } )`}
|
|
37
|
+
* or {@link module:revision-history/revision~Revision#toJSON `Revision#toJSON()`}.
|
|
38
|
+
*
|
|
39
|
+
* ```ts
|
|
40
|
+
* // Get revisions data in an appropriate format.
|
|
41
|
+
* // You can save it in your database.
|
|
42
|
+
* const revisionsData = revisionHistory.getRevisions( { toJSON: true } );
|
|
43
|
+
* // ...
|
|
44
|
+
* // Use revisions data.
|
|
45
|
+
* // That revisions data might be loaded from your database.
|
|
46
|
+
* revisionsData.forEach( revisionData => revisionHistory.addRevisionData( revisionData ) );
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
addRevisionData(revisionData: RevisionJSON): Revision;
|
|
50
|
+
/**
|
|
51
|
+
* Returns the revision with a given revision id or at a given index.
|
|
52
|
+
*/
|
|
53
|
+
getRevision(revisionIdOrIndex: string | number): Revision | null;
|
|
54
|
+
getRevisions(options: {
|
|
55
|
+
toJSON: true;
|
|
56
|
+
}): Array<RevisionJSON>;
|
|
57
|
+
getRevisions(options: {
|
|
58
|
+
toJSON: false;
|
|
59
|
+
}): Array<Revision>;
|
|
60
|
+
getRevisions(options: {
|
|
61
|
+
toJSON: boolean;
|
|
62
|
+
}): Array<Revision> | Array<RevisionJSON>;
|
|
63
|
+
}
|
|
64
|
+
export interface TapeValue {
|
|
65
|
+
id?: number;
|
|
66
|
+
type: 'elementStart' | 'elementEnd' | 'text';
|
|
67
|
+
item: TapeItem;
|
|
68
|
+
previousPosition?: Position;
|
|
69
|
+
nextPosition?: Position;
|
|
70
|
+
isAdded?: {
|
|
71
|
+
userId: string;
|
|
72
|
+
} | boolean;
|
|
73
|
+
isRemoved?: {
|
|
74
|
+
userId: string;
|
|
75
|
+
};
|
|
76
|
+
pairId?: number | null;
|
|
77
|
+
markersStart?: Array<string>;
|
|
78
|
+
markersEnd?: Array<string>;
|
|
79
|
+
isIncorrect?: boolean;
|
|
80
|
+
distance?: number;
|
|
81
|
+
isAddSuggestion?: {
|
|
82
|
+
userId: string;
|
|
83
|
+
type: string;
|
|
84
|
+
name: string;
|
|
85
|
+
};
|
|
86
|
+
isRemoveSuggestion?: {
|
|
87
|
+
userId: string;
|
|
88
|
+
type: string;
|
|
89
|
+
name: string;
|
|
90
|
+
};
|
|
91
|
+
side?: number;
|
|
92
|
+
level?: number;
|
|
93
|
+
index?: number;
|
|
94
|
+
}
|
|
95
|
+
export type TapeItem = Item & {
|
|
96
|
+
name: string;
|
|
97
|
+
startIndex?: number;
|
|
98
|
+
endIndex?: number;
|
|
99
|
+
};
|