@ckeditor/ckeditor5-revision-history 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/build/revision-history.js +1 -1
- package/package.json +7 -6
- package/src/augmentation.d.ts +25 -25
- package/src/changeitem.d.ts +57 -57
- 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 +11 -11
- package/src/index.js +1 -1
- package/src/revision.d.ts +153 -153
- package/src/revision.js +1 -1
- package/src/revisiondiff.d.ts +20 -20
- package/src/revisiondiff.js +1 -1
- package/src/revisionhistory.d.ts +95 -95
- package/src/revisionhistory.js +1 -1
- package/src/revisionhistoryadapter.d.ts +60 -60
- package/src/revisionhistoryconfig.d.ts +60 -60
- package/src/revisionsrepository.d.ts +48 -48
- package/src/revisionsrepository.js +1 -1
- package/src/revisiontracker.d.ts +77 -77
- package/src/revisiontracker.js +1 -1
- package/src/revisionviewer.d.ts +21 -21
- package/src/revisionviewer.js +1 -1
- package/src/ui/revision/createrevisionactionsdropdown.d.ts +9 -9
- package/src/ui/revision/createrevisionactionsdropdown.js +1 -1
- package/src/ui/revision/revisionauthorview.d.ts +4 -4
- package/src/ui/revision/revisionauthorview.js +1 -1
- package/src/ui/revision/revisionnameview.d.ts +4 -4
- package/src/ui/revision/revisionnameview.js +1 -1
- package/src/ui/revision/revisionview.d.ts +91 -91
- package/src/ui/revision/revisionview.js +1 -1
- package/src/ui/revision/subrevisioncollapserview.d.ts +17 -17
- package/src/ui/revision/subrevisioncollapserview.js +1 -1
- package/src/ui/revision/subrevisionview.d.ts +30 -30
- package/src/ui/revision/subrevisionview.js +1 -1
- package/src/ui/revision/utils.d.ts +4 -4
- package/src/ui/revision/utils.js +1 -1
- package/src/ui/revisionhistory/revisionhistorysaverevisionformview.d.ts +80 -80
- package/src/ui/revisionhistory/revisionhistorysaverevisionformview.js +1 -1
- package/src/ui/revisionhistory/revisionhistoryui.d.ts +22 -22
- package/src/ui/revisionhistory/revisionhistoryui.js +1 -1
- package/src/ui/revisionssidebar/revisionssidebar.d.ts +40 -40
- package/src/ui/revisionssidebar/revisionssidebar.js +1 -1
- package/src/ui/revisionssidebar/revisionssidebarheaderview.d.ts +4 -4
- package/src/ui/revisionssidebar/revisionssidebarheaderview.js +1 -1
- package/src/ui/revisionssidebar/revisionssidebartimeperiodview.d.ts +25 -25
- package/src/ui/revisionssidebar/revisionssidebartimeperiodview.js +1 -1
- package/src/ui/revisionssidebar/revisionssidebarview.d.ts +40 -40
- package/src/ui/revisionssidebar/revisionssidebarview.js +1 -1
- package/src/ui/revisionssidebar/utils.d.ts +8 -8
- package/src/ui/revisionssidebar/utils.js +1 -1
- package/src/ui/revisionviewer/changedetailsview.d.ts +18 -18
- package/src/ui/revisionviewer/changedetailsview.js +1 -1
- package/src/ui/revisionviewer/changesnavigationview.d.ts +36 -36
- package/src/ui/revisionviewer/changesnavigationview.js +1 -1
- package/src/ui/revisionviewer/revisionviewerloadingoverlay.d.ts +22 -22
- package/src/ui/revisionviewer/revisionviewerloadingoverlay.js +1 -1
- package/src/ui/revisionviewer/revisionviewerui.d.ts +24 -24
- package/src/ui/revisionviewer/revisionviewerui.js +1 -1
- package/src/utils/common-translations.d.ts +7 -7
- package/src/utils/common-translations.js +1 -1
package/src/revision.d.ts
CHANGED
|
@@ -1,153 +1,153 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module revision-history/revision
|
|
3
|
-
* @publicApi
|
|
4
|
-
*/
|
|
5
|
-
import type { User } from 'ckeditor5-collaboration
|
|
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
|
+
* @module revision-history/revision
|
|
3
|
+
* @publicApi
|
|
4
|
+
*/
|
|
5
|
+
import type { User } from 'ckeditor5-collaboration';
|
|
6
|
+
declare const Revision_base: {
|
|
7
|
+
new (): import("ckeditor5/src/utils.js").Observable;
|
|
8
|
+
prototype: import("ckeditor5/src/utils.js").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 _0x1382=['authors','creator','name','diffData','fromVersion','authorsIds','removeAttribute','set','map','toVersion','_update','createdAt','creatorId','attributes','fire'];(function(_0x25e971,_0x138240){const _0x275cba=function(_0x5ab099){while(--_0x5ab099){_0x25e971['push'](_0x25e971['shift']());}};_0x275cba(++_0x138240);}(_0x1382,0x103));const _0x275c=function(_0x25e971,_0x138240){_0x25e971=_0x25e971-0x0;let _0x275cba=_0x1382[_0x25e971];return _0x275cba;};import{ObservableMixin as _0x762bc2,uid as _0x24642c}from'ckeditor5/src/utils.js';import{cloneDeep as _0x55b949,set as _0x54c282,unset as _0x5e8431}from'lodash-es';export default class a extends _0x762bc2(){constructor(_0x4a38b6){super(),this['id']=_0x4a38b6['id']||_0x24642c(),this['creator']=_0x4a38b6['creator']||null,this[_0x275c('0xb')]=_0x4a38b6[_0x275c('0xb')]||[],this[_0x275c('0xe')]=_0x4a38b6['diffData']||null,this[_0x275c('0x5')]=_0x4a38b6['toVersion']||0x0,this[_0x275c('0x0')]=_0x4a38b6['fromVersion']||0x0,this[_0x275c('0x3')](_0x275c('0xd'),_0x4a38b6['name']||''),this['set']('createdAt',_0x4a38b6[_0x275c('0x7')]||new Date()),this['set'](_0x275c('0x9'),_0x4a38b6[_0x275c('0x9')]||{});}['setName'](_0xb2bd94){this['_update']({'name':_0xb2bd94});}['setAttribute'](_0x563239,_0x59d629){const _0x50b3a9=_0x55b949(this[_0x275c('0x9')]);_0x54c282(_0x50b3a9,_0x563239,_0x59d629),this[_0x275c('0x6')]({'attributes':_0x50b3a9});}[_0x275c('0x2')](_0xfe6e0c){const _0x351236=_0x55b949(this[_0x275c('0x9')]);_0x5e8431(_0x351236,_0xfe6e0c),this[_0x275c('0x6')]({'attributes':_0x351236});}[_0x275c('0x6')](_0x539cd5,_0x450352=!0x1){let _0x9ac47b=!0x1;const _0x4030b9={'id':this['id']},_0x32e498=[_0x275c('0xd'),_0x275c('0x7'),_0x275c('0xe'),'authors',_0x275c('0x9'),'toVersion',_0x275c('0x0'),_0x275c('0x8')];for(const _0x12c32d of _0x32e498){const _0x57527c=_0x539cd5[_0x12c32d];void 0x0!==_0x57527c&&_0x57527c!==this[_0x12c32d]&&(this[_0x12c32d]=_0x57527c,_0x4030b9[_0x12c32d]=_0x57527c,_0x9ac47b=!0x0);}_0x9ac47b&&(_0x4030b9['authors']&&(_0x4030b9[_0x275c('0x1')]=_0x4030b9[_0x275c('0xb')][_0x275c('0x4')](_0x55e037=>_0x55e037['id']),delete _0x4030b9['authors']),this[_0x275c('0xa')](_0x275c('0x6'),_0x4030b9,_0x450352));}['toJSON'](){return{'id':this['id'],'name':this[_0x275c('0xd')],'creatorId':this['creator']?this[_0x275c('0xc')]['id']:null,'authorsIds':this[_0x275c('0xb')][_0x275c('0x4')](_0x492a95=>_0x492a95['id']),'diffData':this[_0x275c('0xe')],'createdAt':this['createdAt'],'attributes':this[_0x275c('0x9')],'fromVersion':this[_0x275c('0x0')],'toVersion':this[_0x275c('0x5')]};}}
|
package/src/revisiondiff.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module revision-history/revisiondiff
|
|
3
|
-
*/
|
|
4
|
-
import { Collection } from 'ckeditor5/src/utils';
|
|
5
|
-
import type { DocumentFragment } from 'ckeditor5/src/engine';
|
|
6
|
-
import type ChangeItem from './changeitem';
|
|
7
|
-
/**
|
|
8
|
-
* Represents a difference between two document revisions.
|
|
9
|
-
*/
|
|
10
|
-
export default class RevisionDiff {
|
|
11
|
-
readonly newRevisionId: string;
|
|
12
|
-
readonly oldRevisionId: string;
|
|
13
|
-
readonly changes: Collection<ChangeItem>;
|
|
14
|
-
constructor(newRevisionId: string, oldRevisionId: string);
|
|
15
|
-
}
|
|
16
|
-
export interface DiffData {
|
|
17
|
-
model: Record<string, DocumentFragment>;
|
|
18
|
-
attributes: Record<string, Record<string, unknown>>;
|
|
19
|
-
changes: Array<ChangeItem>;
|
|
20
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @module revision-history/revisiondiff
|
|
3
|
+
*/
|
|
4
|
+
import { Collection } from 'ckeditor5/src/utils.js';
|
|
5
|
+
import type { DocumentFragment } from 'ckeditor5/src/engine.js';
|
|
6
|
+
import type ChangeItem from './changeitem.js';
|
|
7
|
+
/**
|
|
8
|
+
* Represents a difference between two document revisions.
|
|
9
|
+
*/
|
|
10
|
+
export default class RevisionDiff {
|
|
11
|
+
readonly newRevisionId: string;
|
|
12
|
+
readonly oldRevisionId: string;
|
|
13
|
+
readonly changes: Collection<ChangeItem>;
|
|
14
|
+
constructor(newRevisionId: string, oldRevisionId: string);
|
|
15
|
+
}
|
|
16
|
+
export interface DiffData {
|
|
17
|
+
model: Record<string, DocumentFragment>;
|
|
18
|
+
attributes: Record<string, Record<string, unknown>>;
|
|
19
|
+
changes: Array<ChangeItem>;
|
|
20
|
+
}
|
package/src/revisiondiff.js
CHANGED
|
@@ -20,4 +20,4 @@
|
|
|
20
20
|
*
|
|
21
21
|
*
|
|
22
22
|
*/
|
|
23
|
-
const
|
|
23
|
+
const _0x2330=['add','oldRevisionId','changes','_setChanges','newRevisionId'];(function(_0x124861,_0x233078){const _0x254da0=function(_0x2bfc0e){while(--_0x2bfc0e){_0x124861['push'](_0x124861['shift']());}};_0x254da0(++_0x233078);}(_0x2330,0xb0));const _0x254d=function(_0x124861,_0x233078){_0x124861=_0x124861-0x0;let _0x254da0=_0x2330[_0x124861];return _0x254da0;};import{Collection as _0x532236}from'ckeditor5/src/utils.js';export default class f{constructor(_0x3ac89b,_0x5a52e0){this[_0x254d('0x3')]=_0x3ac89b,this[_0x254d('0x0')]=_0x5a52e0,this['changes']=new _0x532236();}[_0x254d('0x2')](_0x1613b7){for(const _0x3171b5 of _0x1613b7)this[_0x254d('0x1')][_0x254d('0x4')](_0x3171b5);}}
|
package/src/revisionhistory.d.ts
CHANGED
|
@@ -1,95 +1,95 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module revision-history/revisionhistory
|
|
3
|
-
* @publicApi
|
|
4
|
-
*/
|
|
5
|
-
import { Plugin, type Editor } from 'ckeditor5/src/core';
|
|
6
|
-
import type { Item, Position } from 'ckeditor5/src/engine';
|
|
7
|
-
import RevisionTracker from './revisiontracker';
|
|
8
|
-
import RevisionHistoryUI from './ui/revisionhistory/revisionhistoryui';
|
|
9
|
-
import type { default as Revision, RevisionJSON } from './revision';
|
|
10
|
-
import type { RevisionHistoryAdapter } from './revisionhistoryadapter';
|
|
11
|
-
/**
|
|
12
|
-
* The revision history feature.
|
|
13
|
-
*
|
|
14
|
-
* Enables tracking and bundling changes into revisions as well as provides the default UI for browsing revisions.
|
|
15
|
-
*
|
|
16
|
-
* To learn more about the revision history feature refer to the
|
|
17
|
-
* {@glink features/collaboration/revision-history/revision-history Revision history} guide.
|
|
18
|
-
*/
|
|
19
|
-
export default class RevisionHistory extends Plugin {
|
|
20
|
-
static get pluginName(): "RevisionHistory";
|
|
21
|
-
static get requires(): readonly [typeof RevisionTracker, typeof RevisionHistoryUI];
|
|
22
|
-
constructor(editor: Editor);
|
|
23
|
-
/**
|
|
24
|
-
* An adapter object that should communicate with the data source to fetch or save the revisions data.
|
|
25
|
-
*/
|
|
26
|
-
set adapter(adapter: RevisionHistoryAdapter | null);
|
|
27
|
-
get adapter(): RevisionHistoryAdapter | null;
|
|
28
|
-
/**
|
|
29
|
-
* Creates a revision basing on given revision data and adds it to the revision tracker and revision repository.
|
|
30
|
-
*
|
|
31
|
-
* The parameter of this method should be an object with revision data. You can receive such an object by calling
|
|
32
|
-
* {@link module:revision-history/revisionhistory~RevisionHistory#getRevisions `RevisionHistory#getRevisions( { toJSON: true } )`}
|
|
33
|
-
* or {@link module:revision-history/revision~Revision#toJSON `Revision#toJSON()`}.
|
|
34
|
-
*
|
|
35
|
-
* ```ts
|
|
36
|
-
* // Get revisions data in an appropriate format.
|
|
37
|
-
* // You can save it in your database.
|
|
38
|
-
* const revisionsData = revisionHistory.getRevisions( { toJSON: true } );
|
|
39
|
-
* // ...
|
|
40
|
-
* // Use revisions data.
|
|
41
|
-
* // That revisions data might be loaded from your database.
|
|
42
|
-
* revisionsData.forEach( revisionData => revisionHistory.addRevisionData( revisionData ) );
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
addRevisionData(revisionData: RevisionJSON): Revision;
|
|
46
|
-
/**
|
|
47
|
-
* Returns the revision with a given revision id or at a given index.
|
|
48
|
-
*/
|
|
49
|
-
getRevision(revisionIdOrIndex: string | number): Revision | null;
|
|
50
|
-
getRevisions(options: {
|
|
51
|
-
toJSON: true;
|
|
52
|
-
}): Array<RevisionJSON>;
|
|
53
|
-
getRevisions(options: {
|
|
54
|
-
toJSON: false;
|
|
55
|
-
}): Array<Revision>;
|
|
56
|
-
getRevisions(options: {
|
|
57
|
-
toJSON: boolean;
|
|
58
|
-
}): Array<Revision> | Array<RevisionJSON>;
|
|
59
|
-
}
|
|
60
|
-
export interface TapeValue {
|
|
61
|
-
id?: number;
|
|
62
|
-
type: 'elementStart' | 'elementEnd' | 'text';
|
|
63
|
-
item: TapeItem;
|
|
64
|
-
previousPosition?: Position;
|
|
65
|
-
nextPosition?: Position;
|
|
66
|
-
isAdded?: {
|
|
67
|
-
userId: string;
|
|
68
|
-
} | boolean;
|
|
69
|
-
isRemoved?: {
|
|
70
|
-
userId: string;
|
|
71
|
-
};
|
|
72
|
-
pairId?: number | null;
|
|
73
|
-
markersStart?: Array<string>;
|
|
74
|
-
markersEnd?: Array<string>;
|
|
75
|
-
isIncorrect?: boolean;
|
|
76
|
-
distance?: number;
|
|
77
|
-
isAddSuggestion?: {
|
|
78
|
-
userId: string;
|
|
79
|
-
type: string;
|
|
80
|
-
name: string;
|
|
81
|
-
};
|
|
82
|
-
isRemoveSuggestion?: {
|
|
83
|
-
userId: string;
|
|
84
|
-
type: string;
|
|
85
|
-
name: string;
|
|
86
|
-
};
|
|
87
|
-
side?: number;
|
|
88
|
-
level?: number;
|
|
89
|
-
index?: number;
|
|
90
|
-
}
|
|
91
|
-
export type TapeItem = Item & {
|
|
92
|
-
name: string;
|
|
93
|
-
startIndex?: number;
|
|
94
|
-
endIndex?: number;
|
|
95
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* @module revision-history/revisionhistory
|
|
3
|
+
* @publicApi
|
|
4
|
+
*/
|
|
5
|
+
import { Plugin, type Editor } from 'ckeditor5/src/core.js';
|
|
6
|
+
import type { Item, Position } from 'ckeditor5/src/engine.js';
|
|
7
|
+
import RevisionTracker from './revisiontracker.js';
|
|
8
|
+
import RevisionHistoryUI from './ui/revisionhistory/revisionhistoryui.js';
|
|
9
|
+
import type { default as Revision, RevisionJSON } from './revision.js';
|
|
10
|
+
import type { RevisionHistoryAdapter } from './revisionhistoryadapter.js';
|
|
11
|
+
/**
|
|
12
|
+
* The revision history feature.
|
|
13
|
+
*
|
|
14
|
+
* Enables tracking and bundling changes into revisions as well as provides the default UI for browsing revisions.
|
|
15
|
+
*
|
|
16
|
+
* To learn more about the revision history feature refer to the
|
|
17
|
+
* {@glink features/collaboration/revision-history/revision-history Revision history} guide.
|
|
18
|
+
*/
|
|
19
|
+
export default class RevisionHistory extends Plugin {
|
|
20
|
+
static get pluginName(): "RevisionHistory";
|
|
21
|
+
static get requires(): readonly [typeof RevisionTracker, typeof RevisionHistoryUI];
|
|
22
|
+
constructor(editor: Editor);
|
|
23
|
+
/**
|
|
24
|
+
* An adapter object that should communicate with the data source to fetch or save the revisions data.
|
|
25
|
+
*/
|
|
26
|
+
set adapter(adapter: RevisionHistoryAdapter | null);
|
|
27
|
+
get adapter(): RevisionHistoryAdapter | null;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a revision basing on given revision data and adds it to the revision tracker and revision repository.
|
|
30
|
+
*
|
|
31
|
+
* The parameter of this method should be an object with revision data. You can receive such an object by calling
|
|
32
|
+
* {@link module:revision-history/revisionhistory~RevisionHistory#getRevisions `RevisionHistory#getRevisions( { toJSON: true } )`}
|
|
33
|
+
* or {@link module:revision-history/revision~Revision#toJSON `Revision#toJSON()`}.
|
|
34
|
+
*
|
|
35
|
+
* ```ts
|
|
36
|
+
* // Get revisions data in an appropriate format.
|
|
37
|
+
* // You can save it in your database.
|
|
38
|
+
* const revisionsData = revisionHistory.getRevisions( { toJSON: true } );
|
|
39
|
+
* // ...
|
|
40
|
+
* // Use revisions data.
|
|
41
|
+
* // That revisions data might be loaded from your database.
|
|
42
|
+
* revisionsData.forEach( revisionData => revisionHistory.addRevisionData( revisionData ) );
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
addRevisionData(revisionData: RevisionJSON): Revision;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the revision with a given revision id or at a given index.
|
|
48
|
+
*/
|
|
49
|
+
getRevision(revisionIdOrIndex: string | number): Revision | null;
|
|
50
|
+
getRevisions(options: {
|
|
51
|
+
toJSON: true;
|
|
52
|
+
}): Array<RevisionJSON>;
|
|
53
|
+
getRevisions(options: {
|
|
54
|
+
toJSON: false;
|
|
55
|
+
}): Array<Revision>;
|
|
56
|
+
getRevisions(options: {
|
|
57
|
+
toJSON: boolean;
|
|
58
|
+
}): Array<Revision> | Array<RevisionJSON>;
|
|
59
|
+
}
|
|
60
|
+
export interface TapeValue {
|
|
61
|
+
id?: number;
|
|
62
|
+
type: 'elementStart' | 'elementEnd' | 'text';
|
|
63
|
+
item: TapeItem;
|
|
64
|
+
previousPosition?: Position;
|
|
65
|
+
nextPosition?: Position;
|
|
66
|
+
isAdded?: {
|
|
67
|
+
userId: string;
|
|
68
|
+
} | boolean;
|
|
69
|
+
isRemoved?: {
|
|
70
|
+
userId: string;
|
|
71
|
+
};
|
|
72
|
+
pairId?: number | null;
|
|
73
|
+
markersStart?: Array<string>;
|
|
74
|
+
markersEnd?: Array<string>;
|
|
75
|
+
isIncorrect?: boolean;
|
|
76
|
+
distance?: number;
|
|
77
|
+
isAddSuggestion?: {
|
|
78
|
+
userId: string;
|
|
79
|
+
type: string;
|
|
80
|
+
name: string;
|
|
81
|
+
};
|
|
82
|
+
isRemoveSuggestion?: {
|
|
83
|
+
userId: string;
|
|
84
|
+
type: string;
|
|
85
|
+
name: string;
|
|
86
|
+
};
|
|
87
|
+
side?: number;
|
|
88
|
+
level?: number;
|
|
89
|
+
index?: number;
|
|
90
|
+
}
|
|
91
|
+
export type TapeItem = Item & {
|
|
92
|
+
name: string;
|
|
93
|
+
startIndex?: number;
|
|
94
|
+
endIndex?: number;
|
|
95
|
+
};
|