UNPKG

@syncfusion/ej2-documenteditor

Version:

Feature-rich document editor control with built-in support for context menu, options pane and dialogs.

1,188 lines 130 kB
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 __()); }; })(); 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; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (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; }; import { Component, Property, NotifyPropertyChanges, Event, ChildProperty, classList, Complex, formatUnit } from '@syncfusion/ej2-base'; import { isNullOrUndefined, L10n, Browser } from '@syncfusion/ej2-base'; import { Save } from '@syncfusion/ej2-file-utils'; import { LayoutViewer, PageLayoutViewer, WebLayoutViewer, BulletsAndNumberingDialog } from './index'; import { Print } from './index'; import { BodyWidget, ParagraphWidget } from './index'; import { WSectionFormat, WParagraphFormat, WCharacterFormat } from './index'; import { SfdtReader } from './index'; import { Selection } from './index'; import { Editor, EditorHistory } from './index'; import { WStyles } from './index'; import { Search } from './index'; import { OptionsPane } from './index'; import { WordExport } from './index'; import { TextExport } from './index'; import { ContextMenu } from './index'; import { ImageResizer } from './index'; import { SfdtExport } from './index'; import { HyperlinkDialog, TableDialog, BookmarkDialog, StylesDialog, TableOfContentsDialog } from './index'; import { PageSetupDialog, ParagraphDialog, ListDialog, StyleDialog, FontDialog } from './index'; import { TablePropertiesDialog, BordersAndShadingDialog, CellOptionsDialog, TableOptionsDialog } from './index'; import { SpellChecker } from './implementation/spell-check/spell-checker'; import { SpellCheckDialog } from './implementation/dialogs/spellCheck-dialog'; import { DocumentHelper, listsProperty, abstractListsProperty } from './index'; import { CheckBoxFormFieldDialog, DropDownFormField, TextFormField, CheckBoxFormField } from './implementation/index'; import { TextFormFieldDialog } from './implementation/dialogs/form-field-text-dialog'; import { DropDownFormFieldDialog } from './implementation/dialogs/form-field-drop-down-dialog'; import { RevisionCollection } from './implementation/track-changes/track-changes'; import { NotesDialog } from './implementation/dialogs/notes-dialog'; import { FootNoteWidget } from './implementation/viewer/page'; import { internalZoomFactorChange, contentChangeEvent, documentChangeEvent, selectionChangeEvent, zoomFactorChangeEvent, beforeFieldFillEvent, afterFieldFillEvent, serviceFailureEvent, viewChangeEvent, customContextMenuSelectEvent, customContextMenuBeforeOpenEvent, internalviewChangeEvent, internalDocumentEditorSettingsChange, trackChanges } from './base/constants'; import { Optimized, Regular, HelperMethods } from './index'; import { ColumnsDialog } from './implementation/dialogs/columns-dialog'; import { ZipArchiveItem, ZipArchive } from '@syncfusion/ej2-compression'; import { TabDialog } from './implementation/dialogs/tab-dialog'; import { RulerHelper } from './implementation/utility/dom-util'; /** * The `DocumentEditorSettings` module is used to provide the customize property of Document Editor. */ var DocumentEditorSettings = /** @class */ (function (_super) { __extends(DocumentEditorSettings, _super); function DocumentEditorSettings() { return _super !== null && _super.apply(this, arguments) || this; } __decorate([ Property(null) ], DocumentEditorSettings.prototype, "popupTarget", void 0); __decorate([ Property('#FFE97F') ], DocumentEditorSettings.prototype, "searchHighlightColor", void 0); __decorate([ Property(['Algerian', 'Arial', 'Calibri', 'Cambria', 'Cambria Math', 'Candara', 'Courier New', 'Georgia', 'Impact', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Symbol', 'Times New Roman', 'Verdana', 'Wingdings']) ], DocumentEditorSettings.prototype, "fontFamilies", void 0); __decorate([ Property({ shadingColor: '#cfcfcf', applyShading: true, selectionColor: '#cccccc', formFillingMode: 'Popup' }) ], DocumentEditorSettings.prototype, "formFieldSettings", void 0); __decorate([ Property({ interval: 2000, itertationCount: 5 }) ], DocumentEditorSettings.prototype, "autoResizeSettings", void 0); __decorate([ Property({ roomName: '', editableRegionColor: '#22b24b', lockedRegionColor: '#f44336' }) ], DocumentEditorSettings.prototype, "collaborativeEditingSettings", void 0); __decorate([ Property(1) ], DocumentEditorSettings.prototype, "printDevicePixelRatio", void 0); __decorate([ Property(true) ], DocumentEditorSettings.prototype, "enableOptimizedTextMeasuring", void 0); __decorate([ Property(true) ], DocumentEditorSettings.prototype, "allowDragAndDrop", void 0); __decorate([ Property(32767) ], DocumentEditorSettings.prototype, "maximumRows", void 0); __decorate([ Property(63) ], DocumentEditorSettings.prototype, "maximumColumns", void 0); __decorate([ Property(false) ], DocumentEditorSettings.prototype, "showHiddenMarks", void 0); __decorate([ Property(false) ], DocumentEditorSettings.prototype, "showBookmarks", void 0); __decorate([ Property(true) ], DocumentEditorSettings.prototype, "highlightEditableRanges", void 0); __decorate([ Property(true) ], DocumentEditorSettings.prototype, "optimizeSfdt", void 0); __decorate([ Property(false) ], DocumentEditorSettings.prototype, "showRuler", void 0); return DocumentEditorSettings; }(ChildProperty)); export { DocumentEditorSettings }; /** * Represents the settings and properties of the document that is opened in Document editor component. */ var DocumentSettings = /** @class */ (function (_super) { __extends(DocumentSettings, _super); function DocumentSettings() { return _super !== null && _super.apply(this, arguments) || this; } __decorate([ Property('Word2013') ], DocumentSettings.prototype, "compatibilityMode", void 0); return DocumentSettings; }(ChildProperty)); export { DocumentSettings }; /** * Represents the settings required for resizing the Document editor automatically when the visibility of parent element changed. */ var AutoResizeSettings = /** @class */ (function (_super) { __extends(AutoResizeSettings, _super); function AutoResizeSettings() { return _super !== null && _super.apply(this, arguments) || this; } __decorate([ Property(2000) ], AutoResizeSettings.prototype, "interval", void 0); __decorate([ Property(5) ], AutoResizeSettings.prototype, "iterationCount", void 0); return AutoResizeSettings; }(ChildProperty)); export { AutoResizeSettings }; /** * The Document editor component is used to draft, save or print rich text contents as page by page. */ var DocumentEditor = /** @class */ (function (_super) { __extends(DocumentEditor, _super); /** * Initializes a new instance of the DocumentEditor class. * * @param {DocumentEditorModel} options Specifies the document editor model. * @param {string | HTMLElement} element Specifies the element. */ function DocumentEditor(options, element) { var _this = _super.call(this, options, element) || this; _this.enableHeaderFooterIn = false; /** * @private */ _this.isShiftingEnabled = false; /** * @private */ _this.isLayoutEnabled = true; /** * @private */ _this.isPastingContent = false; /** * @private */ _this.isOnIndent = false; /** * @private */ _this.isTableMarkerDragging = false; /** * @private */ _this.startXPosition = 0; /** * @private */ _this.parser = undefined; _this.disableHistoryIn = false; _this.documentSettingOps = []; /** * @private */ _this.skipSettingsOps = false; _this.isSettingOp = false; /** * @private */ _this.findResultsList = undefined; /** * @private */ _this.tablePropertiesDialogModule = undefined; /** * @private */ _this.bordersAndShadingDialogModule = undefined; /** * @private */ _this.cellOptionsDialogModule = undefined; /** * @private */ _this.tableOptionsDialogModule = undefined; /** * @private */ _this.paragraphDialogModule = undefined; /** * @private */ _this.imageResizerModule = undefined; _this.createdTriggered = false; /** * @private */ _this.defaultLocale = { 'Table': 'Table', 'Row': 'Row', 'Cell': 'Cell', 'Ok': 'OK', 'Apply': 'Apply', 'Alt Text': 'Alt Text', 'Title': 'Title', 'Description': 'Description', 'Cancel': 'Cancel', 'Size': 'Size', 'Preferred Width': 'Preferred width', 'Points': 'Points', 'Percent': 'Percent', 'Measure in': 'Measure in', 'Alignment': 'Alignment', 'Left': 'Left', 'Center': 'Center', 'Right': 'Right', 'Decimal': 'Decimal', 'Bar': 'Bar', 'Justify': 'Justify', 'Indent from left': 'Indent from left', 'Borders and Shading': 'Borders and Shading', 'Options': 'Options', 'Specify height': 'Specify height', 'At least': 'At least', 'Exactly': 'Exactly', 'Row height is': 'Row height is', 'Allow row to break across pages': 'Allow row to break across pages', 'Repeat as header row at the top of each page': 'Repeat as header row at the top of each page', 'Vertical alignment': 'Vertical alignment', 'Top': 'Top', 'Bottom': 'Bottom', 'Default cell margins': 'Default cell margins', 'Default cell spacing': 'Default cell spacing', 'Allow spacing between cells': 'Allow spacing between cells', 'Cell margins': 'Cell margins', 'Same as the whole table': 'Same as the whole table', 'Borders': 'Borders', 'None': 'None', 'Style': 'Style', 'Width': 'Width', 'Height': 'Height', 'Letter': 'Letter', '1, 2, 3, ...': '1, 2, 3, ...', 'a, b, c, ...': 'a, b, c, ...', 'A, B, C, ...': 'A, B, C, ...', 'I, II, III, ...': 'I, II, III, ...', 'i, ii, iii, ...': 'i, ii, iii, ...', 'Tabloid': 'Tabloid', 'Legal': 'Legal', 'Statement': 'Statement', 'Executive': 'Executive', 'A3': 'A3', 'A4': 'A4', 'A5': 'A5', 'B4': 'B4', 'B5': 'B5', 'Custom Size': 'Custom size', 'Different odd and even': 'Different odd and even', 'Different first page': 'Different first page', 'From edge': 'From edge', 'Header': 'Header', 'Footer': 'Footer', 'First Page Header': 'First Page Header', 'First Page Footer': 'First Page Footer', 'Even Page Header': 'Even Page Header', 'Even Page Footer': 'Even Page Footer', 'Odd Page Header': 'Odd Page Header', 'Odd Page Footer': 'Odd Page Footer', 'Same as Previous': 'Same as Previous', 'Section': 'Section', 'Margin': 'Margins', 'Paper': 'Paper', 'Layout': 'Layout', 'Orientation': 'Orientation', 'Landscape': 'Landscape', 'Portrait': 'Portrait', 'Show page numbers': 'Show page numbers', 'Right align page numbers': 'Right align page numbers', 'Nothing': 'Nothing', 'Tab leader': 'Tab leader', 'Leader': 'Leader', 'Show levels': 'Show levels', 'Use hyperlinks instead of page numbers': 'Use hyperlinks instead of page numbers', 'Build table of contents from': 'Build table of contents from', 'Styles': 'Styles', 'Available styles': 'Available styles', 'TOC level': 'TOC level', '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', 'List Paragraph': 'List Paragraph', 'Normal': 'Normal', 'Outline levels': 'Outline levels', 'Table entry fields': 'Table entry fields', 'Modify': 'Modify', 'Color': 'Color', 'Setting': 'Setting', 'Box': 'Box', 'All': 'All', 'Custom': 'Custom', 'Preview': 'Preview', 'Shading': 'Shading', 'Fill': 'Fill', 'Apply To': 'Apply to', 'Table Properties': 'Table Properties', 'Cell Options': 'Cell Options', 'Table Options': 'Table Options', 'Insert Table': 'Insert Table', 'Number of columns': 'Number of columns', 'Number of rows': 'Number of rows', 'Text to display': 'Text to display', 'ScreenTip text': 'ScreenTip text', 'Address': 'Address', 'Insert Hyperlink': 'Insert Hyperlink', 'Edit Hyperlink': 'Edit Hyperlink', 'Insert': 'Insert', 'General': 'General', 'Indentation': 'Indentation', 'Before text': 'Before text', 'Special': 'Special', 'First line': 'First line', 'Hanging': 'Hanging', 'After text': 'After text', 'By': 'By', 'Before': 'Before', 'Line Spacing': 'Line spacing', 'After': 'After', 'At': 'At', 'Multiple': 'Multiple', 'Spacing': 'Spacing', 'Define new Multilevel list': 'Define new Multilevel list', 'List level': 'List level', 'Choose level to modify': 'Choose level to modify', 'Level': 'Level', 'Number format': 'Number format', 'Number style for this level': 'Number style for this level', 'Enter formatting for number': 'Enter formatting for number', 'Start at': 'Start at', 'Restart list after': 'Restart list after', 'Position': 'Position', 'Text indent at': 'Text indent at', 'Aligned at': 'Aligned at', 'Follow number with': 'Follow number with', 'Tab character': 'Tab character', 'Space': 'Space', 'Arabic': 'Arabic', 'UpRoman': 'UpRoman', 'LowRoman': 'LowRoman', 'UpLetter': 'UpLetter', 'LowLetter': 'LowLetter', 'Number': 'Number', 'Leading zero': 'Leading zero', 'Bullet': 'Bullet', 'Ordinal': 'Ordinal', 'Ordinal Text': 'Ordinal Text', 'For East': 'For East', 'No Restart': 'No Restart', 'Font': 'Font', 'Font style': 'Font style', 'Underline style': 'Underline style', 'Font color': 'Font color', 'Effects': 'Effects', 'Strikethrough': 'Strikethrough', 'Superscript': 'Superscript', 'Subscript': 'Subscript', 'Double strikethrough': 'Double strikethrough', 'Regular': 'Regular', 'Bold': 'Bold', 'Italic': 'Italic', 'Cut': 'Cut', 'Copy': 'Copy', 'Paste': 'Paste', 'Hyperlink': 'Hyperlink', 'Open Hyperlink': 'Open Hyperlink', 'Copy Hyperlink': 'Copy Hyperlink', 'Remove Hyperlink': 'Remove Hyperlink', 'Paragraph': 'Paragraph', 'Linked Style': 'Linked(Paragraph and Character)', 'Character': 'Character', 'Merge Cells': 'Merge Cells', 'Insert Above': 'Insert Above', 'Insert Below': 'Insert Below', 'Insert Left': 'Insert Left', 'Insert Right': 'Insert Right', 'Delete': 'Delete', 'Delete Table': 'Delete Table', 'Delete Row': 'Delete Row', 'Delete Column': 'Delete Column', 'File Name': 'File Name', 'Format Type': 'Format Type', 'Save': 'Save', 'Navigation': 'Navigation', 'Results': 'Results', 'Replace': 'Replace', 'Replace All': 'Replace All', 'We replaced all': 'We replaced all', 'Find': 'Find', 'No matches': 'No matches', 'All Done': 'All Done', 'Result': 'Result', 'of': 'of', 'instances': 'instances', 'with': 'with', 'Click to follow link': 'Click to follow link', 'Continue Numbering': 'Continue Numbering', 'Bookmark name': 'Bookmark name', 'Tab': 'Tab', 'Tab stop position': 'Tab stop position', 'Close': 'Close', 'Restart At': 'Restart At', 'Properties': 'Properties', 'Name': 'Name', 'Style type': 'Style type', 'Style based on': 'Style based on', 'Style for following paragraph': 'Style for following paragraph', 'Formatting': 'Formatting', 'Numbering and Bullets': 'Numbering and Bullets', 'Numbering': 'Numbering', 'Update Field': 'Update Field', 'Edit Field': 'Edit Field', 'Bookmark': 'Bookmark', 'Page Setup': 'Page Setup', 'No bookmarks found': 'No bookmarks found', 'Number format tooltip information': 'Single-level number format: </br>[PREFIX]%[LEVELNUMBER][SUFFIX]</br>' + 'For example, "Chapter %1." will display numbering like</br>Chapter 1. Item</br>Chapter 2. Item</br>…' + '</br>Chapter N. Item</br>' + '</br>Multilevel number format:</br>[PREFIX]%[LEVELNUMBER][SUFFIX]+[PREFIX]%[LEVELNUMBER][SUFFIX]' + '</br>For example, "%1.%2." will display numbering like</br>1.1. Item</br>1.2. Item</br>…</br>1.N. Item', 'Format': 'Format', 'Create New Style': 'Create New Style', 'Modify Style': 'Modify Style', 'New': 'New', 'InsertFootnote': 'InsertFootnote', 'InsertEndnote': 'InsertEndnote', 'Footnote': 'Footnote', 'Endnote': 'Endnote', 'Notes Options': 'Notes Options', 'Bullets': 'Bullets', 'Use bookmarks': 'Use bookmarks', 'Table of Contents': 'Table of Contents', 'AutoFit': 'AutoFit', 'AutoFit to Contents': 'AutoFit to Contents', 'AutoFit to Window': 'AutoFit to Window', 'Fixed Column Width': 'Fixed Column Width', 'Reset': 'Reset', 'Match case': 'Match case', 'Whole words': 'Whole words', 'Add': 'Add', 'Go To': 'Go To', 'Search for': 'Search for', 'Replace with': 'Replace with', 'TOC 1': 'TOC 1', 'TOC 2': 'TOC 2', 'TOC 3': 'TOC 3', 'TOC 4': 'TOC 4', 'TOC 5': 'TOC 5', 'TOC 6': 'TOC 6', 'TOC 7': 'TOC 7', 'TOC 8': 'TOC 8', 'TOC 9': 'TOC 9', 'Right-to-left': 'Right-to-left', 'Left-to-right': 'Left-to-right', 'Direction': 'Direction', 'Table direction': 'Table direction', 'Indent from right': 'Indent from right', /* eslint-disable */ "Contextual Spacing": "Don't add space between paragraphs of the same style", "Password Mismatch": "The password don't match", 'Restrict Editing': 'Restrict Editing', 'Formatting restrictions': 'Formatting restrictions', 'Allow formatting': 'Allow formatting', 'Editing restrictions': 'Editing restrictions', 'Read only': 'Read only', 'Exceptions Optional': 'Exceptions (optional)', 'Select Part Of Document And User': 'Select parts of the document and choose users who are allowed to freely edit them.', 'Everyone': 'Everyone', 'More users': 'More users', 'Add Users': 'Add Users', 'Enforcing Protection': 'Yes, Start Enforcing Protection', 'Start Enforcing Protection': 'Start Enforcing Protection', 'Enter User': 'Enter User', 'Users': 'Users', 'Enter new password': 'Enter new password', 'Reenter new password to confirm': 'Reenter new password to confirm', 'Your permissions': 'Your permissions', 'Protected Document': 'This document is protected from unintentional editing.', 'FormFieldsOnly': 'You may only fill in forms in this region.', 'CommentsOnly': 'You may only insert comments into this region.', 'ReadOnlyProtection': 'You may edit in this region.', 'Stop Protection': 'Stop Protection', 'Password': 'Password', 'Spelling Editor': 'Spelling Editor', 'Spelling': 'Spelling', 'Spell Check': 'Spell Check', 'Underline errors': 'Underline errors', 'Ignore': 'Ignore', 'Ignore All': 'Ignore All', 'Add to Dictionary': 'Add to Dictionary', 'Change': 'Change', 'Change All': 'Change All', 'Suggestions': 'Suggestions', 'The password is incorrect': 'The password is incorrect', 'Error in establishing connection with web server': 'Error in establishing connection with web server', 'Highlight the regions I can edit': 'Highlight the regions I can edit', 'Show All Regions I Can Edit': 'Show All Regions I Can Edit', 'Find Next Region I Can Edit': 'Find Next Region I Can Edit', 'Keep source formatting': 'Keep source formatting', 'Match destination formatting': 'Match destination formatting', 'InsertAsRows': 'Insert as New Rows', 'InsertAsColumns': 'Insert as New Columns', 'OverwriteCells': 'Overwrite Cells', 'NestTable': 'Nest Table', 'Text only': 'Text only', 'Comments': 'Comments', 'Type your comment': 'Type your comment', 'Post': 'Post', 'Reply': 'Reply', 'New Comment': 'New Comment', 'Edit': 'Edit', 'Resolve': 'Resolve', 'Reopen': 'Reopen', 'No comments in this document': 'No comments in this document', 'more': 'more', 'Type your comment here': 'Type your comment here', 'Next Comment': 'Next Comment', 'Previous Comment': 'Previous Comment', 'Un-posted comments': 'Un-posted comments', 'Discard Comment': 'Added comments not posted. If you continue, that comment will be discarded.', 'No Headings': 'No Heading Found!', 'Add Headings': 'This document has no headings. Please add headings and try again.', 'More Options': 'More Options', 'Click to see this comment': 'Click to see this comment', 'Form Fields': 'Form Fields', 'Text Form': 'Text Form', 'Check Box': 'Check Box', 'Drop Down Form Field': 'Drop Down Form Field', 'Dropdown items': 'Drop-down items', 'Items in dropdown list': 'Items in drop-down list', 'ADD': 'ADD', 'REMOVE': 'REMOVE', 'Field settings': 'Field settings', 'Tooltip': 'Tooltip', 'Dropdown enabled': 'Drop-down enabled', 'Check Box Form Field': 'Check Box Form Field', 'Check box size': 'Check box size', 'Auto': 'Auto', 'Default value': 'Default value', 'Not checked': 'Not checked', 'Checked': 'Checked', 'Check box enabled': 'Check box enabled', 'Text Form Field': 'Text Form Field', 'Type': 'Type', 'Default text': 'Default text', 'Maximum length': 'Maximum length', 'Text format': 'Text format', 'Fillin enabled': 'Fill-in enabled', 'Default number': 'Default number', 'Default date': 'Default date', 'Date format': 'Date format', 'Merge Track': 'This action wont be marked as change. Do you want to continue?', 'UnTrack': 'Cannot be tracked !', 'Accept': 'Accept', 'Reject': 'Reject', 'Previous Changes': 'Previous Changes', 'Next Changes': 'Next Changes', 'Inserted': 'Inserted', 'Deleted': 'Deleted', 'Move From': 'Move From', 'Move To': 'Move To', 'Changes': 'Changes', 'Accept all': 'Accept all', 'Reject all': 'Reject all', 'No changes': 'No changes', 'Accept Changes': 'Accept Changes', 'Reject Changes': 'Reject Changes', 'User': 'User', 'View': 'View', 'Insertion': 'Insertion', 'Deletion': 'Deletion', 'All caps': 'All caps', 'This region is locked by': 'This region is locked by', 'Lock': 'Lock', 'Unlock': 'Unlock', 'Already locked': 'Selected or part of region is already locked by another user', 'Click to View/Edit Footnote': 'Click to View/Edit Footnote', 'Click to View/Edit Endnote': 'Click to View/Edit Endnote', 'Multiple Comment': 'Please post your comment', 'No suggestions': 'No suggestions', 'More Suggestion': 'More Suggestion', 'Ignore Once': 'Ignore Once', 'Keep With Next': 'Keep with next', 'Keep Lines Together': 'Keep lines together', 'WidowControl': 'Widow/Orphan control', 'Indents and Spacing': 'Indents and Spacing', 'Line and Page Breaks': 'Line and Page Breaks', 'Pagination': 'Pagination', 'Single': 'Single', 'DashSmallGap': 'DashSmallGap', 'DashDot': 'DashDot', 'Double': 'Double', 'ThinThickSmallGap': 'ThinThickSmallGap', 'ThickThinSmallGap': 'ThickThinSmallGap', 'ThickThinMediumGap': 'ThickThinMediumGap', 'ThickThinLargeGap': 'ThickThinLargeGap', 'SingleWavy': 'SingleWavy', 'DoubleWavy': 'DoubleWavy', 'Inset': 'Inset', 'DashLargeGap': 'DashLargeGap', 'Dot': 'Dot', 'DashDotDot': 'DashDotDot', 'Triple': 'Triple', 'ThinThickThinSmallGap': 'ThinThickThinSmallGap', 'ThinThickThinMediumGap': 'ThinThickThinMediumGap', 'ThinThickThinLargeGap': 'ThinThickThinLargeGap', 'DashDotStroked': 'DashDotStroked', 'Engrave3D': 'Engrave3D', 'Thick': 'Thick', 'Outset': 'Outset', 'Emboss3D': 'Emboss3D', 'ThinThickLargeGap': 'ThinThickLargeGap', 'ThinThickMediumGap': 'ThinThickMediumGap', 'Number of rows must be between': 'Number of rows must be between', 'Number of columns must be between': 'Number of columns must be between', 'and': 'and', 'Unlimited': 'Unlimited', 'Regular text': 'Regular text', 'Date': 'Date', 'Uppercase': 'Uppercase', 'Lowercase': 'Lowercase', 'FirstCapital': 'FirstCapital', 'TitleCase': 'Titlecase', 'Filling in forms': 'Filling in forms', 'px': 'px', 'Tracked changes': 'Tracked changes', 'TrackChangesOnly': 'You may edit in this region, but all change will be tracked.', 'RemovedIgnoreExceptions': 'If you make this change in document protection, Word will ignore all the exceptions in this document.', 'RemovedIgnore': 'Do you want to remove the ignored exceptions?', 'Information': 'Information', 'Yes': 'Yes', 'No': 'No', 'Page Break': 'Page Break', 'Column Break': 'Column Break', 'Section Break Next Page': 'Section Break (Next Page)', 'Section Break Continuous': 'Section Break (Continuous)', 'Unsupported format': 'The file format you have selected isn\'t supported. Please choose valid format.', 'One': 'One', 'Two': 'Two', 'Three': 'Three', 'Presets': 'Presets', 'Columns': 'Columns', 'Split your text into two or more columns': 'Split your text into two or more columns', 'Line between column': 'Line between column', 'Width and Spacing': 'Width and Spacing', 'Equal column width': 'Equal column width', 'Column': 'Column', 'Paste Content Dialog': 'Due to browser’s security policy, paste from system clipboard is restricted. Alternatively use the keyboard shortcut', 'Paste Content CheckBox': 'Don’t show again', 'BookMarkList': 'List of bookmarks in the document', 'TabMarkList': 'List of tab stops in the paragraph', 'Default tab stops': 'Default tab stops', 'Tab stops to be cleared': 'Tab stops to be cleared', 'Tabs': 'Tabs', 'Set': 'Set', 'Clear': 'Clear', 'Clear All': 'Clear All', 'Discard': 'Discard', 'The top/bottom margins are too large for the page height in some sections.': 'The top/bottom margins are too large for the page height in some sections.', 'Column width cannot be less than 36 pt.': 'Column width cannot be less than 36 pt.', 'Left and right margins.': 'Settings you chose for the left and right margins, column spacing, or pargraph indents are too large for the page width in same secitions.', 'Left Indent': 'Left Indent', 'Right Indent': 'Right Indent', 'Hanging Indent': 'Hanging Indent', 'First Line Indent': 'First Line Indent', 'Left Margin': 'Left Margin', 'Right Margin': 'Right Margin', 'Top Margin': 'Top Margin', 'Bottom Margin': 'Bottom Margin', 'Left Tab': 'Left Tab', 'Right Tab': 'Right Tab', 'Center Tab': 'Center Tab', 'Decimal Tab': 'Decimal Tab', 'Bar Tab': 'Bar Tab', 'Move Table Column': 'Move Table Column', }; _this.initHelper(); return _this; } DocumentEditor_1 = DocumentEditor; Object.defineProperty(DocumentEditor.prototype, "enableHeaderAndFooter", { /** * @private * @returns {boolean} Returns true if header and footer is enabled. */ get: function () { return this.enableHeaderFooterIn; }, /** * @private * @param {boolean} value True if enable the header and footer; Otherwise, false. */ set: function (value) { this.enableHeaderFooterIn = value; if (!value && this.selection && this.selection.isWebLayout) { this.selection.isWebLayout = false; } this.viewer.updateScrollBars(); }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "pageCount", { /** * Gets the total number of pages. * * @returns {number} Returns the page count. */ get: function () { if (!this.isDocumentLoaded || isNullOrUndefined(this.viewer) || this.viewer instanceof WebLayoutViewer) { return 1; } return this.documentHelper.pages.length; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "selection", { /** * Gets the selection object of the document editor. * * @default undefined * @aspType Selection * @returns {Selection} Returns the selection object. */ get: function () { return this.selectionModule; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "editor", { /** * Gets the editor object of the document editor. * * @aspType Editor * @returns {Editor} Returns the editor object. */ get: function () { return this.editorModule; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "editorHistory", { /** * Gets the editor history object of the document editor. * * @aspType EditorHistory * @returns {EditorHistory} Returns the editor history object. */ get: function () { return this.editorHistoryModule; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "search", { /** * Gets the search object of the document editor. * * @aspType Search * @returns { Search } Returns the search object. */ get: function () { return this.searchModule; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "contextMenu", { /** * Gets the context menu object of the document editor. * * @aspType ContextMenu * @returns {ContextMenu} Returns the context menu object. */ get: function () { return this.contextMenuModule; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "spellCheckDialog", { /** * Gets the spell check dialog object of the document editor. * * @returns {SpellCheckDialog} Returns the spell check dialog object. */ get: function () { return this.spellCheckDialogModule; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "spellChecker", { /** * Gets the spell check object of the document editor. * * @aspType SpellChecker * @returns {SpellChecker} Returns the spell checker object. */ get: function () { return this.spellCheckerModule; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "containerId", { /** * @private * @returns {string }- Returns the container id. */ get: function () { return this.element.id; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "isDocumentLoaded", { /** * @private * @returns {boolean} - Returns true if document is loaded. */ get: function () { return this.isDocumentLoadedIn; }, /** * @private */ set: function (value) { this.isDocumentLoadedIn = value; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "isDocumentEmpty", { /** * Describes whether Document contains any content or not * * @returns {boolean} Returns `true` if Document does not contains any content; otherwise, `false` * @aspType bool * @default false */ get: function () { if (this.documentHelper.pages.length == 1) { var firstPage = this.documentHelper.pages[0]; var headerWidget = firstPage.headerWidget; var footerWidget = firstPage.footerWidget; var isHeaderEmpty = true; var isFooterEmpty = true; if (!isNullOrUndefined(headerWidget) && !isNullOrUndefined(headerWidget.firstChild)) { if (!(headerWidget.firstChild instanceof ParagraphWidget) || !headerWidget.firstChild.isEmpty()) { isHeaderEmpty = false; } } if (!isNullOrUndefined(footerWidget) && !isNullOrUndefined(footerWidget.firstChild)) { if (!(footerWidget.firstChild instanceof ParagraphWidget) || !footerWidget.firstChild.isEmpty()) { isFooterEmpty = false; } } if (isHeaderEmpty && isFooterEmpty) { var firstBodywidget = firstPage.bodyWidgets[0]; if (isNullOrUndefined(firstBodywidget.nextWidget)) { var firstChild = firstBodywidget.firstChild; if (firstChild instanceof ParagraphWidget && firstChild.isEmpty() && isNullOrUndefined(firstChild.nextWidget)) { return true; } } } return false; } else { return false; } }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "revisions", { /** * Gets the revision collection which contains information about changes made from original document * * @returns {RevisionCollection} Returns the revision collection object. */ get: function () { if (isNullOrUndefined(this.revisionsInternal)) { this.revisionsInternal = new RevisionCollection(this); } return this.revisionsInternal; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "enableHistoryMode", { /** * Determines whether history needs to be enabled or not. * * @default - false * @private * @returns {boolean} Returns true if history module is enabled. */ get: function () { return this.enableEditorHistory && !isNullOrUndefined(this.editorHistoryModule); }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "documentStart", { /** * Gets the start text position in the document. * * @default undefined * @private * @returns {TextPosition} - Returns the document start. */ get: function () { if (!isNullOrUndefined(this.selectionModule)) { return this.selection.getDocumentStart(); } return undefined; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "documentEnd", { /** * Gets the end text position in the document. * * @default undefined * @private * @returns {TextPosition} - Returns the document end. */ get: function () { if (!isNullOrUndefined(this.selectionModule)) { return this.selection.getDocumentEnd(); } return undefined; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "isReadOnlyMode", { /** * @private * @returns {TextPosition} - Returns isReadOnlyMode. */ get: function () { return this.isReadOnly || isNullOrUndefined(this.editorModule) || isNullOrUndefined(this.selectionModule) || !isNullOrUndefined(this.editor) && this.editor.restrictEditing; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "isSpellCheck", { /** * @private * @returns {TextPosition} - Returns isSpellCheck. */ get: function () { return this.enableSpellCheck && this.spellChecker.enableSpellCheck; }, enumerable: true, configurable: true }); Object.defineProperty(DocumentEditor.prototype, "enableImageResizerMode", { /** * Specifies to enable image resizer option * * @private * @returns {boolean} - Returns enableImageResizerMode. */ get: function () { return this.enableImageResizer && !isNullOrUndefined(this.imageResizerModule); }, enumerable: true, configurable: true }); DocumentEditor.prototype.preRender = function () { var _this = this; if (this.documentEditorSettings && this.documentEditorSettings.enableOptimizedTextMeasuring) { DocumentEditor_1.Inject(Optimized); } else { DocumentEditor_1.Inject(Regular); } //pre render section this.findResultsList = []; setTimeout(function () { if (isNullOrUndefined(_this.documentEditorSettings.popupTarget)) { _this.documentEditorSettings.popupTarget = document.body; } }, 0); if (!isNullOrUndefined(this.element) && this.element.id === '') { //Set unique id, if id is empty this.element.id = HelperMethods.getUniqueElementId(); } if (this.refreshing) { this.initHelper(); } }; DocumentEditor.prototype.initHelper = function () { this.documentHelper = new DocumentHelper(this); if (this.layoutType === 'Pages') { this.viewer = new PageLayoutViewer(this); } else { this.viewer = new WebLayoutViewer(this); } this.parser = new SfdtReader(this.documentHelper); }; DocumentEditor.prototype.render = function () { if (!isNullOrUndefined(this.element)) { var container = this.element; container.style.minHeight = '200px'; container.style.minWidth = '200px'; if (this.height !== '') { this.element.style.height = formatUnit(this.height); } if (this.width !== '') { this.element.style.width = formatUnit(this.width); } } this.textMeasureHelper = (this.optimizedModule) ? this.optimizedModule : this.regularModule; if (isNullOrUndefined(this.textMeasureHelper)) { this.textMeasureHelper = new Optimized(this.documentHelper); } this.documentHelper.initializeComponents(); this.openBlank(); this.renderComplete(); this.renderRulers(); this.createdTriggered = true; }; /** * @private */ DocumentEditor.prototype.renderRulers = function () { // if (this.documentEditorSettings.showRuler) { this.rulerHelper = new RulerHelper(); this.rulerContainer = this.rulerHelper.renderOverlapElement(this); this.rulerHelper.renderRuler(this, true); this.rulerHelper.renderRuler(this, false); this.rulerHelper.renderRulerMarkerIndicatorElement(this); this.rulerHelper.createIndicatorLines(this); this.showHideRulers(); // } }; DocumentEditor.prototype.showHideRulers = function () { if (this.rulerHelper && this.documentEditorSettings && !isNullOrUndefined(!this.documentEditorSettings.showRuler)) { var showRuler = this.documentEditorSettings.showRuler && !this.isReadOnlyMode; this.rulerHelper.hideTabStopSwitch(showRuler); this.rulerHelper.hideRulerBottom(showRuler); if (this.vRuler) { this.vRuler.showHideRuler(showRuler); } if (this.hRuler) { this.hRuler.showHideRuler(showRuler); } } }; /** * Get component name * * @private * @returns {string} - Returns module name. */ DocumentEditor.prototype.getModuleName = function () { return 'DocumentEditor'; }; /** * Called internally if any of the property value changed. * * @private * @param {DocumentEditorModel} model - Specifies the new model. * @param {DocumentEditorModel} oldProp - Specifies the old model. * @returns {void} */ DocumentEditor.prototype.onPropertyChanged = function (model, oldProp) { var _this = this; for (var _i = 0, _a = Object.keys(model); _i < _a.length; _i++) { var prop = _a[_i]; switch (prop) { case 'enableTrackChanges': this.notify(trackChanges, model); this.getSettingData('enableTrackChanges', model.enableTrackChanges); if (this.documentHelper.isTrackedOnlyMode && !model.enableTrackChanges) { this.enableTrackChanges = true; } break; case 'autoResizeOnVisibilityChange': if (model.autoResizeOnVisibilityChange) { this.documentHelper.triggerAutoResizeInterval(); } break; case 'zoomFactor': if (this.viewer && oldProp.zoomFactor !== model.zoomFactor) { this.documentHelper.zoomFactor = model.zoomFactor; if (this.rulerHelper && this.documentEditorSettings && this.documentEditorSettings.showRuler) { this.rulerHelper.updateRuler(this, true); } } break; case 'layoutType': if (this.selection && this.selection.isWebLayout) { break; } this.viewer.destroy(); if (this.layoutType === 'Pages') { this.viewer = new PageLayoutViewer(this); } else { if (this.enableHeaderAndFooter === true) { this.selection.closeHeaderFooter(); } this.viewer = new WebLayoutViewer(this); } /* eslint-disable */ var paragraph = this.selection.start.paragraph; if (paragraph.containerWidget instanceof FootNoteWidget) { this.selection.clearSelectionHighlightInSelectedWidgets(); this.selection.selectContent(this.documentStart, true); } this.editor.layoutWholeDocument(true); setTimeout(function () { _this.fireViewChange(); }, 200); break; case 'locale': this.localizeDialogs(); break; case 'isReadOnly': if (!isNullOrUndefined(this.optionsPaneModule) && this.optionsPaneModule.isOptionsPaneShow) { this.optionsPaneModule.showHideOptionsPane(false); this.documentHelper.updateFocus(); } if (this.showComments) { this.commentReviewPane.showHidePane(true, 'Comments'); } this.commentReviewPane.enableDisableItems(); this.trackChangesPane.enableDisableButton(!this.isReadOnly && !this.documentHelper.isDocumentProtected); this.showHideRulers(); break; case 'currentUser': case 'userColor': if (this.selecti