all files / document-editor-container/ document-editor-container.js

89.29% Statements 517/579
69.71% Branches 290/416
81.97% Functions 50/61
89.18% Lines 511/573
5 statements, 2 functions, 11 branches Ignored     
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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153    48× 48× 48×       161× 161× 161× 161×     58× 58× 58× 58×                                                                                                                                                                                                                                                                                                                                                                                                                                 58×     11961×                     231×   36× 44× 44×                                                                     22× 22×   22×                                                             60× 60× 20×   60×   60× 57× 57×   60× 60×   60× 60×   60× 60× 60×     60× 60× 60× 60× 60× 60× 60× 60×                     63×   63×   63×     60×     60× 60×   60× 60×   60× 60×   60× 60×   60× 60×   60× 60×     62× 62× 62× 62× 62×   62× 62×   62×     62× 62×   62× 62×     62× 62×   62× 62×   62× 62×   62× 62×   62× 62×   62× 62×   62× 62×   62× 62×   62× 62×   62× 62×   62× 62×   62× 62×   62× 62×   62× 62×   62× 62×   62×     62× 62×   62× 62×         188× 188× 180×       188×   60× 60× 60× 60× 60× 60× 59×       60× 60× 60× 60× 60×   60× 60×   62× 60×   62× 59× 59×     57×   59× 59×         60× 60× 60×                                                                   60× 60× 60× 60× 60× 60× 60× 60×   60× 60× 60× 60× 60× 60× 60× 60× 60× 60×                   59×       59×       59× 59× 59× 59× 59×       64× 61×                             24×             781×                         62× 17× 17× 17×       20× 20×   20× 20×   20× 20×   61× 61×   61×   61× 61× 61×   61× 58× 58× 58×   61×   61×       61× 61× 61×   114× 114× 114× 77× 77× 77× 77×                                                             16× 16×             78×     78× 78× 78× 78×                   78× 78× 76×   78× 78× 78× 78×   78× 78×   78× 78×   78×     77× 77×     77×   59×   18× 10×           78× 78× 76×       77× 75×   77× 77× 77× 77×         77× 77× 59× 57×   59×   77× 75× 75× 75× 75×   77×       77× 77× 59× 59× 59×   77× 59×   77× 77× 59×   77× 77× 59×   77× 77× 59×   77× 77× 59×   77× 59×   77× 77× 59× 59×   77×       77×       77× 77× 77× 77× 77×                                                                                                                                                                        
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/* istanbul ignore next */ 
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    Iif (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) Eif (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../document-editor/document-editor", "./properties-pane/header-footer-pane", "./properties-pane/image-properties-pane", "./properties-pane/table-of-content-pane", "./properties-pane/table-properties-pane", "./properties-pane/status-bar", "@syncfusion/ej2-popups", "../document-editor/base/constants", "../index", "@syncfusion/ej2-base", "@syncfusion/ej2-popups"], function (require, exports, ej2_base_1, ej2_base_2, document_editor_1, header_footer_pane_1, image_properties_pane_1, table_of_content_pane_1, table_properties_pane_1, status_bar_1, ej2_popups_1, constants_1, index_1, ej2_base_3, ej2_popups_2) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var DocumentEditorContainer = (function (_super) {
        __extends(DocumentEditorContainer, _super);
        function DocumentEditorContainer(options, element) {
            var _this = _super.call(this, options, element) || this;
            _this.previousContext = '';
            _this.showHeaderProperties = true;
            _this.defaultLocale = {
                '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'
            };
            return _this;
        }
        Object.defineProperty(DocumentEditorContainer.prototype, "documentEditor", {
            get: function () {
                return this.documentEditorInternal;
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(DocumentEditorContainer.prototype, "toolbar", {
            get: function () {
                return this.toolbarModule;
            },
            enumerable: true,
            configurable: true
        });
        DocumentEditorContainer.prototype.getModuleName = function () {
            return 'DocumentEditorContainer';
        };
        DocumentEditorContainer.prototype.onPropertyChanged = function (newModel, oldModel) {
            for (var _i = 0, _a = Object.keys(newModel); _i < _a.length; _i++) {
                var prop = _a[_i];
                switch (prop) {
                    case 'restrictEditing':
                        this.restrictEditingToggleHelper(newModel.restrictEditing);
                        break;
                    case 'showPropertiesPane':
                        this.showHidePropertiesPane(newModel.showPropertiesPane);
                        break;
                    case 'enableTrackChanges':
                        Iif (this.documentEditor.documentHelper.isTrackedOnlyMode && !newModel.enableTrackChanges && newModel.enableTrackChanges !== this.enableTrackChanges) {
                            this.enableTrackChanges = true;
                        }
                        Eif (this.documentEditor) {
                            this.documentEditor.enableTrackChanges = newModel.enableTrackChanges;
                            Eif (this.toolbarModule) {
                                this.toolbarModule.toggleTrackChanges(newModel.enableTrackChanges);
                            }
                            if (this.documentEditor.enableTrackChanges) {
                                this.documentEditor.documentHelper.showRevision = true;
                            }
                            this.documentEditor.resize();
                        }
                        break;
                    case 'enableLocalPaste':
                        Eif (this.documentEditor) {
                            this.documentEditor.enableLocalPaste = newModel.enableLocalPaste;
                        }
                        break;
                    case 'serviceUrl':
                        Eif (this.documentEditor) {
                            this.documentEditor.serviceUrl = newModel.serviceUrl;
                        }
                        break;
                    case 'serverActionSettings':
                        if (this.documentEditor) {
                            this.setserverActionSettings();
                        }
                        break;
                    case 'zIndex':
                        Eif (this.documentEditor) {
                            this.documentEditor.zIndex = newModel.zIndex;
                        }
                        break;
                    case 'headers':
                        Eif (this.documentEditor) {
                            this.documentEditor.headers = newModel.headers;
                        }
                        break;
                    case 'locale':
                    case 'enableRtl':
                        this.refresh();
                        break;
                    case 'enableComment':
                        Eif (this.documentEditor) {
                            this.documentEditor.enableComment = newModel.enableComment;
                        }
                        Eif (this.toolbarModule) {
                            this.toolbarModule.enableDisableInsertComment(newModel.enableComment);
                        }
                        break;
                    case 'enableSpellCheck':
                        if (this.documentEditor) {
                            this.documentEditor.enableSpellCheck = newModel.enableSpellCheck;
                        }
                        break;
                    case 'documentSettings':
                        Eif (this.documentEditor) {
                            this.documentEditor.documentSettings.compatibilityMode = this.documentSettings.compatibilityMode;
                        }
                        break;
                    case 'documentEditorSettings':
                        Eif (this.documentEditor) {
                            this.customizeDocumentEditorSettings();
                        }
                        if (!ej2_base_1.isNullOrUndefined(newModel.documentEditorSettings.fontFamilies)) {
                            var fontFamilyValue = newModel.documentEditorSettings.fontFamilies;
                            this.refreshFontFamilies(fontFamilyValue);
                        }
                        break;
                    case 'toolbarItems':
                        Iif (this.toolbarModule) {
                            this.toolbarModule.reInitToolbarItems(newModel.toolbarItems);
                        }
                        break;
                    case 'currentUser':
                        Eif (this.documentEditor) {
                            this.documentEditor.currentUser = newModel.currentUser;
                        }
                        break;
                    case 'userColor':
                        Eif (this.documentEditor) {
                            this.documentEditor.userColor = newModel.userColor;
                        }
                        break;
                    case 'layoutType':
                        Eif (this.documentEditor) {
                            this.documentEditor.layoutType = newModel.layoutType;
                            Eif (newModel.layoutType === 'Continuous') {
                                this.statusBar.togglePageLayout();
                            }
                            else {
                                this.statusBar.toggleWebLayout();
                            }
                        }
                        break;
                    case 'enableToolbar':
                        this.createToolbarContainer(this.enableRtl, true);
                        Eif (newModel.enableToolbar && this.toolbarModule) {
                            this.toolbarModule.initToolBar(this.toolbarItems);
                            this.toolbarModule.enableDisableInsertComment(this.enableComment);
                            this.toolbarModule.toggleTrackChanges(this.enableTrackChanges);
                        }
                        Eif (this.documentEditor) {
                            this.documentEditor.resize();
                        }
                        break;
                    case 'height':
                        this.element.style.height = ej2_base_1.formatUnit(this.height);
                        Eif (this.documentEditor) {
                            this.documentEditor.resize();
                        }
                        this.resize();
                        break;
                    case 'width':
                        this.element.style.width = ej2_base_1.formatUnit(this.width);
                        Eif (this.documentEditor) {
                            this.documentEditor.resize();
                        }
                        break;
                    case 'enableAutoFocus':
                        Eif (this.documentEditor) {
                            this.documentEditor.enableAutoFocus = newModel.enableAutoFocus;
                        }
                        break;
                    case 'autoResizeOnVisibilityChange':
                        Eif (this.documentEditor) {
                            this.documentEditor.autoResizeOnVisibilityChange = newModel.autoResizeOnVisibilityChange;
                        }
                        break;
                }
            }
        };
        DocumentEditorContainer.prototype.preRender = function () {
            this.localObj = new ej2_base_1.L10n('documenteditorcontainer', this.defaultLocale, this.locale);
            if (!ej2_base_1.isNullOrUndefined(this.element) && this.element.id === '') {
                this.element.id = index_1.HelperMethods.getUniqueElementId();
            }
            this.initContainerElement();
        };
        DocumentEditorContainer.prototype.render = function () {
            if (this.toolbarModule) {
                this.toolbarModule.initToolBar(this.toolbarItems);
                this.toolbarModule.enableDisableInsertComment(this.enableComment);
            }
            Eif (this.height !== '') {
                this.element.style.height = ej2_base_1.formatUnit(this.height);
            }
            Eif (this.width !== '') {
                this.element.style.width = ej2_base_1.formatUnit(this.width);
            }
            this.element.style.minHeight = '320px';
            this.initializeDocumentEditor();
            Iif (this.restrictEditing) {
                this.restrictEditingToggleHelper(this.restrictEditing);
            }
            this.headerFooterProperties = new header_footer_pane_1.HeaderFooterProperties(this, this.enableRtl);
            this.imageProperties = new image_properties_pane_1.ImageProperties(this, this.enableRtl);
            this.tocProperties = new table_of_content_pane_1.TocProperties(this, this.enableRtl);
            this.tableProperties = new table_properties_pane_1.TableProperties(this, this.imageProperties, this.enableRtl);
            this.statusBar = new status_bar_1.StatusBar(this.statusBarElement, this);
            ej2_popups_1.createSpinner({ target: this.containerTarget, cssClass: 'e-spin-overlay' });
            this.setserverActionSettings();
            this.renderComplete();
        };
        DocumentEditorContainer.prototype.restrictEditingToggleHelper = function (restrictEditing) {
            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);
        };
        DocumentEditorContainer.prototype.setFormat = function () {
            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);
            }
        };
        DocumentEditorContainer.prototype.setserverActionSettings = function () {
            Iif (this.serviceUrl) {
                this.documentEditor.serviceUrl = index_1.HelperMethods.sanitizeString(this.serviceUrl);
            }
            Eif (this.serverActionSettings.spellCheck) {
                this.documentEditor.serverActionSettings.spellCheck = index_1.HelperMethods.sanitizeString(this.serverActionSettings.spellCheck);
            }
            Eif (this.serverActionSettings.spellCheckByPage) {
                this.documentEditor.serverActionSettings.spellCheckByPage = index_1.HelperMethods.sanitizeString(this.serverActionSettings.spellCheckByPage);
            }
            Eif (this.serverActionSettings.restrictEditing) {
                this.documentEditor.serverActionSettings.restrictEditing = index_1.HelperMethods.sanitizeString(this.serverActionSettings.restrictEditing);
            }
            Eif (this.serverActionSettings.systemClipboard) {
                this.documentEditor.serverActionSettings.systemClipboard = index_1.HelperMethods.sanitizeString(this.serverActionSettings.systemClipboard);
            }
            Eif (this.serverActionSettings.import) {
                this.documentEditor.serverActionSettingsImport = index_1.HelperMethods.sanitizeString(this.serverActionSettings.import);
            }
            Eif (this.headers) {
                this.documentEditor.headers = JSON.parse(index_1.HelperMethods.sanitizeString(JSON.stringify(this.headers)));
            }
        };
        DocumentEditorContainer.prototype.customizeDocumentEditorSettings = function () {
            Eif (this.documentEditorSettings.formFieldSettings) {
                var settings = this.documentEditorSettings.formFieldSettings;
                var documentEditor = this.documentEditor;
                Eif (!ej2_base_1.isNullOrUndefined(settings.applyShading)) {
                    documentEditor.documentEditorSettings.formFieldSettings.applyShading = settings.applyShading;
                }
                Eif (!ej2_base_1.isNullOrUndefined(settings.formFillingMode)) {
                    documentEditor.documentEditorSettings.formFieldSettings.formFillingMode = settings.formFillingMode;
                }
                Iif (!ej2_base_1.isNullOrUndefined(settings.formattingExceptions)) {
                    documentEditor.documentEditorSettings.formFieldSettings.formattingExceptions = settings.formattingExceptions;
                }
                Eif (!ej2_base_1.isNullOrUndefined(settings.selectionColor)) {
                    documentEditor.documentEditorSettings.formFieldSettings.selectionColor = settings.selectionColor;
                }
                Eif (!ej2_base_1.isNullOrUndefined(settings.shadingColor)) {
                    documentEditor.documentEditorSettings.formFieldSettings.shadingColor = settings.shadingColor;
                }
            }
            Eif (this.documentEditorSettings.searchHighlightColor) {
                this.documentEditor.documentEditorSettings.searchHighlightColor = index_1.HelperMethods.sanitizeString(this.documentEditorSettings.searchHighlightColor);
            }
            Eif (this.documentEditorSettings.fontFamilies) {
                this.documentEditor.documentEditorSettings.fontFamilies = JSON.parse(index_1.HelperMethods.sanitizeString(JSON.stringify(this.documentEditorSettings.fontFamilies)));
            }
            Eif (this.documentEditorSettings.collaborativeEditingSettings) {
                this.documentEditor.documentEditorSettings.collaborativeEditingSettings = this.documentEditorSettings.collaborativeEditingSettings;
            }
            Eif (this.documentEditorSettings.printDevicePixelRatio) {
                this.documentEditor.documentEditorSettings.printDevicePixelRatio = this.documentEditorSettings.printDevicePixelRatio;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.enableOptimizedTextMeasuring)) {
                this.documentEditor.documentEditorSettings.enableOptimizedTextMeasuring = this.documentEditorSettings.enableOptimizedTextMeasuring;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.maximumRows)) {
                this.documentEditor.documentEditorSettings.maximumRows = this.documentEditorSettings.maximumRows;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.maximumColumns)) {
                this.documentEditor.documentEditorSettings.maximumColumns = this.documentEditorSettings.maximumColumns;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.showHiddenMarks)) {
                this.documentEditor.documentEditorSettings.showHiddenMarks = this.documentEditorSettings.showHiddenMarks;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.showBookmarks)) {
                this.documentEditor.documentEditorSettings.showBookmarks = this.documentEditorSettings.showBookmarks;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.highlightEditableRanges)) {
                this.documentEditor.documentEditorSettings.highlightEditableRanges = this.documentEditorSettings.highlightEditableRanges;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.allowDragAndDrop)) {
                this.documentEditor.documentEditorSettings.allowDragAndDrop = this.documentEditorSettings.allowDragAndDrop;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.optimizeSfdt)) {
                this.documentEditor.documentEditorSettings.optimizeSfdt = this.documentEditorSettings.optimizeSfdt;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.autoResizeSettings)) {
                this.documentEditor.documentEditorSettings.autoResizeSettings = this.documentEditorSettings.autoResizeSettings;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.showRuler)) {
                this.documentEditor.documentEditorSettings.showRuler = this.documentEditorSettings.showRuler;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.colorPickerSettings)) {
                this.documentEditor.documentEditorSettings.colorPickerSettings = this.documentEditorSettings.colorPickerSettings;
            }
            Iif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.popupTarget)) {
                this.documentEditor.documentEditorSettings.popupTarget = this.documentEditorSettings.popupTarget;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.showNavigationPane)) {
                this.documentEditor.documentEditorSettings.showNavigationPane = this.documentEditorSettings.showNavigationPane;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings.mentionSettings)) {
                this.documentEditor.documentEditorSettings.mentionSettings = this.documentEditorSettings.mentionSettings;
            }
        };
        DocumentEditorContainer.prototype.getPersistData = function () {
            return 'documenteditor-container';
        };
        DocumentEditorContainer.prototype.requiredModules = function () {
            var modules = [];
            if (this.enableToolbar) {
                modules.push({
                    member: 'toolbar', args: [this]
                });
            }
            return modules;
        };
        DocumentEditorContainer.prototype.initContainerElement = function () {
            var isRtl = this.enableRtl;
            this.containerTarget = this.createElement('div', { className: 'e-de-ctn' });
            this.containerTarget.contentEditable = 'false';
            this.createToolbarContainer(isRtl);
            var propertiesPaneContainerBorder;
            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);
        };
        DocumentEditorContainer.prototype.createToolbarContainer = function (isRtl, isCustom) {
            if (ej2_base_1.isNullOrUndefined((this.editorContainer))) {
                this.editorContainer = this.createElement('div', { className: 'e-de-tool-ctnr-properties-pane' + (isRtl ? ' e-de-ctnr-rtl' : '') });
            }
            if (this.enableToolbar) {
                this.toolbarContainer = this.createElement('div', { className: 'e-de-ctnr-toolbar' + (isRtl ? ' e-de-ctnr-rtl' : '') });
                if (isCustom) {
                    this.containerTarget.insertBefore(this.toolbarContainer, this.containerTarget.firstChild);
                }
                else {
                    this.containerTarget.appendChild(this.toolbarContainer);
                }
                this.editorContainer.classList.remove('e-de-ctnr-properties-pane');
                this.editorContainer.classList.add('e-de-tool-ctnr-properties-pane');
            }
            else {
                this.editorContainer.classList.remove('e-de-tool-ctnr-properties-pane');
                this.editorContainer.classList.add('e-de-ctnr-properties-pane');
            }
        };
        DocumentEditorContainer.prototype.initializeDocumentEditor = function () {
            var id = this.element.id + '_editor';
            var documentEditorTarget = this.createElement('div', { id: id, styles: 'width:100%;height:100%' });
            this.documentEditorInternal = new document_editor_1.DocumentEditor({
                isReadOnly: false, enableRtl: this.enableRtl,
                selectionChange: this.onSelectionChange.bind(this),
                contentChange: this.onContentChange.bind(this),
                documentChange: this.onDocumentChange.bind(this),
                requestNavigate: this.onRequestNavigate.bind(this),
                viewChange: this.onViewChange.bind(this),
                customContextMenuSelect: this.onCustomContextMenuSelect.bind(this),
                customContextMenuBeforeOpen: this.onCustomContextMenuBeforeOpen.bind(this),
                beforePaneSwitch: this.onBeforePaneSwitch.bind(this),
                commentBegin: this.onCommentBegin.bind(this),
                commentEnd: this.onCommentEnd.bind(this),
                commentDelete: this.onCommentDelete.bind(this),
                beforeAcceptRejectChanges: this.onBeforeAcceptRejectChanges.bind(this),
                beforeCommentAction: this.onCommentAction.bind(this),
                trackChange: this.onTrackChange.bind(this),
                serviceFailure: this.fireServiceFailure.bind(this),
                beforeXmlHttpRequestSend: this.beforeXmlHttpSend.bind(this),
                locale: this.locale,
                acceptTab: true,
                zIndex: this.zIndex,
                enableLocalPaste: this.enableLocalPaste,
                layoutType: this.layoutType,
                pageOutline: '#E0E0E0',
                currentUser: this.currentUser,
                userColor: this.userColor,
                height: '100%',
                width: '100%',
                enableTrackChanges: this.enableTrackChanges,
                showRevisions: true,
                showComments: true,
                enableLockAndEdit: this.enableLockAndEdit,
                enableAutoFocus: this.enableAutoFocus
            });
            this.wireEvents();
            this.customizeDocumentEditorSettings();
            this.documentEditor.enableAllModules();
            this.documentEditor.enableComment = this.enableComment;
            this.editorContainer.insertBefore(documentEditorTarget, this.editorContainer.firstChild);
            this.setFormat();
            this.documentEditor.appendTo(documentEditorTarget);
            this.documentEditor.resize();
        };
        DocumentEditorContainer.prototype.wireEvents = function () {
            window.addEventListener('resize', this.onWindowResize.bind(this));
            this.documentEditor.on(constants_1.internalZoomFactorChange, this.onZoomFactorChange, this);
            this.documentEditor.on(constants_1.internalviewChangeEvent, this.onViewChange, this);
            this.documentEditor.on(constants_1.protectionTypeChangeEvent, this.showPropertiesPaneOnSelection, this);
            this.documentEditor.on(constants_1.internalDocumentEditorSettingsChange, this.updateShowHiddenMarks, this);
            this.documentEditor.on(constants_1.internalStyleCollectionChange, this.updateStyleCollection, this);
            this.documentEditor.on(constants_1.internalAutoResize, this.triggerAutoResize, this);
            this.documentEditor.on(constants_1.beforeAutoResize, this.onBeforeAutoResize, this);
            this.documentEditor.on(constants_1.trackChanges, this.onEnableTrackChanges, this);
            this.documentEditor.on(constants_1.internalOptionPaneChange, this.onOptionPaneChange, this);
        };
        DocumentEditorContainer.prototype.onWindowResize = function () {
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditor)) {
                this.documentEditor.isContainerResize = true;
                this.resize();
            }
        };
        DocumentEditorContainer.prototype.onOptionPaneChange = function (args) {
        };
        DocumentEditorContainer.prototype.onEnableTrackChanges = function (model) {
            Iif (model.enableTrackChanges !== this.enableTrackChanges) {
                this.enableTrackChanges = model.enableTrackChanges;
            }
        };
        DocumentEditorContainer.prototype.triggerAutoResize = function (args) {
            args.cancel = true;
            this.resize();
        };
        DocumentEditorContainer.prototype.onBeforeAutoResize = function (args) {
            args.element = this.element;
        };
        DocumentEditorContainer.prototype.unWireEvents = function () {
            Iif (ej2_base_1.isNullOrUndefined(this.documentEditor)) {
                return;
            }
            else {
                Iif (this.documentEditor.isDestroyed) {
                    return;
                }
            }
            this.documentEditor.off(constants_1.internalZoomFactorChange, this.onZoomFactorChange);
            this.documentEditor.off(constants_1.internalviewChangeEvent, this.onViewChange);
            this.documentEditor.off(constants_1.protectionTypeChangeEvent, this.showPropertiesPaneOnSelection);
            this.documentEditor.off(constants_1.internalDocumentEditorSettingsChange, this.updateShowHiddenMarks);
            this.documentEditor.off(constants_1.internalStyleCollectionChange, this.updateStyleCollection);
        };
        DocumentEditorContainer.prototype.onCommentBegin = function () {
            Eif (this.toolbarModule) {
                this.toolbarModule.enableDisableInsertComment(false);
            }
        };
        DocumentEditorContainer.prototype.onCommentEnd = function () {
            if (this.toolbarModule) {
                this.toolbarModule.enableDisableInsertComment(true && this.enableComment);
            }
        };
        DocumentEditorContainer.prototype.beforeXmlHttpSend = function (args) {
            this.trigger(constants_1.beforeXmlHttpRequestSend, args);
        };
        DocumentEditorContainer.prototype.onCommentDelete = function (args) {
            this.trigger(constants_1.commentDeleteEvent, args);
        };
        DocumentEditorContainer.prototype.onBeforeAcceptRejectChanges = function (args) {
            this.trigger(constants_1.revisionActionEvent, args);
        };
        DocumentEditorContainer.prototype.onCommentAction = function (args) {
            this.trigger(constants_1.beforeCommentActionEvent, args);
        };
        DocumentEditorContainer.prototype.onTrackChange = function (args) {
            this.trigger(constants_1.trackChangeEvent, args);
            if (this.toolbarModule) {
                this.toolbarModule.toggleTrackChanges(args.isTrackChangesEnabled);
            }
        };
        DocumentEditorContainer.prototype.onBeforePaneSwitch = function (args) {
            this.trigger(constants_1.beforePaneSwitchEvent, args);
        };
        DocumentEditorContainer.prototype.fireServiceFailure = function (eventArgs) {
            this.trigger(constants_1.serviceFailureEvent, eventArgs);
        };
        DocumentEditorContainer.prototype.showHidePropertiesPane = function (show) {
            if (this.showPropertiesPane) {
                this.showPropertiesPaneOnSelection();
            }
            this.propertiesPaneContainer.style.display = show ? 'block' : 'none';
            Eif (this.toolbarModule) {
                this.toolbarModule.propertiesPaneButton.element.style.opacity = show ? '1' : '0.5';
            }
            this.documentEditor.resize();
        };
        DocumentEditorContainer.prototype.updateStyleCollection = function () {
            if (!ej2_base_1.isNullOrUndefined(this.tableProperties) && !ej2_base_1.isNullOrUndefined(this.tableProperties.tableTextProperties) && !ej2_base_1.isNullOrUndefined(this.tableProperties.tableTextProperties.paragraph)) {
                this.tableProperties.tableTextProperties.paragraph.updateStyleNames();
            }
        };
        DocumentEditorContainer.prototype.resize = function (width, height) {
            Eif (this.element) {
                if (!this.documentEditor.isContainerResize) {
                    Eif (ej2_base_1.isNullOrUndefined(height) && this.element && this.element.parentElement) {
                        height = this.element.parentElement.clientHeight;
                    }
                    Eif (ej2_base_1.isNullOrUndefined(width) && this.element && this.element.parentElement) {
                        width = this.element.parentElement.clientWidth;
                    }
                    Eif (!ej2_base_1.isNullOrUndefined(width) && width > 200) {
                        this.width = width.toString();
                        this.element.style.width = width + 'px';
                    }
                    Eif (!ej2_base_1.isNullOrUndefined(height) && height > 200) {
                        this.height = height.toString();
                        this.element.style.height = height + 'px';
                    }
                }
                Eif (this.documentEditor) {
                    this.documentEditor.resize();
                }
                Eif (this.toolbarModule) {
                    this.toolbarModule.toolbar.refreshOverflow();
                }
                Eif (this.showPropertiesPane) {
                    this.tableProperties.updateTabContainerHeight();
                }
            }
        };
        DocumentEditorContainer.prototype.refreshFontFamilies = function (fontFamilies) {
            if (!ej2_base_1.isNullOrUndefined(this.tableProperties) && !ej2_base_1.isNullOrUndefined(this.tableProperties.tableTextProperties) && !ej2_base_1.isNullOrUndefined(this.tableProperties.tableTextProperties.text)) {
                var text = this.tableProperties.tableTextProperties.text;
                text.fontFamily.refresh();
                for (var i = 0; i < fontFamilies.length; i++) {
                    var fontValue = fontFamilies[i];
                    var fontStyleValue = { 'FontName': fontValue, 'FontValue': fontValue };
                    text.fontFamily.addItem(fontStyleValue, i);
                }
            }
        };
        DocumentEditorContainer.prototype.onContentChange = function (args) {
            Eif (this.toolbarModule) {
                this.toolbarModule.enableDisableUndoRedo();
            }
            Eif (this.statusBar) {
                this.statusBar.updatePageCount();
            }
            var eventArgs = { source: this, operations: args.operations };
            this.trigger(constants_1.contentChangeEvent, eventArgs);
        };
        DocumentEditorContainer.prototype.onDocumentChange = function () {
            this.enableTrackChanges = this.documentEditor.enableTrackChanges;
            Eif (!ej2_base_1.isNullOrUndefined(this.documentSettings) && !ej2_base_1.isNullOrUndefined(this.documentEditor)
                && !ej2_base_1.isNullOrUndefined(this.documentEditor.documentSettings)) {
                this.documentSettings.compatibilityMode = this.documentEditor.documentSettings.compatibilityMode;
            }
            Eif (!ej2_base_1.isNullOrUndefined(this.documentEditorSettings) && !ej2_base_1.isNullOrUndefined(this.documentEditorSettings.fontFamilies)) {
                var fontFamilyValue = this.documentEditorSettings.fontFamilies;
                this.refreshFontFamilies(fontFamilyValue);
            }
            if (this.toolbarModule) {
                this.toolbarModule.isCommentEditing = false;
                this.toolbarModule.enableDisableInsertComment(true);
                this.toolbarModule.enableDisableUndoRedo();
            }
            if (this.statusBar) {
                this.statusBar.updatePageCount();
            }
            Iif (this.documentEditor.documentHelper.contentControlCollection.length > 0) {
                this.documentEditor.selection.isHighlightContentControlEditRegion = true;
                this.documentEditor.selection.onHighlightContentControl();
            }
            var eventArgs = { source: this };
            this.trigger(constants_1.documentChangeEvent, eventArgs);
            this.updateStyleCollection();
        };
        DocumentEditorContainer.prototype.onSelectionChange = function () {
            var _this = this;
            setTimeout(function () {
                if (!ej2_base_1.isNullOrUndefined(_this.documentEditor)) {
                    _this.showPropertiesPaneOnSelection();
                    var eventArgs = { source: _this, isCompleted: _this.documentEditor.documentHelper.isSelectionCompleted };
                    _this.trigger(constants_1.selectionChangeEvent, eventArgs);
                    _this.documentEditor.documentHelper.isSelectionCompleted = true;
                }
            });
        };
        DocumentEditorContainer.prototype.onZoomFactorChange = function () {
            Eif (this.statusBar) {
                this.statusBar.updateZoomContent();
            }
        };
        DocumentEditorContainer.prototype.updateShowHiddenMarks = function (settings) {
            this.documentEditorSettings.showHiddenMarks = settings.showHiddenMarks;
            this.tableProperties.tableTextProperties.paragraph.toggleHiddenMarks();
        };
        DocumentEditorContainer.prototype.onRequestNavigate = function (args) {
            if (args.linkType !== 'Bookmark') {
                var navLink = args.navigationLink;
                var link = ej2_base_3.SanitizeHtmlHelper.sanitize(navLink);
                if (args.localReference.length > 0) {
                    link += '#' + args.localReference;
                }
                if (navLink.substring(0, 8) === 'file:///'
                    || (navLink.substring(0, 7) === 'http://' && navLink.length > 7)
                    || (navLink.substring(0, 8) === 'https://' && navLink.length > 8)
                    || (navLink.substring(0, 4) === 'www.' && navLink.length > 4)
                    || (navLink.substring(0, 7) === 'mailto:' && navLink.length > 7)) {
                    window.open(link);
                }
                else {
                    ej2_popups_2.DialogUtility.alert({
                        title: this.localObj.getConstant("Information"),
                        content: this.localObj.getConstant("The address of this site is not valid. Check the address and try again."),
                        okButton: { text: this.localObj.getConstant("OK") },
                        closeOnEscape: true,
                    });
                }
                args.isHandled = true;
            }
        };
        DocumentEditorContainer.prototype.onViewChange = function (args) {
            Eif (this.statusBar) {
                this.statusBar.updatePageNumberOnViewChange(args);
            }
        };
        DocumentEditorContainer.prototype.onCustomContextMenuSelect = function (args) {
            this.trigger(constants_1.customContextMenuSelectEvent, args);
        };
        DocumentEditorContainer.prototype.onCustomContextMenuBeforeOpen = function (args) {
            this.trigger(constants_1.customContextMenuBeforeOpenEvent, args);
        };
        DocumentEditorContainer.prototype.showPropertiesPaneOnSelection = function () {
            Iif (((this.restrictEditing) && !this.showPropertiesPane) || ej2_base_1.isNullOrUndefined(this.tableProperties)) {
                return;
            }
            var isProtectedDocument = this.documentEditor.documentHelper.protectionType !== 'NoProtection';
            var allowFormatting = isProtectedDocument && this.documentEditor.documentHelper.restrictFormatting;
            var isSelectionInProtectecRegion = this.documentEditor.editorModule.restrictEditing;
            Iif (isProtectedDocument) {
                if (this.toolbarModule) {
                    this.toolbarModule.enableDisableToolBarItem(!isSelectionInProtectecRegion, true);
                }
                this.tableProperties.enableDisableElements(!allowFormatting && !isSelectionInProtectecRegion);
                this.tocProperties.enableDisableElements(!isSelectionInProtectecRegion);
                this.headerFooterProperties.enableDisableElements(!isSelectionInProtectecRegion);
                this.imageProperties.enableDisableElements(!isSelectionInProtectecRegion);
            }
            else {
                var isReadOnly = !this.documentEditor.isReadOnly;
                if (this.toolbarModule) {
                    this.toolbarModule.enableDisableToolBarItem(isReadOnly, true || this.showPropertiesPane);
                }
                this.tableProperties.enableDisableElements(true);
                this.tocProperties.enableDisableElements(true);
                this.headerFooterProperties.enableDisableElements(true);
                this.imageProperties.enableDisableElements(true);
            }
            var currentContext = this.documentEditor.selectionModule.contextType;
            var isInHeaderFooter = currentContext.indexOf('Header') >= 0
                || currentContext.indexOf('Footer') >= 0;
            Eif (!isInHeaderFooter) {
                this.showHeaderProperties = true;
            }
            if (!this.showPropertiesPane) {
                this.showHidePropertiesPane(false);
                this.propertiesPaneContainer.style.display = 'none';
            }
            else {
                this.propertiesPaneContainer.style.display = 'block';
                Iif (isInHeaderFooter && this.showHeaderProperties) {
                    this.showProperties('headerfooter');
                }
                else if ((currentContext.indexOf('List') >= 0 || currentContext.indexOf('Text') >= 0
                    && currentContext.indexOf('Table') < 0)) {
                    this.showProperties('text');
                }
                else if (currentContext.indexOf('Image') >= 0) {
                    this.showProperties('image');
                }
                else Iif (currentContext.indexOf('TableOfContents') >= 0) {
                    this.showProperties('toc');
                }
                else Eif (currentContext.indexOf('Table') >= 0) {
                    this.showProperties('table');
                }
            }
            this.previousContext = this.documentEditor.selectionModule.contextType;
            if (this.toolbarModule && this.toolbarModule.toolbar) {
                this.toolbarModule.enableDisableInsertComment(!this.documentEditor.enableHeaderAndFooter && this.enableComment && !this.documentEditor.isReadOnlyMode && !this.documentEditor.selectionModule.isinFootnote && !this.documentEditor.selectionModule.isinEndnote &&
                    !this.documentEditor.selectionModule.isPlainContentControl());
            }
        };
        DocumentEditorContainer.prototype.showProperties = function (property) {
            if (this.toolbarModule && property !== 'headerfooter' && property !== 'toc') {
                this.toolbarModule.enableDisablePropertyPaneButton(true);
            }
            this.tableProperties.showTableProperties((property === 'table' || property === 'text'), property);
            this.imageProperties.showImageProperties(property === 'image');
            this.headerFooterProperties.showHeaderFooterPane(property === 'headerfooter');
            this.tocProperties.showTocPane(property === 'toc');
        };
        DocumentEditorContainer.prototype.setDefaultCharacterFormat = function (characterFormat) {
            this.characterFormat = characterFormat;
            this.setFormat();
        };
        DocumentEditorContainer.prototype.setDefaultParagraphFormat = function (paragraphFormat) {
            this.paragraphFormat = paragraphFormat;
            this.setFormat();
        };
        DocumentEditorContainer.prototype.setDefaultSectionFormat = function (sectionFormat) {
            this.sectionFormat = sectionFormat;
            this.setFormat();
        };
        DocumentEditorContainer.prototype.destroy = function () {
            _super.prototype.destroy.call(this);
            if (this.element) {
                if (!this.refreshing) {
                    this.element.classList.remove('e-documenteditorcontainer');
                }
                this.element.innerHTML = '';
            }
            if (!this.refreshing) {
                this.element = undefined;
                this.paragraphFormat = undefined;
                this.sectionFormat = undefined;
                this.characterFormat = undefined;
            }
            Iif (this.toolbarContainer && this.toolbarContainer.parentElement) {
                this.toolbarContainer.innerHTML = '';
                this.toolbarContainer.parentElement.removeChild(this.toolbarContainer);
            }
            this.toolbarContainer = undefined;
            if (this.documentEditorInternal) {
                this.unWireEvents();
                this.documentEditorInternal.destroy();
                this.documentEditorInternal = undefined;
            }
            if (this.headerFooterProperties) {
                this.headerFooterProperties.destroy();
            }
            this.headerFooterProperties = undefined;
            if (this.imageProperties) {
                this.imageProperties.destroy();
            }
            this.imageProperties = undefined;
            if (this.tocProperties) {
                this.tocProperties.destroy();
            }
            this.tocProperties = undefined;
            if (this.tableProperties) {
                this.tableProperties.destroy();
            }
            this.tableProperties = undefined;
            if (this.statusBar) {
                this.statusBar.destroy();
            }
            if (this.propertiesPaneContainer && this.propertiesPaneContainer.parentElement) {
                this.propertiesPaneContainer.remove();
            }
            this.propertiesPaneContainer = undefined;
            if (this.editorContainer && this.editorContainer.parentElement) {
                this.editorContainer.innerHTML = '';
                this.editorContainer.parentElement.removeChild(this.editorContainer);
            }
            Iif (this.statusBarElement && this.statusBarElement.parentElement) {
                this.statusBarElement.innerHTML = '';
                this.statusBarElement.parentElement.removeChild(this.statusBarElement);
            }
            Iif (this.containerTarget && this.containerTarget.parentElement) {
                this.containerTarget.innerHTML = '';
                this.containerTarget.parentElement.removeChild(this.containerTarget);
            }
            this.containerTarget = undefined;
            this.statusBarElement = undefined;
            this.editorContainer = undefined;
            this.statusBar = undefined;
            this.previousContext = undefined;
        };
        __decorate([
            ej2_base_1.Property(true)
        ], DocumentEditorContainer.prototype, "showPropertiesPane", void 0);
        __decorate([
            ej2_base_1.Property(true)
        ], DocumentEditorContainer.prototype, "enableToolbar", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], DocumentEditorContainer.prototype, "restrictEditing", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], DocumentEditorContainer.prototype, "enableSpellCheck", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], DocumentEditorContainer.prototype, "enableTrackChanges", void 0);
        __decorate([
            ej2_base_1.Property('Pages')
        ], DocumentEditorContainer.prototype, "layoutType", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], DocumentEditorContainer.prototype, "currentUser", void 0);
        __decorate([
            ej2_base_1.Property('#FFFF00')
        ], DocumentEditorContainer.prototype, "userColor", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], DocumentEditorContainer.prototype, "enableLocalPaste", void 0);
        __decorate([
            ej2_base_1.Property()
        ], DocumentEditorContainer.prototype, "serviceUrl", void 0);
        __decorate([
            ej2_base_1.Property(2000)
        ], DocumentEditorContainer.prototype, "zIndex", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], DocumentEditorContainer.prototype, "enableCsp", void 0);
        __decorate([
            ej2_base_1.Property(true)
        ], DocumentEditorContainer.prototype, "enableComment", void 0);
        __decorate([
            ej2_base_1.Property('100%')
        ], DocumentEditorContainer.prototype, "width", void 0);
        __decorate([
            ej2_base_1.Property('320px')
        ], DocumentEditorContainer.prototype, "height", void 0);
        __decorate([
            ej2_base_1.Property(true)
        ], DocumentEditorContainer.prototype, "enableAutoFocus", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], DocumentEditorContainer.prototype, "enableLockAndEdit", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], DocumentEditorContainer.prototype, "autoResizeOnVisibilityChange", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "created", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "destroyed", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "contentChange", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "selectionChange", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "documentChange", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "toolbarClick", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "customContextMenuSelect", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "customContextMenuBeforeOpen", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "beforePaneSwitch", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "commentDelete", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "beforeAcceptRejectChanges", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "beforeCommentAction", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "serviceFailure", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "trackChange", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "contentControl", void 0);
        __decorate([
            ej2_base_2.Event()
        ], DocumentEditorContainer.prototype, "beforeXmlHttpRequestSend", void 0);
        __decorate([
            ej2_base_1.Complex({}, document_editor_1.DocumentEditorSettings)
        ], DocumentEditorContainer.prototype, "documentEditorSettings", void 0);
        __decorate([
            ej2_base_1.Complex({}, document_editor_1.DocumentSettings)
        ], DocumentEditorContainer.prototype, "documentSettings", void 0);
        __decorate([
            ej2_base_1.Property({ import: 'Import', systemClipboard: 'SystemClipboard', spellCheck: 'SpellCheck', spellCheckByPage: 'SpellCheckByPage', restrictEditing: 'RestrictEditing', canLock: 'CanLock', getPendingActions: 'GetPendingActions' })
        ], DocumentEditorContainer.prototype, "serverActionSettings", void 0);
        __decorate([
            ej2_base_1.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'])
        ], DocumentEditorContainer.prototype, "toolbarItems", void 0);
        __decorate([
            ej2_base_1.Property([])
        ], DocumentEditorContainer.prototype, "headers", void 0);
        DocumentEditorContainer = __decorate([
            ej2_base_1.NotifyPropertyChanges
        ], DocumentEditorContainer);
        return DocumentEditorContainer;
    }(ej2_base_1.Component));
    exports.DocumentEditorContainer = DocumentEditorContainer;
});