@ckeditor/ckeditor5-revision-history 40.0.0 → 40.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/LICENSE.md +3 -3
  2. package/build/revision-history.js +1 -1
  3. package/package.json +6 -6
  4. package/src/augmentation.d.ts +29 -29
  5. package/src/changeitem.d.ts +58 -58
  6. package/src/changeitem.js +1 -1
  7. package/src/editor/revisionviewereditor.d.ts +27 -27
  8. package/src/editor/revisionviewereditor.js +1 -1
  9. package/src/editor/revisionviewereditorui.d.ts +28 -28
  10. package/src/editor/revisionviewereditorui.js +1 -1
  11. package/src/editor/revisionviewereditoruiview.d.ts +43 -43
  12. package/src/editor/revisionviewereditoruiview.js +1 -1
  13. package/src/index.d.ts +15 -15
  14. package/src/revision.d.ts +153 -153
  15. package/src/revision.js +1 -1
  16. package/src/revisiondiff.d.ts +24 -24
  17. package/src/revisiondiff.js +1 -1
  18. package/src/revisionhistory.d.ts +99 -99
  19. package/src/revisionhistory.js +1 -1
  20. package/src/revisionhistoryadapter.d.ts +64 -64
  21. package/src/revisionhistoryconfig.d.ts +60 -60
  22. package/src/revisionsrepository.d.ts +52 -52
  23. package/src/revisionsrepository.js +1 -1
  24. package/src/revisiontracker.d.ts +81 -81
  25. package/src/revisiontracker.js +1 -1
  26. package/src/revisionviewer.d.ts +25 -25
  27. package/src/revisionviewer.js +1 -1
  28. package/src/ui/revision/createrevisionactionsdropdown.d.ts +10 -10
  29. package/src/ui/revision/createrevisionactionsdropdown.js +1 -1
  30. package/src/ui/revision/revisionauthorview.d.ts +5 -5
  31. package/src/ui/revision/revisionauthorview.js +1 -1
  32. package/src/ui/revision/revisionnameview.d.ts +5 -5
  33. package/src/ui/revision/revisionnameview.js +1 -1
  34. package/src/ui/revision/revisionview.d.ts +95 -95
  35. package/src/ui/revision/revisionview.js +1 -1
  36. package/src/ui/revision/subrevisioncollapserview.d.ts +21 -21
  37. package/src/ui/revision/subrevisioncollapserview.js +1 -1
  38. package/src/ui/revision/subrevisionview.d.ts +34 -34
  39. package/src/ui/revision/subrevisionview.js +1 -1
  40. package/src/ui/revision/utils.d.ts +5 -5
  41. package/src/ui/revision/utils.js +1 -1
  42. package/src/ui/revisionhistory/revisionhistorysaverevisionformview.d.ts +81 -81
  43. package/src/ui/revisionhistory/revisionhistorysaverevisionformview.js +1 -1
  44. package/src/ui/revisionhistory/revisionhistoryui.d.ts +26 -26
  45. package/src/ui/revisionhistory/revisionhistoryui.js +1 -1
  46. package/src/ui/revisionssidebar/revisionssidebar.d.ts +44 -44
  47. package/src/ui/revisionssidebar/revisionssidebar.js +1 -1
  48. package/src/ui/revisionssidebar/revisionssidebarheaderview.d.ts +5 -5
  49. package/src/ui/revisionssidebar/revisionssidebarheaderview.js +1 -1
  50. package/src/ui/revisionssidebar/revisionssidebartimeperiodview.d.ts +29 -29
  51. package/src/ui/revisionssidebar/revisionssidebartimeperiodview.js +1 -1
  52. package/src/ui/revisionssidebar/revisionssidebarview.d.ts +44 -44
  53. package/src/ui/revisionssidebar/revisionssidebarview.js +1 -1
  54. package/src/ui/revisionssidebar/utils.d.ts +9 -9
  55. package/src/ui/revisionssidebar/utils.js +1 -1
  56. package/src/ui/revisionviewer/changedetailsview.d.ts +22 -22
  57. package/src/ui/revisionviewer/changedetailsview.js +1 -1
  58. package/src/ui/revisionviewer/changesnavigationview.d.ts +40 -40
  59. package/src/ui/revisionviewer/changesnavigationview.js +1 -1
  60. package/src/ui/revisionviewer/revisionviewerloadingoverlay.d.ts +26 -26
  61. package/src/ui/revisionviewer/revisionviewerloadingoverlay.js +1 -1
  62. package/src/ui/revisionviewer/revisionviewerui.d.ts +28 -28
  63. package/src/ui/revisionviewer/revisionviewerui.js +1 -1
  64. package/src/utils/common-translations.d.ts +11 -11
  65. 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 _0x12cc=['setAttribute','_update','setName','createdAt','map','diffData','fromVersion','name','authorsIds','toVersion','attributes','creatorId','authors','removeAttribute','set','creator'];(function(_0x46dff7,_0x12cc0f){const _0x4ca94c=function(_0x29bedf){while(--_0x29bedf){_0x46dff7['push'](_0x46dff7['shift']());}};_0x4ca94c(++_0x12cc0f);}(_0x12cc,0x18e));const _0x4ca9=function(_0x46dff7,_0x12cc0f){_0x46dff7=_0x46dff7-0x0;let _0x4ca94c=_0x12cc[_0x46dff7];return _0x4ca94c;};import{ObservableMixin as _0x3fef7e,uid as _0x168a4d}from'ckeditor5/src/utils';import{cloneDeep as _0x5aae24,set as _0xa0d48b,unset as _0x32a210}from'lodash-es';export default class a extends _0x3fef7e(){constructor(_0x3d4f89){super(),this['id']=_0x3d4f89['id']||_0x168a4d(),this['creator']=_0x3d4f89[_0x4ca9('0x1')]||null,this[_0x4ca9('0xe')]=_0x3d4f89[_0x4ca9('0xe')]||[],this[_0x4ca9('0x7')]=_0x3d4f89['diffData']||null,this[_0x4ca9('0xb')]=_0x3d4f89[_0x4ca9('0xb')]||0x0,this[_0x4ca9('0x8')]=_0x3d4f89[_0x4ca9('0x8')]||0x0,this[_0x4ca9('0x0')]('name',_0x3d4f89[_0x4ca9('0x9')]||''),this['set']('createdAt',_0x3d4f89[_0x4ca9('0x5')]||new Date()),this[_0x4ca9('0x0')](_0x4ca9('0xc'),_0x3d4f89['attributes']||{});}[_0x4ca9('0x4')](_0x1c29e4){this[_0x4ca9('0x3')]({'name':_0x1c29e4});}[_0x4ca9('0x2')](_0xc477b1,_0x4220a6){const _0x33f19f=_0x5aae24(this[_0x4ca9('0xc')]);_0xa0d48b(_0x33f19f,_0xc477b1,_0x4220a6),this[_0x4ca9('0x3')]({'attributes':_0x33f19f});}[_0x4ca9('0xf')](_0x1fb1e6){const _0x261647=_0x5aae24(this[_0x4ca9('0xc')]);_0x32a210(_0x261647,_0x1fb1e6),this[_0x4ca9('0x3')]({'attributes':_0x261647});}[_0x4ca9('0x3')](_0x50b982,_0x964490=!0x1){let _0x3579bd=!0x1;const _0x510c69={'id':this['id']},_0x13d190=['name','createdAt',_0x4ca9('0x7'),_0x4ca9('0xe'),_0x4ca9('0xc'),'toVersion','fromVersion',_0x4ca9('0xd')];for(const _0xa9df0b of _0x13d190){const _0x356476=_0x50b982[_0xa9df0b];void 0x0!==_0x356476&&_0x356476!==this[_0xa9df0b]&&(this[_0xa9df0b]=_0x356476,_0x510c69[_0xa9df0b]=_0x356476,_0x3579bd=!0x0);}_0x3579bd&&(_0x510c69[_0x4ca9('0xe')]&&(_0x510c69[_0x4ca9('0xa')]=_0x510c69['authors']['map'](_0x1008c5=>_0x1008c5['id']),delete _0x510c69[_0x4ca9('0xe')]),this['fire'](_0x4ca9('0x3'),_0x510c69,_0x964490));}['toJSON'](){return{'id':this['id'],'name':this['name'],'creatorId':this[_0x4ca9('0x1')]?this[_0x4ca9('0x1')]['id']:null,'authorsIds':this[_0x4ca9('0xe')][_0x4ca9('0x6')](_0x26912e=>_0x26912e['id']),'diffData':this[_0x4ca9('0x7')],'createdAt':this[_0x4ca9('0x5')],'attributes':this[_0x4ca9('0xc')],'fromVersion':this[_0x4ca9('0x8')],'toVersion':this[_0x4ca9('0xb')]};}}
23
+ const _0xd63d=['authorsIds','_update','toVersion','fire','set','map','name','setAttribute','createdAt','authors','attributes','diffData','creator','fromVersion','toJSON','setName','removeAttribute'];(function(_0x5a6bc5,_0xd63deb){const _0x11761b=function(_0x2f7590){while(--_0x2f7590){_0x5a6bc5['push'](_0x5a6bc5['shift']());}};_0x11761b(++_0xd63deb);}(_0xd63d,0x1e0));const _0x1176=function(_0x5a6bc5,_0xd63deb){_0x5a6bc5=_0x5a6bc5-0x0;let _0x11761b=_0xd63d[_0x5a6bc5];return _0x11761b;};import{ObservableMixin as _0x5e1c04,uid as _0x10d8e3}from'ckeditor5/src/utils';import{cloneDeep as _0x2b4fb1,set as _0x384c22,unset as _0x52368e}from'lodash-es';export default class a extends _0x5e1c04(){constructor(_0xdd8692){super(),this['id']=_0xdd8692['id']||_0x10d8e3(),this[_0x1176('0x8')]=_0xdd8692['creator']||null,this[_0x1176('0x5')]=_0xdd8692[_0x1176('0x5')]||[],this[_0x1176('0x7')]=_0xdd8692[_0x1176('0x7')]||null,this[_0x1176('0xf')]=_0xdd8692[_0x1176('0xf')]||0x0,this[_0x1176('0x9')]=_0xdd8692['fromVersion']||0x0,this[_0x1176('0x0')]('name',_0xdd8692[_0x1176('0x2')]||''),this[_0x1176('0x0')](_0x1176('0x4'),_0xdd8692[_0x1176('0x4')]||new Date()),this[_0x1176('0x0')](_0x1176('0x6'),_0xdd8692['attributes']||{});}[_0x1176('0xb')](_0x403c24){this[_0x1176('0xe')]({'name':_0x403c24});}[_0x1176('0x3')](_0x11ddbd,_0x4b0291){const _0x411364=_0x2b4fb1(this['attributes']);_0x384c22(_0x411364,_0x11ddbd,_0x4b0291),this[_0x1176('0xe')]({'attributes':_0x411364});}[_0x1176('0xc')](_0x4895e4){const _0x2aeedd=_0x2b4fb1(this[_0x1176('0x6')]);_0x52368e(_0x2aeedd,_0x4895e4),this['_update']({'attributes':_0x2aeedd});}[_0x1176('0xe')](_0x56aba0,_0xe2eac2=!0x1){let _0x5a3a59=!0x1;const _0x2107b5={'id':this['id']},_0x4e00a1=['name',_0x1176('0x4'),_0x1176('0x7'),'authors','attributes',_0x1176('0xf'),_0x1176('0x9'),'creatorId'];for(const _0xe3503a of _0x4e00a1){const _0x2726c9=_0x56aba0[_0xe3503a];void 0x0!==_0x2726c9&&_0x2726c9!==this[_0xe3503a]&&(this[_0xe3503a]=_0x2726c9,_0x2107b5[_0xe3503a]=_0x2726c9,_0x5a3a59=!0x0);}_0x5a3a59&&(_0x2107b5[_0x1176('0x5')]&&(_0x2107b5[_0x1176('0xd')]=_0x2107b5['authors'][_0x1176('0x1')](_0x58d3b3=>_0x58d3b3['id']),delete _0x2107b5[_0x1176('0x5')]),this[_0x1176('0x10')](_0x1176('0xe'),_0x2107b5,_0xe2eac2));}[_0x1176('0xa')](){return{'id':this['id'],'name':this[_0x1176('0x2')],'creatorId':this[_0x1176('0x8')]?this[_0x1176('0x8')]['id']:null,'authorsIds':this[_0x1176('0x5')][_0x1176('0x1')](_0x551ca8=>_0x551ca8['id']),'diffData':this['diffData'],'createdAt':this['createdAt'],'attributes':this[_0x1176('0x6')],'fromVersion':this['fromVersion'],'toVersion':this[_0x1176('0xf')]};}}
@@ -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
+ }
@@ -20,4 +20,4 @@
20
20
  *
21
21
  *
22
22
  */
23
- const _0x48ba=['changes','add','_setChanges','newRevisionId'];(function(_0x2e6e8f,_0x48ba71){const _0x2418e1=function(_0x2b477f){while(--_0x2b477f){_0x2e6e8f['push'](_0x2e6e8f['shift']());}};_0x2418e1(++_0x48ba71);}(_0x48ba,0x127));const _0x2418=function(_0x2e6e8f,_0x48ba71){_0x2e6e8f=_0x2e6e8f-0x0;let _0x2418e1=_0x48ba[_0x2e6e8f];return _0x2418e1;};import{Collection as _0xcf340e}from'ckeditor5/src/utils';export default class f{constructor(_0x39c5f1,_0x5c167b){this[_0x2418('0x0')]=_0x39c5f1,this['oldRevisionId']=_0x5c167b,this[_0x2418('0x1')]=new _0xcf340e();}[_0x2418('0x3')](_0x180de3){for(const _0x2cc9c7 of _0x180de3)this['changes'][_0x2418('0x2')](_0x2cc9c7);}}
23
+ const _0x3aff=['newRevisionId','_setChanges','oldRevisionId','changes'];(function(_0x3d4758,_0x3aff7d){const _0x52a214=function(_0x574463){while(--_0x574463){_0x3d4758['push'](_0x3d4758['shift']());}};_0x52a214(++_0x3aff7d);}(_0x3aff,0x165));const _0x52a2=function(_0x3d4758,_0x3aff7d){_0x3d4758=_0x3d4758-0x0;let _0x52a214=_0x3aff[_0x3d4758];return _0x52a214;};import{Collection as _0x463517}from'ckeditor5/src/utils';export default class f{constructor(_0x2b8c89,_0x3c9e8c){this[_0x52a2('0x3')]=_0x2b8c89,this[_0x52a2('0x1')]=_0x3c9e8c,this[_0x52a2('0x2')]=new _0x463517();}[_0x52a2('0x0')](_0x1c9066){for(const _0x52fdea of _0x1c9066)this[_0x52a2('0x2')]['add'](_0x52fdea);}}
@@ -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
+ };