UNPKG

@syncfusion/ej2-documenteditor

Version:

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

1,138 lines 189 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; }; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = (this && this.__generator) || function (thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; import { Component, Property, NotifyPropertyChanges, Event, ChildProperty, classList, Complex, formatUnit, updateCSSText } from '@syncfusion/ej2-base'; import { isNullOrUndefined, L10n, Browser } from '@syncfusion/ej2-base'; import { Save } from '@syncfusion/ej2-file-utils'; import { XmlHttpRequestHandler, beforeXmlHttpRequestSend } from './index'; 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 { XmlPane } 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 { ContentControl, FootNoteWidget, ImageElementBox, TextElementBox } from './implementation/viewer/page'; import { internalZoomFactorChange, contentChangeEvent, documentChangeEvent, selectionChangeEvent, zoomFactorChangeEvent, beforeFieldFillEvent, afterFieldFillEvent, serviceFailureEvent, viewChangeEvent, customContextMenuSelectEvent, customContextMenuBeforeOpenEvent, internalviewChangeEvent, internalDocumentEditorSettingsChange, trackChanges, internalOptionPaneChange, documentLoadFailedEvent, beforecontentControlFillEvent, aftercontentControlFillEvent } 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'; import { DatePickerDialog } from './implementation/dialogs/datepicker-dialog'; import { ContentControlPropertiesDialog } from './implementation/dialogs/content-control-properties-dialog'; import { PicContentControlDialog } from './implementation/dialogs/pic-contentControl-dialog'; import { DialogUtility, hideSpinner, showSpinner } from '@syncfusion/ej2-popups'; import { Comment } from './base/events-helper'; /** * 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); __decorate([ Property({ mode: 'Picker', modeSwitcher: true, showButtons: true }) ], DocumentEditorSettings.prototype, "colorPickerSettings", void 0); __decorate([ Property(false) ], DocumentEditorSettings.prototype, "showNavigationPane", void 0); __decorate([ Property({ mentionChar: '@' }) ], DocumentEditorSettings.prototype, "mentionSettings", void 0); __decorate([ Property(false) ], DocumentEditorSettings.prototype, "pasteAsNewParagraph", void 0); __decorate([ Property(false) ], DocumentEditorSettings.prototype, "enableScreenReader", 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.isContainerResize = false; /** * @private */ _this.enableXMLPane = 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; /** * @private */ _this.isUpdateTrackChanges = false; _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.serverActionSettingsImport = 'Import'; /** * Gets or sets a value indicating whether xml toolbar is enabled or not. * @private * * @default false */ _this.isXmlPaneTool = false; /** * Gets or sets a value indicating whether xml cc is enabled or not. * @private * * @default false */ _this.isXmlMapCC = 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', 'OutlineLevel': 'Outline Level', 'BodyText': 'Body Text', 'Level1': 'Level 1', 'Level2': 'Level 2', 'Level3': 'Level 3', 'Level4': 'Level 4', 'Level5': 'Level 5', 'Level6': 'Level 6', 'Level7': 'Level 7', 'Level8': 'Level 8', 'Level9': 'Level 9', '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', 'Heading 7': 'Heading 7', 'Heading 8': 'Heading 8', 'Heading 9': 'Heading 9', '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', 'The number must be between': 'The number must be between 1 and 9', 'The Invalid number': 'This is not a valid number', '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', 'Remove Content Control': 'Remove Content Control', 'Content Control Properties': 'Content Control Properties', 'Remove content control when contents are edited': 'Remove content control when contents are edited', 'Content control cannot be deleted': 'Content control cannot be deleted', 'Contents cannot be edited': 'Contents cannot be edited', 'Plain Text properties': 'Plain Text properties', 'Allow carriage returns': 'Allow carriage returns', 'Drop_Down List properties': 'Drop_Down List properties', 'Display Text': 'Display Text', 'Locking': 'Locking', 'Tag': 'Tag', 'Value': 'Value', 'PictureContentControl': 'PictureContentControl', 'Upload from computer': 'Upload from computer', 'Picture': 'Picture', 'Choose an item': 'Choose an item', 'Insert Pictures': 'Insert Pictures', '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', 'Failed to load the file': 'Failed to load the file', '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', 'XML Mapping': 'XML Mapping', 'Custom XML Part': 'Custom XML Part:', 'Discard Comment': 'Added comments not posted. If you continue, that comment will be discarded.', 'Discard Content Control': 'You can not insert a content control when the selection includes another content control.', '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', 'Default Content Control Text': 'Click here or tap to insert text', 'Default Date Picker': 'Click or tap enter the date', 'Rich text Controls': 'Rich text controls cannot be applied here.', 'Plain text Controls': 'Plain text controls cannot be applied here.', 'DropDownLimitWarning': 'You can have no more than 25 items in your drop-down list box.' }; _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.selectionModule && this.selectionModule.isWebLayout) { this.selectionModule.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 }); /** * Gets the entire document's comment information. * * @returns {CommentInfo[]} Returns the collection of comments. */ DocumentEditor.prototype.getComments = function () { var data = []; var commentCollection = this.documentHelper.comments; if (commentCollection.length > 0) { var tempData = []; for (var _i = 0, _a = this.documentHelper.comments; _i < _a.length; _i++) { var comment = _a[_i]; tempData = []; var commentProperties = { author: comment.author, isResolved: comment.isResolved ? comment.isResolved : false, dateTime: this.editor.parseDateTime(comment.createdDate) }; for (var _b = 0, _c = comment.replyComments; _b < _c.length; _b++) { var replyComment = _c[_b]; var replyCommentProperties = { author: replyComment.author, isResolved: replyComment.isResolved ? comment.isResolved : false, dateTime: this.editor.parseDateTime(replyComment.createdDate) }; var commentText = HelperMethods.parseCommentAsText(replyComment); var newComment = new Comment(replyComment.commentId, replyCommentProperties, commentText); tempData.push(newComment); } var commentInfo = { id: comment.commentId, text: HelperMethods.parseCommentAsText(comment), commentProperties: commentProperties, replies: tempData }; data.push(commentInfo); } } return data; }; 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 () { if (!this.selectionModule) { this.checkModuleInjection('Selection', this.enableSelection); } 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 () { if (!this.editorModule) { this.checkModuleInjection('Editor', this.enableEditor); } 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 () { if (!this.editorHistoryModule) { this.checkModuleInjection('EditorHistory', this.enableEditorHistory); } 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 () { if (!this.searchModule) { this.checkModuleInjection('Search', this.enableSearch); } 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 () { if (!this.contextMenuModule) { this.checkModuleInjection('ContextMenu', this.enableContextMenu); } 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 () { if (!this.spellCheckDialogModule) { this.checkModuleInjection('SpellCheck', this.enableSpellCheck); } 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 () { if (!this.spellCheckerModule) { this.checkModuleInjection('SpellCheck', this.enableSpellCheck); } 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 * @param {boolean} value - Specifies whether the document is loaded or not. * @returns {void} */ 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