-
Notifications
You must be signed in to change notification settings - Fork 155
/
Copy pathdocument-editor-container.ts
1503 lines (1473 loc) · 63.5 KB
/
document-editor-container.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, ModuleDeclaration, L10n, Complex, isNullOrUndefined, formatUnit } from '@syncfusion/ej2-base';
import { Event, EmitType } from '@syncfusion/ej2-base';
import { Toolbar } from './tool-bar/tool-bar';
import { DocumentEditorContainerModel } from './document-editor-container-model';
import { DocumentEditor, DocumentEditorSettings, DocumentSettings } from '../document-editor/document-editor';
import { HeaderFooterProperties } from './properties-pane/header-footer-pane';
import { ImageProperties } from './properties-pane/image-properties-pane';
import { TocProperties } from './properties-pane/table-of-content-pane';
import { TableProperties } from './properties-pane/table-properties-pane';
import { StatusBar } from './properties-pane/status-bar';
import { ViewChangeEventArgs, RequestNavigateEventArgs, ContainerContentChangeEventArgs, ContainerSelectionChangeEventArgs, ContainerDocumentChangeEventArgs, CustomContentMenuEventArgs, BeforeOpenCloseCustomContentMenuEventArgs, BeforePaneSwitchEventArgs, LayoutType, CommentDeleteEventArgs, RevisionActionEventArgs, ServiceFailureArgs, CommentActionEventArgs, XmlHttpRequestEventArgs } from '../document-editor/base';
import { createSpinner } from '@syncfusion/ej2-popups';
import { ContainerServerActionSettingsModel, DocumentEditorModel, DocumentEditorSettingsModel, DocumentSettingsModel, FormFieldSettingsModel } from '../document-editor/document-editor-model';
import { CharacterFormatProperties, ParagraphFormatProperties, SectionFormatProperties } from '../document-editor/implementation';
import { ToolbarItem } from '../document-editor/base/types';
import { CustomToolbarItemModel, TrackChangeEventArgs, AutoResizeEventArgs, ContentChangeEventArgs } from '../document-editor/base/events-helper';
import { ClickEventArgs } from '@syncfusion/ej2-navigations';
import { beforeAutoResize, internalAutoResize, internalZoomFactorChange, beforeCommentActionEvent, commentDeleteEvent, contentChangeEvent, trackChangeEvent, beforePaneSwitchEvent, serviceFailureEvent, documentChangeEvent, selectionChangeEvent, customContextMenuSelectEvent, customContextMenuBeforeOpenEvent, internalviewChangeEvent, beforeXmlHttpRequestSend, protectionTypeChangeEvent, internalDocumentEditorSettingsChange, internalStyleCollectionChange, revisionActionEvent, trackChanges, internalOptionPaneChange } from '../document-editor/base/constants';
import { HelperMethods } from '../index';
import { SanitizeHtmlHelper } from '@syncfusion/ej2-base';
import { DialogUtility } from '@syncfusion/ej2-popups';
import { Text } from './properties-pane/text-properties';
/**
* Document Editor container component.
*/
@NotifyPropertyChanges
export class DocumentEditorContainer extends Component<HTMLElement> implements INotifyPropertyChanged {
/**
* Show or hide properties pane.
*
* @default true
*/
@Property(true)
public showPropertiesPane: boolean;
/**
* Enable or disable the toolbar in document editor container.
*
* @default true
*/
@Property(true)
public enableToolbar: boolean;
/**
* Specifies the restrict editing operation.
*
* @default false
*/
@Property(false)
public restrictEditing: boolean;
/**
* Enable or disable the spell checker in document editor container.
*
* @default false
*/
@Property(false)
public enableSpellCheck: boolean;
/**
* Enable or disable the track changes in document editor container.
*
* @default false
*/
@Property(false)
public enableTrackChanges: boolean;
/**
* Gets or sets the 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;
/**
* Enables the local paste.
*
* @default false
*/
@Property(false)
public enableLocalPaste: boolean;
/**
* Gets or sets the Sfdt service URL.
*
* @default ''
*/
@Property()
public serviceUrl: string;
/**
* 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;
/**
* Enables the rendering with strict Content Security policy.
*/
@Property(false)
public enableCsp: boolean;
/**
* Gets or sets a value indicating whether comment is enabled or not
*
* @default true
*/
@Property(true)
public enableComment: boolean;
/**
* Defines the width of the DocumentEditorContainer component
*
* @default '100%'
*/
@Property('100%')
public width: string;
/**
* Defines the height of the DocumentEditorContainer component
*
* @default '320px'
*/
@Property('320px')
public height: string;
/**
* Gets or sets a value indicating whether the automatic focus behavior is enabled for Document editor or not.
*
* > By default, the Document editor gets focused automatically when the page loads. If you want the Document editor not to be focused automatically, then set this property to false.
*
* @returns {boolean}
* @aspType bool
* @default true
*/
@Property(true)
public enableAutoFocus: boolean;
/**
* Enables the partial lock and edit module.
*
* @default false
*/
@Property(false)
public enableLockAndEdit: boolean;
/**
* Gets or sets a value indicating whether to start automatic resize with the specified time interval and iteration count.
*
* > * Resize action triggers automatically for the specified number of iterations, or till the parent element's height and width is non-zero.
*
* > * If the parent element's height and width is zero even in the last iteration, then the default height and width (200) is allocated for the Document editor.
*
* @default false
* @returns {boolean}
*/
@Property(false)
public autoResizeOnVisibilityChange: boolean;
/**
* 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>;
/* eslint-enable */
/**
* Triggers whenever the content changes in the document editor container.
*
* @event contentChange
*/
@Event()
public contentChange: EmitType<ContainerContentChangeEventArgs>;
/**
* Triggers whenever selection changes in the document editor container.
*
* @event selectionChange
*/
@Event()
public selectionChange: EmitType<ContainerSelectionChangeEventArgs>;
/**
* Triggers whenever document changes in the document editor container.
*
* @event documentChange
*/
@Event()
public documentChange: EmitType<ContainerDocumentChangeEventArgs>;
/**
* Triggers when toolbar item is clicked.
*
* @event toolbarClick
*/
@Event()
public toolbarClick: EmitType<ClickEventArgs>;
/**
* 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>;
/**
* Trigger before switching panes in DocumentEditor.
*
* @event beforePaneSwitch
*/
@Event()
public beforePaneSwitch: EmitType<BeforePaneSwitchEventArgs>;
/**
* Triggers on deleting a comment.
*
* @event commentDelete
*/
@Event()
public commentDelete: EmitType<CommentDeleteEventArgs>;
/**
* Triggers before accepting or rejecting changes.
*
* @event beforeAcceptRejectChanges
*/
@Event()
public beforeAcceptRejectChanges: EmitType<RevisionActionEventArgs>;
/**
* Triggers on comment actions(Post, edit, reply, resolve, reopen).
*
* @event beforeCommentAction
*/
@Event()
public beforeCommentAction: EmitType<CommentActionEventArgs>;
/**
* Triggers when the server action fails.
*
* @event serviceFailure
*/
@Event()
public serviceFailure: EmitType<ServiceFailureArgs>;
/**
* Triggers Keyboard shortcut of TrackChanges.
*
* @event trackChange
*/
@Event()
public trackChange: EmitType<TrackChangeEventArgs>;
/**
* Triggers when user interaction prevented in content control.
*
* @event contentControl
*/
@Event()
public contentControl: EmitType<Object>;
/**
* Triggers before a server request is started, allows you to modify the XMLHttpRequest object (setting additional headers, if needed).
*/
@Event()
public beforeXmlHttpRequestSend: EmitType<XmlHttpRequestEventArgs>;
/**
* Document editor container's toolbar module
*
* @private
*/
public toolbarModule: Toolbar;
/**
* @private
*/
public localObj: L10n;
/**
* Document Editor instance
*/
private documentEditorInternal: DocumentEditor;
/**
* @private
*/
public toolbarContainer: HTMLElement;
/**
* @private
*/
public editorContainer: HTMLElement;
/**
* @private
*/
public propertiesPaneContainer: HTMLElement;
/**
* @private
*/
public statusBarElement: HTMLElement;
/**
* Header footer Properties
*
* @private
*/
public headerFooterProperties: HeaderFooterProperties;
/**
* Image Properties Pane
*
* @private
*/
public imageProperties: ImageProperties;
/**
* @private
*/
public tocProperties: TocProperties;
/**
* @private
*/
public tableProperties: TableProperties;
/**
* @private
*/
public statusBar: StatusBar;
/**
* @private
*/
public containerTarget: HTMLElement;
/**
* @private
*/
public previousContext: string = '';
/**
* @private
*/
public characterFormat: CharacterFormatProperties;
/**
* @private
*/
public paragraphFormat: ParagraphFormatProperties;
/**
* @private
*/
public sectionFormat: SectionFormatProperties;
/**
* @private
*/
public showHeaderProperties: boolean = true;
/**
* 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 DocumentEditorContainer service.
*/
@Property({ import: 'Import', systemClipboard: 'SystemClipboard', spellCheck: 'SpellCheck', spellCheckByPage: 'SpellCheckByPage', restrictEditing: 'RestrictEditing', canLock: 'CanLock', getPendingActions: 'GetPendingActions' })
public serverActionSettings: ContainerServerActionSettingsModel;
/**
* Defines toolbar items for DocumentEditorContainer.
*
* @default ['New','Open','Separator','Undo','Redo','Separator','Image','Table','Hyperlink','Bookmark','TableOfContents','Separator','Header','Footer','PageSetup','PageNumber','Break','InsertFootnote','InsertEndnote','Separator','Find','Separator','Comments','TrackChanges','LocalClipboard','RestrictEditing','Separator','FormFields','UpdateFields','ContentControl','XML Mapping']
*/
@Property(['New', 'Open', 'Separator', 'Undo', 'Redo', 'Separator', 'Image', 'Table', 'Hyperlink', 'Bookmark', 'TableOfContents', 'Separator', 'Header', 'Footer', 'PageSetup', 'PageNumber', 'Break', 'InsertFootnote', 'InsertEndnote', 'Separator', 'Find', 'Separator', 'Comments', 'TrackChanges', 'Separator', 'LocalClipboard', 'RestrictEditing', 'Separator', 'FormFields', 'UpdateFields', 'ContentControl', 'XML Mapping'])
public toolbarItems: (CustomToolbarItemModel | ToolbarItem)[];
/* eslint-enable max-len */
/* eslint-disable */
/**
* Adds the custom headers to XMLHttpRequest.
*
* @default []
*/
@Property([])
public headers: object[];
/* eslint-enable */
/**
* Gets the DocumentEditor instance.
*
* @aspType DocumentEditor
* @returns {DocumentEditor} Returns the DocumentEditor instance.
*/
public get documentEditor(): DocumentEditor {
return this.documentEditorInternal;
}
/**
* Gets the toolbar instance.
*
* @returns {Toolbar} Returns the toolbar module.
*/
public get toolbar(): Toolbar {
return this.toolbarModule;
}
/**
* Initializes a new instance of the DocumentEditorContainer class.
*
* @param { DocumentEditorContainerModel } options Specifies the DocumentEditorContainer model as options.
* @param { string | HTMLElement } element Specifies the element that is rendered as a DocumentEditorContainer.
*/
public constructor(options?: DocumentEditorContainerModel, element?: string | HTMLElement) {
super(options, element);
}
/**
* default locale
*
* @private
*/
public defaultLocale: Object = {
'New': 'New',
'Insert Footnote': 'Insert Footnote',
'Insert Endnote': 'Insert Endnote',
'Footnote Tooltip': 'Insert Footnote (Alt+Ctrl+F).',
'Endnote Tooltip': 'Insert Endnote (Alt+Ctrl+D).',
'Open': 'Open',
'Undo': 'Undo',
'Redo': 'Redo',
'Image': 'Image',
'Table': 'Table',
'Link': 'Link',
'Bookmark': 'Bookmark',
'Table of Contents': 'Table of Contents',
'HEADING - - - - 1': 'HEADING - - - - 1',
'HEADING - - - - 2': 'HEADING - - - - 2',
'HEADING - - - - 3': 'HEADING - - - - 3',
'Header': 'Header',
'Footer': 'Footer',
'XML Mapping Pane': 'XML Mapping Pane',
'Page Setup': 'Page Setup',
'Page Number': 'Page Number',
'Break': 'Break',
'Find': 'Find',
'Local Clipboard': 'Local Clipboard',
'Restrict Editing': 'Restrict Editing',
'Upload from computer': 'Upload from computer',
'By URL': 'By URL',
'Page': 'Page',
'Show properties pane': 'Show properties pane',
'Hide properties pane': 'Hide properties pane',
'Next Page': 'Next Page',
'Continuous': 'Continuous',
'Header And Footer': 'Header & Footer',
'Options': 'Options',
'XML Mapping': 'XML Mapping',
'Custom XML Part:': 'Custom XML Part:',
'Core Properties': 'Core Properties',
'Levels': 'Levels',
'Different First Page': 'Different First Page',
'Different header and footer for odd and even pages': 'Different header and footer for odd and even pages.',
'Different Odd And Even Pages': 'Different Odd & Even Pages',
'Different header and footer for first page': 'Different header and footer for first page.',
'Position': 'Position',
'Header from Top': 'Header from Top',
'Footer from Bottom': 'Footer from Bottom',
'Distance from top of the page to top of the header': 'Distance from top of the page to top of the header.',
'Distance from bottom of the page to bottom of the footer': 'Distance from bottom of the page to bottom of the footer.',
'Aspect ratio': 'Aspect ratio',
'W': 'W',
'H': 'H',
'Width': 'Width',
'Height': 'Height',
'Text': 'Text',
'Paragraph': 'Paragraph',
'Fill': 'Fill',
'Fill color': 'Fill color',
'Border Style': 'Border Style',
'Outside borders': 'Outside borders',
'All borders': 'All borders',
'Inside borders': 'Inside borders',
'Left border': 'Left border',
'Inside vertical border': 'Inside vertical border',
'Right border': 'Right border',
'Top border': 'Top border',
'Inside horizontal border': 'Inside horizontal border',
'Bottom border': 'Bottom border',
'Border color': 'Border color',
'Border width': 'Border width',
'Cell': 'Cell',
'Merge cells': 'Merge cells',
'Insert Or Delete': 'Insert / Delete',
'Insert columns to the left': 'Insert columns to the left',
'Insert columns to the right': 'Insert columns to the right',
'Insert rows above': 'Insert rows above',
'Insert rows below': 'Insert rows below',
'Delete rows': 'Delete rows',
'Delete columns': 'Delete columns',
'Cell Margin': 'Cell Margin',
'Top': 'Top',
'Bottom': 'Bottom',
'Left': 'Left',
'Right': 'Right',
'Align Text': 'Align Text',
'Align top': 'Align top',
'Align bottom': 'Align bottom',
'Align center': 'Align center',
'Number of heading or outline levels to be shown in table of contents': 'Number of heading or outline levels to be shown in table of contents.',
'Show page numbers': 'Show page numbers',
'Show page numbers in table of contents': 'Show page numbers in table of contents.',
'Right align page numbers': 'Right align page numbers',
'Right align page numbers in table of contents': 'Right align page numbers in table of contents.',
'Use hyperlinks': 'Use hyperlinks',
'Use hyperlinks instead of page numbers': 'Use hyperlinks instead of page numbers.',
'Font': 'Font',
'Font Size': 'Font Size',
'Font color': 'Font color',
'Text highlight color': 'Text highlight color',
'Clear all formatting': 'Clear all formatting',
'Bold Tooltip': 'Bold (Ctrl+B)',
'Italic Tooltip': 'Italic (Ctrl+I)',
'Underline Tooltip': 'Underline (Ctrl+U)',
'Strikethrough': 'Strikethrough',
'Superscript Tooltip': 'Superscript (Ctrl+Shift++)',
'Subscript Tooltip': 'Subscript (Ctrl+=)',
'Align left Tooltip': 'Align left (Ctrl+L)',
'Center Tooltip': 'Center (Ctrl+E)',
'Align right Tooltip': 'Align right (Ctrl+R)',
'Justify Tooltip': 'Justify (Ctrl+J)',
'Decrease indent': 'Decrease indent',
'Increase indent': 'Increase indent',
'Line spacing': 'Line spacing',
'Bullets': 'Bullets',
'Numbering': 'Numbering',
'Styles': 'Styles',
'Manage Styles': 'Manage Styles',
'of': 'of',
'Fit one page': 'Fit one page',
'Spell Check': 'Spell Check',
'Spelling': 'Spelling',
'Underline errors': 'Underline errors',
'Fit page width': 'Fit page width',
'Update': 'Update',
'Cancel': 'Cancel',
'Insert': 'Insert',
'No Border': 'No Border',
'Create a new document': 'Create a new document.',
'Open a document': 'Open a document.',
'Undo Tooltip': 'Undo the last operation (Ctrl+Z).',
'Redo Tooltip': 'Redo the last operation (Ctrl+Y).',
'Insert inline picture from a file': 'Insert inline picture from a file.',
'Insert a table into the document': 'Insert a table into the document',
'Create Hyperlink': 'Create a link in your document for quick access to web pages and files (Ctrl+K).',
'Insert a bookmark in a specific place in this document': 'Insert a bookmark in a specific place in this document.',
'Provide an overview of your document by adding a table of contents': 'Provide an overview of your document by adding a table of contents.',
'Add or edit the header': 'Add or edit the header.',
'Add or edit the footer': 'Add or edit the footer.',
'Open the page setup dialog': 'Open the page setup dialog.',
'Content Control': 'Content Control',
'Insert Content Control': 'Insert Content Control',
'Add page numbers': 'Add page numbers.',
'Find Text': 'Find text in the document (Ctrl+F).',
'Toggle between the internal clipboard and system clipboard': 'Toggle between the internal clipboard and system clipboard.</br>' +
'Access to system clipboard through script is denied due to browsers security policy. Instead, </br>' +
' 1. You can enable internal clipboard to cut, copy and paste within the component.</br>' +
' 2. You can use the keyboard shortcuts (Ctrl+X, Ctrl+C and Ctrl+V) to cut, copy and paste with system clipboard.',
'Current Page Number': 'The current page number in the document. Click or tap to navigate specific page.',
'Read only': 'Read only',
'Protections': 'Protections',
'Error in establishing connection with web server': 'Error in establishing connection with web server',
'Single': 'Single',
'Double': 'Double',
'New comment': 'New comment',
'Comments': 'Comments',
'Print layout': 'Print layout',
'Web layout': 'Web layout',
'Form Fields': 'Form Fields',
'Text Form': 'Text Form',
'Check Box': 'Check Box',
'DropDown': 'Drop-Down',
'Update Fields': 'Update Fields',
'Update cross reference fields': 'Update cross reference fields',
'Track Changes': 'Keep track of the changes made in the document',
'TrackChanges': 'Track Changes',
'AllCaps': 'AllCaps',
'Change case Tooltip': 'Change case',
'UPPERCASE': 'UPPERCASE',
'SentenceCase': 'Sentence case',
'Lowercase': 'Lowercase',
'CapitalizeEachWord': 'Capitalize each word',
'ToggleCase': 'tOGGLE cASE',
'No color': 'No color',
'Top margin': 'Top margin',
'Bottom margin': 'Bottom margin',
'Left margin': 'Left margin',
'Right margin': 'Right margin',
'Normal': 'Normal',
'Heading': 'Heading',
'Heading 1': 'Heading 1',
'Heading 2': 'Heading 2',
'Heading 3': 'Heading 3',
'Heading 4': 'Heading 4',
'Heading 5': 'Heading 5',
'Heading 6': 'Heading 6',
'Heading 7': 'Heading 7',
'Heading 8': 'Heading 8',
'Heading 9': 'Heading 9',
'ZoomLevelTooltip': 'Zoom level. Click or tap to open the Zoom options.',
'None': 'None',
'Borders': 'Borders',
'ShowHiddenMarks Tooltip': 'Show the hidden characters like spaces, tab, paragraph marks, and breaks.(Ctrl + *)',
'Columns': 'Columns',
'Column': 'Column',
'Page Breaks': 'Page Breaks',
'Section Breaks': 'Section Breaks',
'Link to Previous': 'Link to Previous',
'Link to PreviousTooltip': 'Link this section with previous section header or footer',
'Alternate Text': 'Alternate Text',
'The address of this site is not valid. Check the address and try again.': 'The address of this site is not valid. Check the address and try again.',
'OK': 'OK',
'Information': 'Information',
'Rich Text Content Control': 'Rich Text Content Control',
'Plain Text Content Control': 'Plain Text Content Control',
'Picture Content Control': 'Picture Content Control',
'Combo Box Content Control': 'Combo Box Content Control',
'Drop-Down List Content Control': 'Drop-Down List Content Control',
'Date Picker Content Control': 'Date Picker Content Control',
'Check Box Content Control': 'Check Box Content Control'
};
/* eslint-enable @typescript-eslint/naming-convention */
/**
* @private
* @returns {string} Returns the DocumentEditorContainer module name.
*/
public getModuleName(): string {
return 'DocumentEditorContainer';
}
/**
* @private
*/
/* eslint-disable */
public onPropertyChanged(newModel: DocumentEditorContainerModel, oldModel: DocumentEditorContainerModel): void {
for (let prop of Object.keys(newModel)) {
switch (prop) {
case 'restrictEditing':
this.restrictEditingToggleHelper(newModel.restrictEditing);
break;
case 'showPropertiesPane':
this.showHidePropertiesPane(newModel.showPropertiesPane);
break;
case 'enableTrackChanges':
if (this.documentEditor.documentHelper.isTrackedOnlyMode && !newModel.enableTrackChanges && newModel.enableTrackChanges !== this.enableTrackChanges) {
this.enableTrackChanges = true;
}
if (this.documentEditor) {
this.documentEditor.enableTrackChanges = newModel.enableTrackChanges;
if (this.toolbarModule) {
this.toolbarModule.toggleTrackChanges(newModel.enableTrackChanges);
}
if (this.documentEditor.enableTrackChanges) {
this.documentEditor.documentHelper.showRevision = true;
}
this.documentEditor.resize();
}
break;
case 'enableLocalPaste':
if (this.documentEditor) {
this.documentEditor.enableLocalPaste = newModel.enableLocalPaste;
}
break;
case 'serviceUrl':
if (this.documentEditor) {
this.documentEditor.serviceUrl = newModel.serviceUrl;
}
break;
case 'serverActionSettings':
if (this.documentEditor) {
this.setserverActionSettings();
}
break;
case 'zIndex':
if (this.documentEditor) {
this.documentEditor.zIndex = newModel.zIndex;
}
break;
case 'headers':
if (this.documentEditor) {
this.documentEditor.headers = newModel.headers;
}
break;
case 'locale':
case 'enableRtl':
this.refresh();
break;
case 'enableComment':
if (this.documentEditor) {
this.documentEditor.enableComment = newModel.enableComment;
}
if (this.toolbarModule) {
this.toolbarModule.enableDisableInsertComment(newModel.enableComment);
}
break;
case 'enableSpellCheck':
if (this.documentEditor) {
this.documentEditor.enableSpellCheck = newModel.enableSpellCheck;
}
break;
case 'documentSettings':
if (this.documentEditor) {
this.documentEditor.documentSettings.compatibilityMode = this.documentSettings.compatibilityMode;
}
break;
case 'documentEditorSettings':
if (this.documentEditor) {
this.customizeDocumentEditorSettings();
}
if (!isNullOrUndefined(newModel.documentEditorSettings.fontFamilies)) {
const fontFamilyValue: string[] = newModel.documentEditorSettings.fontFamilies;
this.refreshFontFamilies(fontFamilyValue);
}
break;
case 'toolbarItems':
if (this.toolbarModule) {
this.toolbarModule.reInitToolbarItems(newModel.toolbarItems);
}
break;
case 'currentUser':
if (this.documentEditor) {
this.documentEditor.currentUser = newModel.currentUser;
}
break;
case 'userColor':
if (this.documentEditor) {
this.documentEditor.userColor = newModel.userColor;
}
break;
case 'layoutType':
if (this.documentEditor) {
this.documentEditor.layoutType = newModel.layoutType;
if (newModel.layoutType === 'Continuous') {
this.statusBar.togglePageLayout();
} else {
this.statusBar.toggleWebLayout();
}
}
break;
case 'enableToolbar':
this.createToolbarContainer(this.enableRtl, true);
if (newModel.enableToolbar && this.toolbarModule) {
this.toolbarModule.initToolBar(this.toolbarItems);
this.toolbarModule.enableDisableInsertComment(this.enableComment);
this.toolbarModule.toggleTrackChanges(this.enableTrackChanges);
}
if (this.documentEditor) {
this.documentEditor.resize();
}
break;
case 'height':
this.element.style.height = formatUnit(this.height);
if (this.documentEditor) {
this.documentEditor.resize();
}
this.resize();
break;
case 'width':
this.element.style.width = formatUnit(this.width);
if (this.documentEditor) {
this.documentEditor.resize();
}
break;
case 'enableAutoFocus':
if (this.documentEditor) {
this.documentEditor.enableAutoFocus = newModel.enableAutoFocus;
}
break;
case 'autoResizeOnVisibilityChange':
if (this.documentEditor) {
this.documentEditor.autoResizeOnVisibilityChange = newModel.autoResizeOnVisibilityChange;
}
break;
}
}
}
/**
* @private
*/
protected preRender(): void {
this.localObj = new L10n('documenteditorcontainer', this.defaultLocale, this.locale);
if (!isNullOrUndefined(this.element) && this.element.id === '') {
//Set unique id, if id is empty
this.element.id = HelperMethods.getUniqueElementId();
}
this.initContainerElement();
}
/**
* @private
*/
protected render(): void {
if (this.toolbarModule) {
this.toolbarModule.initToolBar(this.toolbarItems);
this.toolbarModule.enableDisableInsertComment(this.enableComment);
}
if (this.height !== '') {
this.element.style.height = formatUnit(this.height);
}
if (this.width !== '') {
this.element.style.width = formatUnit(this.width);
}
this.element.style.minHeight = '320px';
this.initializeDocumentEditor();
if (this.restrictEditing) {
this.restrictEditingToggleHelper(this.restrictEditing);
}
this.headerFooterProperties = new HeaderFooterProperties(this, this.enableRtl);
this.imageProperties = new ImageProperties(this, this.enableRtl);
this.tocProperties = new TocProperties(this, this.enableRtl);
this.tableProperties = new TableProperties(this, this.imageProperties, this.enableRtl);
this.statusBar = new StatusBar(this.statusBarElement, this);
// Waiting popup
createSpinner({ target: this.containerTarget, cssClass: 'e-spin-overlay' });
this.setserverActionSettings();
this.renderComplete();
}
private restrictEditingToggleHelper(restrictEditing: boolean): void {
this.documentEditor.isReadOnly = restrictEditing;
if (this.toolbarModule) {
this.toolbarModule.enableDisableToolBarItem(!restrictEditing, false);
this.toolbarModule.toggleRestrictEditing(restrictEditing);
}
this.showPropertiesPane = !restrictEditing;
this.showHidePropertiesPane(!restrictEditing);
this.documentEditor.trackChangesPane.enableDisableButton(!restrictEditing && !this.documentEditor.documentHelper.isDocumentProtected);
}
private setFormat(): void {
if (this.characterFormat && this.documentEditor) {
this.documentEditor.setDefaultCharacterFormat(this.characterFormat);
}
if (this.paragraphFormat && this.documentEditor) {
this.documentEditor.setDefaultParagraphFormat(this.paragraphFormat);
}
if (this.sectionFormat && this.documentEditor) {
this.documentEditor.setDefaultSectionFormat(this.sectionFormat);
}
}
private setserverActionSettings(): void {
if (this.serviceUrl) {
this.documentEditor.serviceUrl = HelperMethods.sanitizeString(this.serviceUrl);
}
if (this.serverActionSettings.spellCheck) {
this.documentEditor.serverActionSettings.spellCheck = HelperMethods.sanitizeString(this.serverActionSettings.spellCheck);
}
if (this.serverActionSettings.spellCheckByPage) {
this.documentEditor.serverActionSettings.spellCheckByPage = HelperMethods.sanitizeString(this.serverActionSettings.spellCheckByPage);
}
if (this.serverActionSettings.restrictEditing) {
this.documentEditor.serverActionSettings.restrictEditing = HelperMethods.sanitizeString(this.serverActionSettings.restrictEditing);
}
if (this.serverActionSettings.systemClipboard) {
this.documentEditor.serverActionSettings.systemClipboard = HelperMethods.sanitizeString(this.serverActionSettings.systemClipboard);
}
if (this.serverActionSettings.import) {
this.documentEditor.serverActionSettingsImport = HelperMethods.sanitizeString(this.serverActionSettings.import);
}
if (this.headers) {
this.documentEditor.headers = JSON.parse(HelperMethods.sanitizeString(JSON.stringify(this.headers)));
}
}
private customizeDocumentEditorSettings(): void {
if (this.documentEditorSettings.formFieldSettings) {
let settings: FormFieldSettingsModel = this.documentEditorSettings.formFieldSettings;
let documentEditor: DocumentEditor = this.documentEditor;
if (!isNullOrUndefined(settings.applyShading)) {
documentEditor.documentEditorSettings.formFieldSettings.applyShading = settings.applyShading;
}
if (!isNullOrUndefined(settings.formFillingMode)) {
documentEditor.documentEditorSettings.formFieldSettings.formFillingMode = settings.formFillingMode;
}
if (!isNullOrUndefined(settings.formattingExceptions)) {
documentEditor.documentEditorSettings.formFieldSettings.formattingExceptions = settings.formattingExceptions;
}
if (!isNullOrUndefined(settings.selectionColor)) {
documentEditor.documentEditorSettings.formFieldSettings.selectionColor = settings.selectionColor;
}
if (!isNullOrUndefined(settings.shadingColor)) {
documentEditor.documentEditorSettings.formFieldSettings.shadingColor = settings.shadingColor;
}
}
if (this.documentEditorSettings.searchHighlightColor) {
this.documentEditor.documentEditorSettings.searchHighlightColor = HelperMethods.sanitizeString(this.documentEditorSettings.searchHighlightColor);
}
if (this.documentEditorSettings.fontFamilies) {
this.documentEditor.documentEditorSettings.fontFamilies = JSON.parse(HelperMethods.sanitizeString(JSON.stringify(this.documentEditorSettings.fontFamilies)));
}
if (this.documentEditorSettings.collaborativeEditingSettings) {
this.documentEditor.documentEditorSettings.collaborativeEditingSettings = this.documentEditorSettings.collaborativeEditingSettings;
}
if (this.documentEditorSettings.printDevicePixelRatio) {
this.documentEditor.documentEditorSettings.printDevicePixelRatio = this.documentEditorSettings.printDevicePixelRatio;
}
if (!isNullOrUndefined(this.documentEditorSettings.enableOptimizedTextMeasuring)) {
this.documentEditor.documentEditorSettings.enableOptimizedTextMeasuring = this.documentEditorSettings.enableOptimizedTextMeasuring;
}
if (!isNullOrUndefined(this.documentEditorSettings.maximumRows)) {
this.documentEditor.documentEditorSettings.maximumRows = this.documentEditorSettings.maximumRows;
}
if (!isNullOrUndefined(this.documentEditorSettings.maximumColumns)) {
this.documentEditor.documentEditorSettings.maximumColumns = this.documentEditorSettings.maximumColumns;
}
if (!isNullOrUndefined(this.documentEditorSettings.showHiddenMarks)) {
this.documentEditor.documentEditorSettings.showHiddenMarks = this.documentEditorSettings.showHiddenMarks;
}
if (!isNullOrUndefined(this.documentEditorSettings.showBookmarks)) {
this.documentEditor.documentEditorSettings.showBookmarks = this.documentEditorSettings.showBookmarks;
}
if (!isNullOrUndefined(this.documentEditorSettings.highlightEditableRanges)) {
this.documentEditor.documentEditorSettings.highlightEditableRanges = this.documentEditorSettings.highlightEditableRanges;
}
if (!isNullOrUndefined(this.documentEditorSettings.allowDragAndDrop)) {
this.documentEditor.documentEditorSettings.allowDragAndDrop = this.documentEditorSettings.allowDragAndDrop;
}
if (!isNullOrUndefined(this.documentEditorSettings.optimizeSfdt)) {
this.documentEditor.documentEditorSettings.optimizeSfdt = this.documentEditorSettings.optimizeSfdt;
}
if (!isNullOrUndefined(this.documentEditorSettings.autoResizeSettings)) {
this.documentEditor.documentEditorSettings.autoResizeSettings = this.documentEditorSettings.autoResizeSettings;
}
if (!isNullOrUndefined(this.documentEditorSettings.showRuler)) {
this.documentEditor.documentEditorSettings.showRuler = this.documentEditorSettings.showRuler;
}
if (!isNullOrUndefined(this.documentEditorSettings.colorPickerSettings)) {
this.documentEditor.documentEditorSettings.colorPickerSettings = this.documentEditorSettings.colorPickerSettings;
}
if (!isNullOrUndefined(this.documentEditorSettings.popupTarget)) {
this.documentEditor.documentEditorSettings.popupTarget = this.documentEditorSettings.popupTarget;
}
if (!isNullOrUndefined(this.documentEditorSettings.showNavigationPane)) {
this.documentEditor.documentEditorSettings.showNavigationPane = this.documentEditorSettings.showNavigationPane;
}
if (!isNullOrUndefined(this.documentEditorSettings.mentionSettings)) {
this.documentEditor.documentEditorSettings.mentionSettings = this.documentEditorSettings.mentionSettings;
}
if (!isNullOrUndefined(this.documentEditorSettings.pasteAsNewParagraph)) {
this.documentEditor.documentEditorSettings.pasteAsNewParagraph = this.documentEditorSettings.pasteAsNewParagraph;
}
}
/**
* @private
*/
public getPersistData(): string {
return 'documenteditor-container';
}
/* eslint-disable */
protected requiredModules(): ModuleDeclaration[] {
let modules: ModuleDeclaration[] = [];
if (this.enableToolbar) {
modules.push({
member: 'toolbar', args: [this]
});
}
return modules;
}
private initContainerElement(): void {
// Toolbar container
let isRtl: boolean = this.enableRtl;
this.containerTarget = this.createElement('div', { className: 'e-de-ctn' });
this.containerTarget.contentEditable = 'false';
this.createToolbarContainer(isRtl);
let propertiesPaneContainerBorder: string;
if (!isRtl) {
propertiesPaneContainerBorder = 'e-de-pane';
} else {
propertiesPaneContainerBorder = 'e-de-pane-rtl';
}
this.propertiesPaneContainer = this.createElement('div', { className: propertiesPaneContainerBorder, styles: 'display:none' });
this.editorContainer.appendChild(this.propertiesPaneContainer);
this.containerTarget.appendChild(this.editorContainer);
this.statusBarElement = this.createElement('div', { className: 'e-de-status-bar' });
if (isRtl) {
this.statusBarElement.style.direction = 'rtl';
}
this.containerTarget.appendChild(this.statusBarElement);
this.element.appendChild(this.containerTarget);
}
private createToolbarContainer(isRtl: boolean, isCustom?: boolean): void {
if (isNullOrUndefined((this.editorContainer))) {
this.editorContainer = this.createElement('div', { className: 'e-de-tool-ctnr-properties-pane' + (isRtl ? ' e-de-ctnr-rtl' : '') });