@syncfusion/ej2-docx-renderer 0.0.0-stage → 35.2.15
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/README.md +2 -2
- package/base.d.ts +4 -0
- package/base.js +4 -0
- package/dist/ej2-docx-renderer.umd.min.js +2 -0
- package/dist/ej2-docx-renderer.umd.min.js.map +1 -0
- package/dist/es6/ej2-docx-renderer.es2015.js +52432 -0
- package/dist/es6/ej2-docx-renderer.es2015.js.map +1 -0
- package/dist/es6/ej2-docx-renderer.es5.js +54425 -0
- package/dist/es6/ej2-docx-renderer.es5.js.map +1 -0
- package/dist/global/ej2-docx-renderer.min.js +2 -0
- package/dist/global/ej2-docx-renderer.min.js.map +1 -0
- package/dist/global/index.d.ts +5 -0
- package/format.d.ts +4 -0
- package/format.js +4 -0
- package/helper.d.ts +4 -0
- package/helper.js +4 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/license +10 -0
- package/list.d.ts +4 -0
- package/list.js +4 -0
- package/package.json +26 -4
- package/parser.d.ts +4 -0
- package/parser.js +4 -0
- package/src/base/constants.d.ts +2 -0
- package/src/base/constants.js +2 -0
- package/src/base/dictionary.d.ts +52 -0
- package/src/base/dictionary.js +137 -0
- package/src/base/index.d.ts +9 -0
- package/src/base/index.js +9 -0
- package/src/base/keywords.d.ts +422 -0
- package/src/base/keywords.js +422 -0
- package/src/base/types.d.ts +2590 -0
- package/src/base/types.js +1056 -0
- package/src/base/unique-format.d.ts +87 -0
- package/src/base/unique-format.js +858 -0
- package/src/base/unique-formats.d.ts +32 -0
- package/src/base/unique-formats.js +87 -0
- package/src/document-canvas.d.ts +61 -0
- package/src/document-canvas.js +221 -0
- package/src/docx-renderer.d.ts +941 -0
- package/src/docx-renderer.js +2251 -0
- package/src/format/border.d.ts +53 -0
- package/src/format/border.js +600 -0
- package/src/format/borders.d.ts +44 -0
- package/src/format/borders.js +314 -0
- package/src/format/cell-format.d.ts +42 -0
- package/src/format/cell-format.js +309 -0
- package/src/format/character-format.d.ts +152 -0
- package/src/format/character-format.js +1224 -0
- package/src/format/index.d.ts +14 -0
- package/src/format/index.js +14 -0
- package/src/format/list-format.d.ts +32 -0
- package/src/format/list-format.js +238 -0
- package/src/format/paragraph-format.d.ts +103 -0
- package/src/format/paragraph-format.js +854 -0
- package/src/format/row-format.d.ts +119 -0
- package/src/format/row-format.js +545 -0
- package/src/format/section-format.d.ts +89 -0
- package/src/format/section-format.js +689 -0
- package/src/format/shading.d.ts +24 -0
- package/src/format/shading.js +137 -0
- package/src/format/style.d.ts +106 -0
- package/src/format/style.js +286 -0
- package/src/format/table-format.d.ts +51 -0
- package/src/format/table-format.js +395 -0
- package/src/global.js +1 -0
- package/src/helper/document-editor-helper.d.ts +515 -0
- package/src/helper/document-editor-helper.js +1302 -0
- package/src/helper/document-editor-settings.d.ts +293 -0
- package/src/helper/document-editor-settings.js +94 -0
- package/src/helper/index.d.ts +5 -0
- package/src/helper/index.js +5 -0
- package/src/helper/layout-helper-methods.d.ts +539 -0
- package/src/helper/layout-helper-methods.js +1065 -0
- package/src/helper/renderer-hooks.d.ts +74 -0
- package/src/helper/renderer-hooks.js +14 -0
- package/src/helper/revision-helper-methods.d.ts +199 -0
- package/src/helper/revision-helper-methods.js +362 -0
- package/src/index.d.ts +18 -0
- package/src/index.js +18 -0
- package/src/layout-helper.d.ts +190 -0
- package/src/layout-helper.js +1368 -0
- package/src/layout.d.ts +779 -0
- package/src/layout.js +17232 -0
- package/src/list/abstract-list.d.ts +25 -0
- package/src/list/abstract-list.js +67 -0
- package/src/list/index.d.ts +7 -0
- package/src/list/index.js +7 -0
- package/src/list/level-override.d.ts +22 -0
- package/src/list/level-override.js +43 -0
- package/src/list/list-level.d.ts +57 -0
- package/src/list/list-level.js +249 -0
- package/src/list/list.d.ts +30 -0
- package/src/list/list.js +100 -0
- package/src/page.d.ts +4155 -0
- package/src/page.js +11342 -0
- package/src/parser/index.d.ts +1 -0
- package/src/parser/index.js +1 -0
- package/src/parser/sfdt-reader.d.ts +254 -0
- package/src/parser/sfdt-reader.js +4569 -0
- package/src/render.d.ts +226 -0
- package/src/render.js +4222 -0
- package/src/text-helper.d.ts +144 -0
- package/src/text-helper.js +1079 -0
- package/src/text-helpers/index.d.ts +2 -0
- package/src/text-helpers/index.js +2 -0
- package/src/text-helpers/optimized.d.ts +45 -0
- package/src/text-helpers/optimized.js +121 -0
- package/src/text-helpers/regular.d.ts +37 -0
- package/src/text-helpers/regular.js +93 -0
- package/src/themes/font-scheme.d.ts +28 -0
- package/src/themes/font-scheme.js +107 -0
- package/src/themes/index.d.ts +6 -0
- package/src/themes/index.js +6 -0
- package/src/themes/major-minor-font-scheme.d.ts +14 -0
- package/src/themes/major-minor-font-scheme.js +45 -0
- package/src/themes/themes.d.ts +11 -0
- package/src/themes/themes.js +31 -0
- package/src/utility/index.d.ts +1 -0
- package/src/utility/index.js +1 -0
- package/src/utility/path-util.d.ts +133 -0
- package/src/utility/path-util.js +639 -0
- package/text-helpers.d.ts +4 -0
- package/text-helpers.js +4 -0
- package/themes.d.ts +4 -0
- package/themes.js +4 -0
- package/utility.d.ts +4 -0
- package/utility.js +4 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { BookmarkElementBox, BlockWidget, BodyWidget, CommentElementBox, ContentControl, ElementBox, TextElementBox, Widget } from '../page';
|
|
2
|
+
import { BaselineAlignment } from '../base/types';
|
|
3
|
+
import { WCharacterFormat } from '../format/character-format';
|
|
4
|
+
import { RevisionBase } from './revision-helper-methods';
|
|
5
|
+
import { WRowFormat } from '../index';
|
|
6
|
+
/**
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Editor callbacks used by layout and render. The editor assigns every hook in one place.
|
|
11
|
+
*
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
export declare class RendererHooks {
|
|
15
|
+
/**
|
|
16
|
+
* @private
|
|
17
|
+
* @param {RevisionBase} revision - revision
|
|
18
|
+
* @param {ElementBox | WCharacterFormat | WRowFormat} insertElement - insertElement
|
|
19
|
+
*/
|
|
20
|
+
onRevisionConstructed: (revision: RevisionBase, insertElement: ElementBox | WCharacterFormat | WRowFormat) => void;
|
|
21
|
+
/**
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
onUpdateScrollBars: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* @private
|
|
27
|
+
* @param {BodyWidget} section - section
|
|
28
|
+
*/
|
|
29
|
+
onProcessAsyncPageUpdate: (section: BodyWidget) => void;
|
|
30
|
+
/**
|
|
31
|
+
* @private
|
|
32
|
+
* @param {boolean} isAsync - isAsync
|
|
33
|
+
*/
|
|
34
|
+
onPerformUpdateAfterLoad: (isAsync: boolean) => void;
|
|
35
|
+
/**
|
|
36
|
+
* @private
|
|
37
|
+
* @param {string} name - name
|
|
38
|
+
* @param {BookmarkElementBox} bookmark - bookmark
|
|
39
|
+
*/
|
|
40
|
+
onUpdateBookmarkCollection: (name: string, bookmark: BookmarkElementBox) => void;
|
|
41
|
+
/**
|
|
42
|
+
* @private
|
|
43
|
+
* @param {ContentControl} element - element
|
|
44
|
+
*/
|
|
45
|
+
onInsertContentControl: (element: ContentControl) => void;
|
|
46
|
+
/**
|
|
47
|
+
* @private
|
|
48
|
+
* @param {BlockWidget} start - start
|
|
49
|
+
* @param {BlockWidget} block - block
|
|
50
|
+
*/
|
|
51
|
+
isBlockExistAfter: (start: BlockWidget, block: BlockWidget) => boolean;
|
|
52
|
+
/**
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
getSelectionOffsets: () => {
|
|
56
|
+
start: string;
|
|
57
|
+
end: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* @private
|
|
61
|
+
* @param {string} start - start
|
|
62
|
+
* @param {string} end - end
|
|
63
|
+
*/
|
|
64
|
+
selectRange: (start: string, end: string) => void;
|
|
65
|
+
/**
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
onTriggerSpellChecker: (elementBox: TextElementBox, containerWidget: Widget, isRTL: boolean, left: number, top: number, underlineY: number, baselineAlignment: BaselineAlignment) => void;
|
|
69
|
+
/**
|
|
70
|
+
* @private
|
|
71
|
+
* @param {CommentElementBox} comment - comment
|
|
72
|
+
*/
|
|
73
|
+
onCommentSelected: (comment: CommentElementBox) => void;
|
|
74
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @private
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Editor callbacks used by layout and render. The editor assigns every hook in one place.
|
|
6
|
+
*
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
var RendererHooks = /** @class */ (function () {
|
|
10
|
+
function RendererHooks() {
|
|
11
|
+
}
|
|
12
|
+
return RendererHooks;
|
|
13
|
+
}());
|
|
14
|
+
export { RendererHooks };
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { RevisionType } from '../base';
|
|
2
|
+
import { DocxRenderer } from '../index';
|
|
3
|
+
import { WCharacterFormat, WRowFormat } from '../format';
|
|
4
|
+
import { ElementBox, ParagraphWidget } from '../page';
|
|
5
|
+
/**
|
|
6
|
+
* Shared revision identity used by both the DOCX renderer and the document editor.
|
|
7
|
+
* Contains only members that do not depend on DocumentEditor (accept/reject/select/history).
|
|
8
|
+
*
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class RevisionBase {
|
|
12
|
+
/**
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
ownerNode: ParagraphWidget | WCharacterFormat | WRowFormat;
|
|
16
|
+
/**
|
|
17
|
+
* Gets or sets the author name who made the change.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
author: string;
|
|
23
|
+
/**
|
|
24
|
+
* Indicates when the track changes were made.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
date: string;
|
|
30
|
+
/**
|
|
31
|
+
* To set the custom data value.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
customData: string;
|
|
37
|
+
/**
|
|
38
|
+
* Indicates the type of track changes revision.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
revisionType: RevisionType;
|
|
44
|
+
/**
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
revisionID: string;
|
|
48
|
+
/**
|
|
49
|
+
* @private
|
|
50
|
+
* Cached range of items this revision covers. Subclasses refresh it in getRange().
|
|
51
|
+
*/
|
|
52
|
+
range: (WCharacterFormat | WRowFormat | ElementBox)[];
|
|
53
|
+
/**
|
|
54
|
+
* @private
|
|
55
|
+
* Marks the cached range stale so the next getRange() rebuilds it.
|
|
56
|
+
*/
|
|
57
|
+
hasChanges: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
abstract getRange(updateRange?: boolean): (WCharacterFormat | WRowFormat | ElementBox)[];
|
|
62
|
+
/**
|
|
63
|
+
* @private
|
|
64
|
+
*/
|
|
65
|
+
abstract cloneRevision(): RevisionBase;
|
|
66
|
+
/**
|
|
67
|
+
* @private
|
|
68
|
+
*/
|
|
69
|
+
destroy(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Method to clone the revisions for the element.
|
|
72
|
+
*
|
|
73
|
+
* @param {RevisionBase[]} revisions - revision array.
|
|
74
|
+
* @returns {string[]} - cloned revision ids.
|
|
75
|
+
*/
|
|
76
|
+
/**
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
static cloneRevisions(revisions: RevisionBase[]): string[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Renderer-side revision. Layout, SFDT parse, and paint use this type only.
|
|
83
|
+
* Editor accept/reject/select live on the editor Revision subclass of RevisionBase.
|
|
84
|
+
*/
|
|
85
|
+
/**
|
|
86
|
+
* @private
|
|
87
|
+
*/
|
|
88
|
+
export declare class DocxRevision extends RevisionBase {
|
|
89
|
+
private owner;
|
|
90
|
+
/**
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
constructor(documentHelper: DocxRenderer, author: string, date: string, ownerNode?: ParagraphWidget | WCharacterFormat | WRowFormat);
|
|
94
|
+
/**
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
destroy(): void;
|
|
98
|
+
/**
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
cloneRevision(): DocxRevision;
|
|
102
|
+
/**
|
|
103
|
+
* @private
|
|
104
|
+
*/
|
|
105
|
+
getRange(updateRange?: boolean): (WCharacterFormat | WRowFormat | ElementBox)[];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Shared revision collection. The renderer stores DocxRevision. The editor stores Revision.
|
|
109
|
+
* Both extend RevisionBase, so this is the type EditorProperties can hold.
|
|
110
|
+
*/
|
|
111
|
+
/**
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
export declare class RevisionCollectionBase {
|
|
115
|
+
/**
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
changes: RevisionBase[];
|
|
119
|
+
/**
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
clear(): void;
|
|
123
|
+
/**
|
|
124
|
+
* @private
|
|
125
|
+
*/
|
|
126
|
+
destroy(): void;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Represents the revision collections in the document (renderer).
|
|
130
|
+
* Stores DocxRevision only. The editor keeps its own RevisionCollection of Revision.
|
|
131
|
+
*/
|
|
132
|
+
/**
|
|
133
|
+
* @private
|
|
134
|
+
*/
|
|
135
|
+
export declare class DocxRevisionCollection extends RevisionCollectionBase {
|
|
136
|
+
/**
|
|
137
|
+
* @private
|
|
138
|
+
*/
|
|
139
|
+
changes: DocxRevision[];
|
|
140
|
+
/**
|
|
141
|
+
* @private
|
|
142
|
+
*/
|
|
143
|
+
clear(): void;
|
|
144
|
+
/**
|
|
145
|
+
* @private
|
|
146
|
+
*/
|
|
147
|
+
destroy(): void;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @private
|
|
151
|
+
*/
|
|
152
|
+
export interface RevisionInfo {
|
|
153
|
+
type: RevisionType;
|
|
154
|
+
color: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* The RevisionHelperMethods class which holds revision helper methods.
|
|
158
|
+
*/
|
|
159
|
+
/**
|
|
160
|
+
* @private
|
|
161
|
+
*/
|
|
162
|
+
export declare class RevisionHelperMethods {
|
|
163
|
+
private documentHelper;
|
|
164
|
+
/**
|
|
165
|
+
* @private
|
|
166
|
+
*/
|
|
167
|
+
constructor(documentHelper: DocxRenderer);
|
|
168
|
+
/**
|
|
169
|
+
* @private
|
|
170
|
+
* @returns {void}
|
|
171
|
+
*/
|
|
172
|
+
destroy(): void;
|
|
173
|
+
/**
|
|
174
|
+
* @private
|
|
175
|
+
*/
|
|
176
|
+
retrieveRevisionByType(item: any, revisionToRetrieve: RevisionType): DocxRevision;
|
|
177
|
+
/**
|
|
178
|
+
* @private
|
|
179
|
+
*/
|
|
180
|
+
insertRevision(item: ElementBox | WCharacterFormat | WRowFormat, type: RevisionType, author?: string, date?: string, spittedRange?: object[], skip?: boolean, parseRevisionId?: string): RevisionBase;
|
|
181
|
+
/**
|
|
182
|
+
* @private
|
|
183
|
+
*/
|
|
184
|
+
private getOwnerNodeForRevision;
|
|
185
|
+
/**
|
|
186
|
+
* Method help to clear previous revisions and include new revision at specified index
|
|
187
|
+
*
|
|
188
|
+
* @private
|
|
189
|
+
* @param range - range of elements to be cleared
|
|
190
|
+
* @param revision - revision to be inserted
|
|
191
|
+
* @param index - index at which to be included in the revision range
|
|
192
|
+
* @returns {void}
|
|
193
|
+
*/
|
|
194
|
+
private clearAndUpdateRevisions;
|
|
195
|
+
/**
|
|
196
|
+
* @private
|
|
197
|
+
*/
|
|
198
|
+
compareTwoRevisions(revision: RevisionBase, compare: RevisionBase): boolean;
|
|
199
|
+
}
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
extendStatics(d, b);
|
|
10
|
+
function __() { this.constructor = d; }
|
|
11
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
12
|
+
};
|
|
13
|
+
})();
|
|
14
|
+
/* eslint-disable */
|
|
15
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
16
|
+
import { LayoutHelperMethods, TextElementBox } from '../index';
|
|
17
|
+
import { WCharacterFormat } from '../format';
|
|
18
|
+
import { ElementBox, ParagraphWidget } from '../page';
|
|
19
|
+
/**
|
|
20
|
+
* Shared revision identity used by both the DOCX renderer and the document editor.
|
|
21
|
+
* Contains only members that do not depend on DocumentEditor (accept/reject/select/history).
|
|
22
|
+
*
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
var RevisionBase = /** @class */ (function () {
|
|
26
|
+
function RevisionBase() {
|
|
27
|
+
/**
|
|
28
|
+
* Gets or sets the author name who made the change.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
this.author = null;
|
|
34
|
+
/**
|
|
35
|
+
* Indicates when the track changes were made.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
this.date = null;
|
|
41
|
+
/**
|
|
42
|
+
* To set the custom data value.
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
this.customData = null;
|
|
48
|
+
/**
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
this.revisionID = '';
|
|
52
|
+
/**
|
|
53
|
+
* @private
|
|
54
|
+
* Marks the cached range stale so the next getRange() rebuilds it.
|
|
55
|
+
*/
|
|
56
|
+
this.hasChanges = false;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
RevisionBase.prototype.destroy = function () {
|
|
62
|
+
this.author = undefined;
|
|
63
|
+
this.revisionID = undefined;
|
|
64
|
+
this.date = undefined;
|
|
65
|
+
this.ownerNode = undefined;
|
|
66
|
+
this.customData = undefined;
|
|
67
|
+
this.range = [];
|
|
68
|
+
this.range = undefined;
|
|
69
|
+
this.hasChanges = undefined;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Method to clone the revisions for the element.
|
|
73
|
+
*
|
|
74
|
+
* @param {RevisionBase[]} revisions - revision array.
|
|
75
|
+
* @returns {string[]} - cloned revision ids.
|
|
76
|
+
*/
|
|
77
|
+
/**
|
|
78
|
+
* @private
|
|
79
|
+
*/
|
|
80
|
+
RevisionBase.cloneRevisions = function (revisions) {
|
|
81
|
+
var clonedRevisions = [];
|
|
82
|
+
for (var i = 0; i < revisions.length; i++) {
|
|
83
|
+
clonedRevisions.push(revisions[i].revisionID);
|
|
84
|
+
}
|
|
85
|
+
return clonedRevisions;
|
|
86
|
+
};
|
|
87
|
+
return RevisionBase;
|
|
88
|
+
}());
|
|
89
|
+
export { RevisionBase };
|
|
90
|
+
/**
|
|
91
|
+
* Renderer-side revision. Layout, SFDT parse, and paint use this type only.
|
|
92
|
+
* Editor accept/reject/select live on the editor Revision subclass of RevisionBase.
|
|
93
|
+
*/
|
|
94
|
+
/**
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
var DocxRevision = /** @class */ (function (_super) {
|
|
98
|
+
__extends(DocxRevision, _super);
|
|
99
|
+
/**
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
function DocxRevision(documentHelper, author, date, ownerNode) {
|
|
103
|
+
var _this = _super.call(this) || this;
|
|
104
|
+
_this.author = author;
|
|
105
|
+
if (isNullOrUndefined(_this.author)) {
|
|
106
|
+
_this.author = 'Unknown';
|
|
107
|
+
}
|
|
108
|
+
_this.date = date;
|
|
109
|
+
_this.owner = documentHelper;
|
|
110
|
+
_this.ownerNode = ownerNode;
|
|
111
|
+
return _this;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @private
|
|
115
|
+
*/
|
|
116
|
+
DocxRevision.prototype.destroy = function () {
|
|
117
|
+
this.owner = undefined;
|
|
118
|
+
_super.prototype.destroy.call(this);
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
DocxRevision.prototype.cloneRevision = function () {
|
|
124
|
+
var revision = new DocxRevision(this.owner, this.author, this.date);
|
|
125
|
+
revision.revisionID = this.revisionID;
|
|
126
|
+
revision.revisionType = this.revisionType;
|
|
127
|
+
revision.author = this.author;
|
|
128
|
+
revision.date = this.date;
|
|
129
|
+
revision.customData = this.customData;
|
|
130
|
+
return revision;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* @private
|
|
134
|
+
*/
|
|
135
|
+
DocxRevision.prototype.getRange = function (updateRange) {
|
|
136
|
+
if (this.ownerNode instanceof ParagraphWidget) {
|
|
137
|
+
if (isNullOrUndefined(this.range) || isNullOrUndefined(updateRange) || updateRange ||
|
|
138
|
+
(!isNullOrUndefined(this.owner) && !isNullOrUndefined(this.owner.editorProperties) &&
|
|
139
|
+
this.owner.editorProperties.hasChanges) || this.hasChanges) {
|
|
140
|
+
this.range = this.ownerNode.getRevisionRange(this);
|
|
141
|
+
this.hasChanges = false;
|
|
142
|
+
}
|
|
143
|
+
return this.range;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
return this.ownerNode.getRevisionRange(this);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
return DocxRevision;
|
|
150
|
+
}(RevisionBase));
|
|
151
|
+
export { DocxRevision };
|
|
152
|
+
/**
|
|
153
|
+
* Shared revision collection. The renderer stores DocxRevision. The editor stores Revision.
|
|
154
|
+
* Both extend RevisionBase, so this is the type EditorProperties can hold.
|
|
155
|
+
*/
|
|
156
|
+
/**
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
159
|
+
var RevisionCollectionBase = /** @class */ (function () {
|
|
160
|
+
function RevisionCollectionBase() {
|
|
161
|
+
/**
|
|
162
|
+
* @private
|
|
163
|
+
*/
|
|
164
|
+
this.changes = [];
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @private
|
|
168
|
+
*/
|
|
169
|
+
RevisionCollectionBase.prototype.clear = function () {
|
|
170
|
+
this.changes = [];
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* @private
|
|
174
|
+
*/
|
|
175
|
+
RevisionCollectionBase.prototype.destroy = function () {
|
|
176
|
+
if (this.changes) {
|
|
177
|
+
for (var i = 0; i < this.changes.length; i++) {
|
|
178
|
+
this.changes[parseInt(i.toString(), 10)].destroy();
|
|
179
|
+
}
|
|
180
|
+
this.changes = [];
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
return RevisionCollectionBase;
|
|
184
|
+
}());
|
|
185
|
+
export { RevisionCollectionBase };
|
|
186
|
+
/**
|
|
187
|
+
* Represents the revision collections in the document (renderer).
|
|
188
|
+
* Stores DocxRevision only. The editor keeps its own RevisionCollection of Revision.
|
|
189
|
+
*/
|
|
190
|
+
/**
|
|
191
|
+
* @private
|
|
192
|
+
*/
|
|
193
|
+
var DocxRevisionCollection = /** @class */ (function (_super) {
|
|
194
|
+
__extends(DocxRevisionCollection, _super);
|
|
195
|
+
function DocxRevisionCollection() {
|
|
196
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
197
|
+
/**
|
|
198
|
+
* @private
|
|
199
|
+
*/
|
|
200
|
+
_this.changes = [];
|
|
201
|
+
return _this;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* @private
|
|
205
|
+
*/
|
|
206
|
+
DocxRevisionCollection.prototype.clear = function () {
|
|
207
|
+
this.changes = [];
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* @private
|
|
211
|
+
*/
|
|
212
|
+
DocxRevisionCollection.prototype.destroy = function () {
|
|
213
|
+
if (this.changes) {
|
|
214
|
+
for (var i = 0; i < this.changes.length; i++) {
|
|
215
|
+
var revision = this.changes[i];
|
|
216
|
+
revision.destroy();
|
|
217
|
+
}
|
|
218
|
+
this.changes = [];
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
return DocxRevisionCollection;
|
|
222
|
+
}(RevisionCollectionBase));
|
|
223
|
+
export { DocxRevisionCollection };
|
|
224
|
+
/**
|
|
225
|
+
* The RevisionHelperMethods class which holds revision helper methods.
|
|
226
|
+
*/
|
|
227
|
+
/**
|
|
228
|
+
* @private
|
|
229
|
+
*/
|
|
230
|
+
var RevisionHelperMethods = /** @class */ (function () {
|
|
231
|
+
/**
|
|
232
|
+
* @private
|
|
233
|
+
*/
|
|
234
|
+
function RevisionHelperMethods(documentHelper) {
|
|
235
|
+
this.documentHelper = undefined;
|
|
236
|
+
this.documentHelper = documentHelper;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* @private
|
|
240
|
+
* @returns {void}
|
|
241
|
+
*/
|
|
242
|
+
RevisionHelperMethods.prototype.destroy = function () {
|
|
243
|
+
this.documentHelper = undefined;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* @private
|
|
247
|
+
*/
|
|
248
|
+
RevisionHelperMethods.prototype.retrieveRevisionByType = function (item, revisionToRetrieve) {
|
|
249
|
+
for (var i = 0; i < item.revisionLength; i++) {
|
|
250
|
+
if (item.revisions[i].revisionType === revisionToRetrieve) {
|
|
251
|
+
return item.revisions[i];
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return undefined;
|
|
255
|
+
};
|
|
256
|
+
// moved form editor.ts file
|
|
257
|
+
/**
|
|
258
|
+
* @private
|
|
259
|
+
*/
|
|
260
|
+
RevisionHelperMethods.prototype.insertRevision = function (item, type, author, date, spittedRange, skip, parseRevisionId) {
|
|
261
|
+
if ((this.documentHelper.editorProperties.isRemoteAction && isNullOrUndefined(this.documentHelper.editorProperties.revisionData) && !this.documentHelper.parser.isPaste)) {
|
|
262
|
+
return undefined;
|
|
263
|
+
}
|
|
264
|
+
var revisionId;
|
|
265
|
+
if (isNullOrUndefined(spittedRange) && !isNullOrUndefined(this.documentHelper.editorProperties.revisionData) && this.documentHelper.editorProperties.revisionData.length > 0) {
|
|
266
|
+
var newRevisionData = this.documentHelper.editorProperties.revisionData[0];
|
|
267
|
+
author = newRevisionData.author;
|
|
268
|
+
date = newRevisionData.date;
|
|
269
|
+
}
|
|
270
|
+
if (!isNullOrUndefined(parseRevisionId)) {
|
|
271
|
+
revisionId = parseRevisionId;
|
|
272
|
+
}
|
|
273
|
+
author = !isNullOrUndefined(author) ? author : this.documentHelper.editorProperties.currentUser ? this.documentHelper.editorProperties.currentUser : 'Guest user';
|
|
274
|
+
var currentDate = !isNullOrUndefined(date) ? date : LayoutHelperMethods.getUtcDate();
|
|
275
|
+
this.documentHelper.editorProperties.revision = new DocxRevision(this.documentHelper, author, currentDate, this.getOwnerNodeForRevision(item));
|
|
276
|
+
this.documentHelper.editorProperties.revision.revisionType = type;
|
|
277
|
+
if (this.documentHelper.documentEditorSettings.revisionSettings && this.documentHelper.documentEditorSettings.revisionSettings.customData) {
|
|
278
|
+
this.documentHelper.editorProperties.revision.customData = this.documentHelper.documentEditorSettings.revisionSettings.customData;
|
|
279
|
+
}
|
|
280
|
+
if (this.documentHelper.editorProperties.enableCollaborativeEditing && this.documentHelper.editorProperties.isRemoteAction && !isNullOrUndefined(revisionId) && revisionId != '') {
|
|
281
|
+
this.documentHelper.editorProperties.revision.revisionID = revisionId;
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
this.documentHelper.editorProperties.revision.revisionID = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
285
|
+
}
|
|
286
|
+
if (!isNullOrUndefined(spittedRange) && spittedRange.length > 0) {
|
|
287
|
+
this.clearAndUpdateRevisions(spittedRange, this.documentHelper.editorProperties.revision, spittedRange.indexOf(item));
|
|
288
|
+
this.documentHelper.editorProperties.isupdateCurrentTrackChanges = true;
|
|
289
|
+
;
|
|
290
|
+
}
|
|
291
|
+
if (!isNullOrUndefined(item)) {
|
|
292
|
+
if (item.getAllRevision().indexOf(this.documentHelper.editorProperties.revision) === -1) {
|
|
293
|
+
item.addRevision(this.documentHelper.editorProperties.revision);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
if (this.documentHelper.editorProperties.isRemoteAction && this.documentHelper.parser.isPaste) {
|
|
297
|
+
this.documentHelper.editorProperties.remotePasteRevision.push(this.documentHelper.editorProperties.revision);
|
|
298
|
+
}
|
|
299
|
+
else if (this.documentHelper.editorProperties.revision.getRange().length > 0 && !this.documentHelper.parser.isPaste) {
|
|
300
|
+
// Above isPaste condition is used because when pasting the content with revision we need to create only the revision. Because widgets is not pushed in the DOM level.
|
|
301
|
+
// So we will update the revision to the collection in the insert block internal method after the widgets are pushed into dom level.
|
|
302
|
+
//this.updateRevisionCollection(revision); - commented become this docxrender method call from paste action, so this code never execute
|
|
303
|
+
}
|
|
304
|
+
this.documentHelper.editorProperties.revisionItem = item;
|
|
305
|
+
return this.documentHelper.editorProperties.revision;
|
|
306
|
+
};
|
|
307
|
+
// moved form editor.ts file
|
|
308
|
+
/**
|
|
309
|
+
* @private
|
|
310
|
+
*/
|
|
311
|
+
RevisionHelperMethods.prototype.getOwnerNodeForRevision = function (item) {
|
|
312
|
+
if (item instanceof ElementBox) {
|
|
313
|
+
return item.paragraph.getSplitWidgets()[0];
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
return item;
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
/**
|
|
320
|
+
* Method help to clear previous revisions and include new revision at specified index
|
|
321
|
+
*
|
|
322
|
+
* @private
|
|
323
|
+
* @param range - range of elements to be cleared
|
|
324
|
+
* @param revision - revision to be inserted
|
|
325
|
+
* @param index - index at which to be included in the revision range
|
|
326
|
+
* @returns {void}
|
|
327
|
+
*/
|
|
328
|
+
RevisionHelperMethods.prototype.clearAndUpdateRevisions = function (range, revision, index) {
|
|
329
|
+
//TODO:
|
|
330
|
+
// if (revision.getRange().filter(range => range instanceof WCharacterFormat)) {
|
|
331
|
+
// index += 1;
|
|
332
|
+
// }
|
|
333
|
+
for (var i = index; i < range.length; i++) {
|
|
334
|
+
if (range[i] instanceof ElementBox || range[i] instanceof WCharacterFormat) {
|
|
335
|
+
var currentElement = range[i];
|
|
336
|
+
if (currentElement instanceof TextElementBox && currentElement.text === '') {
|
|
337
|
+
currentElement.removeRevision(currentElement.revisionLength - 1);
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
for (var j = 0; j < currentElement.revisionLength; j++) {
|
|
341
|
+
var currentRevision = currentElement.getRevision(j);
|
|
342
|
+
if (this.compareTwoRevisions(currentRevision, revision)) {
|
|
343
|
+
currentElement.removeRevision(j);
|
|
344
|
+
currentElement.insertRevisionAt(j, revision);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
// moved form editor.ts file
|
|
351
|
+
/**
|
|
352
|
+
* @private
|
|
353
|
+
*/
|
|
354
|
+
RevisionHelperMethods.prototype.compareTwoRevisions = function (revision, compare) {
|
|
355
|
+
if (revision.revisionType === compare.revisionType && revision.author === compare.author) {
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
return false;
|
|
359
|
+
};
|
|
360
|
+
return RevisionHelperMethods;
|
|
361
|
+
}());
|
|
362
|
+
export { RevisionHelperMethods };
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viewer Export
|
|
3
|
+
*/
|
|
4
|
+
export * from './page';
|
|
5
|
+
export * from './layout';
|
|
6
|
+
export * from './parser/sfdt-reader';
|
|
7
|
+
export * from './docx-renderer';
|
|
8
|
+
export * from './base/index';
|
|
9
|
+
export * from './format/index';
|
|
10
|
+
export * from './helper/index';
|
|
11
|
+
export * from './list/index';
|
|
12
|
+
export * from './themes/index';
|
|
13
|
+
export * from './text-helpers/index';
|
|
14
|
+
export * from './layout-helper';
|
|
15
|
+
export * from './utility/path-util';
|
|
16
|
+
export * from './render';
|
|
17
|
+
export * from './document-canvas';
|
|
18
|
+
export * from './text-helper';
|
package/src/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viewer Export
|
|
3
|
+
*/
|
|
4
|
+
export * from './page';
|
|
5
|
+
export * from './layout';
|
|
6
|
+
export * from './parser/sfdt-reader';
|
|
7
|
+
export * from './docx-renderer';
|
|
8
|
+
export * from './base/index';
|
|
9
|
+
export * from './format/index';
|
|
10
|
+
export * from './helper/index';
|
|
11
|
+
export * from './list/index';
|
|
12
|
+
export * from './themes/index';
|
|
13
|
+
export * from './text-helpers/index';
|
|
14
|
+
export * from './layout-helper';
|
|
15
|
+
export * from './utility/path-util';
|
|
16
|
+
export * from './render';
|
|
17
|
+
export * from './document-canvas';
|
|
18
|
+
export * from './text-helper';
|