-
Notifications
You must be signed in to change notification settings - Fork 155
/
Copy pathdocument-editor.ts
3039 lines (3003 loc) · 104 KB
/
document-editor.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import { Component, Property, INotifyPropertyChanged, NotifyPropertyChanges, Event, ModuleDeclaration, ChildProperty, classList, Complex, formatUnit } from '@syncfusion/ej2-base';
import { isNullOrUndefined, L10n, EmitType, Browser } from '@syncfusion/ej2-base';
import { Save } from '@syncfusion/ej2-file-utils';
import { DocumentChangeEventArgs, ViewChangeEventArgs, ZoomFactorChangeEventArgs, StyleType, WStyle, BeforePaneSwitchEventArgs, LayoutType, FormFieldFillEventArgs, FormFieldData } from './index';
import { SelectionChangeEventArgs, RequestNavigateEventArgs, ContentChangeEventArgs, DocumentEditorKeyDownEventArgs, CustomContentMenuEventArgs, BeforeOpenCloseCustomContentMenuEventArgs, CommentDeleteEventArgs, BeforeFileOpenArgs, CommentActionEventArgs, XmlHttpRequestEventArgs } from './index';
import { LayoutViewer, PageLayoutViewer, WebLayoutViewer, BulletsAndNumberingDialog } from './index';
import { Print, SearchResultsChangeEventArgs } from './index';
import { Page, BodyWidget, ParagraphWidget } from './index';
import { WSectionFormat, WParagraphFormat, WCharacterFormat } from './index';
import { SfdtReader } from './index';
import { Selection } from './index';
import { TextPosition } from './index';
import { Editor, EditorHistory } from './index';
import { WStyles } from './index';
import { HeaderFooters } from './index';
import { Search } from './index';
import { OptionsPane } from './index';
import { WordExport } from './index';
import { TextExport } from './index';
import { FormatType, PageFitType, DialogType, FormattingExceptions, CompatibilityMode } from './index';
import { ContextMenu } from './index';
import { ImageResizer } from './index';
import { SfdtExport } from './index';
import { HyperlinkDialog, TableDialog, BookmarkDialog, StylesDialog, TableOfContentsDialog } from './index';
import { PageSetupDialog, ParagraphDialog, ListDialog, StyleDialog, FontDialog } from './index';
import { TablePropertiesDialog, BordersAndShadingDialog, CellOptionsDialog, TableOptionsDialog } from './index';
import { SpellChecker } from './implementation/spell-check/spell-checker';
import { SpellCheckDialog } from './implementation/dialogs/spellCheck-dialog';
import { DocumentEditorModel, ServerActionSettingsModel, DocumentEditorSettingsModel, FormFieldSettingsModel, CollaborativeEditingSettingsModel, DocumentSettingsModel } from './document-editor-model';
import { CharacterFormatProperties, ParagraphFormatProperties, SectionFormatProperties, DocumentHelper } from './index';
import { PasteOptions } from './index';
import { CommentReviewPane, CheckBoxFormFieldDialog, DropDownFormField, TextFormField, CheckBoxFormField, FieldElementBox, TextFormFieldInfo, CheckBoxFormFieldInfo, DropDownFormFieldInfo, ContextElementInfo, CollaborativeEditing, CollaborativeEditingEventArgs } from './implementation/index';
import { TextFormFieldDialog } from './implementation/dialogs/form-field-text-dialog';
import { DropDownFormFieldDialog } from './implementation/dialogs/form-field-drop-down-dialog';
import { FormFillingMode, TrackChangeEventArgs, ServiceFailureArgs, ImageFormat } from './base';
import { TrackChangesPane } from './implementation/track-changes/track-changes-pane';
import { RevisionCollection } from './implementation/track-changes/track-changes';
import { NotesDialog } from './implementation/dialogs/notes-dialog';
import { FootNoteWidget } from './implementation/viewer/page';
import { internalZoomFactorChange, contentChangeEvent, documentChangeEvent, selectionChangeEvent, zoomFactorChangeEvent, beforeFieldFillEvent, afterFieldFillEvent, serviceFailureEvent, viewChangeEvent, customContextMenuSelectEvent, customContextMenuBeforeOpenEvent, internalviewChangeEvent } from './base/constants';
import { Optimized, Regular, HelperMethods } from './index';
/**
* The `DocumentEditorSettings` module is used to provide the customize property of Document Editor.
*/
export class DocumentEditorSettings extends ChildProperty<DocumentEditorSettings> {
/**
* Specifies the user preferred Search Highlight Color of Document Editor.
*
* @default '#FFE97F'
*/
@Property('#FFE97F')
public searchHighlightColor: string;
/* eslint-disable */
/**
* Specifies the user preferred font family of Document Editor.
* @default ['Algerian','Arial','Calibri','Cambria','CambriaMath','Candara','CourierNew','Georgia','Impact','SegoePrint','SegoeScript','SegoeUI','Symbol','TimesNewRoman','Verdana','Wingdings']
*/
@Property(['Algerian', 'Arial', 'Calibri', 'Cambria', 'Cambria Math', 'Candara', 'Courier New', 'Georgia', 'Impact', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Symbol', 'Times New Roman', 'Verdana', 'Wingdings'])
public fontFamilies: string[];
/* eslint-enable */
/**
* Form field settings.
*/
@Property({ shadingColor: '#cfcfcf', applyShading: true, selectionColor: '#cccccc', formFillingMode: 'Popup' })
public formFieldSettings: FormFieldSettingsModel;
/**
* Collaborative editing settings.
*/
@Property({ roomName: '', editableRegionColor: '#22b24b', lockedRegionColor: '#f44336' })
public collaborativeEditingSettings: CollaborativeEditingSettingsModel;
/**
* Specifies the device pixel ratio for the image generated for printing.
* > Increasing the device pixel ratio will increase the image file size, due to high resolution of image.
*/
@Property(1)
public printDevicePixelRatio: number;
/**
* Gets or sets a value indicating whether to use optimized text measuring approach to match Microsoft Word pagination.
*
* @default true
* @aspType bool
* @returns {boolean} - `true` use optimized text measuring approach to match Microsoft Word pagination; otherwise, `false`
*/
@Property(true)
public enableOptimizedTextMeasuring: boolean;
/**
* Gets or sets the maximum number of rows allowed while inserting a table in Document editor component.
* > The maximum value is 32767, as per Microsoft Word application and you can set any value less than 32767 to this property. If you set any value greater than 32767, then Syncfusion Document editor will automatically reset as 32767.
* @default 32767
* @returns {number}
*/
@Property(32767)
public maximumRows: number;
}
/**
* Represents the settings and properties of the document that is opened in Document editor component.
*/
export class DocumentSettings extends ChildProperty<DocumentSettings> {
/**
* Gets or sets the compatibility mode of the current document.
*
* @default `Word2013`
* @returns {CompatibilityMode}
*/
@Property('Word2013')
public compatibilityMode: CompatibilityMode;
}
/**
* The Document editor component is used to draft, save or print rich text contents as page by page.
*/
@NotifyPropertyChanges
export class DocumentEditor extends Component<HTMLElement> implements INotifyPropertyChanged {
private enableHeaderFooterIn: boolean = false;
/**
* @private
* @returns {boolean} - Returns true if header and footer is enabled.
*/
public get enableHeaderAndFooter(): boolean {
return this.enableHeaderFooterIn;
}
public set enableHeaderAndFooter(value: boolean) {
this.enableHeaderFooterIn = value;
if (!value && this.selection && this.selection.isWebLayout) {
this.selection.isWebLayout = false;
}
this.viewer.updateScrollBars();
}
/**
* @private
*/
public viewer: LayoutViewer;
/**
* @private
*/
public documentHelper: DocumentHelper;
/**
* @private
*/
public isShiftingEnabled: boolean = false;
/**
* @private
*/
public isLayoutEnabled: boolean = true;
/**
* @private
*/
public isPastingContent: boolean = false;
/**
* @private
*/
public parser: SfdtReader = undefined;
private isDocumentLoadedIn: boolean;
private disableHistoryIn: boolean = false;
/**
* @private
*/
public findResultsList: string[] = undefined;
//Module Declaration
/**
* @private
*/
public printModule: Print;
/**
* @private
*/
public sfdtExportModule: SfdtExport;
/**
* @private
*/
public selectionModule: Selection;
/**
* @private
*/
public editorModule: Editor;
/**
* @private
*/
public wordExportModule: WordExport;
/**
* @private
*/
public textExportModule: TextExport;
/**
* @private
*/
public editorHistoryModule: EditorHistory;
/**
* @private
*/
public tableOfContentsDialogModule: TableOfContentsDialog;
/**
* @private
*/
public tablePropertiesDialogModule: TablePropertiesDialog = undefined;
/**
* @private
*/
public bordersAndShadingDialogModule: BordersAndShadingDialog = undefined;
/**
* @private
*/
public listDialogModule: ListDialog;
/**
* @private
*/
public styleDialogModule: StyleDialog;
/**
* @private
*/
public cellOptionsDialogModule: CellOptionsDialog = undefined;
/**
* @private
*/
public tableOptionsDialogModule: TableOptionsDialog = undefined;
/**
* @private
*/
public tableDialogModule: TableDialog;
/**
* @private
*/
public spellCheckDialogModule: SpellCheckDialog;
/**
* @private
*/
public pageSetupDialogModule: PageSetupDialog;
/**
* @private
*/
public footNotesDialogModule: NotesDialog;
/**
* @private
*/
public paragraphDialogModule: ParagraphDialog = undefined;
/**
* @private
*/
public checkBoxFormFieldDialogModule: CheckBoxFormFieldDialog;
/**
* @private
*/
public textFormFieldDialogModule: TextFormFieldDialog;
/**
* @private
*/
public dropDownFormFieldDialogModule: DropDownFormFieldDialog;
/**
* @private
*/
public optionsPaneModule: OptionsPane;
/**
* @private
*/
public hyperlinkDialogModule: HyperlinkDialog;
/**
* @private
*/
public bookmarkDialogModule: BookmarkDialog;
/**
* @private
*/
public stylesDialogModule: StylesDialog;
/**
* @private
*/
public contextMenuModule: ContextMenu;
/**
* @private
*/
public imageResizerModule: ImageResizer = undefined;
/**
* @private
*/
public searchModule: Search;
/**
* @private
*/
public optimizedModule: Optimized;
/**
* @private
*/
public regularModule: Regular;
private createdTriggered: boolean = false;
/**
* Collaborative editing module
*/
public collaborativeEditingModule: CollaborativeEditing;
/**
* Holds regular or optimized module based on DocumentEditorSettting `enableOptimizedTextMeasuring` property.
*
* @private
*/
public textMeasureHelper: Regular | Optimized
/**
* Default Paste Formatting Options
*
* @default KeepSourceFormatting
*/
@Property('KeepSourceFormatting')
public defaultPasteOption: PasteOptions;
/**
* Layout Type
*
* @default Pages
*/
@Property('Pages')
public layoutType: LayoutType;
/**
* Gets or sets the current user.
*
* @default ''
*/
@Property('')
public currentUser: string;
/**
* Gets or sets the color used for highlighting the editable ranges or regions of the `currentUser` in Document Editor. The default value is "#FFFF00".
* > If the visibility of text affected due this highlight color matching with random color applied for the track changes, then modify the color value of this property to resolve text visibility problem.
*
* @default '#FFFF00'
*/
@Property('#FFFF00')
public userColor: string;
/**
* Gets or sets the page gap value in document editor
*
* @default 20
*/
@Property(20)
public pageGap: number;
/**
* Gets or sets the name of the document.
*
* @default ''
*/
@Property('')
public documentName: string;
/**
* @private
*/
public spellCheckerModule: SpellChecker;
/**
* Defines the width of the DocumentEditor component
*
* @default '100%'
*/
@Property('100%')
public width: string;
/**
* Defines the height of the DocumentEditor component
*
* @default '200px'
*/
@Property('200px')
public height: string;
/**
* Sfdt Service URL
*
* @default ''
*/
@Property('')
public serviceUrl: string;
// Public Implementation Starts
/**
* Gets or sets the zoom factor in document editor.
*
* @default 1
*/
@Property(1)
public zoomFactor: number;
/**
* Specifies the z-order for rendering that determines whether the dialog is displayed in front or behind of another component.
*
* @default 2000
* @aspType int
*/
@Property(2000)
public zIndex: number;
/**
* Gets or sets a value indicating whether the document editor is in read only state or not.
*
* @default true
*/
@Property(true)
public isReadOnly: boolean;
/**
* Gets or sets a value indicating whether print needs to be enabled or not.
*
* @default false
*/
@Property(false)
public enablePrint: boolean;
/**
* Gets or sets a value indicating whether selection needs to be enabled or not.
*
* @default false
*/
@Property(false)
public enableSelection: boolean;
/**
* Gets or sets a value indicating whether editor needs to be enabled or not.
*
* @default false
*/
@Property(false)
public enableEditor: boolean;
/**
* Gets or sets a value indicating whether editor history needs to be enabled or not.
*
* @default false
*/
@Property(false)
public enableEditorHistory: boolean;
/**
* Gets or sets a value indicating whether Sfdt export needs to be enabled or not.
*
* @default false
*/
@Property(false)
public enableSfdtExport: boolean;
/**
* Gets or sets a value indicating whether word export needs to be enabled or not.
*
* @default false
*/
@Property(false)
public enableWordExport: boolean;
/**
* Gets or sets a value indicating whether text export needs to be enabled or not.
*
* @default false
*/
@Property(false)
public enableTextExport: boolean;
/**
* Gets or sets a value indicating whether options pane is enabled or not.
*
* @default false
*/
@Property(false)
public enableOptionsPane: boolean;
/**
* Gets or sets a value indicating whether context menu is enabled or not.
*
* @default false
*/
@Property(false)
public enableContextMenu: boolean;
/**
* Gets or sets a value indicating whether hyperlink dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enableHyperlinkDialog: boolean;
/**
* Gets or sets a value indicating whether bookmark dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enableBookmarkDialog: boolean;
/**
* Gets or sets a value indicating whether table of contents dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enableTableOfContentsDialog: boolean;
/**
* Gets or sets a value indicating whether search module is enabled or not.
*
* @default false
*/
@Property(false)
public enableSearch: boolean;
/**
* Gets or sets a value indicating whether paragraph dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enableParagraphDialog: boolean;
/**
* Gets or sets a value indicating whether list dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enableListDialog: boolean;
/**
* Gets or sets a value indicating whether table properties dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enableTablePropertiesDialog: boolean;
/**
* Gets or sets a value indicating whether borders and shading dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enableBordersAndShadingDialog: boolean;
/**
* Gets or sets a value indicating whether notes dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enableFootnoteAndEndnoteDialog: boolean;
/**
* Gets or sets a value indicating whether margin dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enablePageSetupDialog: boolean;
/**
* Gets or sets a value indicating whether font dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enableStyleDialog: boolean;
/**
* Gets or sets a value indicating whether font dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enableFontDialog: boolean;
/**
* @private
*/
public fontDialogModule: FontDialog;
/**
* Gets or sets a value indicating whether table options dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enableTableOptionsDialog: boolean;
/**
* Gets or sets a value indicating whether table dialog is enabled or not.
*
* @default false
*/
@Property(false)
public enableTableDialog: boolean;
/**
* Gets or sets a value indicating whether image resizer is enabled or not.
*
* @default false
*/
@Property(false)
public enableImageResizer: boolean;
/**
* Gets or sets a value indicating whether editor need to be spell checked.
*
* @default false
*/
@Property(false)
public enableSpellCheck: boolean;
/**
* Gets or set a value indicating whether comment is enabled or not
*
* @default false
*/
@Property(false)
public enableComment: boolean;
/**
* Gets or set a value indicating whether track changes is enabled or not
*
* @default false
*/
@Property(false)
public enableTrackChanges: boolean;
/**
* Gets or set a value indicating whether form fields is enabled or not.
*
* @default false
*/
@Property(true)
public enableFormField: boolean;
/**
* Gets or Sets a value indicating whether tab key can be accepted as input or not.
*
* @default false
*/
@Property(false)
public acceptTab: boolean;
/**
* Gets or Sets a value indicating whether holding Ctrl key is required to follow hyperlink on click. The default value is true.
*
* @default true
*/
@Property(true)
public useCtrlClickToFollowHyperlink: boolean;
/**
* Gets or sets the page outline color.
*
* @default '#000000'
*/
@Property('#000000')
public pageOutline: string;
/**
* Gets or sets a value indicating whether to enable cursor in document editor on read only state or not. The default value is false.
*
* @default false
*/
@Property(false)
public enableCursorOnReadOnly: boolean;
/**
* Gets or sets a value indicating whether local paste needs to be enabled or not.
*
* @default false
*/
@Property(false)
public enableLocalPaste: boolean;
/**
* Enable partial lock and edit module.
*
* @default false
*/
@Property(false)
public enableLockAndEdit: boolean;
/**
* Defines the settings for DocumentEditor customization.
*
* @default {}
*/
@Complex<DocumentEditorSettingsModel>({}, DocumentEditorSettings)
public documentEditorSettings: DocumentEditorSettingsModel;
/**
* Gets the settings and properties of the document that is opened in Document editor component.
*
* @default {}
*/
@Complex<DocumentSettingsModel>({}, DocumentSettings)
public documentSettings: DocumentSettingsModel;
/**
* Defines the settings of the DocumentEditor services
*/
@Property({ systemClipboard: 'SystemClipboard', spellCheck: 'SpellCheck', restrictEditing: 'RestrictEditing', canLock: 'CanLock', getPendingActions: 'GetPendingActions' })
public serverActionSettings: ServerActionSettingsModel;
/**
* Add custom headers to XMLHttpRequest.
*
* @default []
*/
@Property([])
public headers: object[];
/* eslint-enable */
/**
* Show comment in the document.
*
* @default false
*/
@Property(false)
public showComments: boolean;
/**
* Shows revision changes in the document.
*
* @default false
*/
@Property(false)
public showRevisions: boolean;
/**
* Triggers whenever document changes in the document editor.
*
* @event documentChange
*/
@Event()
public documentChange: EmitType<DocumentChangeEventArgs>;
/**
* Triggers whenever container view changes in the document editor.
*
* @event viewChange
*/
@Event()
public viewChange: EmitType<ViewChangeEventArgs>;
/**
* Triggers whenever zoom factor changes in the document editor.
*
* @event zoomFactorChange
*/
@Event()
public zoomFactorChange: EmitType<ZoomFactorChangeEventArgs>;
/**
* Triggers whenever selection changes in the document editor.
*
* @event selectionChange
*/
@Event()
public selectionChange: EmitType<SelectionChangeEventArgs>;
/**
* Triggers whenever hyperlink is clicked or tapped in the document editor.
*
* @event requestNavigate
*/
@Event()
public requestNavigate: EmitType<RequestNavigateEventArgs>;
/**
* Triggers whenever content changes in the document editor.
*
* @event contentChange
*/
@Event()
public contentChange: EmitType<ContentChangeEventArgs>;
/**
* Triggers whenever key is pressed in the document editor.
*
* @event keyDown
*/
@Event()
public keyDown: EmitType<DocumentEditorKeyDownEventArgs>;
/**
* Triggers whenever search results changes in the document editor.
*
* @event searchResultsChange
*/
@Event()
public searchResultsChange: EmitType<SearchResultsChangeEventArgs>;
/**
* Triggers when the component is created
*
* @event created
*/
@Event()
public created: EmitType<Object>;
/**
* Triggers when the component is destroyed.
*
* @event destroyed
*/
@Event()
public destroyed: EmitType<Object>;
/**
* Triggers while selecting the custom context-menu option.
*
* @event customContextMenuSelect
*/
@Event()
public customContextMenuSelect: EmitType<CustomContentMenuEventArgs>;
/**
* Triggers before opening the custom context-menu option.
*
* @event customContextMenuBeforeOpen
*/
@Event()
public customContextMenuBeforeOpen: EmitType<BeforeOpenCloseCustomContentMenuEventArgs>;
/**
* Triggers before opening comment pane.
*
* @event beforePaneSwitch
*/
@Event()
public beforePaneSwitch: EmitType<BeforePaneSwitchEventArgs>;
/**
* Triggers after inserting comment.
*
* @event commentBegin
*/
@Event()
public commentBegin: EmitType<Object>;
/**
* Triggers after posting comment.
*
* @event commentEnd
*/
@Event()
public commentEnd: EmitType<Object>;
/**
* Triggers before a file is opened.
*
* @event beforeFileOpen
*/
@Event()
public beforeFileOpen: EmitType<BeforeFileOpenArgs>;
/**
* Triggers after inserting comment.
*
* @event commentDelete
*/
@Event()
public commentDelete: EmitType<CommentDeleteEventArgs>;
/**
* Triggers on comment actions(Post, edit, reply, resolve, reopen).
*
* @event beforeCommentAction
*/
@Event()
public beforeCommentAction: EmitType<CommentActionEventArgs>;
/**
* Triggers when TrackChanges enabled / disabled.
*
* @event trackChange
*/
@Event()
public trackChange: EmitType<TrackChangeEventArgs>;
/**
* Triggers before form field fill.
*
* @event beforeFormFieldFill
*/
@Event()
public beforeFormFieldFill: EmitType<FormFieldFillEventArgs>;
/**
* Triggers when the server side action fails.
*
* @event serviceFailure
*/
@Event()
public serviceFailure: EmitType<ServiceFailureArgs>;
/**
* Triggers after form field fill.
*
* @event afterFormFieldFill
*/
@Event()
public afterFormFieldFill: EmitType<FormFieldFillEventArgs>;
/**
* Triggers when the document editor collaborative actions (such as LockContent, SaveContent, UnlockContent) gets completed.
*
* @event actionComplete
*/
@Event()
public actionComplete: EmitType<CollaborativeEditingEventArgs>;
/**
* Triggers when user interaction prevented in content control.
*
* @event contentControl
*/
@Event()
public contentControl: EmitType<Object>;
/**
* This event is triggered before a server request is started, allows you to modify the XMLHttpRequest object (setting additional headers, if needed).
*/
@Event()
public beforeXmlHttpRequestSend: EmitType<XmlHttpRequestEventArgs>;
/**
* @private
*/
public characterFormat: CharacterFormatProperties;
/**
* @private
*/
public paragraphFormat: ParagraphFormatProperties;
/**
* @private
*/
public sectionFormat: SectionFormatProperties;
/**
* @private
*/
public commentReviewPane: CommentReviewPane;
/**
* @private
*/
public trackChangesPane: TrackChangesPane;
/**
* @private
*/
public revisionsInternal: RevisionCollection;
/**
* Gets the total number of pages.
*
* @returns {number} - Returns the page count.
*/
public get pageCount(): number {
if (!this.isDocumentLoaded || isNullOrUndefined(this.viewer) || this.viewer instanceof WebLayoutViewer) {
return 1;
}
return this.documentHelper.pages.length;
}
/**
* Gets the selection object of the document editor.
*
* @default undefined
* @aspType Selection
* @returns {Selection} - Returns the selection object.
*/
public get selection(): Selection {
return this.selectionModule;
}
/**
* Gets the editor object of the document editor.
*
* @aspType Editor
* @returns {Editor} - Returns the editor object.
*/
public get editor(): Editor {
return this.editorModule;
}
/**
* Gets the editor history object of the document editor.
*
* @aspType EditorHistory
* @returns {EditorHistory} - Returns the editor history object.
*/
public get editorHistory(): EditorHistory {
return this.editorHistoryModule;
}
/**
* Gets the search object of the document editor.
*
* @aspType Search
* @returns { Search } - Returns the search object.
*/
public get search(): Search {
return this.searchModule;
}
/**
* Gets the context menu object of the document editor.
*
* @aspType ContextMenu
* @returns {ContextMenu} - Returns the context menu object.
*/
public get contextMenu(): ContextMenu {
return this.contextMenuModule;
}
/**
* Gets the spell check dialog object of the document editor.
*
* @returns {SpellCheckDialog} - Returns the spell check dialog object.
*/
public get spellCheckDialog(): SpellCheckDialog {
return this.spellCheckDialogModule;
}
/**
* Gets the spell check object of the document editor.
*
* @aspType SpellChecker
* @returns {SpellChecker} - Returns the spell checker object.
*/
public get spellChecker(): SpellChecker {
return this.spellCheckerModule;
}
/**
* @private
* @returns {string }- Returns the container id.
*/
public get containerId(): string {
return this.element.id;
}
/**
* @private
* @returns {boolean} - Returns true if document is loaded.
*/
public get isDocumentLoaded(): boolean {
return this.isDocumentLoadedIn;
}
public set isDocumentLoaded(value: boolean) {
this.isDocumentLoadedIn = value;
}
/**
* Gets the revision collection which contains information about changes made from original document
*
* @returns {RevisionCollection} - Returns the revision collection object.
*/
public get revisions(): RevisionCollection {
if (isNullOrUndefined(this.revisionsInternal)) {
this.revisionsInternal = new RevisionCollection(this);
}
return this.revisionsInternal;
}
/**
* Determines whether history needs to be enabled or not.
*
* @default - false
* @private
* @returns {boolean} - Returns true if history module is enabled.
*/
public get enableHistoryMode(): boolean {
return this.enableEditorHistory && !isNullOrUndefined(this.editorHistoryModule);
}
/**
* Gets the start text position in the document.
*
* @default undefined
* @private
* @returns {TextPosition} - Returns the document start.
*/
public get documentStart(): TextPosition {
if (!isNullOrUndefined(this.selectionModule)) {
return this.selection.getDocumentStart();