all files / document-editor/implementation/dialogs/ paragraph-dialog.js

85.06% Statements 632/743
74.6% Branches 235/315
60.87% Functions 28/46
85.06% Lines 632/743
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   159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159× 159×         159×         159×             159×                   159×           159×         159×             159×                   159×           159×   159×     159×   159×     159× 13×   159×   159×         159×     159×     159×     159×     159×                                                       159× 13×     13×                   13× 13× 13×     159× 26×     24×   26× 26×     24×   26× 26× 26× 26× 26×     25×   26×       26×       26×     26×       26×       26×     26× 26× 26× 26× 26× 26× 26× 26×   22×   26×     26×       26×   26× 26× 26× 16×   26×     25× 25×   26×       26×   26×       26×   26×       26×   26×   159×                                                                                               159×   159×   159×               14486×   14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14×             14×                         14× 14× 14× 14× 14×     14× 14× 14× 14× 14× 14× 14×     14× 14× 14× 14× 14× 14× 14×       14× 14× 14×       14× 14× 14× 14×     14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14×       14× 14× 14× 14× 14× 14× 14× 14×           14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14×           14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14×     14× 14×     14× 14×     14× 14×           14× 14× 14× 14×           14× 14× 14× 14×     14× 14× 14× 14× 14× 14× 14× 14× 14× 14×         14× 14× 14× 14×       14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14× 14×     14× 14×           14× 14× 14×     14× 14×           14× 14× 14×     14× 14×           14× 14× 14× 14×       14× 14×                                   30× 30×   29× 24×         30×   26× 26×     25×     26× 26× 25×                                                     26×                   19×     17×   19× 19× 19× 13×   19× 19× 19× 19× 19× 19×                           19× 19× 19× 19× 19× 19× 19× 19× 19×     222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 222× 14× 14×   222× 222× 14× 14×   222× 222×       222× 222× 222× 222× 14×   14×       14× 14×       14×     222× 14×   222× 14×   222× 14×     222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×   222× 14× 14×          
define(["require", "exports", "@syncfusion/ej2-inputs", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-dropdowns", "../index", "@syncfusion/ej2-buttons", "@syncfusion/ej2-navigations"], function (require, exports, ej2_inputs_1, ej2_base_1, ej2_base_2, ej2_dropdowns_1, index_1, ej2_buttons_1, ej2_navigations_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var ParagraphDialog = (function () {
        function ParagraphDialog(documentHelper) {
            var _this = this;
            this.leftIndent = undefined;
            this.rightIndent = undefined;
            this.beforeSpacing = undefined;
            this.afterSpacing = undefined;
            this.spaceBeforeAuto = false;
            this.spaceAfterAuto = false;
            this.textAlignment = undefined;
            this.paraOutlineLevel = undefined;
            this.firstLineIndent = undefined;
            this.lineSpacingIn = undefined;
            this.lineSpacingType = undefined;
            this.paragraphFormat = undefined;
            this.bidi = undefined;
            this.contextualSpacing = undefined;
            this.isStyleDialog = false;
            this.directionDiv = undefined;
            this.keepWithNextValue = undefined;
            this.keepLineTogetherValue = undefined;
            this.widowControlValue = undefined;
            this.tabObj = undefined;
            this.clickBeforeSpacingClickHandler = this.onClickBeforeSpacingClick.bind(this);
            this.clickAfterSpacingClickHandler = this.onClickAfterSpacingClick.bind(this);
            this.keyUpParagraphSettingsClickHandler = this.onKeyUpParagraphSettingsClick.bind(this);
            this.keyUpParagraphSettings = function (event) {
                if (event.keyCode === 13) {
                    _this.applyParagraphFormat();
                }
            };
            this.changeBeforeSpacing = function (event) {
                var local = new ej2_base_1.L10n('documenteditor', _this.documentHelper.owner.defaultLocale);
                local.setLocale(_this.documentHelper.owner.locale);
                if (event.value === -1) {
                    _this.beforeSpacingIn.element.value = local.getConstant('Auto');
                    _this.beforeSpacingIn.step = 1;
                    _this.spaceBeforeAuto = true;
                    _this.beforeSpacing = 5;
                }
                else {
                    _this.beforeSpacing = event.value;
                    _this.beforeSpacingIn.step = 6;
                    _this.spaceBeforeAuto = false;
                }
            };
            this.focusBeforeSpacing = function (event) {
                var local = new ej2_base_1.L10n('documenteditor', _this.documentHelper.owner.defaultLocale);
                local.setLocale(_this.documentHelper.owner.locale);
                if (event.value === -1) {
                    _this.beforeSpacingIn.element.value = local.getConstant('Auto');
                }
            };
            this.blurBeforeSpacing = function (event) {
                var local = new ej2_base_1.L10n('documenteditor', _this.documentHelper.owner.defaultLocale);
                local.setLocale(_this.documentHelper.owner.locale);
                if (event.value === -1) {
                    var proxy_1 = _this.beforeSpacingIn;
                    setTimeout(function () {
                        proxy_1.element.value = local.getConstant('Auto');
                    }, 0);
                }
            };
            this.clickBeforeSpacing = function () {
                var local = new ej2_base_1.L10n('documenteditor', _this.documentHelper.owner.defaultLocale);
                local.setLocale(_this.documentHelper.owner.locale);
                if (_this.beforeSpacingIn.element.value === '-1.0')
                    _this.beforeSpacingIn.element.value = local.getConstant('Auto');
            };
            this.changeAfterSpacing = function (event) {
                var local = new ej2_base_1.L10n('documenteditor', _this.documentHelper.owner.defaultLocale);
                local.setLocale(_this.documentHelper.owner.locale);
                if (event.value === -1) {
                    _this.afterSpacingIn.element.value = local.getConstant('Auto');
                    _this.afterSpacingIn.step = 1;
                    _this.spaceAfterAuto = true;
                    _this.afterSpacing = 5;
                }
                else {
                    _this.afterSpacing = event.value;
                    _this.afterSpacingIn.step = 6;
                    _this.spaceAfterAuto = false;
                }
            };
            this.focusAfterSpacing = function (event) {
                var local = new ej2_base_1.L10n('documenteditor', _this.documentHelper.owner.defaultLocale);
                local.setLocale(_this.documentHelper.owner.locale);
                if (event.value === -1) {
                    _this.afterSpacingIn.element.value = local.getConstant('Auto');
                }
            };
            this.blurAfterSpacing = function (event) {
                var local = new ej2_base_1.L10n('documenteditor', _this.documentHelper.owner.defaultLocale);
                local.setLocale(_this.documentHelper.owner.locale);
                if (event.value === -1) {
                    var proxy_2 = _this.afterSpacingIn;
                    setTimeout(function () {
                        proxy_2.element.value = local.getConstant('Auto');
                    }, 0);
                }
            };
            this.clickAfterSpacing = function () {
                var local = new ej2_base_1.L10n('documenteditor', _this.documentHelper.owner.defaultLocale);
                local.setLocale(_this.documentHelper.owner.locale);
                if (_this.afterSpacingIn.element.value === '-1.0')
                    _this.afterSpacingIn.element.value = local.getConstant('Auto');
            };
            this.changeLeftIndent = function (event) {
                _this.leftIndent = event.value;
            };
            this.changeRightIndent = function (event) {
                _this.rightIndent = event.value;
            };
            this.changeLineSpacingValue = function (event) {
                _this.lineSpacingIn = event.value;
            };
            this.changeFirstLineIndent = function (event) {
                _this.firstLineIndent = event.value;
                Eif (_this.special.index === 2) {
                    _this.firstLineIndent = -(_this.firstLineIndent);
                    _this.leftIndent = _this.leftIndentIn.value + event.value;
                }
            };
            this.changeByTextAlignment = function (args) {
                _this.textAlignment = args.value;
            };
            this.changeByOutlineLevel = function (args) {
                _this.paraOutlineLevel = args.value;
            };
            this.changeBidirectional = function (event) {
                if (event.value === 'ltr') {
                    _this.rtlButton.checked = !_this.ltrButton.checked;
                    _this.bidi = false;
                }
                else {
                    _this.ltrButton.checked = !_this.rtlButton.checked;
                    _this.bidi = true;
                }
                _this.changeAlignmentByBidi();
            };
            this.changeContextualSpacing = function (args) {
                _this.contextualSpacing = args.checked;
            };
            this.changeKeepWithNext = function (args) {
                _this.keepWithNextValue = args.checked;
            };
            this.changeKeepLinesTogether = function (args) {
                _this.keepLineTogetherValue = args.checked;
            };
            this.changeWidowControl = function (args) {
                _this.widowControlValue = args.checked;
            };
            this.changeByValue = function () {
                var paragraphFormat = _this.documentHelper.selection.paragraphFormat;
                switch (_this.special.index) {
                    case 0:
                        if (paragraphFormat.firstLineIndent !== 0) {
                            _this.byIn.value = 0;
                            _this.leftIndent = _this.leftIndentIn.value;
                        }
                        break;
                    case 1:
                        Iif (paragraphFormat.firstLineIndent === 0 || ej2_base_2.isNullOrUndefined(paragraphFormat.firstLineIndent)) {
                            _this.byIn.value = 0.1;
                        }
                        else Iif (paragraphFormat.firstLineIndent < 0) {
                            _this.byIn.value = -(paragraphFormat.firstLineIndent);
                            if (Math.abs(paragraphFormat.firstLineIndent) <= _this.leftIndent) {
                                _this.leftIndent = paragraphFormat.firstLineIndent + _this.leftIndent;
                            }
                        }
                        break;
                    case 2:
                        Iif (paragraphFormat.firstLineIndent === 0 || ej2_base_2.isNullOrUndefined(paragraphFormat.firstLineIndent)) {
                            paragraphFormat.firstLineIndent = -0.1;
                        }
                        else Iif (paragraphFormat.firstLineIndent > 0) {
                            _this.byIn.value = (paragraphFormat.firstLineIndent);
                            if (!ej2_base_2.isNullOrUndefined(_this.leftIndent)) {
                                _this.leftIndent = _this.leftIndent + paragraphFormat.firstLineIndent;
                            }
                            else {
                                _this.leftIndent = paragraphFormat.firstLineIndent;
                            }
                        }
                        break;
                }
            };
            this.changeBySpacing = function () {
                Iif (ej2_base_2.isNullOrUndefined(_this.lineSpacing)) {
                    return;
                }
                switch (_this.lineSpacing.index) {
                    case 0:
                        _this.lineSpacingType = 'AtLeast';
                        _this.atIn.value = 12;
                        break;
                    case 1:
                        _this.lineSpacingType = 'Exactly';
                        _this.atIn.value = 12;
                        break;
                    case 2:
                        _this.lineSpacingType = 'Multiple';
                        _this.atIn.value = 1;
                        break;
                }
            };
            this.loadParagraphDialog = function () {
                if (_this.isStyleDialog) {
                    _this.directionDiv.classList.add('e-de-disabledbutton');
                }
                else {
                    _this.directionDiv.classList.remove('e-de-disabledbutton');
                }
                var selectionFormat;
                if (_this.paragraphFormat) {
                    selectionFormat = _this.paragraphFormat;
                }
                else {
                    selectionFormat = _this.documentHelper.selection.paragraphFormat;
                }
                var alignValue = _this.getAlignmentValue(selectionFormat.textAlignment);
                _this.alignment.index = alignValue;
                var outlineValue = _this.getOutlineValue(selectionFormat.outlineLevel);
                _this.outlineLevel.index = outlineValue;
                if (_this.isHeadingStyle()) {
                    _this.outlineLevel.readonly = true;
                }
                else {
                    _this.outlineLevel.readonly = false;
                }
                Iif (selectionFormat.spaceBeforeAuto) {
                    _this.beforeSpacingIn.value = -1;
                }
                else {
                    Iif (selectionFormat.beforeSpacing === -1) {
                        _this.beforeSpacingIn.value = undefined;
                    }
                    else {
                        _this.beforeSpacingIn.value = selectionFormat.beforeSpacing;
                    }
                }
                Iif (selectionFormat.spaceAfterAuto) {
                    _this.afterSpacingIn.value = -1;
                }
                else {
                    Iif (selectionFormat.afterSpacing === -1) {
                        _this.afterSpacingIn.value = undefined;
                    }
                    else {
                        _this.afterSpacingIn.value = selectionFormat.afterSpacing;
                    }
                }
                _this.leftIndentIn.value = selectionFormat.leftIndent;
                _this.rightIndentIn.value = selectionFormat.rightIndent;
                _this.byIn.value = Math.abs(selectionFormat.firstLineIndent);
                var lineSpaceValue = _this.lineSpacing.index;
                _this.keepWithNextValue = undefined;
                _this.keepLineTogetherValue = undefined;
                _this.widowControlValue = undefined;
                if (selectionFormat.firstLineIndent > 0) {
                    _this.special.index = 1;
                }
                else if (selectionFormat.firstLineIndent < 0) {
                    _this.special.index = 2;
                    _this.leftIndentIn.value = selectionFormat.leftIndent - _this.byIn.value;
                }
                Iif (selectionFormat.lineSpacingType === 'AtLeast') {
                    lineSpaceValue = 0;
                }
                else Iif (selectionFormat.lineSpacingType === 'Exactly') {
                    lineSpaceValue = 1;
                }
                else {
                    lineSpaceValue = 2;
                }
                _this.lineSpacing.index = lineSpaceValue;
                _this.atIn.value = selectionFormat.lineSpacing;
                if (_this.documentHelper.selection.caret.style.display !== 'none') {
                    _this.documentHelper.selection.caret.style.display = 'none';
                }
                if (selectionFormat.bidi) {
                    _this.rtlButton.checked = true;
                    _this.ltrButton.checked = false;
                }
                else {
                    _this.ltrButton.checked = true;
                    _this.rtlButton.checked = false;
                }
                Iif (ej2_base_2.isNullOrUndefined(selectionFormat.keepWithNext)) {
                    _this.keepWithNext.indeterminate = true;
                }
                else {
                    _this.keepWithNext.checked = selectionFormat.keepWithNext;
                }
                Iif (ej2_base_2.isNullOrUndefined(selectionFormat.keepLinesTogether)) {
                    _this.keepLinesTogether.indeterminate = true;
                }
                else {
                    _this.keepLinesTogether.checked = selectionFormat.keepLinesTogether;
                }
                Iif (ej2_base_2.isNullOrUndefined(selectionFormat.widowControl)) {
                    _this.widowControlIn.indeterminate = true;
                }
                else {
                    _this.widowControlIn.checked = selectionFormat.widowControl;
                }
                _this.contextSpacing.checked = selectionFormat.contextualSpacing;
            };
            this.applyParagraphFormat = function () {
                var paraFormat;
                var isApply;
                Iif (_this.paragraphFormat) {
                    paraFormat = _this.paragraphFormat;
                    isApply = false;
                }
                else {
                    paraFormat = new index_1.WParagraphFormat();
                    paraFormat.borders = undefined;
                    isApply = true;
                }
                if (!ej2_base_2.isNullOrUndefined(_this.beforeSpacing)) {
                    paraFormat.beforeSpacing = _this.beforeSpacing;
                }
                if (!ej2_base_2.isNullOrUndefined(_this.afterSpacing)) {
                    paraFormat.afterSpacing = _this.afterSpacing;
                }
                Eif (!ej2_base_2.isNullOrUndefined(_this.spaceBeforeAuto)) {
                    paraFormat.spaceBeforeAuto = _this.spaceBeforeAuto;
                }
                Eif (!ej2_base_2.isNullOrUndefined(_this.spaceAfterAuto)) {
                    paraFormat.spaceAfterAuto = _this.spaceAfterAuto;
                }
                if (!ej2_base_2.isNullOrUndefined(_this.lineSpacingType)) {
                    paraFormat.lineSpacingType = _this.lineSpacingType;
                }
                if (!ej2_base_2.isNullOrUndefined(_this.leftIndent)) {
                    paraFormat.leftIndent = _this.leftIndent;
                }
                Iif (!ej2_base_2.isNullOrUndefined(_this.rightIndent)) {
                    paraFormat.rightIndent = _this.rightIndent;
                }
                Iif (!ej2_base_2.isNullOrUndefined(_this.lineSpacingIn)) {
                    paraFormat.lineSpacing = _this.lineSpacingIn;
                }
                Iif (!ej2_base_2.isNullOrUndefined(_this.firstLineIndent)) {
                    paraFormat.firstLineIndent = Math.abs(_this.firstLineIndent);
                    if (_this.special.index === 2) {
                        paraFormat.firstLineIndent = -paraFormat.firstLineIndent;
                        paraFormat.leftIndent = _this.leftIndentIn.value + _this.byIn.value;
                    }
                }
                Iif (!ej2_base_2.isNullOrUndefined(_this.paraOutlineLevel)) {
                    paraFormat.outlineLevel = _this.paraOutlineLevel;
                }
                if (!ej2_base_2.isNullOrUndefined(_this.bidi)) {
                    paraFormat.bidi = _this.bidi;
                }
                if (!ej2_base_2.isNullOrUndefined(_this.textAlignment)) {
                    var textAlignment = _this.textAlignment;
                    if (paraFormat.bidi) {
                        if (textAlignment === 'Right') {
                            textAlignment = 'Left';
                        }
                        else Iif (textAlignment === 'Left') {
                            textAlignment = 'Right';
                        }
                    }
                    paraFormat.textAlignment = textAlignment;
                }
                Iif (!ej2_base_2.isNullOrUndefined(_this.contextualSpacing)) {
                    paraFormat.contextualSpacing = _this.contextualSpacing;
                }
                Iif (!ej2_base_2.isNullOrUndefined(_this.keepWithNextValue)) {
                    paraFormat.keepWithNext = _this.keepWithNextValue;
                }
                else Iif (_this.documentHelper.selection.paragraphFormat.keepWithNext) {
                    paraFormat.keepWithNext = _this.documentHelper.selection.paragraphFormat.keepWithNext;
                }
                Iif (!ej2_base_2.isNullOrUndefined(_this.keepLineTogetherValue)) {
                    paraFormat.keepLinesTogether = _this.keepLineTogetherValue;
                }
                else Iif (_this.documentHelper.selection.paragraphFormat.keepLinesTogether) {
                    paraFormat.keepLinesTogether = _this.documentHelper.selection.paragraphFormat.keepLinesTogether;
                }
                Iif (!ej2_base_2.isNullOrUndefined(_this.widowControlValue)) {
                    paraFormat.widowControl = _this.widowControlValue;
                }
                else Eif (_this.documentHelper.selection.paragraphFormat.widowControl) {
                    paraFormat.widowControl = _this.documentHelper.selection.paragraphFormat.widowControl;
                }
                Eif (isApply) {
                    _this.onParagraphFormat(paraFormat);
                }
                else {
                    _this.documentHelper.owner.styleDialogModule.updateParagraphFormat(paraFormat);
                }
                _this.documentHelper.hideDialog();
            };
            this.openTabDialog = function () {
                _this.documentHelper.hideDialog();
                _this.documentHelper.owner.tabDialogModule.show();
            };
            this.closeParagraphDialog = function () {
                _this.leftIndent = undefined;
                _this.afterSpacing = undefined;
                _this.beforeSpacing = undefined;
                _this.firstLineIndent = undefined;
                _this.textAlignment = undefined;
                _this.paraOutlineLevel = undefined;
                _this.rightIndent = undefined;
                _this.lineSpacingIn = undefined;
                _this.lineSpacingType = undefined;
                _this.paragraphFormat = undefined;
                _this.documentHelper.hideDialog();
            };
            this.documentHelper = documentHelper;
        }
        Object.defineProperty(ParagraphDialog.prototype, "owner", {
            get: function () {
                return this.documentHelper.owner.viewer;
            },
            enumerable: true,
            configurable: true
        });
        ParagraphDialog.prototype.getModuleName = function () {
            return 'ParagraphDialog';
        };
        ParagraphDialog.prototype.initParagraphDialog = function (locale) {
            var tabContainer = ej2_base_1.createElement('div');
            this.ejtab = ej2_base_1.createElement('div');
            this.instance = this;
            var ownerId = this.documentHelper.owner.containerId;
            this.indentContainer = ej2_base_1.createElement('div', { className: 'e-de-dlg-tab-first-child e-de-para-dlg-container' });
            this.target = tabContainer;
            tabContainer.appendChild(this.ejtab);
            this.div = ej2_base_1.createElement('div', { styles: 'width:400px;' });
            this.generalDiv = ej2_base_1.createElement('div');
            this.genLabel = ej2_base_1.createElement('div', { className: 'e-de-para-dlg-heading', innerHTML: locale.getConstant('General') });
            this.generalDiv.appendChild(this.genLabel);
            this.alignmentWholeDiv = ej2_base_1.createElement('div', { className: 'e-de-container-row' });
            this.generalDiv.appendChild(this.alignmentWholeDiv);
            this.alignmentDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-left' });
            this.alignmentWholeDiv.appendChild(this.alignmentDiv);
            var alignment = ej2_base_1.createElement('select', {
                id: ownerId + '_Alignment',
                innerHTML: '<option value="Center">' + locale.getConstant('Center') +
                    '</option><option value="Left">' + locale.getConstant('Left') +
                    '</option><option value="Right">' + locale.getConstant('Right') +
                    '</option><option value="Justify">' + locale.getConstant('Justify') + '</option>'
            });
            var outlineLevel = ej2_base_1.createElement('select', {
                id: ownerId + '_Outline',
                innerHTML: '<option value="BodyText">' + locale.getConstant('BodyText') +
                    '</option><option value="Level1">' + locale.getConstant('Level1') +
                    '</option><option value="Level2">' + locale.getConstant('Level2') +
                    '</option><option value="Level3">' + locale.getConstant('Level3') +
                    '</option><option value="Level4">' + locale.getConstant('Level4') +
                    '</option><option value="Level5">' + locale.getConstant('Level5') +
                    '</option><option value="Level6">' + locale.getConstant('Level6') +
                    '</option><option value="Level7">' + locale.getConstant('Level7') +
                    '</option><option value="Level8">' + locale.getConstant('Level8') +
                    '</option><option value="Level9">' + locale.getConstant('Level9') + '</option>'
            });
            this.alignmentDiv.appendChild(alignment);
            this.alignmentDiv.setAttribute('aria-labelledby', alignment.innerText);
            this.alignmentDiv.appendChild(outlineLevel);
            this.alignmentDiv.setAttribute('aria-labelledby', outlineLevel.innerText);
            this.dirLabel = ej2_base_1.createElement('div', {
                className: 'e-de-dlg-sub-header', innerHTML: locale.getConstant('Direction')
            });
            this.directionDiv = ej2_base_1.createElement('div', { className: 'e-de-container-row' });
            this.rtlDiv = ej2_base_1.createElement('div', { className: 'e-de-rtl-btn-div' });
            this.rtlInputELe = ej2_base_1.createElement('input', { id: ownerId + '_rtlEle' });
            this.rtlDiv.appendChild(this.rtlInputELe);
            this.directionDiv.appendChild(this.rtlDiv);
            var isRtl = this.documentHelper.owner.enableRtl;
            Iif (isRtl) {
                this.rtlDiv.classList.add('e-de-rtl');
            }
            this.ltrDiv = ej2_base_1.createElement('div', { className: 'e-de-ltr-btn-div' });
            this.ltrInputELe = ej2_base_1.createElement('input', { id: ownerId + '_ltrEle' });
            this.ltrDiv.appendChild(this.ltrInputELe);
            this.directionDiv.appendChild(this.ltrDiv);
            this.generalDiv.appendChild(this.dirLabel);
            this.generalDiv.appendChild(this.directionDiv);
            this.rtlButton = new ej2_buttons_1.RadioButton({
                label: locale.getConstant('Right-to-left'), enableRtl: isRtl,
                value: 'rtl', cssClass: 'e-small', change: this.changeBidirectional
            });
            this.rtlButton.appendTo(this.rtlInputELe);
            this.rtlInputELe.setAttribute('aria-label', locale.getConstant('Right-to-left'));
            this.ltrButton = new ej2_buttons_1.RadioButton({
                label: locale.getConstant('Left-to-right'), enableRtl: isRtl,
                value: 'ltr', cssClass: 'e-small', change: this.changeBidirectional
            });
            this.ltrButton.appendTo(this.ltrInputELe);
            this.ltrInputELe.setAttribute('aria-label', locale.getConstant('Left-to-right'));
            this.indentionWholeDiv = ej2_base_1.createElement('div');
            this.indentLabel = ej2_base_1.createElement('div', { className: 'e-de-para-dlg-heading',
                innerHTML: locale.getConstant('Indentation')
            });
            this.indentionWholeDiv.appendChild(this.indentLabel);
            this.indentionSubDiv1 = ej2_base_1.createElement('div', { className: 'e-de-container-row' });
            this.indentionWholeDiv.appendChild(this.indentionSubDiv1);
            this.indentionSubDiv2 = ej2_base_1.createElement('div', { className: 'e-de-container-row' });
            this.indentionWholeDiv.appendChild(this.indentionSubDiv2);
            this.beforeTextDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-left' });
            this.indentionSubDiv1.appendChild(this.beforeTextDiv);
            this.afterTextDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-right' });
            this.indentionSubDiv1.appendChild(this.afterTextDiv);
            this.specialDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-left' });
            this.indentionSubDiv2.appendChild(this.specialDiv);
            this.byDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-right' });
            this.indentionSubDiv2.appendChild(this.byDiv);
            this.spacingDiv = ej2_base_1.createElement('div');
            this.leftSpacingDiv = ej2_base_1.createElement('div');
            this.spacingDiv.appendChild(this.leftSpacingDiv);
            this.contextSpacingDiv = ej2_base_1.createElement('div', { className: 'e-de-container-row' });
            this.spacingDiv.appendChild(this.contextSpacingDiv);
            this.rightSpacingDiv = ej2_base_1.createElement('div', { className: 'e-de-container-row' });
            this.spacingDiv.appendChild(this.rightSpacingDiv);
            this.contextInputEle = ej2_base_1.createElement('input', {
                attrs: { type: 'checkbox' },
                id: ownerId + '_contextSpacing'
            });
            this.contextSpacingDiv.appendChild(this.contextInputEle);
            var leftIndent = ej2_base_1.createElement('input', { id: ownerId + '_leftIndent', attrs: { 'type': 'text' } });
            var rightIndent = ej2_base_1.createElement('input', { id: ownerId + '_rightIndent', attrs: { 'type': 'text' } });
            this.beforeTextDiv.appendChild(leftIndent);
            this.beforeTextDiv.setAttribute('aria-labelledby', locale.getConstant('Indent from left'));
            this.afterTextDiv.appendChild(rightIndent);
            this.afterTextDiv.setAttribute('aria-labelledby', locale.getConstant('Indent from right'));
            var special = ej2_base_1.createElement('select', {
                id: ownerId + '_special',
                innerHTML: '<option value="None">' + locale.getConstant('None') +
                    '</option><option value="First Line">' + locale.getConstant('First line') +
                    '</option><option value="Hanging">' + locale.getConstant('Hanging') + '</option> '
            });
            this.by = ej2_base_1.createElement('input', { id: ownerId + '_By', attrs: { 'type': 'text' } });
            this.specialDiv.setAttribute('aria-labelledby', 'Special');
            this.specialDiv.appendChild(special);
            this.byDiv.appendChild(this.by);
            this.byDiv.setAttribute('aria-labelledby', 'By');
            this.spaceLabel = ej2_base_1.createElement('div', { className: 'e-de-para-dlg-heading', innerHTML: locale.getConstant('Spacing') });
            this.spacingWholeDiv = ej2_base_1.createElement('div', { className: 'e-de-container-row' });
            this.beforeSpacingWholeDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-left' });
            var beforeSpacing = ej2_base_1.createElement('input', { id: ownerId + '_beforeSpacing', attrs: { 'type': 'text' } });
            this.afterSpacingWholeDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-right' });
            var afterSpacing = ej2_base_1.createElement('input', { id: ownerId + '_afterSpacing', attrs: { 'type': 'text' } });
            this.leftSpacingDiv.appendChild(this.spaceLabel);
            this.leftSpacingDiv.appendChild(this.spacingWholeDiv);
            this.beforeSpacingWholeDiv.appendChild(beforeSpacing);
            this.spacingWholeDiv.appendChild(this.beforeSpacingWholeDiv);
            this.afterSpacingWholeDiv.appendChild(afterSpacing);
            this.spacingWholeDiv.appendChild(this.afterSpacingWholeDiv);
            this.lineSpacingDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-left' });
            var lineSpacing = ej2_base_1.createElement('select', {
                id: ownerId + '_lineSpacing',
                innerHTML: '<option value="At least">' + locale.getConstant('At least') +
                    '</option><option value="Exactly">' + locale.getConstant('Exactly') +
                    '</option><option value="Multiple">' + locale.getConstant('Multiple') + '</option>'
            });
            this.lineTypeDiv = ej2_base_1.createElement('div', { className: 'e-de-subcontainer-right' });
            this.lineSpacingAt = ej2_base_1.createElement('input', { id: ownerId + '_lineSpacingAt', attrs: { 'type': 'text' } });
            this.lineSpacingDiv.appendChild(lineSpacing);
            this.rightSpacingDiv.appendChild(this.lineSpacingDiv);
            this.lineTypeDiv.appendChild(this.lineSpacingAt);
            this.rightSpacingDiv.appendChild(this.lineTypeDiv);
            this.div.appendChild(this.generalDiv);
            this.div.appendChild(this.indentionWholeDiv);
            this.div.appendChild(this.spacingDiv);
            this.indentContainer.appendChild(this.div);
            this.leftIndentIn = new ej2_inputs_1.NumericTextBox({
                format: 'n1', value: 0, min: -1584, max: 1584, enablePersistence: false, floatLabelType: 'Always', placeholder: locale.getConstant('Before text'), change: this.changeLeftIndent
            });
            this.leftIndentIn.appendTo(leftIndent);
            this.rightIndentIn = new ej2_inputs_1.NumericTextBox({
                format: 'n1', value: 0, min: -1584, max: 1584, enablePersistence: false, floatLabelType: 'Always', placeholder: locale.getConstant('After text'), change: this.changeRightIndent
            });
            this.rightIndentIn.appendTo(rightIndent);
            this.byIn = new ej2_inputs_1.NumericTextBox({
                format: 'n1', value: 0, min: 0, max: 1584, enablePersistence: false, floatLabelType: 'Always', placeholder: locale.getConstant('By'), change: this.changeFirstLineIndent
            });
            this.byIn.appendTo(this.by);
            this.beforeSpacingIn = new ej2_inputs_1.NumericTextBox({
                format: 'n1', value: 0, min: -1, max: 1584, step: 6, enablePersistence: false, floatLabelType: 'Always', placeholder: locale.getConstant('Before'),
                change: this.changeBeforeSpacing,
                focus: this.focusBeforeSpacing,
                blur: this.blurBeforeSpacing,
            });
            this.beforeSpacingIn.appendTo(beforeSpacing);
            this.beforeSpacingSpinDown = this.beforeSpacingWholeDiv.getElementsByClassName("e-input-group-icon e-spin-down")[0];
            this.beforeSpacingSpinDown.addEventListener('click', this.clickBeforeSpacingClickHandler);
            this.afterSpacingIn = new ej2_inputs_1.NumericTextBox({
                format: 'n1', value: 0, min: -1, max: 1584, step: 6, enablePersistence: false, floatLabelType: 'Always', placeholder: locale.getConstant('After'),
                change: this.changeAfterSpacing,
                focus: this.focusAfterSpacing,
                blur: this.blurAfterSpacing
            });
            this.afterSpacingIn.appendTo(afterSpacing);
            this.afterSpacingSpinDown = this.afterSpacingWholeDiv.getElementsByClassName("e-input-group-icon e-spin-down")[0];
            this.afterSpacingSpinDown.addEventListener('click', this.clickAfterSpacingClickHandler);
            this.atIn = new ej2_inputs_1.NumericTextBox({
                format: 'n1', value: 0, min: 1, max: 1584, step: 0.5, enablePersistence: false, floatLabelType: 'Always', placeholder: locale.getConstant('At'), change: this.changeLineSpacingValue
            });
            this.special = new ej2_dropdowns_1.DropDownList({ change: this.changeByValue, enableRtl: isRtl, floatLabelType: 'Always', placeholder: locale.getConstant('Special') });
            this.special.appendTo(special);
            this.lineSpacing = new ej2_dropdowns_1.DropDownList({ change: this.changeBySpacing, enableRtl: isRtl, floatLabelType: 'Always', placeholder: locale.getConstant('Line Spacing'), htmlAttributes: { 'aria-labelledby': locale.getConstant('Line Spacing') } });
            this.lineSpacing.appendTo(lineSpacing);
            this.alignment = new ej2_dropdowns_1.DropDownList({ change: this.changeByTextAlignment, enableRtl: isRtl, floatLabelType: 'Always', placeholder: locale.getConstant('Alignment'), htmlAttributes: { 'aria-labelledby': locale.getConstant('Alignment') } });
            this.alignment.appendTo(alignment);
            this.outlineLevel = new ej2_dropdowns_1.DropDownList({ change: this.changeByOutlineLevel, enableRtl: isRtl, floatLabelType: 'Always', placeholder: locale.getConstant('OutlineLevel'), htmlAttributes: { 'aria-labelledby': locale.getConstant('OutlineLevel') } });
            this.outlineLevel.appendTo(outlineLevel);
            this.atIn.appendTo(this.lineSpacingAt);
            this.contextSpacing = new ej2_buttons_1.CheckBox({
                change: this.changeContextualSpacing,
                label: locale.getConstant("Contextual Spacing"),
                enableRtl: isRtl
            });
            this.contextSpacing.appendTo(this.contextInputEle);
            this.contextInputEle.setAttribute('aria-labelledby', locale.getConstant("Contextual Spacing"));
            this.indentContainer.addEventListener('keyup', this.instance.keyUpParagraphSettingsClickHandler);
            Iif (isRtl) {
                this.afterSpacingWholeDiv.classList.add('e-de-rtl');
                this.lineTypeDiv.classList.add('e-de-rtl');
            }
            this.lineBreakContainer = ej2_base_1.createElement('div', { className: 'e-de-dlg-tab-first-child' });
            var paginationDiv = ej2_base_1.createElement('div', { className: 'e-de-para-dlg-sub-container' });
            this.paginationDiv = paginationDiv;
            this.paginationLabel = ej2_base_1.createElement('div', { className: 'e-de-para-dlg-heading', innerHTML: locale.getConstant('Pagination') });
            paginationDiv.appendChild(this.paginationLabel);
            this.widowContorlContainer = ej2_base_1.createElement('div', { styles: 'display:block' });
            paginationDiv.appendChild(this.widowContorlContainer);
            this.keepNextContainer = ej2_base_1.createElement('div', { styles: 'display:block' });
            paginationDiv.appendChild(this.keepNextContainer);
            this.keepLines = ej2_base_1.createElement('div', { styles: 'display:block' });
            paginationDiv.appendChild(this.keepLines);
            this.keepWithNext1 = ej2_base_1.createElement('input', {
                attrs: { type: 'checkbox' },
            });
            this.keepNextContainer.appendChild(this.keepWithNext1);
            this.keepWithNext = new ej2_buttons_1.CheckBox({
                change: this.changeKeepWithNext,
                label: locale.getConstant('Keep With Next'),
                enableRtl: isRtl,
                cssClass: 'e-de-para-dlg-cs-check-box'
            });
            this.keepWithNext.appendTo(this.keepWithNext1);
            this.keepWithNext1.setAttribute('aria-label', locale.getConstant('Keep With Next'));
            this.keepLinesTogether1 = ej2_base_1.createElement('input', {
                attrs: { type: 'checkbox' },
            });
            this.keepLines.appendChild(this.keepLinesTogether1);
            this.keepLinesTogether = new ej2_buttons_1.CheckBox({
                change: this.changeKeepLinesTogether,
                label: locale.getConstant('Keep Lines Together'),
                enableRtl: isRtl,
                cssClass: 'e-de-para-dlg-cs-check-box'
            });
            this.keepLinesTogether.appendTo(this.keepLinesTogether1);
            this.keepLinesTogether1.setAttribute('aria-label', locale.getConstant('Keep Lines Together'));
            this.widowControl = ej2_base_1.createElement('input', {
                attrs: { type: 'checkbox' },
            });
            this.widowContorlContainer.appendChild(this.widowControl);
            this.widowControlIn = new ej2_buttons_1.CheckBox({
                change: this.changeWidowControl,
                label: locale.getConstant('WidowControl'),
                enableRtl: isRtl,
                cssClass: 'e-de-para-dlg-cs-check-box'
            });
            this.widowControlIn.appendTo(this.widowControl);
            this.widowControl.setAttribute('aria-label', locale.getConstant('WidowControl'));
            this.lineBreakContainer.appendChild(paginationDiv);
            var items = [
                { header: { text: locale.getConstant('Indents and Spacing') }, content: this.indentContainer },
                { header: { text: locale.getConstant('Line and Page Breaks') }, content: this.lineBreakContainer }
            ];
            this.tabObj = new ej2_navigations_1.Tab({ items: items, enableRtl: isRtl, animation: { previous: { effect: 'None' }, next: { effect: 'None' } } }, this.ejtab);
            this.tabObj.isStringTemplate = true;
        };
        ParagraphDialog.prototype.onKeyUpParagraphSettingsClick = function (event) {
            this.keyUpParagraphSettings(event);
        };
        ParagraphDialog.prototype.onClickBeforeSpacingClick = function () {
            this.clickBeforeSpacing();
        };
        ParagraphDialog.prototype.onClickAfterSpacingClick = function () {
            this.clickAfterSpacing();
        };
        ParagraphDialog.prototype.changeAlignmentByBidi = function () {
            if (this.textAlignment === 'Left') {
                this.textAlignment = 'Right';
            }
            else if (this.textAlignment === 'Right') {
                this.textAlignment = 'Left';
            }
            if (!ej2_base_2.isNullOrUndefined(this.textAlignment)) {
                this.alignment.index = this.getAlignmentValue(this.textAlignment);
            }
            else {
                Eif (this.alignment.index === 0) {
                    this.textAlignment = 'Center';
                }
                else {
                    this.textAlignment = 'Justify';
                }
            }
        };
        ParagraphDialog.prototype.getAlignmentValue = function (textAlignment) {
            var alignValue;
            if (textAlignment === 'Center') {
                alignValue = 0;
            }
            else if (textAlignment === 'Left') {
                alignValue = 1;
            }
            else if (textAlignment === 'Right') {
                alignValue = 2;
            }
            else {
                alignValue = 3;
            }
            return alignValue;
        };
        ParagraphDialog.prototype.isHeadingStyle = function () {
            var parastyle = this.documentHelper.selection.paragraphFormat.styleName;
            if (parastyle === 'Heading 1' || parastyle === 'Heading 2' || parastyle === 'Heading 3' || parastyle === 'Heading 4' || parastyle === 'Heading 5' || parastyle === 'Heading 6' || parastyle === 'Heading 7' || parastyle === 'Heading 8' || parastyle === 'Heading 9') {
                return true;
            }
            else {
                return false;
            }
        };
        ParagraphDialog.prototype.getOutlineValue = function (outlineLevel) {
            var alignValue;
            if (outlineLevel === 'BodyText') {
                alignValue = 0;
            }
            else Eif (outlineLevel === 'Level1') {
                alignValue = 1;
            }
            else if (outlineLevel === 'Level2') {
                alignValue = 2;
            }
            else if (outlineLevel === 'Level3') {
                alignValue = 3;
            }
            else if (outlineLevel === 'Level4') {
                alignValue = 4;
            }
            else if (outlineLevel === 'Level5') {
                alignValue = 5;
            }
            else if (outlineLevel === 'Level6') {
                alignValue = 6;
            }
            else if (outlineLevel === 'Level7') {
                alignValue = 7;
            }
            else if (outlineLevel === 'Level8') {
                alignValue = 8;
            }
            else {
                alignValue = 9;
            }
            return alignValue;
        };
        ParagraphDialog.prototype.onParagraphFormat = function (paragraphFormat) {
            var selection = this.documentHelper.selection;
            Iif (!ej2_base_2.isNullOrUndefined(selection) && selection.checkContentControlLocked(true)) {
                return;
            }
            var isListBidi = paragraphFormat.bidi && selection.paragraphFormat.listId !== -1;
            Eif (!isListBidi) {
                this.documentHelper.layout.isBidiReLayout = true;
            }
            this.documentHelper.owner.editorModule.setPreviousBlockToLayout();
            this.documentHelper.owner.editorModule.initHistory('ParagraphFormat');
            this.documentHelper.owner.isShiftingEnabled = true;
            if (this.documentHelper.selection.isEmpty) {
                this.documentHelper.owner.editorModule.applyParaFormatProperty(selection.start.paragraph, undefined, paragraphFormat, false);
                this.documentHelper.owner.editorModule.isMeasureParaWidth = true;
                this.documentHelper.owner.editorModule.layoutItemBlock(selection.start.paragraph, false);
                this.documentHelper.owner.editorModule.isMeasureParaWidth = true;
            }
            else {
                this.documentHelper.owner.editorModule.updateSelectionParagraphFormatting('ParagraphFormat', paragraphFormat, false);
            }
            this.documentHelper.owner.editorModule.reLayout(selection);
            Eif (!isListBidi) {
                this.documentHelper.layout.isBidiReLayout = false;
            }
        };
        ParagraphDialog.prototype.show = function (paragraphFormat) {
            if (paragraphFormat) {
                this.isStyleDialog = true;
                this.paragraphFormat = paragraphFormat;
            }
            else {
                this.isStyleDialog = false;
            }
            var local = new ej2_base_1.L10n('documenteditor', this.documentHelper.owner.defaultLocale);
            local.setLocale(this.documentHelper.owner.locale);
            if (!this.target) {
                this.initParagraphDialog(local);
            }
            this.loadParagraphDialog();
            this.documentHelper.dialog.header = local.getConstant('Paragraph');
            this.documentHelper.dialog.content = this.target;
            this.documentHelper.dialog.height = 'auto';
            this.documentHelper.dialog.width = 'auto';
            this.documentHelper.dialog.buttons = [
                {
                    click: this.openTabDialog,
                    buttonModel: { content: local.getConstant('Tabs') + '....', cssClass: 'e-flat e-de-para-tab', enableRtl: this.documentHelper.owner.enableRtl }
                },
                {
                    click: this.applyParagraphFormat,
                    buttonModel: { content: local.getConstant('Ok'), cssClass: 'e-flat e-para-okay', isPrimary: true }
                },
                {
                    click: this.closeParagraphDialog,
                    buttonModel: { content: local.getConstant('Cancel'), cssClass: 'e-flat e-para-cancel' }
                }
            ];
            this.documentHelper.dialog.beforeOpen = this.documentHelper.updateFocus;
            this.documentHelper.dialog.close = this.documentHelper.updateFocus;
            this.documentHelper.dialog.dataBind();
            this.alignment.focusIn();
            this.documentHelper.dialog.show();
            var dialogElement = this.documentHelper.dialog.element;
            Eif (dialogElement) {
                var width = this.documentHelper.updateDialogTabHeight(dialogElement, this.target);
                this.paginationDiv.style.width = width.toString() + 'px';
            }
        };
        ParagraphDialog.prototype.destroy = function () {
            if (this.afterSpacingIn) {
                this.afterSpacingIn.destroy();
                this.afterSpacingIn = undefined;
            }
            if (this.beforeSpacingIn) {
                this.beforeSpacingIn.destroy();
                this.beforeSpacingIn = undefined;
            }
            if (this.leftIndentIn) {
                this.leftIndentIn.destroy();
                this.leftIndentIn = undefined;
            }
            if (this.rightIndentIn) {
                this.rightIndentIn.destroy();
                this.rightIndentIn = undefined;
            }
            if (this.byIn) {
                this.byIn.destroy();
                this.byIn = undefined;
            }
            if (this.special) {
                this.special.destroy();
                this.special = undefined;
            }
            if (this.atIn) {
                this.atIn.destroy();
                this.atIn = undefined;
            }
            if (this.alignment) {
                this.alignment.change = undefined;
                this.alignment.destroy();
            }
            this.alignment = undefined;
            if (this.outlineLevel) {
                this.outlineLevel.change = undefined;
                this.outlineLevel.destroy();
            }
            this.outlineLevel = undefined;
            if (this.lineSpacing) {
                this.lineSpacing.change = undefined;
                this.lineSpacing.destroy();
            }
            this.lineSpacing = undefined;
            Iif (this.special) {
                this.special.change = undefined;
                this.special.destroy();
            }
            this.removeEvents();
            this.removeElements();
            this.special = undefined;
            if (!ej2_base_2.isNullOrUndefined(this.target)) {
                if (this.target.parentElement) {
                    this.target.parentElement.removeChild(this.target);
                }
                for (var q = 0; q < this.target.childNodes.length; q++) {
                    this.target.removeChild(this.target.childNodes[parseInt(q.toString(), 10)]);
                    q--;
                }
                this.target = undefined;
                Iif (this.paragraphFormat) {
                    this.paragraphFormat.destroy();
                    this.paragraphFormat = undefined;
                }
                this.documentHelper = undefined;
            }
        };
        ParagraphDialog.prototype.removeEvents = function () {
            if (this.beforeSpacingSpinDown) {
                this.beforeSpacingSpinDown.removeEventListener('click', this.clickBeforeSpacingClickHandler);
            }
            if (this.afterSpacingSpinDown) {
                this.afterSpacingSpinDown.removeEventListener('click', this.clickAfterSpacingClickHandler);
            }
            if (this.indentContainer) {
                this.indentContainer.removeEventListener('keyup', this.instance.keyUpParagraphSettingsClickHandler);
            }
        };
        ParagraphDialog.prototype.removeElements = function () {
            if (this.ejtab) {
                this.ejtab.remove();
                this.ejtab = undefined;
            }
            if (this.div) {
                this.div.remove();
                this.div = undefined;
            }
            if (this.generalDiv) {
                this.generalDiv.remove();
                this.generalDiv = undefined;
            }
            if (this.genLabel) {
                this.genLabel.remove();
                this.genLabel = undefined;
            }
            if (this.alignmentWholeDiv) {
                this.alignmentWholeDiv.remove();
                this.alignmentWholeDiv = undefined;
            }
            if (this.alignmentDiv) {
                this.alignmentDiv.remove();
                this.alignmentDiv = undefined;
            }
            if (this.dirLabel) {
                this.dirLabel.remove();
                this.dirLabel = undefined;
            }
            if (this.rtlDiv) {
                this.rtlDiv.remove();
                this.rtlDiv = undefined;
            }
            if (this.rtlInputELe) {
                this.rtlInputELe.remove();
                this.rtlInputELe = undefined;
            }
            if (this.ltrDiv) {
                this.ltrDiv.remove();
                this.ltrDiv = undefined;
            }
            if (this.ltrInputELe) {
                this.ltrInputELe.remove();
                this.ltrInputELe = undefined;
            }
            if (this.indentionWholeDiv) {
                this.indentionWholeDiv.remove();
                this.indentionWholeDiv = undefined;
            }
            if (this.indentLabel) {
                this.indentLabel.remove();
                this.indentLabel = undefined;
            }
            if (this.indentionSubDiv1) {
                this.indentionSubDiv1.remove();
                this.indentionSubDiv1 = undefined;
            }
            if (this.indentionSubDiv2) {
                this.indentionSubDiv2.remove();
                this.indentionSubDiv2 = undefined;
            }
            if (this.beforeTextDiv) {
                this.beforeTextDiv.remove();
                this.beforeTextDiv = undefined;
            }
            if (this.afterTextDiv) {
                this.afterTextDiv.remove();
                this.afterTextDiv = undefined;
            }
            if (this.specialDiv) {
                this.specialDiv.remove();
                this.specialDiv = undefined;
            }
            if (this.byDiv) {
                this.byDiv.remove();
                this.byDiv = undefined;
            }
            if (this.by) {
                this.by.remove();
                this.by = undefined;
            }
            if (this.spacingDiv) {
                this.spacingDiv.remove();
                this.spacingDiv = undefined;
            }
            if (this.leftSpacingDiv) {
                this.leftSpacingDiv.remove();
                this.leftSpacingDiv = undefined;
            }
            if (this.contextSpacingDiv) {
                this.contextSpacingDiv.remove();
                this.contextSpacingDiv = undefined;
            }
            if (this.rightSpacingDiv) {
                this.rightSpacingDiv.remove();
                this.rightSpacingDiv = undefined;
            }
            if (this.contextInputEle) {
                this.contextInputEle.remove();
                this.contextInputEle = undefined;
            }
            if (this.spaceLabel) {
                this.spaceLabel.remove();
                this.spaceLabel = undefined;
            }
            if (this.spacingWholeDiv) {
                this.spacingWholeDiv.remove();
                this.spacingWholeDiv = undefined;
            }
            if (this.beforeSpacingWholeDiv) {
                this.beforeSpacingWholeDiv.remove();
                this.beforeSpacingWholeDiv = undefined;
            }
            if (this.afterSpacingWholeDiv) {
                this.afterSpacingWholeDiv.remove();
                this.afterSpacingWholeDiv = undefined;
            }
            if (this.lineSpacingDiv) {
                this.lineSpacingDiv.remove();
                this.lineSpacingDiv = undefined;
            }
            if (this.lineTypeDiv) {
                this.lineTypeDiv.remove();
                this.lineTypeDiv = undefined;
            }
            if (this.lineSpacingAt) {
                this.lineSpacingAt.remove();
                this.lineSpacingAt = undefined;
            }
            if (this.lineBreakContainer) {
                this.lineBreakContainer.remove();
                this.lineBreakContainer = undefined;
            }
            if (this.paginationLabel) {
                this.paginationLabel.remove();
                this.paginationLabel = undefined;
            }
            if (this.widowContorlContainer) {
                this.widowContorlContainer.remove();
                this.widowContorlContainer = undefined;
            }
            if (this.keepNextContainer) {
                this.keepNextContainer.remove();
                this.keepNextContainer = undefined;
            }
            if (this.keepLines) {
                this.keepLines.remove();
                this.keepLines = undefined;
            }
            if (this.widowControl) {
                this.widowControl.remove();
                this.widowControl = undefined;
            }
            if (this.keepWithNext1) {
                this.keepWithNext1.remove();
                this.keepWithNext1 = undefined;
            }
            if (this.keepLinesTogether1) {
                this.keepLinesTogether1.remove();
                this.keepLinesTogether1 = undefined;
            }
            if (this.beforeSpacingSpinDown) {
                this.beforeSpacingSpinDown.remove();
                this.beforeSpacingSpinDown = undefined;
            }
            if (this.afterSpacingSpinDown) {
                this.afterSpacingSpinDown.remove();
                this.afterSpacingSpinDown = undefined;
            }
            if (this.indentContainer) {
                this.indentContainer.remove();
                this.indentContainer = undefined;
            }
        };
        return ParagraphDialog;
    }());
    exports.ParagraphDialog = ParagraphDialog;
});