UNPKG

@syncfusion/ej2-documenteditor

Version:

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

1,508 lines (1,507 loc) 88.9 kB
import { Selection } from '../index'; import { TextPosition } from '../selection/selection-helper'; import { IWidget, ParagraphWidget, LineWidget, ElementBox, ImageElementBox, BlockWidget, BodyWidget, TableWidget, TableCellWidget, TableRowWidget, Widget, BookmarkElementBox, HeaderFooterWidget, FieldTextElementBox, EditRangeStartElementBox, EditRangeEndElementBox, CommentElementBox, CommentCharacterElementBox, FormField, ShapeElementBox, ContentControl, FootnoteElementBox } from '../viewer/page'; import { WCharacterFormat } from '../format/character-format'; import { CellInfo, IndexInfo, BlockInfo, Base64, TextFormFieldInfo, CheckBoxFormFieldInfo, DropDownFormFieldInfo, FieldInfo } from './editor-helper'; import { WParagraphFormat, WSectionFormat, WTableFormat, WRowFormat, WCellFormat, WBorders, WShading, WTabStop } from '../index'; import { WList } from '../list/list'; import { WListLevel } from '../list/list-level'; import { WLevelOverride } from '../list/level-override'; import { FieldElementBox } from '../viewer/page'; import { HighlightColor, BaselineAlignment, Strikethrough, Underline, LineSpacingType, TextAlignment, ListLevelPattern, HeaderFooterType, ContentControlInfo, CommentProperties, Comment } from '../../base/index'; import { Action } from '../../index'; import { MarkerInfo } from '../editor-history/base-history-info'; import { TableResizer } from './table-resizer'; import { Dictionary } from '../../base/dictionary'; import { CellVerticalAlignment, BorderType, LineStyle, TabLeader, OutlineLevel, AutoFitType, ProtectionType, PasteOptions, TablePasteOptions, FormFieldType, RevisionType, ContentControlType } from '../../base/types'; import { DocumentHelper } from '../viewer'; import { Revision } from '../track-changes/track-changes'; import { SectionBreakType } from '../../base/types'; import { FieldSettingsModel } from '@syncfusion/ej2-dropdowns'; /** * Editor module */ export declare class Editor { /** * @private */ documentHelper: DocumentHelper; private nodes; private editHyperlinkInternal; private startOffset; private startParagraph; private endOffset; private pasteRequestHandler; private endParagraph; private currentProtectionType; private alertDialog; private formFieldCounter; private skipFieldDeleteTracking; private skipFootNoteDeleteTracking; private isForHyperlinkFormat; private isTrackingFormField; private previousBlockToLayout; private isInsertText; private keywordIndex; private casingIndex; private checkLastLetterSpace; private checkLastLetterSpaceDot; private pasteFootNoteType; private footnoteRevision; private isInsertingText; dateValue: string; /** * @private */ isFootnoteElementRemoved: boolean; /** * @private */ isEndnoteElementRemoved: boolean; /** * @private */ handledEnter: boolean; /** * @private */ removeEditRange: boolean; /** * @private */ isRemoveRevision: boolean; /** * @private */ isFootNoteInsert: boolean; /** * @private */ isTableInsert: boolean; /** * @private */ isFootNote: boolean; /** * @private */ isHandledComplex: boolean; /** * @private */ isUserInsert: boolean; /** * @private */ tableResize: TableResizer; /** * @private */ tocStyles: TocLevelSettings; /** * @private */ triggerPageSpellCheck: boolean; /** * @private */ chartType: boolean; /** * @private */ removedBookmarkElements: BookmarkElementBox[]; /** * @private */ removedEditRangeStartElements: EditRangeStartElementBox[]; /** * @private */ removedEditRangeEndElements: EditRangeEndElementBox[]; /** * @private */ tocBookmarkId: number; /** * @private */ copiedData: string; /** * @private */ isPasteContentCheck: boolean; private animationTimer; private pageRefFields; private delBlockContinue; private delBlock; private delSection; /** * @private */ isInsertingTOC: boolean; /** * @private */ isMeasureParaWidth: boolean; private editStartRangeCollection; private skipReplace; private skipTableElements; private removedTextNodes; private editRangeID; /** * @private */ isImageInsert: boolean; /** * @private */ isSkipOperationsBuild: boolean; /** * @private */ isCellFormatApplied: boolean; /** * @private */ revisionData: MarkerInfo[]; /** * @private */ splittedRevisions: MarkerInfo[]; /** * @private */ isSkipComments: boolean; private currentHashValue; /** * @private */ isRemoteAction: boolean; /** * @private */ isIncrementalSave: boolean; /** * @private */ listNumberFormat: string; /** * @private */ listLevelPattern: ListLevelPattern; /** * @private */ listLevelNumber: number; /** * @private */ isXmlMapped: boolean; private isAutoList; private isLastParaMarkCopied; private combineLastBlock; /** * @private */ remotePasteRevision: Revision[]; /** * @private */ isFieldOperation: boolean; /** * @private * @returns {boolean} - Returns the restrict formatting */ readonly restrictFormatting: boolean; /** * @private * @returns {boolean} - Returns the restrict editing */ readonly restrictEditing: boolean; /** * @private * @returns {boolean} - Returns the can edit content control. */ readonly canEditContentControl: boolean; /** * @private */ copiedContent: any; /** * @private */ copiedTextContent: string; /** * @private */ previousParaFormat: WParagraphFormat; private previousCharFormat; private previousSectionFormat; private currentPasteOptions; private pasteTextPosition; /** * @private */ isPaste: boolean; /** * @private */ isPasteListUpdated: boolean; /** * @private */ isHtmlPaste: boolean; /** * @private */ base64: Base64; /** * @private */ isInsertField: boolean; /** * Initialize the editor module * * @param {DocumentHelper} documentHelper - Document helper * @private */ constructor(documentHelper: DocumentHelper); private readonly viewer; private readonly editorHistory; /** * @private */ isBordersAndShadingDialog: boolean; /** * @private */ pasteImageIndex: Dictionary<string, string>; private readonly selection; private readonly owner; private getModuleName; /** * Sets the field information for the selected field. * * @param { FieldInfo } fieldInfo – Specifies the field information. * @returns {void} * > Nested field gets replaced completely with the specified field information. */ setFieldInfo(fieldInfo: FieldInfo): void; /** * Inserts the specified field at cursor position. * * @param {string} code Specify the field code. * @param {string} result Specify the field result. * @returns {void} */ insertField(code: string, result?: string): void; /** * @private */ isLinkedStyle(styleName: string): boolean; /** * Applies the specified style for paragraph. * * @param {string} style Specify the style name to apply. * @param {boolean} clearDirectFormatting - Removes manual formatting (formatting not applied using a style) * from the selected text, to match the formatting of the applied style. Default value is false. * @returns {void} */ applyStyle(style: string, clearDirectFormatting?: boolean): void; /** * Moves the selected content in the document editor control to clipboard. * * @returns {void} */ cut(): void; /** * Inserts the editing region where everyone can edit. * * @returns {void} */ insertEditingRegion(): void; /** * Inserts the editing region where mentioned user can edit. * * @returns {void} */ insertEditingRegion(user: string): void; /** * Enforces the document protection by protection type. * * @param {string} credential Specify the credential to protect the document. * * @param {ProtectionType} protectionType Specify the document protection type. * * @returns {void} */ enforceProtection(credential: string, protectionType: ProtectionType): void; /** * Enforces the document protection with the specified credential. * * @param {string} credential Specify the credential to protect the document. * * @param {boolean} limitToFormatting True if to limit the document formatting; Otherwise, false. * * @param {boolean} isReadOnly True if to allow read-only access to the document; Otherwise, false. * * @returns {void} */ enforceProtection(credential: string, limitToFormatting: boolean, isReadOnly: boolean): void; /** * Enforces the document protection with the specified protection type. * * @param {string} credential Specify the credential to protect the document. * * @param {ProtectionType} protectionType Specify the document protection type. * * @returns {Promise} Returns a Promise which is resolved when protection is enforced, or rejected if for any reason protection cannot be enforced. */ enforceProtectionAsync(credential: string, protectionType: ProtectionType): Promise<void>; /** * Enforces the document protection with the specified credential. * * @param {string} credential Specify the credential to protect the document. * * @param {boolean} limitToFormatting True if to limit the document formatting; Otherwise, false. * * @param {boolean} isReadOnly True if to allow read-only access to the document; Otherwise, false. * * @returns {Promise} Returns a Promise which is resolved when protection is enforced, or rejected if for any reason protection cannot be enforced. */ enforceProtectionAsync(credential: string, limitToFormatting: boolean, isReadOnly: boolean): Promise<void>; private getCommentHierarchicalIndex; private alertBox; /** * Inserts a reply to a comment. * * @param {string} id - The unique identifier of the comment to reply to. * @param {string} text - The text of the reply. * @param {CommentProperties} commentProperties - The properties of the reply (author, isResolved, dateTime). * @returns {Comment} Returns the inserted reply comment. */ insertReplyComment(id: string, text: string, commentProperties: CommentProperties): Comment; private getCommentInfo; /** * Inserts the comment. * * @param {string} text Specify the comment text to be inserted. * @returns {void} */ insertComment(text?: string): void; /** * Inserts a comment with the specified properties. * * @param {string} text The text of the comment to be inserted. * @param {CommentProperties} commentProperties The properties of the comment (author, isResolved, dateTime). * @returns {Comment} The inserted comment. */ insertComment(text: string, commentProperties: CommentProperties): Comment; /** * @private */ parseDateTime(dateTime: string): Date; private insertCommentInternal; /** * @private */ updateCommentElement(commentAdv: CommentElementBox, commentRangeStart: CommentCharacterElementBox, commentRangeEnd: CommentCharacterElementBox, markerData: MarkerInfo): CommentElementBox; /** * Deletes all the comments in the current document. * * @returns {void} */ deleteAllComments(): void; /** * Deletes the specified comment. * If the provided id corresponds to a parent comment, the entire comment along with its replies will be deleted. * If the provided id corresponds to a single reply comment, only that particular reply will be deleted. * * @param {string} [id] - The unique identifier of the comment to be deleted. If not provided, the currently selected comment will be deleted. * @returns {void} */ deleteComment(id?: string): void; /** * @param {CommentElementBox} comment - Specified the comment element box * @private * @returns {void} */ deleteCommentInternal(comment: CommentElementBox): void; private deleteCommentWidgetInternal; /** * @param {CommentElementBox} comment - Specified the comment element box * @private * @returns {void} */ deleteCommentWidget(comment: CommentElementBox): void; /** * @param {CommentElementBox} comment - Specified the comment element box * @private * @returns {void} */ resolveComment(comment: CommentElementBox): void; /** * @param {CommentElementBox} comment - Specified the comment element box * @private * @returns {void} */ reopenComment(comment: CommentElementBox): void; /** * @private */ resolveOrReopenComment(comment: CommentElementBox, resolve: boolean): void; /** * @param {CommentElementBox} parentComment - Specified the parent comment * @param {string} text - Specified the text. * @private * @returns {void} */ replyComment(parentComment: CommentElementBox, text?: string, mentions?: FieldSettingsModel[], markerData?: MarkerInfo): void; private removeInline; /** * @param {CommentElementBox} commentWidget - Specifies the comment * @param {boolean} isNewComment - Specifies is new comment * @param {boolean} showComments - Specifies show comments * @param {boolean} selectComment - Specified select comment * @private * @returns {void} */ addCommentWidget(commentWidget: CommentElementBox, isNewComment: boolean, showComments: boolean, selectComment: boolean): void; /** * @param {CommentElementBox} comment - Specifies comment element box * @param {string} hierarchicalIndex - Specifies the hierachical index. * @private * @returns {void} */ addReplyComment(comment: CommentElementBox, hierarchicalIndex: string): void; /** * @param {string} password - Specifies the password * @param {string} protectionType - Specifies the protection type * @param {boolean} isAsync - specifies whether the send method is synchronous or asynchronous * @private * @returns {void} */ addProtection(password: string, protectionType: ProtectionType, isAsync?: boolean): Promise<void>; private protectionFailureHandler; private enforceProtectionInternal; /** * @private */ enforceProtectionAssign(saltValue: string, hashValue: string, protectionType: ProtectionType): void; private toggleTrackChangesProtection; /** * @private */ protectDocument(protectionType: ProtectionType): void; /** * Stops the document protection. * * @param {string} password Specify the password to stop protection. * @returns {void} */ stopProtection(password: string): void; /** * Stops the document protection. * * @param {string} password Specify the password to stop protection. * @returns {Promise} Returns a Promise which is resolved when protection is stopped, or rejected if for any reason protection cannot be stopped. */ stopProtectionAsync(password: string): Promise<void>; private onUnProtectionSuccess; /** * @private */ validateHashValue(currentHashValue: string): void; /** * @private * @returns {void} */ unProtectDocument(): void; /** * Notify content change event * * @private * @returns {void} */ fireContentChange(): void; /** * Update physical location for text position * * @param {boolean} isSelectionChanged - Specifies the selection change * @private * @returns {void} */ updateSelectionTextPosition(isSelectionChanged: boolean): void; /** * @private * @returns {void} */ onTextInputInternal: () => void; /** * Predict text * * @private * @returns {void} */ predictText(): void; private getPrefixAndSuffix; /** * Fired on paste. * * @param {ClipboardEvent} event - Specfies clipboard event * @private * @returns {void} */ onPaste: (event: ClipboardEvent) => void; /** * key action * @private * @returns {void} */ onKeyDownInternal(event: KeyboardEvent, ctrl: boolean, shift: boolean, alt: boolean): void; /** * @private * @returns {void} */ handleShiftEnter(): void; /** * Handles back key. * * @private * @returns {void} */ handleBackKey(): void; /** * Handles delete * * @private * @returns {void} */ handleDelete(): void; /** * Handles enter key. * * @private * @returns {void} */ handleEnterKey(): void; /** * Handles Control back key. * * @private * @returns {void} */ handleCtrlBackKey(): void; /** * Handles Ctrl delete * * @private * @returns {void} */ handleCtrlDelete(): void; /** * @private * @returns {void} */ handleTextInput(text: string): void; /** * Copies to format. * @param {WCharacterFormat} format * @private * @returns {void} */ copyInsertFormat(format: WCharacterFormat, copy: boolean, widget?: ParagraphWidget): WCharacterFormat; private getResultContentControlText; insertContentControlPlaceholder(): void; /** * Inserts a content control. * * @param {ContentControlType} type - The type of content control to insert. * @param {string} [value] - The value for the content control, if applicable. * @returns {ContentControlInfo} The inserted content control information. * * {% codeBlock src='editor-insertContentControl/index.md' %}{% endcodeBlock %} */ insertContentControl(type: ContentControlType, value?: string): ContentControlInfo; /** * Inserts a content control. * * @param {ContentControlType} type - The type of content control to insert. * @param {boolean} [value] - The boolean value for the content control, if applicable. * @returns {ContentControlInfo} The inserted content control information. * * {% codeBlock src='editor-insertContentControl/index.md' %}{% endcodeBlock %} */ insertContentControl(type: ContentControlType, value?: boolean): ContentControlInfo; /** * Inserts a content control. * * @param {ContentControlType} type - The type of content control to insert. * @param {string} [value] - The value for the content control, if applicable. * @param {string[]} [items] - The items for the content control, applicable if the type is combobox or dropdownlist. * @returns {ContentControlInfo} The inserted content control information. * * {% codeBlock src='editor-insertContentControl/index.md' %}{% endcodeBlock %} */ insertContentControl(type: ContentControlType, value?: string, items?: string[]): ContentControlInfo; /** * Inserts a content control with the specified content control properties. * * @param {ContentControlInfo} info - The content control information specifying the properties of the content control to insert * @returns {ContentControlInfo} The inserted content control information. * * {% codeBlock src='editor-insertContentControl/index.md' %}{% endcodeBlock %} */ insertContentControl(info: ContentControlInfo): ContentControlInfo; private applyRichText; private applyPlainText; private applyComboBox; private applyDatePickerContentControl; private applyCheckBoxContentControl; /** * Apply the content Control properties to the picture content Control * @param {type} refers the type of Content control. */ private applyPictureContentControl; /** * @private * @returns {void} */ dropDownChange(contentControl: ContentControl, value: string): void; private updateXmlMappedContentControl; private updateCustomXml; /** * Inserts the specified text at cursor position * @param {string} text Specify the text to insert. */ insertText(text: string): void; /** * @private * @returns {void} */ insertTextInternal(text: string, isReplace: boolean, revisionType?: RevisionType, allowLayout?: boolean): void; private extendSelectionToBookmarkStart; private updateElementInFieldRevision; /** * Retrieves the resultant field text from the specified field element box. * @param item Specify the field element box to retrieve field text. * @returns Returns the resultant field text. */ retrieveFieldResultantText(item: FieldElementBox): string; private checkToCombineRevisionsinBlocks; private checkToMapRevisionWithNextNode; private checkToMapRevisionWithPreviousNode; private checkToMapRevisionWithInlineText; private combineElementRevisions; private applyMatchedRevisionInorder; private copyElementRevision; private mapMatchedRevisions; private isRevisionAlreadyIn; private getMatchedRevisionsToCombine; private decideInlineForTrackChanges; /** * @private * @returns {void} */ insertIMEText(text: string, isUpdate: boolean): void; /** * Inserts the section break at cursor position with specified section break type. * * @param {SectionBreakType} sectionBreakType Specifies the section break type. * > If this parameter is not set, it inserts the section break of type new page. * @returns {void} */ insertSectionBreak(sectionBreakType?: SectionBreakType, sectionFormat?: WSectionFormat): void; private combineRevisionWithBlocks; private checkToCombineRevisionWithNextPara; private checkToCombineRevisionWithPrevPara; private combineRevisionWithNextPara; private combineRevisionWithPrevPara; /** * Removes the specified revision from the document. * * @param revisionToRemove Specify the revision to be removed. * @returns {void} */ removeRevision(revisionToRemove: Revision): any; /** * Clears the specified revision from the document. * * @param revision Specify the revision to clear from the document. * @returns {void} */ clearElementRevision(revision: Revision): void; /** * @private * @returns {void} */ insertRevision(item: any, type: RevisionType, author?: string, date?: string, spittedRange?: object[], skip?: boolean, parseRevisionId?: string): Revision; private insertRevisionForFootnoteWidget; /** * Method help to clear previous revisions and include new revision at specified index * * @param range - range of elements to be cleared * @param revision - revision to be inserted * @param index - index at which to be included in the revision range * @returns {void} */ private clearAndUpdateRevisons; private splitRevisionByElement; /** * Method to update revision for the splitted text element * @param inline - Original text element * @param splittedSpan - Splitted element */ private updateRevisionForSpittedTextElement; /** * @private */ getRevision(revisionId: string): Revision; private isRevisionMatched; private compareElementRevision; private canInsertRevision; private insertRevisionAtEnd; private insertRevisionAtPosition; private insertRevisionAtBegining; private splitRevisionForSpittedElement; /** * Method to combine element revision if not inserts new revision */ private combineElementRevision; /** * @private * @returns {void} */ removeMarkerInfoRevision(revisionID: string, markerInfo: MarkerInfo[]): void; private combineRevisions; private handleDeleteTrackingForParaMark; /** * Method to update the revision for whole block * * @private * @returns {void} */ insertRevisionForBlock(widget: ParagraphWidget, revisionType: RevisionType, isTOC?: boolean, revision?: Revision, skipReLayout?: boolean, isRemoveInline?: boolean): void; /** * @private */ getLastParaForBodywidgetCollection(widget: ParagraphWidget): IWidget; private updatePasteRevision; private updateRevisionCollection; /** * @private * @returns {BodyWidget} */ insertSection(selection: Selection, selectFirstBlock: boolean, isUndoing?: boolean, sectionBreakContinuous?: boolean, sectionBreakNewPage?: boolean, sectionFormat?: WSectionFormat): BlockWidget; /** * @private */ splitBodyWidget(bodyWidget: BodyWidget, sectionFormat: WSectionFormat, startBlock: BlockWidget, sectionBreakContinuous?: boolean, sectionBreakNewPage?: boolean): BodyWidget; private insertRemoveHeaderFooter; private updateBlockIndex; /** * @private * @returns {void} */ updateSectionIndex(sectionFormat: WSectionFormat, startBodyWidget: BodyWidget, increaseIndex: boolean): void; /** * @private * @returns {void} */ updateColumnIndex(startBodyWidget: BodyWidget, increaseIndex: boolean): void; private checkAndConvertList; private checkNextLevelAutoList; private isConvertList; private getNumber; private getListLevelPattern; private autoConvertList; private checkNumberFormat; private checkLeadingZero; private getPageFromBlockWidget; /** * @private * @returns {void} */ insertTextInline(element: ElementBox, selection: Selection, text: string, index: number, skipReLayout?: boolean): void; private insertFieldBeginText; private insertBookMarkText; private insertFieldSeparatorText; private insertFieldEndText; private insertImageText; /** * @private */ private isListTextSelected; private checkAndConvertToHyperlink; private autoFormatHyperlink; private appylingHyperlinkFormat; private createHyperlinkElement; private insertHyperlinkfield; /** * @private */ unlinkRangeFromRevision(inline: any, removeCollection?: boolean): void; /** * @private */ constructRevisionnsForLink(inline: any, isRemove: boolean): void; /** * @private */ unlinkWholeRangeInRevision(item: any, revision: Revision): void; /** * @private * @returns {void} */ unLinkFieldCharacter(inline: ElementBox): void; private getCharacterFormat; /** * Inserts the Hyperlink. * * @param {string} address Specify the Hyperlink URL to be inserted. * @param {string} displayText Specify the display text for the hyperlink * @param {string} screenTip Specify the screen tip text. * @returns {void} */ insertHyperlink(address: string, displayText?: string, screenTip?: string): void; /** * @private */ insertHyperlinkInternal(url: string, displayText: string, remove: boolean, isBookmark?: boolean): void; private insertHyperlinkInternalInternal; private insertHyperlinkByFormat; /** * @private */ initInsertInline(element: ElementBox, insertHyperlink?: boolean, isInsertRemovedBookamrk?: boolean): void; private insertElementInCurrentLine; /** * Edit Hyperlink * @param {Selection} selection - Specified the selection * @param {string} url - Specifies the url * @param {string} displayText - Specified the display test * @param {boolean} isBookmark - Specifies is bookmark * @private * @returns {boolean} - Return tru of hyperlink is edited. */ editHyperlink(selection: Selection, url: string, displayText: string, isBookmark?: boolean): boolean; private insertClonedFieldResult; private getClonedFieldResultWithSel; private getClonedFieldResult; /** * Removes the content control if selection is in content control * @returns {void} * @private */ removeContentControl(): void; /** * Removes the content control if selection is in content control * @returns {void} * @private */ removeContentControlInternal(): void; /** * Removes the hyperlink if selection is within hyperlink. * * @returns {void} */ removeHyperlink(): void; /** * @private */ updateHyperlinkFormat(selection: Selection): void; /** * Paste copied clipboard content on Paste event * @param {ClipboardEvent} event - Specifies the paste event * @param {any} pasteWindow - Specifies the paste window * @private */ pasteInternal(event: ClipboardEvent, pasteWindow?: any): void; private pasteImage; /** * @private * @returns {void} */ onPasteImage(data: string): void; private pasteAjax; /** * @private * @returns {void} */ pasteFormattedContent(result: any): void; private onPasteFailure; /** * Pastes the provided sfdt content or the data present in local clipboard if any. * * @param {string} sfdt Specifies the sfdt content to paste at current position. * @param {PasteOptions} defaultPasteOption Specifies the paste options. * @returns {void} */ paste(sfdt?: string, defaultPasteOption?: PasteOptions): void; /** * @private */ getUniqueListOrAbstractListId(isList: boolean): number; private checkSameLevelFormat; private listLevelPatternInCollection; private isEqualParagraphFormat; private getBlocksToUpdate; private updateListIdForBlocks; private updatePasteContent; /** * @private */ getBlocks(pasteContent: any, isPaste: boolean, sections?: BodyWidget[], comments?: CommentElementBox[], revision?: Revision[]): BodyWidget[]; private applyMergeFormat; private applyParaFormatInternal; private applyFormatInternal; /** * @private */ applyPasteOptions(options: PasteOptions, isPasteOptionTextOnly?: boolean): void; /** * @private */ applyTablePasteOptions(options: TablePasteOptions): void; /** * @private * @returns {void} */ pasteContents(content: any, currentFormat?: WParagraphFormat): void; private pasteContentsInternal; private defaultPaste; private pasteAsNewColumn; private pasteAsNestedTable; private pasteOverwriteCell; private pasteAsNewRow; private tableUpdate; private rowspannedCollection; private insertSpannedCells; private addRows; private pasteContent; private pasteCopiedData; private arrangeEndnoteCollection; private arrangeFootnoteCollection; private generateTableRevision; private isSectionEmpty; /** * Insert table on undo * * @param {TableWidget} table - Specifies the table * @param {TableWidget} newTable - Speciefies the new table * @param {boolean} moveRows - Specifies the new row * @private * @private {void} */ insertTableInternal(table: TableWidget, newTable: TableWidget, moveRows: boolean, skipRemoving?: boolean): void; private removeRevisionFromTable; private canConstructRevision; private constructRevisionsForTable; private deleteRevision; private constructRevisionForFootnote; private constructRevisionsForBlock; /** * @private * @param paraWidget * @param startoffset * @param endoffset * @param revisionId * @param isParaMarkIncluded * @returns {void} */ applyRevisionForCurrentPara(paraWidget: ParagraphWidget, startoffset: number, endoffset: number, revisionId: string, isParaMarkIncluded: boolean): void; /** * Insert table on undo * * @param {Selection} selection - Specified the selection * @param {WBlock} block - Spcifies the block * @param {WTable} table - Specifies the table. * @private * @returns {void} */ insertBlockTable(selection: Selection, block: BlockWidget, table: TableWidget): void; /** * On cut handle selected content remove and relayout * * @param {Selection} selection - Specified the selection * @private * @returns {void} */ handleCut(selection: Selection): void; private insertInlineInternal; private insertElement; private updateRevisionForElement; private insertElementInternal; private incrementCommentIndex; /** * @private * @returns {void} */ constructRevisionFromID(insertElement: any, isEnd: boolean, prevElement?: ElementBox, index?: number): void; /** * Insert block on undo * * @param {Selection} selection - Specifies the selection * @param {WBlock} block - Specifes the block * @private * @returns {void} */ insertBlock(block: BlockWidget): void; private insertBlockInternal; /** * Inserts the image with specified size at cursor position in the document editor. * * * @param {string} imageString Base64 string, web URL or file URL. * @param {number} width Specify the image width. * @param {number} height Specify the image height. * @param {string} alternateText Specify the image alternateText. * @returns {void} */ insertImage(imageString: string, width?: number, height?: number, alternateText?: string): void; /** * Inserts an image with a specified size at the cursor position in the DocumentEditor component. * * @param {string} imageString - The Base64 string, web URL, or file URL of the image to be inserted. * @param {number} width - The width of the image. Optional parameter, if not specified, the original width of the image will be used. * @param {number} height - The height of the image. Optional parameter, if not specified, the original height of the image will be used. * @param {string} alternateText - The alternate text of the image. Optional parameter, if specified, this text will be displayed when the image is not available or when images are disabled in the document. * @returns {Promise<void>} - A Promise that is resolved when the image has been inserted successfully, or rejected if the image could not be inserted for any reason. */ insertImageAsync(imageString: string, width?: number, height?: number, alternateText?: string): Promise<void>; /** * Inserts the image with specified size at cursor position in the document editor. * * @private * @param {string} imageString Base64 string, web URL or file URL. * @param {boolean} isUiInteracted Is image instered from UI interaction. * @param {number} width? Image width * @param {number} height? Image height * @param {string} alternateText? Image alternateText * @returns {void} */ insertImageInternal(imageString: string, isUiInteracted: boolean, width?: number, height?: number, alternateText?: string): Promise<void>; /** * Inserts a table of specified size at cursor position in the document editor. * * @param {number} rows Default value of ‘rows’ parameter is 1. * @param {number} columns Default value of ‘columns’ parameter is 1. * @returns {void} */ insertTable(rows?: number, columns?: number): void; /** * Inserts the specified number of rows to the table above or below to the row at cursor position. * * @param {boolean} above The above parameter is optional and if omitted, * it takes the value as false and inserts below the row at cursor position. * @param {number} count The count parameter is optional and if omitted, it takes the value as 1. * @returns {void} */ insertRow(above?: boolean, count?: number): void; private rowInsertion; /** * Fits the table based on AutoFitType. * * @param {AutoFitType} fitType Specify the auto fit type. * @returns {void} */ autoFitTable(fitType: AutoFitType): void; /** * * @private * @returns {void} */ insertAutoFitTable(fitType: AutoFitType, tableAdv?: TableWidget): void; /** * Inserting the row for collaborative editing. * @private * @returns {void} */ rowInsertionForCE(index: number, cellCount: number, insertrow: number, table: TableWidget, rowData: any, cellData: any[], paragraphData: any[], characterData: any[]): void; private updateCellFormatForInsertedRow; private updateRowspan; private getInsertedTable; private insertTableRows; /** * Inserts the specified number of columns to the table left or right to the column at cursor position. * * @param {number} left The left parameter is optional and if omitted, it takes the value as false and * inserts to the right of column at cursor position. * @param {number} count The count parameter is optional and if omitted, it takes the value as 1. * @returns {void} */ insertColumn(left?: boolean, count?: number): void; /** * Inserting the cell for collaborative editing. * @private * @returns {void} */ cellInsertionForCE(index: number, row: TableRowWidget, cellData: any, paragraphData: any, characterData: any): void; private copyCellFormats; private copyContent; private tableReLayout; /** * Creates table with specified rows and columns. * @private * * @returns {TableWidget} */ createTable(rows: number, columns: number): TableWidget; private createRowAndColumn; private createColumn; private getColumnCountToInsert; private getRowCountToInsert; /** * @private */ getOwnerCell(isStart: boolean): TableCellWidget; private getOwnerRow; private getOwnerTable; /** * Merge Selected cells * * @private * @returns {void} */ mergeSelectedCellsInTable(): void; private confirmCellMerge; private mergeSelectedCells; private mergeBorders; private updateBlockIndexAfterMerge; /** * Determines whether the merge cell operation can be done. * * @returns {boolean} Returns true if to merge cells; Otherwise, false. */ canMergeCells(): boolean; private canMergeSelectedCellsInTable; private checkCellWidth; private checkCellWithInSelection; private checkPrevOrNextCellIsWithinSel; private checkCurrentCell; private checkRowSpannedCells; /** * @private * @returns {void} */ insertNewParagraphWidget(newParagraph: ParagraphWidget, insertAfter: boolean): void; private insertParagraph; private moveInlines; private moveContent; private updateRevisionForMovedContent; /** * update complex changes when history is not preserved * * @param {number} action - Specifies the action * @param {string} start - Specifies the selection start * @param {string} end - Specified the selection end * @private * @returns {void} */ updateComplexWithoutHistory(action?: number, start?: string, end?: string): void; /** * Re-layout content. * * @param {Selection} selection - Specifies the selection * @param isSelectionChanged - Specifies the selection changed * @private * @returns {void} */ reLayout(selection: Selection, isSelectionChanged?: boolean, isLayoutChanged?: boolean): void; /** * @private * @returns {void} */ updateHeaderFooterWidget(headerFooterWidget?: HeaderFooterWidget): void; private updateHeaderFooterWidgetToPage; private updateHeaderFooterWidgetToPageInternal; /** * @private * @returns {void} */ removeFieldInWidget(widget: Widget, isBookmark?: boolean, isContentControl?: boolean): void; /** * @private * @returns {void} */ removeFieldInBlock(block: BlockWidget, isBookmark?: boolean, isContentControl?: boolean): void; private removeFieldTable; private shiftFootnotePageContent; /** * @private * @returns {void} */ shiftPageContent(type: HeaderFooterType, sectionFormat: WSectionFormat): void; private checkAndShiftFromBottom; private allowFormattingInFormFields; /** * @private * @returns {void} */ getContentControl(): ContentControl; private checkPlainTextContentControl; /** * Applies character format for selection. * * @param {string} property - Specifies the property * @param {Object} value - Specifies the value * @param {boolean} update - Spcifies the update * @private * @returns {void} */ onApplyCharacterFormat(property: string, value: Object, update?: boolean, applyStyle?: boolean): void; private applyCharacterFormatForListText; private applyListCharacterFormatByValue; /** * @private * @returns {void} */ updateListCharacterFormat(selection: Selection, property: string, value: Object): void; private updateListTextSelRange; /** * @private * @returns {void} */ updateInsertPosition(): void; /** * Preserve paragraph and offset value for selection * * @private * @returns {void} */ setOffsetValue(selection: Selection): void; /** * Toggles the highlight color property of selected contents. * * @param {HighlightColor} highlightColor Specify the highlight color to be applied (default: Yellow). * @returns {void} */ toggleHighlightColor(highlightColor?: HighlightColor): void; /** * Toggles the subscript formatting of selected contents. * * @returns {void} */ toggleSubscript(): void; /** * Toggles the superscript formatting of selected contents. * * @returns {void} */ toggleSuperscript(): void; /** * Increases the left indent of selected paragraphs to a factor of 36 points. * * @returns {void} */ increaseIndent(): void; /** * Decreases the left indent of selected paragraphs to a factor of 36 points. * * @returns {void} */ decreaseIndent(): void; /** * Clears the list format for selected paragraphs. * * @returns {void} */ clearList(): void; /** * Applies the bullet list to selected paragraphs. * * @param {string} bullet Specify the bullet character to be applied. * @param {string} fontFamily Specify the bullet font family name. * @returns {void} */ applyBullet(bullet: string, fontFamily: string): void; /** * Applies the numbering list to selected paragraphs. * * @param {string} numberFormat “%n” representations in ‘numberFormat’ parameter will be replaced by respective list level’s value. * `“%1)” will be displayed as “1)” ` * @param {ListLevelPattern} listLevelPattern Default value of ‘listLevelPattern’ parameter is ListLevelPattern.Arabic * @returns {void} */ applyNumbering(numberFormat: string, listLevelPattern?: ListLevelPattern): void; /** * Toggles the baseline alignment property of selected contents. * * @param {BaselineAlignment} baseAlignment Specifies the baseline alignment. * @returns {void} */ toggleBaselineAlignment(baseAlignment: BaselineAlignment): void; private clearFormattingInternal; /** * Clears the formatting. * * @returns {void} */ clearFormatting(): void; private updateProperty; private getCompleteStyles; /** * Initialize default styles * * @private * @returns {void} */ intializeDefaultStyles(): void; /** * Creates a new style or modifies an existing style with the specified style properties. * * > If modifyExistingStyle parameter is set to true and a style already exists with same name, it modifies the specified properties in the existing style. * > If modifyExistingStyle parameter is set to false and a style already exists with same name, it creates a new style with unique name by appending ‘_1’. Hence, the newly style will not have the specified name. * > If no style exists with same name, it creates a new style. * * @param {string} styleString The style properties. * @param {boolean} modifyExistingStyle The Boolean value denotes whether to modify the properties in the existing style or create a new style. * * @returns {string} Returns the name of the created style. */ createStyle(styleString: string, modifyExistingStyle?: boolean): string; /** * @private * Adds a new style to the document or updates an existing style. * * @param {string} styleString - The style to be added or updated. * @param {boolean} modifyExistingStyle - Whether to modify an existing style. * @returns {Object} - The style that was added or updated. */ createStyleIn(styleString: string, modifyExistingStyle: boolean): Object; /** * Modify the Style * @private * @returns {void} */ private setStyle; private getStyle; private getUniqueStyleName; private getUniqueName; /** * Update Character format for selection * @private */ updateSelectionCharacterFormatting(property: string, values: Object, update: boolean): void; private updateCharacterFormat; private updateCharacterFormatWithUpdate; private applyCharFormatSelectedContent; private applyCharFormatForSelectedPara; private splittedLastParagraph; private getNextParagraphForCharacterFormatting; private applyCharFormat; /** * Toggles the bold property of selected contents. * * @returns {void} */ toggleBold(): void; /** * Toggles the bold property of selected contents. * * @returns {void} */ toggleItalic(): void; /** * Change the selected text to uppercase. * @private */ changeCase(property: string): void; /** * Change the selected text case. * @private */ changeSelectedTextCase(selection: Selection, startPosition: TextPosition, endPosition: TextPosition, property: string, removedTextNodes?: IWidget[]): void; private changeTextCase; private changeCaseParagraph; private changeCaseInline; private addRemovedTextNodes; private changeCaseInlineInternal; private changeCaseNextBlock; private getNextBlockForChangeCase; private getChangeCaseText; private capitalizeFirst; private sentencecase; private togglecase; private changeCaseForTable; private changeCaseForSelectedCell; private changeCaseForSelectedPara; private changeCaseForSelTable; private changeCaseParaFormatInCell; private changeCaseParaForTableCell; private changeCaseParaForCellInternal; private changeCaseParaFormatTableInternal; private changeCaseParaForRow; /** * Toggles the all Caps formatting for the selected content. * * @returns {void} */ toggleAllCaps(): void; toggleChangeCase(): string; private getCurrentSelectionValue; private getSelectedCharacterFormat; /** * Toggles the underline property of selected contents. * * @param underline Specify the underline to be toggled (default: Single). * @returns {void} */ toggleUnderline(underline?: Underline): void; /** * Toggles the strike through property of selected contents. * * @param {Strikethrough} strikethrough Specify the strike through to be toggled (default: SingleStrike). * @returns {void} */ toggleStrikethrough(strikethrough?: Strikethrough): void; private updateFontSize; private applyCharFormatInline; private formatInline; private updateRevisionForFormattedContent; private applyCharFormatCell; private applyCharFormatForSelectedCell; private applyCharFormatRow; private applyCharFormatForTable; private applyCharFormatForSelTable; private applyCharFormatForTableCell; /** * private * @returns {CellInfo} */ updateSelectedCellsInTable(start: number, end: number, endCellLeft: number, endCellRight: number): CellInfo; private getCharacterFormatValueOfCell; /** * Apply Character format for selection * * @private * @returns {void} */ applyCharFormatValueInternal(selection: Selection, format: WCharacterFormat, property: string, value: Object): void; private copyInlineCharacterFormat; private applyCharFormatValue; /** * @private */ updateStyleObject(styleData: Object): void; /** * @private * @returns {void} */ onImageFormat(elementBox: ImageElementBox, width: number, height: number, alternateText: string): void; /** * Toggles the text alignment of selected paragraphs. * * @param {TextAlignment} textAlignment Specifies the text alignment. * @returns {void} */ toggleTextAlignment(textAlignment: TextAlignment): void; /** * @private */ setPreviousBlockToLayout(): void; /** * Apply borders for selected paragraph borders * @private */ applyParagraphBorder