@syncfusion/ej2-documenteditor
Advanced tools
Comparing version 17.3.19 to 17.3.21
@@ -7,2 +7,13 @@ # Changelog | ||
#### Bug Fixes | ||
- `#251576` - Enable repeat row header is now enabled properly in table properties dialog. | ||
- `#250638` - Scroll position is now maintained after inserting columns. | ||
- `#253260` - Script error now resolved when double click on header footer. | ||
- `#252506` - Spell checker performance has been improved. | ||
## 17.3.19 (2019-10-22) | ||
### Document Editor | ||
#### New Features | ||
@@ -9,0 +20,0 @@ |
/*! | ||
* filename: index.d.ts | ||
* version : 17.3.19 | ||
* version : 17.3.21 | ||
* Copyright Syncfusion Inc. 2001 - 2019. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
{ | ||
"_from": "@syncfusion/ej2-documenteditor@*", | ||
"_id": "@syncfusion/ej2-documenteditor@17.3.17", | ||
"_id": "@syncfusion/ej2-documenteditor@17.3.19", | ||
"_inBundle": false, | ||
"_integrity": "sha512-f5Ry1Q5yPFRR5LbG3jxLzhPmGPD62+25PRIrBOj+mb5fYijFlFrIboZG6dBpxNmvKMy4zIBeEiwUjn+l+EQ0FQ==", | ||
"_integrity": "sha512-N9QzVEwC1CXp75ZLQ6Di2WSoiYSbVjaR1kr7z0gXxAAO29ye+FEF40/riJZIsFECYPXMTaa8Q08uMJ7QDKdWcg==", | ||
"_location": "/@syncfusion/ej2-documenteditor", | ||
@@ -26,4 +26,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-documenteditor/-/ej2-documenteditor-17.3.17.tgz", | ||
"_shasum": "2b309b9cd7f3ab53c72619a1cd65094c7227e93a", | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-documenteditor/-/ej2-documenteditor-17.3.19.tgz", | ||
"_shasum": "6c876f612c5b808e04432aac4217d7bd5594c550", | ||
"_spec": "@syncfusion/ej2-documenteditor@*", | ||
@@ -42,6 +42,6 @@ "_where": "/jenkins/workspace/ation_hotfix_17.2.0.34_Vol2-DDPJ6C2YEWTWLLKKNA7AG2JBE6DYTCTNGMHGORWGAYAVCL6L7OLQ/packages/included", | ||
"@syncfusion/ej2-compression": "~17.3.19", | ||
"@syncfusion/ej2-dropdowns": "~17.3.19", | ||
"@syncfusion/ej2-dropdowns": "~17.3.21", | ||
"@syncfusion/ej2-file-utils": "~17.3.19", | ||
"@syncfusion/ej2-inputs": "~17.3.19", | ||
"@syncfusion/ej2-navigations": "~17.3.19", | ||
"@syncfusion/ej2-inputs": "~17.3.21", | ||
"@syncfusion/ej2-navigations": "~17.3.21", | ||
"@syncfusion/ej2-office-chart": "~17.3.19", | ||
@@ -76,4 +76,4 @@ "@syncfusion/ej2-popups": "~17.3.19", | ||
"typings": "index.d.ts", | ||
"version": "17.3.19", | ||
"version": "17.3.21", | ||
"sideEffects": false | ||
} |
@@ -259,4 +259,4 @@ /** | ||
HeaderFooterProperties.prototype.onSelectionChange = function () { | ||
this.headerFromTop.value = this.documentEditor.sectionFormat.headerDistance; | ||
this.footerFromTop.value = this.documentEditor.sectionFormat.footerDistance; | ||
this.headerFromTop.value = this.documentEditor.selection.sectionFormat.headerDistance; | ||
this.footerFromTop.value = this.documentEditor.selection.sectionFormat.footerDistance; | ||
if (this.documentEditor.selection.sectionFormat.differentFirstPage) { | ||
@@ -263,0 +263,0 @@ this.firstPage.checked = true; |
@@ -1094,4 +1094,7 @@ var __extends = (this && this.__extends) || (function () { | ||
this.viewer.styles = new WStyles(); | ||
this.viewer.triggerElementsOnLoading = true; | ||
this.viewer.triggerSpellCheck = true; | ||
this.viewer.cachedPages = []; | ||
if (this.enableSpellCheck && !this.spellChecker.enableOptimizedSpellCheck) { | ||
this.viewer.triggerElementsOnLoading = true; | ||
this.viewer.triggerSpellCheck = true; | ||
} | ||
if (!isNullOrUndefined(sfdtText) && this.viewer) { | ||
@@ -1103,4 +1106,6 @@ this.viewer.onDocumentChanged(this.parser.convertJsonToDocument(sfdtText)); | ||
} | ||
this.viewer.triggerElementsOnLoading = false; | ||
this.viewer.triggerSpellCheck = false; | ||
if (this.enableSpellCheck && !this.spellChecker.enableOptimizedSpellCheck) { | ||
this.viewer.triggerElementsOnLoading = false; | ||
this.viewer.triggerSpellCheck = false; | ||
} | ||
} | ||
@@ -1276,2 +1281,3 @@ }; | ||
this.viewer.userCollection.push('Everyone'); | ||
this.viewer.cachedPages = []; | ||
this.viewer.setDefaultDocumentFormat(); | ||
@@ -1278,0 +1284,0 @@ this.viewer.headersFooters.push(hfs); |
@@ -73,15 +73,25 @@ import { ContextMenu as Menu } from '@syncfusion/ej2-navigations'; | ||
_this.currentContextInfo = _this.spellChecker.findCurretText(); | ||
var splittedSuggestion = void 0; | ||
var splittedSuggestion_1; | ||
/* tslint:disable:no-any */ | ||
var allSuggestions = void 0; | ||
var exactData = _this.spellChecker.manageSpecialCharacters(_this.currentContextInfo.text, undefined, true); | ||
if (!isNullOrUndefined(exactData) && _this.spellChecker.errorWordCollection.containsKey(exactData)) { | ||
var allSuggestions_1; | ||
var exactData_1 = _this.spellChecker.manageSpecialCharacters(_this.currentContextInfo.text, undefined, true); | ||
if (!isNullOrUndefined(exactData_1) && _this.spellChecker.errorWordCollection.containsKey(exactData_1)) { | ||
_this.spellChecker.currentContextInfo = _this.currentContextInfo; | ||
if (_this.spellChecker.errorSuggestions.containsKey(exactData)) { | ||
allSuggestions = _this.spellChecker.errorSuggestions.get(exactData).slice(); | ||
splittedSuggestion = _this.spellChecker.handleSuggestions(allSuggestions); | ||
_this.processSuggestions(allSuggestions, splittedSuggestion, isTouch ? event : event); | ||
if (_this.spellChecker.errorSuggestions.containsKey(exactData_1)) { | ||
allSuggestions_1 = _this.spellChecker.errorSuggestions.get(exactData_1).slice(); | ||
splittedSuggestion_1 = _this.spellChecker.handleSuggestions(allSuggestions_1); | ||
_this.processSuggestions(allSuggestions_1, splittedSuggestion_1, isTouch ? event : event); | ||
} | ||
else { | ||
_this.processSuggestions(allSuggestions, splittedSuggestion, isTouch ? event : event); | ||
// tslint:disable-next-line:max-line-length | ||
_this.spellChecker.CallSpellChecker(_this.spellChecker.languageID, exactData_1, false, true, false, false).then(function (data) { | ||
/* tslint:disable:no-any */ | ||
var jsonObject = JSON.parse(data); | ||
allSuggestions_1 = jsonObject.Suggestions; | ||
if (!isNullOrUndefined(allSuggestions_1)) { | ||
_this.spellChecker.errorSuggestions.add(exactData_1, allSuggestions_1.slice()); | ||
splittedSuggestion_1 = _this.spellChecker.handleSuggestions(allSuggestions_1); | ||
} | ||
_this.processSuggestions(allSuggestions_1, splittedSuggestion_1, isTouch ? event : event); | ||
}); | ||
} | ||
@@ -88,0 +98,0 @@ } |
@@ -199,2 +199,3 @@ import { LayoutViewer } from '../index'; | ||
*/ | ||
enableRepeatHeader(): boolean; | ||
/** | ||
@@ -201,0 +202,0 @@ * @private |
@@ -957,4 +957,3 @@ import { createElement, isNullOrUndefined, L10n } from '@syncfusion/ej2-base'; | ||
this.rowHeightType.enabled = enableRowHeight; | ||
// let enabledHeader: boolean = this.enableRepeatHeader() ? false : true; | ||
var enabledHeader = true; | ||
var enabledHeader = this.enableRepeatHeader() ? false : true; | ||
if (isNullOrUndefined(this.owner.selection.rowFormat.isHeader)) { | ||
@@ -1015,14 +1014,14 @@ this.repeatHeader.indeterminate = true; | ||
*/ | ||
// public enableRepeatHeader(): boolean { | ||
// let isFirstRow: number = 0; | ||
// for (let i: number = 0; i < this.owner.selection.selectionRanges.length; i++) { | ||
// let range: SelectionRange = this.owner.selection.selectionRanges.getRange(i); | ||
// let table: WTable = range.start.paragraph.associatedCell.ownerTable; | ||
// if (table.childNodes.indexOf(range.start.paragraph.associatedCell.ownerRow) === 0 || | ||
// table.childNodes.indexOf(range.start.paragraph.associatedCell.ownerRow) === 0) { | ||
// isFirstRow++; | ||
// } | ||
// } | ||
// return isFirstRow === this.owner.selection.selectionRanges.length; | ||
// } | ||
TablePropertiesDialog.prototype.enableRepeatHeader = function () { | ||
var selection = this.owner.selection; | ||
var start = selection.start; | ||
var end = selection.end; | ||
if (!selection.isForward) { | ||
start = selection.end; | ||
end = selection.start; | ||
} | ||
var startCell = start.paragraph.associatedCell; | ||
var endCell = end.paragraph.associatedCell; | ||
return startCell.ownerRow.index === 0 && endCell.ownerTable.equals(startCell.ownerTable); | ||
}; | ||
//#endregion | ||
@@ -1029,0 +1028,0 @@ //#region Cell Format |
@@ -287,2 +287,9 @@ import { LineWidget, ElementBox, BodyWidget, ParagraphWidget, TextElementBox } from '../viewer/page'; | ||
*/ | ||
export interface WordSpellInfo { | ||
hasSpellError: boolean; | ||
isElementPresent: boolean; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
export interface TextInLineInfo { | ||
@@ -289,0 +296,0 @@ elementsWithOffset: Dictionary<TextElementBox, number>; |
@@ -1,4 +0,4 @@ | ||
import { LayoutViewer, ContextElementInfo, ElementInfo, ErrorInfo, WCharacterFormat, SpecialCharacterInfo, SpaceCharacterInfo, TextSearchResult, MatchResults } from '../index'; | ||
import { LayoutViewer, ContextElementInfo, ElementInfo, ErrorInfo, WCharacterFormat, SpecialCharacterInfo, SpaceCharacterInfo, TextSearchResult, MatchResults, WordSpellInfo } from '../index'; | ||
import { Dictionary } from '../../base/dictionary'; | ||
import { ElementBox, TextElementBox, ErrorTextElementBox } from '../viewer/page'; | ||
import { ElementBox, TextElementBox, ErrorTextElementBox, Page } from '../viewer/page'; | ||
import { BaselineAlignment } from '../../base/types'; | ||
@@ -10,2 +10,6 @@ /** | ||
private langIDInternal; | ||
/** | ||
* @private | ||
*/ | ||
uniqueSpelledWords: any[]; | ||
private spellSuggestionInternal; | ||
@@ -28,8 +32,18 @@ /** | ||
currentContextInfo: ContextElementInfo; | ||
/** | ||
* @private | ||
*/ | ||
uniqueKey: string; | ||
private removeUnderlineInternal; | ||
private spellCheckSuggestion; | ||
/** | ||
* @default 1000 | ||
*/ | ||
private uniqueWordsCountInternal; | ||
/** | ||
* @private | ||
*/ | ||
errorSuggestions: Dictionary<string, string[]>; | ||
spellJsonData: string; | ||
private performOptimizedCheck; | ||
/** | ||
@@ -40,2 +54,24 @@ * Gets module name. | ||
/** | ||
* Gets the boolean indicating whether optimized spell check to be performed. | ||
* @aspType bool | ||
* @blazorType bool | ||
*/ | ||
/** | ||
* Sets the boolean indicating whether optimized spell check to be performed. | ||
* @aspType bool | ||
* @blazorType bool | ||
*/ | ||
enableOptimizedSpellCheck: boolean; | ||
/** | ||
* Gets the spell checked Unique words. | ||
* @aspType int | ||
* @blazorType int | ||
*/ | ||
/** | ||
* Sets the spell checked Unique words. | ||
* @aspType int | ||
* @blazorType int | ||
*/ | ||
uniqueWordsCount: number; | ||
/** | ||
* Gets the languageID. | ||
@@ -200,3 +236,5 @@ * @aspType int | ||
*/ | ||
checkElementCanBeCombined(elementBox: TextElementBox, underlineY: number, beforeIndex: number, callSpellChecker: boolean): boolean; | ||
checkElementCanBeCombined(elementBox: TextElementBox, underlineY: number, beforeIndex: number, callSpellChecker: boolean, textToCombine?: string, isNext?: boolean, isPrevious?: boolean, canCombine?: boolean): boolean; | ||
private lookThroughPreviousLine; | ||
private lookThroughNextLine; | ||
/** | ||
@@ -243,3 +281,3 @@ * Method to handle combined elements | ||
*/ | ||
CallSpellChecker(languageID: number, word: string, checkSpelling: boolean, checkSuggestion: boolean, addWord?: boolean): Promise<any>; | ||
CallSpellChecker(languageID: number, word: string, checkSpelling: boolean, checkSuggestion: boolean, addWord?: boolean, isByPage?: boolean): Promise<any>; | ||
/** | ||
@@ -305,3 +343,27 @@ * Method to check for next error | ||
*/ | ||
getPageContent(page: Page): string; | ||
/** | ||
* @private | ||
* @param spelledWords | ||
*/ | ||
updateUniqueWords(spelledWords: any[]): void; | ||
private checkForUniqueWords; | ||
/** | ||
* Method to clear cached words for spell check | ||
*/ | ||
clearCache(): void; | ||
/** | ||
* Method to create GUID | ||
*/ | ||
private createGuid; | ||
/** | ||
* Check spelling in page data | ||
* @private | ||
* @param {string} wordToCheck | ||
*/ | ||
checkSpellingInPageInfo(wordToCheck: string): WordSpellInfo; | ||
/** | ||
* @private | ||
*/ | ||
destroy(): void; | ||
} |
import { Dictionary } from '../../base/dictionary'; | ||
import { TextElementBox, ErrorTextElementBox, TableCellWidget } from '../viewer/page'; | ||
import { TextElementBox, ErrorTextElementBox, TableCellWidget, FieldElementBox } from '../viewer/page'; | ||
import { isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
//import { XmlHttpRequestHandler } from '../..'; | ||
/** | ||
@@ -14,3 +15,13 @@ * The spell checker module | ||
this.spellSuggestionInternal = true; | ||
/** | ||
* @private | ||
*/ | ||
this.uniqueKey = ''; | ||
this.removeUnderlineInternal = false; | ||
/** | ||
* @default 1000 | ||
*/ | ||
this.uniqueWordsCountInternal = 10000; | ||
this.spellJsonData = ''; | ||
this.performOptimizedCheck = false; | ||
this.viewer = viewer; | ||
@@ -20,2 +31,4 @@ this.errorWordCollection = new Dictionary(); | ||
this.ignoreAllItems = []; | ||
this.uniqueSpelledWords = []; | ||
this.uniqueKey = this.viewer.owner.element.id + '_' + this.createGuid(); | ||
} | ||
@@ -28,2 +41,42 @@ /** | ||
}; | ||
Object.defineProperty(SpellChecker.prototype, "enableOptimizedSpellCheck", { | ||
/** | ||
* Gets the boolean indicating whether optimized spell check to be performed. | ||
* @aspType bool | ||
* @blazorType bool | ||
*/ | ||
get: function () { | ||
return this.performOptimizedCheck; | ||
}, | ||
/** | ||
* Sets the boolean indicating whether optimized spell check to be performed. | ||
* @aspType bool | ||
* @blazorType bool | ||
*/ | ||
set: function (value) { | ||
this.performOptimizedCheck = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SpellChecker.prototype, "uniqueWordsCount", { | ||
/** | ||
* Gets the spell checked Unique words. | ||
* @aspType int | ||
* @blazorType int | ||
*/ | ||
get: function () { | ||
return isNullOrUndefined(this.uniqueWordsCountInternal) ? 0 : this.uniqueWordsCountInternal; | ||
}, | ||
/** | ||
* Sets the spell checked Unique words. | ||
* @aspType int | ||
* @blazorType int | ||
*/ | ||
set: function (value) { | ||
this.uniqueWordsCountInternal = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(SpellChecker.prototype, "languageID", { | ||
@@ -266,3 +319,3 @@ /** | ||
// tslint:disable-next-line:max-line-length | ||
var pattern = new RegExp('^[#\\@\\!\\~\\$\\%\\^\\&\\*\\(\\)\\-\\_\\+\\=\\{\\}\\[\\]\\:\\;\\"\'\\,\\<\\.\\>\\/\\?\\`\\s]+', 'g'); | ||
var pattern = new RegExp('^[#\\@\\!\\~\\$\\%\\^\\&\\*\\(\\)\\-\\_\\+\\=\\{\\}\\[\\]\\:\\;\\"\\”\'\\,\\<\\.\\>\\/\\?\\`\\s]+', 'g'); | ||
var matches = []; | ||
@@ -282,6 +335,6 @@ var matchInfo = void 0; | ||
// tslint:disable-next-line:max-line-length | ||
var endPattern = new RegExp('[#\\@\\!\\~\\$\\%\\^\\&\\*\\(\\)\\-\\_\\+\\=\\{\\}\\[\\]\\:\\;\\"\'\\,\\<\\.\\>\\/\\?\\s\\`]+$', 'g'); | ||
var endPattern = new RegExp('[#\\@\\!\\~\\$\\%\\^\\&\\*\\(\\)\\-\\_\\+\\=\\{\\}\\[\\]\\:\\;\\"\\”\'\\,\\<\\.\\>\\/\\?\\s\\`]+$', 'g'); | ||
matches = []; | ||
//tslint:disable no-conditional-assignment | ||
while (!isNullOrUndefined(matchInfo = endPattern.exec(exactText))) { | ||
while (!isNullOrUndefined(matchInfo = endPattern.exec(replaceText))) { | ||
matches.push(matchInfo); | ||
@@ -293,3 +346,3 @@ } | ||
var match = matches[i]; | ||
replaceText = (!isRemove) ? replaceText + match[0] : replaceText.replace(match[0], ''); | ||
replaceText = (!isRemove) ? replaceText + match[0] : replaceText.slice(0, match.index); | ||
} | ||
@@ -605,5 +658,7 @@ } | ||
// tslint:disable-next-line:max-line-length | ||
SpellChecker.prototype.checkElementCanBeCombined = function (elementBox, underlineY, beforeIndex, callSpellChecker) { | ||
var currentText = ''; | ||
var isCombined = false; | ||
SpellChecker.prototype.checkElementCanBeCombined = function (elementBox, underlineY, beforeIndex, callSpellChecker, textToCombine, isNext, isPrevious, canCombine) { | ||
var currentText = isNullOrUndefined(textToCombine) ? '' : textToCombine; | ||
var isCombined = isNullOrUndefined(canCombine) ? false : canCombine; | ||
var checkPrevious = !isNullOrUndefined(isPrevious) ? isPrevious : true; | ||
var checkNext = !isNullOrUndefined(isNext) ? isNext : true; | ||
var combinedElements = []; | ||
@@ -614,29 +669,67 @@ var line = this.viewer.selection.getLineWidget(elementBox, 0); | ||
combinedElements.push(elementBox); | ||
for (var i = index - 1; i >= 0; i--) { | ||
if (line.children[i] instanceof TextElementBox) { | ||
var textElement = line.children[i]; | ||
if (prevText.indexOf(' ') !== 0 && textElement.text.lastIndexOf(' ') !== textElement.text.length - 1) { | ||
currentText = textElement.text + currentText; | ||
prevText = textElement.text; | ||
combinedElements.push(textElement); | ||
isCombined = true; | ||
var difference = (isPrevious) ? 0 : 1; | ||
var prevCombined = false; | ||
var isPrevField = false; | ||
if (elementBox.text !== '\v') { | ||
if (checkPrevious) { | ||
var textElement = undefined; | ||
for (var i = index - difference; i >= 0; i--) { | ||
if (line.children[i] instanceof TextElementBox && !isPrevField) { | ||
textElement = line.children[i]; | ||
if (prevText.indexOf(' ') !== 0 && textElement.text.lastIndexOf(' ') !== textElement.text.length - 1) { | ||
prevCombined = !isNullOrUndefined(textToCombine) ? true : false; | ||
currentText = textElement.text + currentText; | ||
prevText = textElement.text; | ||
isPrevField = false; | ||
combinedElements.push(textElement); | ||
isCombined = true; | ||
} | ||
else if (!isNullOrUndefined(textElement)) { | ||
textElement = textElement.nextElement; | ||
break; | ||
} | ||
} | ||
else if (line.children[i] instanceof FieldElementBox) { | ||
isPrevField = true; | ||
} | ||
} | ||
else if (!isNullOrUndefined(textElement)) { | ||
break; | ||
var currentElement = (isCombined) ? textElement : elementBox; | ||
if (this.lookThroughPreviousLine(currentText, prevText, currentElement, underlineY, beforeIndex)) { | ||
return true; | ||
} | ||
} | ||
} | ||
currentText += elementBox.text; | ||
var nextText = elementBox.text; | ||
for (var i = index + 1; i < line.children.length; i++) { | ||
if (line.children[i] instanceof TextElementBox) { | ||
var element = line.children[i]; | ||
if (nextText.lastIndexOf(' ') !== nextText.length - 1 && element.text.indexOf(' ') !== 0) { | ||
currentText += element.text; | ||
nextText = element.text; | ||
combinedElements.push(element); | ||
isCombined = true; | ||
if (isPrevious) { | ||
currentText = (prevCombined) ? currentText : elementBox.text + currentText; | ||
} | ||
else { | ||
currentText += elementBox.text; | ||
} | ||
isPrevField = false; | ||
var nextText = elementBox.text; | ||
if (checkNext) { | ||
var canCombine_1 = false; | ||
var element = undefined; | ||
for (var i = index + 1; i < line.children.length; i++) { | ||
if (line.children[i] instanceof TextElementBox && !isPrevField) { | ||
element = line.children[i]; | ||
if (nextText.lastIndexOf(' ') !== nextText.length - 1 && element.text.indexOf(' ') !== 0) { | ||
currentText += element.text; | ||
nextText = element.text; | ||
isPrevField = false; | ||
combinedElements.push(element); | ||
canCombine_1 = true; | ||
isCombined = true; | ||
} | ||
else if (!isNullOrUndefined(element)) { | ||
element = element.previousElement; | ||
break; | ||
} | ||
} | ||
else if (line.children[i] instanceof FieldElementBox) { | ||
isPrevField = true; | ||
} | ||
} | ||
else if (!isNullOrUndefined(element)) { | ||
break; | ||
var currentElement = (canCombine_1) ? element : elementBox; | ||
if (this.lookThroughNextLine(currentText, prevText, currentElement, underlineY, beforeIndex)) { | ||
return true; | ||
} | ||
@@ -650,2 +743,35 @@ } | ||
}; | ||
// tslint:disable-next-line:max-line-length | ||
SpellChecker.prototype.lookThroughPreviousLine = function (currentText, prevText, currentElement, underlineY, beforeIndex) { | ||
// tslint:disable-next-line:max-line-length | ||
if (!isNullOrUndefined(currentElement) && currentElement.indexInOwner === 0 && !isNullOrUndefined(currentElement.line.previousLine)) { | ||
var previousLine = currentElement.line.previousLine; | ||
var index = previousLine.children.length - 1; | ||
if (!isNullOrUndefined(previousLine.children[index]) && previousLine.children[index] instanceof TextElementBox) { | ||
var firstElement = previousLine.children[index]; | ||
if (currentElement.text.indexOf(' ') !== 0 && firstElement.text.lastIndexOf(' ') !== firstElement.text.length - 1) { | ||
currentText = (currentText.length > 0) ? currentText : prevText; | ||
this.checkElementCanBeCombined(firstElement, underlineY, beforeIndex, true, currentText, false, true, true); | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
}; | ||
// tslint:disable-next-line:max-line-length | ||
SpellChecker.prototype.lookThroughNextLine = function (currentText, prevText, elementBox, underlineY, beforeIndex) { | ||
// tslint:disable-next-line:max-line-length | ||
if (!isNullOrUndefined(elementBox) && elementBox.indexInOwner === elementBox.line.children.length - 1 && !isNullOrUndefined(elementBox.line.nextLine)) { | ||
var nextLine = elementBox.line.nextLine; | ||
if (!isNullOrUndefined(nextLine.children[0]) && nextLine.children[0] instanceof TextElementBox) { | ||
var firstElement = nextLine.children[0]; | ||
if (elementBox.text.lastIndexOf(' ') !== elementBox.text.length - 1 && firstElement.text.indexOf(' ') !== 0) { | ||
currentText = (currentText.length > 0) ? currentText : prevText; | ||
this.checkElementCanBeCombined(firstElement, underlineY, beforeIndex, true, currentText, true, false, true); | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
}; | ||
/** | ||
@@ -662,6 +788,8 @@ * Method to handle combined elements | ||
var splittedText = currentText.split(/[\s]+/); | ||
if (this.ignoreAllItems.indexOf(currentText) === -1 && elementBox.ignoreOnceItems.indexOf(currentText) === -1) { | ||
// tslint:disable-next-line:max-line-length | ||
if (this.ignoreAllItems.indexOf(currentText) === -1 && elementBox instanceof TextElementBox && elementBox.ignoreOnceItems.indexOf(currentText) === -1) { | ||
if (splittedText.length > 1) { | ||
for (var i = 0; i < splittedText.length; i++) { | ||
var currentText_1 = splittedText[i]; | ||
currentText_1 = this.manageSpecialCharacters(currentText_1, undefined, true); | ||
// tslint:disable-next-line:max-line-length | ||
@@ -672,2 +800,3 @@ this.viewer.render.handleUnorderdElements(currentText_1, elementBox, underlineY, i, 0, i === splittedText.length - 1, beforeIndex); | ||
else { | ||
currentText = this.manageSpecialCharacters(currentText, undefined, true); | ||
this.viewer.render.handleUnorderdElements(currentText, elementBox, underlineY, 0, 0, true, beforeIndex); | ||
@@ -754,3 +883,3 @@ } | ||
// tslint:disable-next-line:max-line-length | ||
SpellChecker.prototype.CallSpellChecker = function (languageID, word, checkSpelling, checkSuggestion, addWord) { | ||
SpellChecker.prototype.CallSpellChecker = function (languageID, word, checkSpelling, checkSuggestion, addWord, isByPage) { | ||
var _this = this; | ||
@@ -761,4 +890,10 @@ return new Promise(function (resolve, reject) { | ||
// tslint:disable-next-line:max-line-length | ||
httpRequest_1.open('POST', _this.viewer.owner.serviceUrl + _this.viewer.owner.serverActionSettings.spellCheck, true); | ||
var service = _this.viewer.owner.serviceUrl + _this.viewer.owner.serverActionSettings.spellCheck; | ||
service = (isByPage) ? service + 'ByPage' : service; | ||
httpRequest_1.open('POST', service, true); | ||
httpRequest_1.setRequestHeader('Content-Type', 'application/json'); | ||
// tslint:disable-next-line:max-line-length | ||
/* tslint:disable:no-any */ | ||
var spellCheckData = { LanguageID: languageID, TexttoCheck: word, CheckSpelling: checkSpelling, CheckSuggestion: checkSuggestion, AddWord: addWord }; | ||
httpRequest_1.send(JSON.stringify(spellCheckData)); | ||
httpRequest_1.onreadystatechange = function () { | ||
@@ -774,6 +909,2 @@ if (httpRequest_1.readyState === 4) { | ||
}; | ||
// tslint:disable-next-line:max-line-length | ||
/* tslint:disable:no-any */ | ||
var spellCheckData = { LanguageID: languageID, TexttoCheck: word, CheckSpelling: checkSpelling, CheckSuggestion: checkSuggestion, AddWord: addWord }; | ||
httpRequest_1.send(JSON.stringify(spellCheckData)); | ||
} | ||
@@ -971,2 +1102,89 @@ }); | ||
*/ | ||
SpellChecker.prototype.getPageContent = function (page) { | ||
var content = ''; | ||
if (this.viewer.owner.sfdtExportModule) { | ||
var sfdtExport = this.viewer.owner.sfdtExportModule; | ||
sfdtExport.Initialize(); | ||
var document_1 = sfdtExport.writePage(page); | ||
if (this.viewer.owner.textExportModule) { | ||
var textExport = this.viewer.owner.textExportModule; | ||
textExport.pageContent = ''; | ||
textExport.setDocument(document_1); | ||
textExport.writeInternal(); | ||
content = textExport.pageContent; | ||
} | ||
} | ||
return content; | ||
}; | ||
/** | ||
* @private | ||
* @param spelledWords | ||
*/ | ||
SpellChecker.prototype.updateUniqueWords = function (spelledWords) { | ||
if (!isNullOrUndefined(localStorage.getItem(this.uniqueKey))) { | ||
this.uniqueSpelledWords = JSON.parse(localStorage.getItem(this.uniqueKey)); | ||
} | ||
var totalCount = spelledWords.length + this.uniqueSpelledWords.length; | ||
if (totalCount <= this.uniqueWordsCount) { | ||
for (var i = 0; i < spelledWords.length; i++) { | ||
this.checkForUniqueWords(spelledWords[i]); | ||
} | ||
} | ||
localStorage.setItem(this.uniqueKey, JSON.stringify(this.uniqueSpelledWords)); | ||
this.uniqueSpelledWords = []; | ||
}; | ||
SpellChecker.prototype.checkForUniqueWords = function (spellData) { | ||
var identityMatched = false; | ||
for (var i = 0; i < this.uniqueSpelledWords.length; i++) { | ||
if (this.uniqueSpelledWords[i].Text === spellData.Text) { | ||
identityMatched = true; | ||
break; | ||
} | ||
} | ||
if (!identityMatched) { | ||
this.uniqueSpelledWords.push(spellData); | ||
} | ||
}; | ||
/** | ||
* Method to clear cached words for spell check | ||
*/ | ||
SpellChecker.prototype.clearCache = function () { | ||
if (!isNullOrUndefined(localStorage.getItem(this.uniqueKey))) { | ||
localStorage.removeItem(this.uniqueKey); | ||
} | ||
}; | ||
/** | ||
* Method to create GUID | ||
*/ | ||
SpellChecker.prototype.createGuid = function () { | ||
var dateTime = new Date().getTime(); | ||
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (char) { | ||
var randNo = (dateTime + Math.random() * 16) % 16 | 0; | ||
dateTime = Math.floor(dateTime / 16); | ||
return (char === 'x' ? randNo : (randNo & 0x3 | 0x8)).toString(16); | ||
}); | ||
return uuid; | ||
}; | ||
/** | ||
* Check spelling in page data | ||
* @private | ||
* @param {string} wordToCheck | ||
*/ | ||
SpellChecker.prototype.checkSpellingInPageInfo = function (wordToCheck) { | ||
var hasError = false; | ||
var elementPresent = false; | ||
/* tslint:disable:no-any */ | ||
var uniqueWords = JSON.parse(localStorage.getItem(this.viewer.owner.spellChecker.uniqueKey)); | ||
if (!isNullOrUndefined(uniqueWords)) { | ||
for (var i = 0; i < uniqueWords.length; i++) { | ||
if (uniqueWords[i].Text === wordToCheck) { | ||
return { hasSpellError: uniqueWords[i].HasSpellError, isElementPresent: true }; | ||
} | ||
} | ||
} | ||
return { hasSpellError: hasError, isElementPresent: elementPresent }; | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
SpellChecker.prototype.destroy = function () { | ||
@@ -976,2 +1194,6 @@ this.errorWordCollection = undefined; | ||
this.errorSuggestions = undefined; | ||
this.uniqueSpelledWords = []; | ||
if (!isNullOrUndefined(localStorage.getItem(this.uniqueKey))) { | ||
localStorage.removeItem(this.uniqueKey); | ||
} | ||
}; | ||
@@ -978,0 +1200,0 @@ return SpellChecker; |
@@ -2460,2 +2460,6 @@ import { WTableFormat, WRowFormat, WCellFormat } from '../format/index'; | ||
/** | ||
* | ||
*/ | ||
allowNextPageRendering: boolean; | ||
/** | ||
* @private | ||
@@ -2462,0 +2466,0 @@ */ |
@@ -481,3 +481,3 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
elementBox.isVisible = false; | ||
if (!elementBox.isSpellChecked) { | ||
if (!elementBox.isSpellChecked || elementBox.line.paragraph.isChangeDetected) { | ||
elementBox.ischangeDetected = true; | ||
@@ -704,2 +704,5 @@ } | ||
var beforeIndex = this.pageIndex; | ||
if (elementBox.text === '\v') { | ||
return; | ||
} | ||
if (!this.spellChecker.checkElementCanBeCombined(elementBox, underlineY, beforeIndex, true)) { | ||
@@ -723,16 +726,26 @@ /* tslint:disable:no-any */ | ||
var retrievedText = this.spellChecker.manageSpecialCharacters(checkText, undefined, true); | ||
// tslint:disable-next-line:max-line-length | ||
if (this.spellChecker.ignoreAllItems.indexOf(retrievedText) === -1 && elementBox.ignoreOnceItems.indexOf(retrievedText) === -1) { | ||
var indexInLine_1 = elementBox.indexInOwner; | ||
var indexinParagraph_1 = elementBox.line.paragraph.indexInOwner; | ||
/* tslint:disable:no-any */ | ||
if (checkText.length > 0) { | ||
// tslint:disable-next-line:max-line-length | ||
this.spellChecker.CallSpellChecker(this.spellChecker.languageID, checkText, true, this.spellChecker.allowSpellCheckAndSuggestion).then(function (data) { | ||
/* tslint:disable:no-any */ | ||
var jsonObject = JSON.parse(data); | ||
// tslint:disable-next-line:max-line-length | ||
var canUpdate = (beforeIndex === _this.pageIndex || elementBox.isVisible) && (indexInLine_1 === elementBox.indexInOwner) && (indexinParagraph_1 === elementBox.line.paragraph.indexInOwner); | ||
// tslint:disable-next-line:max-line-length | ||
_this.spellChecker.handleWordByWordSpellCheck(jsonObject, elementBox, left, top, underlineY, baselineAlignment, canUpdate); | ||
}); | ||
if (this.spellChecker.ignoreAllItems.indexOf(retrievedText) === -1 && elementBox.ignoreOnceItems.indexOf(retrievedText) === -1) { | ||
var indexInLine_1 = elementBox.indexInOwner; | ||
var indexinParagraph_1 = elementBox.line.paragraph.indexInOwner; | ||
var spellInfo = this.spellChecker.checkSpellingInPageInfo(retrievedText); | ||
if (spellInfo.isElementPresent && this.spellChecker.enableOptimizedSpellCheck) { | ||
var jsonObject = JSON.parse('{\"HasSpellingError\":' + spellInfo.hasSpellError + '}'); | ||
// tslint:disable-next-line:max-line-length | ||
this.spellChecker.handleWordByWordSpellCheck(jsonObject, elementBox, left, top, underlineY, baselineAlignment, true); | ||
} | ||
else { | ||
/* tslint:disable:no-any */ | ||
// tslint:disable-next-line:max-line-length | ||
this.spellChecker.CallSpellChecker(this.spellChecker.languageID, checkText, true, this.spellChecker.allowSpellCheckAndSuggestion).then(function (data) { | ||
/* tslint:disable:no-any */ | ||
var jsonObject = JSON.parse(data); | ||
// tslint:disable-next-line:max-line-length | ||
var canUpdate = (beforeIndex === _this.pageIndex || elementBox.isVisible) && (indexInLine_1 === elementBox.indexInOwner) && (indexinParagraph_1 === elementBox.line.paragraph.indexInOwner); | ||
// tslint:disable-next-line:max-line-length | ||
_this.spellChecker.handleWordByWordSpellCheck(jsonObject, elementBox, left, top, underlineY, baselineAlignment, canUpdate); | ||
}); | ||
} | ||
} | ||
} | ||
@@ -755,12 +768,22 @@ } | ||
var indexinParagraph = elementBox.line.paragraph.indexInOwner; | ||
/* tslint:disable:no-any */ | ||
// tslint:disable-next-line:max-line-length | ||
this.spellChecker.CallSpellChecker(this.spellChecker.languageID, currentText, true, this.spellChecker.allowSpellCheckAndSuggestion).then(function (data) { | ||
/* tslint:disable:no-any */ | ||
var jsonObject = JSON.parse(data); | ||
// tslint:disable-next-line:max-line-length | ||
var canUpdate = (elementBox.isVisible) && (indexInLine === elementBox.indexInOwner) && (indexinParagraph === elementBox.line.paragraph.indexInOwner); | ||
// tslint:disable-next-line:max-line-length | ||
_this.spellChecker.handleSplitWordSpellCheck(jsonObject, currentText, elementBox, canUpdate, underlineY, iteration, markindex, isLastItem); | ||
}); | ||
if (currentText.length > 0) { | ||
var spellInfo = this.spellChecker.checkSpellingInPageInfo(currentText); | ||
if (spellInfo.isElementPresent && this.spellChecker.enableOptimizedSpellCheck) { | ||
var jsonObject = JSON.parse('{\"HasSpellingError\":' + spellInfo.hasSpellError + '}'); | ||
// tslint:disable-next-line:max-line-length | ||
this.spellChecker.handleSplitWordSpellCheck(jsonObject, currentText, elementBox, true, underlineY, iteration, markindex, isLastItem); | ||
} | ||
else { | ||
/* tslint:disable:no-any */ | ||
// tslint:disable-next-line:max-line-length | ||
this.spellChecker.CallSpellChecker(this.spellChecker.languageID, currentText, true, this.spellChecker.allowSpellCheckAndSuggestion).then(function (data) { | ||
/* tslint:disable:no-any */ | ||
var jsonObject = JSON.parse(data); | ||
// tslint:disable-next-line:max-line-length | ||
var canUpdate = (elementBox.isVisible) && (indexInLine === elementBox.indexInOwner) && (indexinParagraph === elementBox.line.paragraph.indexInOwner); | ||
// tslint:disable-next-line:max-line-length | ||
_this.spellChecker.handleSplitWordSpellCheck(jsonObject, currentText, elementBox, canUpdate, underlineY, iteration, markindex, isLastItem); | ||
}); | ||
} | ||
} | ||
}; | ||
@@ -767,0 +790,0 @@ /** |
@@ -366,4 +366,9 @@ import { Dictionary } from '../../base/dictionary'; | ||
*/ | ||
cachedPages: number[]; | ||
longTouchTimer: number; | ||
/** | ||
* @private | ||
*/ | ||
skipScrollToPosition: boolean; | ||
/** | ||
* Gets container canvas. | ||
@@ -370,0 +375,0 @@ * @private |
import { WListFormat, WCharacterFormat } from '../format/index'; | ||
import { LayoutViewer } from '../index'; | ||
import { LineWidget, ChartElementBox } from '../viewer/page'; | ||
import { LineWidget, Page, ChartElementBox } from '../viewer/page'; | ||
/** | ||
@@ -38,2 +38,10 @@ * Exports the document to Sfdt format. | ||
write(line?: LineWidget, startOffset?: number, endLine?: LineWidget, endOffset?: number, writeInlineStyles?: boolean): any; | ||
/** | ||
* @private | ||
*/ | ||
Initialize(): void; | ||
/** | ||
* @private | ||
*/ | ||
writePage(page: Page): any; | ||
private writeBodyWidget; | ||
@@ -40,0 +48,0 @@ private writeHeaderFooters; |
@@ -81,13 +81,3 @@ import { WParagraphFormat } from '../format/paragraph-format'; | ||
} | ||
this.lists = []; | ||
this.document = {}; | ||
this.document.sections = []; | ||
this.document.characterFormat = this.writeCharacterFormat(this.viewer.characterFormat); | ||
this.document.paragraphFormat = this.writeParagraphFormat(this.viewer.paragraphFormat); | ||
this.document.defaultTabWidth = this.viewer.defaultTabWidth; | ||
this.document.enforcement = this.viewer.isDocumentProtected; | ||
this.document.hashValue = this.viewer.hashValue; | ||
this.document.saltValue = this.viewer.saltValue; | ||
this.document.formatting = this.viewer.restrictFormatting; | ||
this.document.protectionType = this.viewer.protectionType; | ||
this.Initialize(); | ||
this.updateEditRangeId(); | ||
@@ -165,8 +155,3 @@ if (line instanceof LineWidget && endLine instanceof LineWidget) { | ||
var page = this.viewer.pages[0]; | ||
if (page.bodyWidgets.length > 0) { | ||
var nextBlock = page.bodyWidgets[0]; | ||
do { | ||
nextBlock = this.writeBodyWidget(nextBlock, 0); | ||
} while (!isNullOrUndefined(nextBlock)); | ||
} | ||
this.writePage(page); | ||
} | ||
@@ -180,2 +165,30 @@ } | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
SfdtExport.prototype.Initialize = function () { | ||
this.lists = []; | ||
this.document = {}; | ||
this.document.sections = []; | ||
this.document.characterFormat = this.writeCharacterFormat(this.viewer.characterFormat); | ||
this.document.paragraphFormat = this.writeParagraphFormat(this.viewer.paragraphFormat); | ||
this.document.defaultTabWidth = this.viewer.defaultTabWidth; | ||
this.document.enforcement = this.viewer.isDocumentProtected; | ||
this.document.hashValue = this.viewer.hashValue; | ||
this.document.saltValue = this.viewer.saltValue; | ||
this.document.formatting = this.viewer.restrictFormatting; | ||
this.document.protectionType = this.viewer.protectionType; | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
SfdtExport.prototype.writePage = function (page) { | ||
if (page.bodyWidgets.length > 0) { | ||
var nextBlock = page.bodyWidgets[0]; | ||
do { | ||
nextBlock = this.writeBodyWidget(nextBlock, 0); | ||
} while (!isNullOrUndefined(nextBlock)); | ||
} | ||
return this.document; | ||
}; | ||
SfdtExport.prototype.writeBodyWidget = function (bodyWidget, index) { | ||
@@ -182,0 +195,0 @@ if (!(bodyWidget instanceof BodyWidget)) { |
import { LayoutViewer } from '../index'; | ||
import { StreamWriter } from '@syncfusion/ej2-file-utils'; | ||
/** | ||
@@ -7,3 +8,6 @@ * Exports the document to Text format. | ||
private getModuleName; | ||
private text; | ||
/** | ||
* @private | ||
*/ | ||
pageContent: string; | ||
private curSectionIndex; | ||
@@ -24,4 +28,12 @@ private sections; | ||
private serialize; | ||
private setDocument; | ||
private writeInternal; | ||
/** | ||
* @private | ||
* @param document | ||
*/ | ||
setDocument(document: any): void; | ||
/** | ||
* @private | ||
* @param streamWriter | ||
*/ | ||
writeInternal(streamWriter?: StreamWriter): void; | ||
private writeBody; | ||
@@ -28,0 +40,0 @@ private writeParagraph; |
@@ -8,3 +8,6 @@ import { StreamWriter } from '@syncfusion/ej2-file-utils'; | ||
function TextExport() { | ||
this.text = ''; | ||
/** | ||
* @private | ||
*/ | ||
this.pageContent = ''; | ||
this.curSectionIndex = 0; | ||
@@ -43,2 +46,6 @@ this.inField = false; | ||
}; | ||
/** | ||
* @private | ||
* @param document | ||
*/ | ||
TextExport.prototype.setDocument = function (document) { | ||
@@ -48,2 +55,6 @@ this.document = document; | ||
}; | ||
/** | ||
* @private | ||
* @param streamWriter | ||
*/ | ||
TextExport.prototype.writeInternal = function (streamWriter) { | ||
@@ -137,6 +148,16 @@ var section = undefined; | ||
TextExport.prototype.writeNewLine = function (writer) { | ||
writer.writeLine(''); | ||
if (!isNullOrUndefined(writer)) { | ||
writer.writeLine(''); | ||
} | ||
else { | ||
this.pageContent = this.pageContent + ' '; | ||
} | ||
}; | ||
TextExport.prototype.writeText = function (writer, text) { | ||
writer.write(text); | ||
if (!isNullOrUndefined(writer)) { | ||
writer.write(text); | ||
} | ||
else { | ||
this.pageContent += text; | ||
} | ||
}; | ||
@@ -143,0 +164,0 @@ TextExport.prototype.updateLastParagraph = function () { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
38056837
326369