@syncfusion/ej2-pdfviewer
Advanced tools
Comparing version 17.2.39 to 17.2.40
@@ -9,2 +9,18 @@ # Changelog | ||
- #242329 - Provided the support to customize scale ratio value of measurement annotation. | ||
- #241886 - Provided the support to display context menu in mouse up action. | ||
#### Bug Fixes | ||
- #242495, 243160 – Hyperlink element is now rendered properly for the rotated page document. | ||
- #238064 – Searched target text is now highlighted properly for the provided document. | ||
- #241904, 241294 – Converted PDF document is now rendered properly in IE browser. | ||
- #242282 – Text search is now working properly while using PDF Viewer control inside the Tab control. | ||
## 17.2.39 (2019-07-30) | ||
### PDF Viewer | ||
#### New Features | ||
- #240440 - More details have been provided in the ajaxRequestfailure event. | ||
@@ -11,0 +27,0 @@ - #242375 – Now, the annotation edit toolbar is enabled by default using the enableAnnotationToolbar property. |
/*! | ||
* filename: index.d.ts | ||
* version : 17.2.39 | ||
* version : 17.2.40 | ||
* 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-pdfviewer@*", | ||
"_id": "@syncfusion/ej2-pdfviewer@17.2.36", | ||
"_id": "@syncfusion/ej2-pdfviewer@17.2.39", | ||
"_inBundle": false, | ||
"_integrity": "sha512-oGVH9GmjI5JY2a3KAtO45MfdyRhwsQFXjZVhZuT2d6/o9LxlWRcAhFURS4kskPiybUtD0cajC+Cr2aQStD1nRA==", | ||
"_integrity": "sha512-n/gqdcaJiXhbO/q3rPx/Cz4V4uj4DPvLZSUqiyCJDu3TVQo8mcqhYlIY1Wpi8kl0EDxOUU/jWDF7YseXgzy9Zg==", | ||
"_location": "/@syncfusion/ej2-pdfviewer", | ||
@@ -26,4 +26,4 @@ "_phantomChildren": {}, | ||
], | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-pdfviewer/-/ej2-pdfviewer-17.2.36.tgz", | ||
"_shasum": "eee5dd4af2acc9cf10c5d8fa6f2b449cfd4e1bf5", | ||
"_resolved": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-pdfviewer/-/ej2-pdfviewer-17.2.39.tgz", | ||
"_shasum": "f8c99a53d11de54f0cd96bcbb91857d5ba25e97f", | ||
"_spec": "@syncfusion/ej2-pdfviewer@*", | ||
@@ -39,3 +39,3 @@ "_where": "/jenkins/workspace/ation_hotfix_16.4.0.42_Vol4-CJVRBFC7Z7RSISPRJNEMNQSRMCB6XTG67IJD6R2DVNXFIKQEITTQ/packages/included", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "~17.2.39", | ||
"@syncfusion/ej2-base": "~17.2.40", | ||
"@syncfusion/ej2-buttons": "~17.2.35", | ||
@@ -45,8 +45,8 @@ "@syncfusion/ej2-calendars": "~17.2.36", | ||
"@syncfusion/ej2-drawings": "~17.2.34", | ||
"@syncfusion/ej2-dropdowns": "~17.2.39", | ||
"@syncfusion/ej2-inplace-editor": "~17.2.35", | ||
"@syncfusion/ej2-inputs": "~17.2.39", | ||
"@syncfusion/ej2-dropdowns": "~17.2.40", | ||
"@syncfusion/ej2-inplace-editor": "~17.2.40", | ||
"@syncfusion/ej2-inputs": "~17.2.40", | ||
"@syncfusion/ej2-lists": "~17.2.34", | ||
"@syncfusion/ej2-navigations": "~17.2.39", | ||
"@syncfusion/ej2-notifications": "~17.2.34", | ||
"@syncfusion/ej2-navigations": "~17.2.40", | ||
"@syncfusion/ej2-notifications": "~17.2.40", | ||
"@syncfusion/ej2-popups": "~17.2.35", | ||
@@ -79,4 +79,4 @@ "@syncfusion/ej2-richtexteditor": "~17.2.39" | ||
"typings": "index.d.ts", | ||
"version": "17.2.39", | ||
"version": "17.2.40", | ||
"sideEffects": false | ||
} |
@@ -96,5 +96,7 @@ var __extends = (this && this.__extends) || (function () { | ||
//remove helper | ||
this.commandHandler.tool = ''; | ||
if (this.helper) { | ||
this.commandHandler.remove(this.helper); | ||
if (this.commandHandler) { | ||
this.commandHandler.tool = ''; | ||
if (this.helper) { | ||
this.commandHandler.remove(this.helper); | ||
} | ||
} | ||
@@ -101,0 +103,0 @@ this.commandHandler = null; |
@@ -41,6 +41,6 @@ import { ColorPicker, NumericTextBox } from '@syncfusion/ej2-inputs'; | ||
this.volumeThickness = this.pdfViewer.volumeSettings.thickness ? this.pdfViewer.volumeSettings.thickness : 1; | ||
this.unit = 'in'; | ||
this.displayUnit = 'in'; | ||
this.ratio = 1; | ||
this.volumeDepth = 96; | ||
this.unit = this.pdfViewer.measurementSettings.conversionUnit; | ||
this.displayUnit = this.pdfViewer.measurementSettings.displayUnit; | ||
this.ratio = this.pdfViewer.measurementSettings.scaleRatio; | ||
this.volumeDepth = this.pdfViewer.measurementSettings.depth; | ||
this.scaleRatioString = '1 ' + this.unit + ' = ' + '1 ' + this.displayUnit; | ||
@@ -47,0 +47,0 @@ } |
@@ -126,2 +126,8 @@ import { createElement, Browser } from '@syncfusion/ej2-base'; | ||
} | ||
else if (this.pdfViewer.textSelectionModule && (this.pdfViewer.contextMenuOption === 'MouseUp')) { | ||
// tslint:disable-next-line:max-line-length | ||
this.contextMenuObj.hideItems([this.pdfViewer.localeObj.getConstant('Cut'), this.pdfViewer.localeObj.getConstant('Paste'), this.pdfViewer.localeObj.getConstant('Delete Context'), this.pdfViewer.localeObj.getConstant('Scale Ratio'), this.pdfViewer.localeObj.getConstant('Comment'), this.pdfViewer.localeObj.getConstant('Properties')]); | ||
this.pdfViewerBase.getElement('_context_menu_separator').classList.add('e-menu-hide'); | ||
this.pdfViewerBase.getElement('_context_menu_comment_separator').classList.add('e-menu-hide'); | ||
} | ||
else { | ||
@@ -138,2 +144,5 @@ if (this.pdfViewer.selectedItems.annotations.length === 0) { | ||
} | ||
if (this.pdfViewer.contextMenuOption === 'None') { | ||
args.cancel = true; | ||
} | ||
}; | ||
@@ -140,0 +149,0 @@ ContextMenu.prototype.onOpeningForShape = function (isProp) { |
@@ -15,2 +15,6 @@ import { PdfViewer, PdfViewerBase } from '../index'; | ||
*/ | ||
characterBound: any[]; | ||
/** | ||
* @private | ||
*/ | ||
constructor(pdfViewer: PdfViewer, pdfViewerBase: PdfViewerBase); | ||
@@ -17,0 +21,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import { createElement } from '@syncfusion/ej2-base'; | ||
import { createElement, isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
import { Dialog } from '@syncfusion/ej2-popups'; | ||
@@ -15,2 +15,7 @@ /** | ||
this.textBoundsArray = []; | ||
/** | ||
* @private | ||
*/ | ||
// tslint:disable-next-line | ||
this.characterBound = []; | ||
this.closeNotification = function () { | ||
@@ -90,2 +95,5 @@ _this.notifyDialog.hide(); | ||
var textDiv = this.pdfViewerBase.getElement('_text_' + pageNumber + '_' + i); | ||
if (isNullOrUndefined(textDiv)) { | ||
break; | ||
} | ||
if (textBounds) { | ||
@@ -120,2 +128,5 @@ bounds = textBounds[i]; | ||
} | ||
if (this.pdfViewer.textSearch) { | ||
this.pdfViewer.textSearch.resizeSearchElements(pageNumber); | ||
} | ||
}; | ||
@@ -228,3 +239,3 @@ TextLayer.prototype.applyTextRotation = function (scale, textDiv, rotation, textRotation) { | ||
higherPageValue = (higherPageValue < this.pdfViewerBase.pageCount) ? higherPageValue : (this.pdfViewerBase.pageCount - 1); | ||
var textLayers = document.querySelectorAll('div[id*="_textLayer_"]'); | ||
var textLayers = document.querySelectorAll('div[id*="' + this.pdfViewer.element.id + '_textLayer_"]'); | ||
for (var i = 0; i < textLayers.length; i++) { | ||
@@ -334,3 +345,3 @@ textLayers[i].style.display = 'block'; | ||
TextLayer.prototype.clearDivSelection = function () { | ||
var textLayers = document.querySelectorAll('div[id*="_textLayer_"]'); | ||
var textLayers = document.querySelectorAll('div[id*="' + this.pdfViewer.element.id + '_textLayer_"]'); | ||
for (var i = 0; i < textLayers.length; i++) { | ||
@@ -369,3 +380,3 @@ var childNodes = textLayers[i].childNodes; | ||
TextLayer.prototype.modifyTextCursor = function (isAdd) { | ||
var textLayerList = document.querySelectorAll('div[id*="_textLayer_"]'); | ||
var textLayerList = document.querySelectorAll('div[id*="' + this.pdfViewer.element.id + '_textLayer_"]'); | ||
for (var i = 0; i < textLayerList.length; i++) { | ||
@@ -372,0 +383,0 @@ var childNodes = textLayerList[i].childNodes; |
@@ -29,1 +29,5 @@ /** | ||
export declare type CalibrationUnit = 'pt' | 'in' | 'mm' | 'cm' | 'p'; | ||
/** | ||
* Enum unit for ContextMenu Actions | ||
*/ | ||
export declare type ContextMenuAction = 'None' | 'MouseUp' | 'RightClick'; |
@@ -376,3 +376,3 @@ import { Browser } from '@syncfusion/ej2-base'; | ||
this.clearRendering(); | ||
var oldCanvases = document.querySelectorAll('canvas[id*="oldCanvas"]'); | ||
var oldCanvases = document.querySelectorAll('canvas[id*="' + this.pdfViewer.element.id + '_oldCanvas_"]'); | ||
for (var i = 0; i < oldCanvases.length; i++) { | ||
@@ -435,2 +435,5 @@ // tslint:disable-next-line | ||
} | ||
if (this.pdfViewer.textSearchModule) { | ||
this.pdfViewer.textSearchModule.clearAllOccurrences(); | ||
} | ||
var scrollValue = this.pdfViewerBase.viewerContainer.scrollTop; | ||
@@ -478,3 +481,3 @@ this.isAutoZoom = false; | ||
if (this.pdfViewerBase.textLayer) { | ||
var textLayers = document.querySelectorAll('div[id*="_textLayer_"]'); | ||
var textLayers = document.querySelectorAll('div[id*="' + this.pdfViewer.element.id + '_textLayer_"]'); | ||
for (var i = 0; i < textLayers.length; i++) { | ||
@@ -485,3 +488,4 @@ textLayers[i].style.display = 'block'; | ||
if (this.pdfViewerBase.isTextMarkupAnnotationModule()) { | ||
var annotationLayers = document.querySelectorAll('canvas[id*="_annotationCanvas_"]'); | ||
// tslint:disable-next-line:max-line-length | ||
var annotationLayers = document.querySelectorAll('canvas[id*="' + this.pdfViewer.element.id + '_annotationCanvas_"]'); | ||
for (var j = 0; j < annotationLayers.length; j++) { | ||
@@ -488,0 +492,0 @@ var pageNumber = annotationLayers[j].id.split('_annotationCanvas_')[1]; |
@@ -1,2 +0,2 @@ | ||
import { Component, INotifyPropertyChanged, NotifyPropertyChanges, ChildProperty, L10n, Collection, Complex } from '@syncfusion/ej2-base';import { ModuleDeclaration, isNullOrUndefined, Property, Event, EmitType } from '@syncfusion/ej2-base';import { PdfViewerBase } from './index';import { Navigation } from './index';import { Magnification } from './index';import { Toolbar } from './index';import { ToolbarItem } from './index';import { LinkTarget, InteractionMode, AnnotationType, AnnotationToolbarItem, LineHeadStyle } from './base/types';import { Annotation } from './index';import { LinkAnnotation } from './index';import { ThumbnailView } from './index';import { BookmarkView } from './index';import { TextSelection } from './index';import { TextSearch } from './index';import { Print } from './index';import { UnloadEventArgs, LoadEventArgs, LoadFailedEventArgs, AjaxRequestFailureEventArgs, PageChangeEventArgs, PageClickEventArgs, ZoomChangeEventArgs, HyperlinkClickEventArgs } from './index';import { AnnotationAddEventArgs, AnnotationRemoveEventArgs, AnnotationPropertiesChangeEventArgs, AnnotationResizeEventArgs, AnnotationSelectEventArgs } from './index';import { PdfAnnotationBase, ZOrderPageTable } from '../diagram/pdf-annotation';import { PdfAnnotationBaseModel } from '../diagram/pdf-annotation-model';import { Drawing, ClipBoardObject } from '../diagram/drawing';import { Selector } from '../diagram/selector';import { SelectorModel } from '../diagram/selector-model';import { PointModel, IElement, Rect } from '@syncfusion/ej2-drawings';import { renderAdornerLayer } from '../diagram/dom-util'; | ||
import { Component, INotifyPropertyChanged, NotifyPropertyChanges, ChildProperty, L10n, Collection, Complex } from '@syncfusion/ej2-base';import { ModuleDeclaration, isNullOrUndefined, Property, Event, EmitType } from '@syncfusion/ej2-base';import { PdfViewerBase } from './index';import { Navigation } from './index';import { Magnification } from './index';import { Toolbar } from './index';import { ToolbarItem } from './index';import { LinkTarget, InteractionMode, AnnotationType, AnnotationToolbarItem, LineHeadStyle, ContextMenuAction } from './base/types';import { Annotation } from './index';import { LinkAnnotation } from './index';import { ThumbnailView } from './index';import { BookmarkView } from './index';import { TextSelection } from './index';import { TextSearch } from './index';import { Print, CalibrationUnit } from './index';import { UnloadEventArgs, LoadEventArgs, LoadFailedEventArgs, AjaxRequestFailureEventArgs, PageChangeEventArgs, PageClickEventArgs, ZoomChangeEventArgs, HyperlinkClickEventArgs } from './index';import { AnnotationAddEventArgs, AnnotationRemoveEventArgs, AnnotationPropertiesChangeEventArgs, AnnotationResizeEventArgs, AnnotationSelectEventArgs } from './index';import { PdfAnnotationBase, ZOrderPageTable } from '../diagram/pdf-annotation';import { PdfAnnotationBaseModel } from '../diagram/pdf-annotation-model';import { Drawing, ClipBoardObject } from '../diagram/drawing';import { Selector } from '../diagram/selector';import { SelectorModel } from '../diagram/selector-model';import { PointModel, IElement, Rect } from '@syncfusion/ej2-drawings';import { renderAdornerLayer } from '../diagram/dom-util'; | ||
import {IAjaxHeaders} from "./pdfviewer"; | ||
@@ -18,3 +18,3 @@ import {ComponentModel} from '@syncfusion/ej2-base'; | ||
*/ | ||
toolbarItem?: ToolbarItem[]; | ||
toolbarItems?: ToolbarItem[]; | ||
@@ -762,2 +762,29 @@ } | ||
/** | ||
* Interface for a class MeasurementSettings | ||
*/ | ||
export interface MeasurementSettingsModel { | ||
/** | ||
* specifies the scale ratio of the annotation. | ||
*/ | ||
scaleRatio?: number; | ||
/** | ||
* specifies the unit of the annotation. | ||
*/ | ||
conversionUnit?: CalibrationUnit; | ||
/** | ||
* specifies the unit of the annotation. | ||
*/ | ||
displayUnit?: CalibrationUnit; | ||
/** | ||
* specifies the depth of the volume annotation. | ||
*/ | ||
depth?: number; | ||
} | ||
/** | ||
* Interface for a class PdfViewer | ||
@@ -838,2 +865,8 @@ */ | ||
/** | ||
* Specifies the state of the ContextMenu in the PDF document. | ||
* @default RightClick | ||
*/ | ||
contextMenuOption?: ContextMenuAction; | ||
/** | ||
* Enable or disables the Navigation module of PdfViewer. | ||
@@ -1033,2 +1066,7 @@ * @default true | ||
/** | ||
* Defines the settings of measurement annotation. | ||
*/ | ||
measurementSettings?: MeasurementSettingsModel; | ||
/** | ||
* Defines the collection of selected items, size and position of the selector | ||
@@ -1035,0 +1073,0 @@ * @default {} |
import { Component, INotifyPropertyChanged, ChildProperty, L10n } from '@syncfusion/ej2-base'; | ||
import { ModuleDeclaration, EmitType } from '@syncfusion/ej2-base'; | ||
import { PdfViewerModel, HighlightSettingsModel, UnderlineSettingsModel, StrikethroughSettingsModel, LineSettingsModel, ArrowSettingsModel, RectangleSettingsModel, CircleSettingsModel, PolygonSettingsModel, StampSettingsModel, StickyNotesSettingsModel, CustomStampSettingsModel, VolumeSettingsModel, RadiusSettingsModel, AreaSettingsModel, PerimeterSettingsModel, DistanceSettingsModel } from './pdfviewer-model'; | ||
import { PdfViewerModel, HighlightSettingsModel, UnderlineSettingsModel, StrikethroughSettingsModel, LineSettingsModel, ArrowSettingsModel, RectangleSettingsModel, CircleSettingsModel, PolygonSettingsModel, StampSettingsModel, StickyNotesSettingsModel, CustomStampSettingsModel, VolumeSettingsModel, RadiusSettingsModel, AreaSettingsModel, PerimeterSettingsModel, DistanceSettingsModel, MeasurementSettingsModel } from './pdfviewer-model'; | ||
import { ToolbarSettingsModel, AnnotationToolbarSettingsModel } from './pdfviewer-model'; | ||
@@ -11,3 +11,3 @@ import { ServerActionSettingsModel, AjaxRequestSettingsModel } from './pdfviewer-model'; | ||
import { ToolbarItem } from './index'; | ||
import { LinkTarget, InteractionMode, AnnotationType, AnnotationToolbarItem, LineHeadStyle } from './base/types'; | ||
import { LinkTarget, InteractionMode, AnnotationType, AnnotationToolbarItem, LineHeadStyle, ContextMenuAction } from './base/types'; | ||
import { Annotation } from './index'; | ||
@@ -19,3 +19,3 @@ import { LinkAnnotation } from './index'; | ||
import { TextSearch } from './index'; | ||
import { Print } from './index'; | ||
import { Print, CalibrationUnit } from './index'; | ||
import { UnloadEventArgs, LoadEventArgs, LoadFailedEventArgs, AjaxRequestFailureEventArgs, PageChangeEventArgs, PageClickEventArgs, ZoomChangeEventArgs, HyperlinkClickEventArgs } from './index'; | ||
@@ -39,3 +39,3 @@ import { AnnotationAddEventArgs, AnnotationRemoveEventArgs, AnnotationPropertiesChangeEventArgs, AnnotationResizeEventArgs, AnnotationSelectEventArgs } from './index'; | ||
*/ | ||
toolbarItem: ToolbarItem[]; | ||
toolbarItems: ToolbarItem[]; | ||
} | ||
@@ -632,2 +632,23 @@ /** | ||
/** | ||
* The `MeasurementSettings` module is used to provide the settings to measurement annotations. | ||
*/ | ||
export declare class MeasurementSettings extends ChildProperty<MeasurementSettings> { | ||
/** | ||
* specifies the scale ratio of the annotation. | ||
*/ | ||
scaleRatio: number; | ||
/** | ||
* specifies the unit of the annotation. | ||
*/ | ||
conversionUnit: CalibrationUnit; | ||
/** | ||
* specifies the unit of the annotation. | ||
*/ | ||
displayUnit: CalibrationUnit; | ||
/** | ||
* specifies the depth of the volume annotation. | ||
*/ | ||
depth: number; | ||
} | ||
/** | ||
* Represents the PDF viewer component. | ||
@@ -730,2 +751,7 @@ * ```html | ||
/** | ||
* Specifies the state of the ContextMenu in the PDF document. | ||
* @default RightClick | ||
*/ | ||
contextMenuOption: ContextMenuAction; | ||
/** | ||
* Enable or disables the Navigation module of PdfViewer. | ||
@@ -876,2 +902,6 @@ * @default true | ||
/** | ||
* Defines the settings of measurement annotation. | ||
*/ | ||
measurementSettings: MeasurementSettingsModel; | ||
/** | ||
* @private | ||
@@ -878,0 +908,0 @@ */ |
@@ -40,3 +40,3 @@ var __extends = (this && this.__extends) || (function () { | ||
Property() | ||
], ToolbarSettings.prototype, "toolbarItem", void 0); | ||
], ToolbarSettings.prototype, "toolbarItems", void 0); | ||
return ToolbarSettings; | ||
@@ -618,2 +618,25 @@ }(ChildProperty)); | ||
/** | ||
* The `MeasurementSettings` module is used to provide the settings to measurement annotations. | ||
*/ | ||
var MeasurementSettings = /** @class */ (function (_super) { | ||
__extends(MeasurementSettings, _super); | ||
function MeasurementSettings() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
__decorate([ | ||
Property(1) | ||
], MeasurementSettings.prototype, "scaleRatio", void 0); | ||
__decorate([ | ||
Property('in') | ||
], MeasurementSettings.prototype, "conversionUnit", void 0); | ||
__decorate([ | ||
Property('in') | ||
], MeasurementSettings.prototype, "displayUnit", void 0); | ||
__decorate([ | ||
Property(96) | ||
], MeasurementSettings.prototype, "depth", void 0); | ||
return MeasurementSettings; | ||
}(ChildProperty)); | ||
export { MeasurementSettings }; | ||
/** | ||
* Represents the PDF viewer component. | ||
@@ -1401,2 +1424,5 @@ * ```html | ||
__decorate([ | ||
Property('RightClick') | ||
], PdfViewer.prototype, "contextMenuOption", void 0); | ||
__decorate([ | ||
Property(true) | ||
@@ -1441,3 +1467,3 @@ ], PdfViewer.prototype, "enableNavigation", void 0); | ||
__decorate([ | ||
Property({ showTooltip: true, toolbarItem: ['OpenOption', 'UndoRedoTool', 'PageNavigationTool', 'MagnificationTool', 'PanTool', 'SelectionTool', 'CommentTool', 'AnnotationEditTool', 'FreeTextAnnotationOption', 'InkAnnotationOption', 'ShapeAnnotationOption', 'StampAnnotation', 'SignatureOption', 'SearchOption', 'PrintOption', 'DownloadOption'] }) | ||
Property({ showTooltip: true, toolbarItems: ['OpenOption', 'UndoRedoTool', 'PageNavigationTool', 'MagnificationTool', 'PanTool', 'SelectionTool', 'CommentTool', 'AnnotationEditTool', 'FreeTextAnnotationOption', 'InkAnnotationOption', 'ShapeAnnotationOption', 'StampAnnotation', 'SignatureOption', 'SearchOption', 'PrintOption', 'DownloadOption'] }) | ||
], PdfViewer.prototype, "toolbarSettings", void 0); | ||
@@ -1502,2 +1528,5 @@ __decorate([ | ||
__decorate([ | ||
Property({ conversionUnit: 'in', displayUnit: 'in', scaleRatio: 1, depth: 96 }) | ||
], PdfViewer.prototype, "measurementSettings", void 0); | ||
__decorate([ | ||
Complex({}, Selector) | ||
@@ -1504,0 +1533,0 @@ ], PdfViewer.prototype, "selectedItems", void 0); |
@@ -71,9 +71,7 @@ import { PdfViewer, PdfViewerBase } from '../index'; | ||
private getSearchPage; | ||
private convertMatches; | ||
private highlightSearchedTexts; | ||
private beginText; | ||
private addSpanForSearch; | ||
private addDivForSearch; | ||
private addDivElement; | ||
private createSearchTextDiv; | ||
private isClassAvailable; | ||
private addSpan; | ||
private searchOnSelection; | ||
private getScrollElement; | ||
@@ -84,8 +82,15 @@ private scrollToSearchStr; | ||
*/ | ||
resizeSearchElements(pageIndex: number): void; | ||
/** | ||
* @private | ||
*/ | ||
highlightOtherOccurrences(pageNumber: number): void; | ||
private highlightOthers; | ||
private clearAllOccurrences; | ||
/** | ||
* @private | ||
*/ | ||
clearAllOccurrences(): void; | ||
/** | ||
* @private | ||
*/ | ||
getIndexes(): any; | ||
@@ -92,0 +97,0 @@ private applyTextSelection; |
@@ -1,2 +0,2 @@ | ||
import { createElement, Browser } from '@syncfusion/ej2-base'; | ||
import { createElement, Browser, isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
import { CheckBox } from '@syncfusion/ej2-buttons'; | ||
@@ -203,4 +203,5 @@ import { AjaxHandler } from '../index'; | ||
if (inputString !== '') { | ||
if (this.searchCollection[this.searchPageIndex] && inputString === this.searchString) { | ||
if (this.searchCollection[this.searchPageIndex].length === 0) { | ||
// tslint:disable-next-line | ||
if (this.searchMatches[this.searchPageIndex] && inputString === this.searchString) { | ||
if (this.searchMatches[this.searchPageIndex].length === 0) { | ||
this.initSearch(this.searchPageIndex, false); | ||
@@ -234,5 +235,5 @@ } | ||
this.searchIndex = this.searchIndex + 1; | ||
if (this.searchCollection[this.searchPageIndex]) { | ||
if (this.searchMatches[this.searchPageIndex]) { | ||
// tslint:disable-next-line:max-line-length | ||
if (this.searchIndex >= this.searchCollection[this.searchPageIndex].length || this.searchPageIndex !== this.pdfViewerBase.currentPageNumber - 1) { | ||
if (this.searchIndex >= this.searchMatches[this.searchPageIndex].length || this.searchPageIndex !== this.pdfViewerBase.currentPageNumber - 1) { | ||
this.searchIndex = 0; | ||
@@ -282,2 +283,4 @@ this.searchPageIndex = ((this.searchPageIndex + 1) < this.pdfViewerBase.pageCount) ? (this.searchPageIndex + 1) : 0; | ||
var textContents = null; | ||
// tslint:disable-next-line | ||
var characterBounds = null; | ||
if (storedData) { | ||
@@ -288,4 +291,5 @@ // tslint:disable-next-line | ||
textContents = storedData['textContent']; | ||
characterBounds = this.pdfViewerBase.textLayer.characterBound[pageIndex]; | ||
this.textContents[pageIndex] = textContents; | ||
this.getPossibleMatches(pageIndex, this.searchString, pageText, textContents, isSinglePageSearch); | ||
this.getPossibleMatches(pageIndex, this.searchString, pageText, textContents, isSinglePageSearch, characterBounds); | ||
} | ||
@@ -298,4 +302,4 @@ else { | ||
}; | ||
// tslint:disable-next-line:max-line-length | ||
TextSearch.prototype.getPossibleMatches = function (pageIndex, searchString, pageString, textContents, isSinglePageSearch) { | ||
// tslint:disable-next-line | ||
TextSearch.prototype.getPossibleMatches = function (pageIndex, searchString, pageString, textContents, isSinglePageSearch, characterBounds) { | ||
var pageText = pageString; | ||
@@ -310,2 +314,3 @@ var searchText = searchString; | ||
var matchIndex = -queryLength; | ||
var newIndex = -queryLength; | ||
while (matchIndex !== 0) { | ||
@@ -316,6 +321,20 @@ if (searchText === '' || searchText === ' ' || !searchText) { | ||
matchIndex = pageText.indexOf(searchText, matchIndex + queryLength); | ||
if (matchIndex === -1) { | ||
if (searchText.indexOf(' ') !== -1) { | ||
var newString = searchString.replace(' ', '\r\n'); | ||
newIndex = pageText.indexOf(newString, newIndex + queryLength); | ||
if (!(newIndex <= -1)) { | ||
if (newIndex < matchIndex) { | ||
matches.push(newIndex); | ||
} | ||
} | ||
} | ||
if (matchIndex <= -1 && newIndex <= -1) { | ||
break; | ||
} | ||
matches.push(matchIndex); | ||
if (!(matchIndex <= -1)) { | ||
matches.push(matchIndex); | ||
} | ||
if (newIndex > matchIndex && !(newIndex <= -1)) { | ||
matches.push(newIndex); | ||
} | ||
} | ||
@@ -336,3 +355,3 @@ this.searchMatches[pageIndex] = matches; | ||
// tslint:disable-next-line:max-line-length | ||
if (this.searchCollection.length > 0 && (this.searchIndex === 0 || this.searchIndex === -1) && (this.searchPageIndex) === this.currentSearchIndex) { | ||
if (this.searchMatches.length > 0 && (this.searchIndex === 0 || this.searchIndex === -1) && (this.searchPageIndex) === this.currentSearchIndex) { | ||
if (!this.isMessagePopupOpened) { | ||
@@ -347,3 +366,3 @@ this.onMessageBoxOpen(); | ||
} | ||
this.convertMatches(pageIndex, queryLength, textContents, isSinglePageSearch); | ||
this.highlightSearchedTexts(pageIndex, isSinglePageSearch); | ||
} | ||
@@ -364,3 +383,3 @@ else { | ||
// tslint:disable-next-line:max-line-length | ||
if (!this.searchCollection[this.searchPageIndex] && this.searchCollection.length === 0 && this.searchedPages.length === this.pdfViewerBase.pageCount) { | ||
if (!this.searchMatches[this.searchPageIndex] && this.searchMatches.length === 0 && this.searchedPages.length === this.pdfViewerBase.pageCount) { | ||
// tslint:disable-next-line:max-line-length | ||
@@ -372,3 +391,3 @@ if (!this.isMessagePopupOpened) { | ||
} | ||
else if (this.searchCollection.length > 0 && (this.searchIndex === 0 || this.searchIndex === -1) && (searchPageIndex) === this.currentSearchIndex) { | ||
else if (this.searchMatches.length > 0 && (this.searchIndex === 0 || this.searchIndex === -1) && (searchPageIndex) === this.currentSearchIndex) { | ||
if (this.isPrevSearch) { | ||
@@ -379,3 +398,3 @@ // tslint:disable-next-line:max-line-length | ||
} | ||
this.searchPageIndex = this.getSearchPage(this.pdfViewerBase.currentPageNumber - 1); | ||
this.searchPageIndex = searchPageIndex; | ||
this.searchedPages = []; | ||
@@ -388,3 +407,3 @@ this.searchIndex = -1; | ||
} | ||
this.searchPageIndex = this.getSearchPage(this.pdfViewerBase.currentPageNumber - 1); | ||
this.searchPageIndex = searchPageIndex; | ||
this.searchedPages = []; | ||
@@ -403,3 +422,3 @@ this.searchIndex = 0; | ||
for (var i = pageIndex; i >= 0; i--) { | ||
if (i !== pageIndex && this.searchCollection[i]) { | ||
if (i !== pageIndex && this.searchMatches[i]) { | ||
pageNumber = i; | ||
@@ -411,3 +430,3 @@ break; | ||
for (var j = this.pdfViewerBase.pageCount - 1; j > pageIndex; j--) { | ||
if (this.searchCollection[j]) { | ||
if (this.searchMatches[j]) { | ||
pageNumber = j; | ||
@@ -421,3 +440,3 @@ break; | ||
for (var i = pageIndex; i < this.pdfViewerBase.pageCount; i++) { | ||
if (i !== pageIndex && this.searchCollection[i]) { | ||
if (i !== pageIndex && this.searchMatches[i]) { | ||
pageNumber = i; | ||
@@ -429,3 +448,3 @@ break; | ||
for (var j = 0; j < pageIndex; j++) { | ||
if (this.searchCollection[j]) { | ||
if (this.searchMatches[j]) { | ||
pageNumber = j; | ||
@@ -439,39 +458,5 @@ break; | ||
}; | ||
TextSearch.prototype.convertMatches = function (pageIndex, queryLength, textContents, isSinglePageSearch) { | ||
var m = 0; | ||
TextSearch.prototype.highlightSearchedTexts = function (pageIndex, isSinglePageSearch) { | ||
// tslint:disable-next-line | ||
var matches = this.searchMatches[pageIndex]; | ||
var divIndex = 0; | ||
var end = textContents.length - 1; | ||
var matchCollection = []; | ||
for (var i = 0; i < matches.length; i++) { | ||
var matchIndex = matches[i]; | ||
while (m !== end && matchIndex >= (divIndex + textContents[m].split('\r\n')[0].length)) { | ||
divIndex += textContents[m].split('\r\n')[0].length; | ||
m++; | ||
} | ||
var match = { | ||
begin: { | ||
divId: m, | ||
offsetValue: matchIndex - divIndex, | ||
} | ||
}; | ||
matchIndex += queryLength; | ||
while (m !== end && matchIndex > (divIndex + textContents[m].length)) { | ||
divIndex += textContents[m].length; | ||
m++; | ||
} | ||
match.end = { | ||
divId: m, | ||
offsetValue: matchIndex - divIndex, | ||
}; | ||
matchCollection.push(match); | ||
} | ||
if (this.searchCollection.length === 0) { | ||
this.currentSearchIndex = pageIndex; | ||
} | ||
this.searchCollection[pageIndex] = matchCollection; | ||
this.highlightSearchedTexts(pageIndex, isSinglePageSearch); | ||
}; | ||
TextSearch.prototype.highlightSearchedTexts = function (pageIndex, isSinglePageSearch) { | ||
var matches = this.searchCollection[pageIndex]; | ||
var prevEnd = null; | ||
@@ -482,97 +467,98 @@ // tslint:disable-next-line | ||
var className; | ||
for (var i = 0; i < matches.length; i++) { | ||
var match = matches[i]; | ||
// tslint:disable-next-line | ||
var start = match.begin; | ||
// tslint:disable-next-line | ||
var end = match.end; | ||
if (i === this.searchIndex && pageIndex === this.searchPageIndex) { | ||
className = 'e-pv-search-text-highlight'; | ||
startId = start.divId; | ||
} | ||
else { | ||
className = 'e-pv-search-text-highlightother'; | ||
} | ||
if (!prevEnd || start.divId !== prevEnd.divId) { | ||
if (prevEnd !== null) { | ||
// tslint:disable-next-line:max-line-length | ||
this.addSpanForSearch(pageIndex, parseFloat(prevEnd.divId.toString()), parseFloat(prevEnd.offsetValue.toString()), undefined, null); | ||
// tslint:disable-next-line | ||
var characterBounds = this.pdfViewerBase.textLayer.characterBound[pageIndex]; | ||
if (characterBounds) { | ||
for (var i = 0; i < matches.length; i++) { | ||
if (i === this.searchIndex && pageIndex === this.searchPageIndex) { | ||
className = 'e-pv-search-text-highlight'; | ||
} | ||
this.beginText(start, pageIndex, null); | ||
else { | ||
className = 'e-pv-search-text-highlightother'; | ||
} | ||
this.addDivForSearch(i, pageIndex, characterBounds, this.searchString.length, className); | ||
} | ||
else { | ||
// tslint:disable-next-line:max-line-length | ||
this.addSpanForSearch(pageIndex, parseFloat(prevEnd.divId.toString()), parseFloat(prevEnd.offsetValue.toString()), parseFloat(start.offsetValue.toString()), null); | ||
} | ||
if (start.divId === end.divId) { | ||
this.addSpanForSearch(pageIndex, start.divId, start.offsetValue, end.offsetValue, className); | ||
} | ||
else { | ||
this.addSpanForSearch(pageIndex, start.divId, start.offsetValue, undefined, className); | ||
for (var k = start.divId + 1; k < end.divId; k++) { | ||
this.addSpanForSearch(pageIndex, k, 0, undefined, className + ' middle'); | ||
if (pageIndex === this.searchPageIndex && !isSinglePageSearch) { | ||
var element = this.pdfViewerBase.getElement('_searchtext_' + pageIndex + '_' + this.searchIndex); | ||
if (element) { | ||
var targetScrollElement = this.getScrollElement(element); | ||
this.scrollToSearchStr(targetScrollElement, scrollPoint); | ||
} | ||
this.beginText(end, pageIndex, className); | ||
else { | ||
this.pdfViewerBase.updateScrollTop(pageIndex); | ||
var element_1 = this.pdfViewerBase.getElement('_searchtext_' + pageIndex + '_' + this.searchIndex); | ||
if (element_1) { | ||
var targetScrollElement = this.getScrollElement(element_1); | ||
this.scrollToSearchStr(targetScrollElement, scrollPoint); | ||
} | ||
} | ||
} | ||
prevEnd = end; | ||
} | ||
if (prevEnd) { | ||
// tslint:disable-next-line:max-line-length | ||
this.addSpanForSearch(pageIndex, parseFloat(prevEnd.divId.toString()), parseFloat(prevEnd.offsetValue.toString()), undefined, null); | ||
}; | ||
// tslint:disable-next-line | ||
TextSearch.prototype.addDivForSearch = function (index, pageIndex, characterBounds, queryLength, className) { | ||
var textLayer = this.pdfViewerBase.getElement('_textLayer_' + pageIndex); | ||
if (isNullOrUndefined(textLayer) && className === 'e-pv-search-text-highlight') { | ||
this.pdfViewer.navigation.goToPage(pageIndex + 1); | ||
} | ||
if (pageIndex === this.searchPageIndex && !isSinglePageSearch) { | ||
var element = this.pdfViewerBase.getElement('_text_' + pageIndex + '_' + startId); | ||
if (element) { | ||
var targetScrollElement = this.getScrollElement(element); | ||
this.scrollToSearchStr(targetScrollElement, scrollPoint); | ||
} | ||
else { | ||
this.pdfViewerBase.updateScrollTop(pageIndex); | ||
var element_1 = this.pdfViewerBase.getElement('_text_' + pageIndex + '_' + startId); | ||
var targetScrollElement = this.getScrollElement(element_1); | ||
this.scrollToSearchStr(targetScrollElement, scrollPoint); | ||
} | ||
var count = this.searchMatches[pageIndex][index]; | ||
var initial = count; | ||
var divCount = 0; | ||
while (count < initial + queryLength) { | ||
count = this.addDivElement(count, characterBounds, queryLength, className, index, pageIndex, initial, divCount); | ||
divCount++; | ||
} | ||
}; | ||
// tslint:disable-next-line | ||
TextSearch.prototype.beginText = function (start, pageIndex, className) { | ||
var divIndex = parseFloat(start.divId); | ||
var textDiv = this.pdfViewerBase.getElement('_text_' + pageIndex + '_' + divIndex); | ||
if (textDiv) { | ||
TextSearch.prototype.addDivElement = function (count, characterBounds, queryLength, className, index, pageIndex, initial, divCount) { | ||
var height = 0; | ||
var width = 0; | ||
var top = 0; | ||
var left = 0; | ||
left = characterBounds[count].X; | ||
top = characterBounds[count].Y; | ||
var v = 0; | ||
if ((count - initial) !== 0) { | ||
v = count - initial; | ||
queryLength += 1; | ||
} | ||
for (v = v; v < queryLength; v++) { | ||
// tslint:disable-next-line | ||
this.tempElementStorage = new Array(); | ||
for (var i = 0; i < textDiv.childNodes.length; i++) { | ||
// tslint:disable-next-line:max-line-length | ||
var ele = { text: textDiv.childNodes[i].textContent, classString: textDiv.childNodes[i].className }; | ||
this.tempElementStorage.push(ele); | ||
var charBound = characterBounds[count]; | ||
if (left > charBound.X) { | ||
break; | ||
} | ||
textDiv.textContent = ''; | ||
this.addSpanForSearch(pageIndex, divIndex, 0, start.offsetValue, className); | ||
top = (top < charBound.Y) ? top : charBound.Y; | ||
var topDifference = (top < charBound.Y) ? (charBound.Y - top) : (top - charBound.Y); | ||
height = (height > (topDifference + charBound.Height)) ? height : (topDifference + charBound.Height); | ||
count++; | ||
} | ||
var isContinuation = false; | ||
if (initial + queryLength !== count) { | ||
isContinuation = true; | ||
width = (characterBounds[count - 1].X - left); | ||
} | ||
else { | ||
isContinuation = false; | ||
width = (characterBounds[count].X - left); | ||
} | ||
this.createSearchTextDiv(index, pageIndex, height, width, top, left, className, isContinuation, divCount); | ||
return count; | ||
}; | ||
// tslint:disable-next-line:max-line-length | ||
TextSearch.prototype.addSpanForSearch = function (pageIndex, divIndex, fromOffset, toOffset, className) { | ||
var divTextContent; | ||
var textDiv = this.pdfViewerBase.getElement('_text_' + pageIndex + '_' + divIndex); | ||
if (textDiv) { | ||
var textContent = this.textContents[pageIndex]; | ||
divTextContent = textContent[divIndex].substring(fromOffset, toOffset); | ||
var node = document.createTextNode(divTextContent); | ||
if (className) { | ||
var spanElement = document.createElement('span'); | ||
spanElement.className = className; | ||
if (spanElement.classList.contains('middle')) { | ||
textDiv.textContent = ''; | ||
} | ||
spanElement.appendChild(node); | ||
textDiv.appendChild(spanElement); | ||
// tslint:disable-next-line | ||
TextSearch.prototype.createSearchTextDiv = function (index, pageIndex, height, width, top, left, className, isContinuation, divCount) { | ||
var idString = '_searchtext_' + pageIndex + '_' + index; | ||
if (isContinuation) { | ||
idString += '_' + divCount; | ||
} | ||
if (!this.pdfViewerBase.getElement(idString)) { | ||
var textDiv = createElement('div', { id: this.pdfViewer.element.id + idString }); | ||
textDiv.style.height = height * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
textDiv.style.width = width * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
textDiv.style.top = top * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
textDiv.style.left = left * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
textDiv.classList.add(className); | ||
var textLayer = this.pdfViewerBase.getElement('_textLayer_' + pageIndex); | ||
if (textLayer) { | ||
textLayer.appendChild(textDiv); | ||
} | ||
else { | ||
if (this.pdfViewer.textSelectionModule.isTextSelection) { | ||
this.searchOnSelection(textDiv, node, divTextContent); | ||
} | ||
else { | ||
textDiv.appendChild(node); | ||
} | ||
} | ||
} | ||
@@ -593,175 +579,2 @@ }; | ||
}; | ||
TextSearch.prototype.addSpan = function (text, textDiv) { | ||
var newNode = document.createTextNode(text); | ||
var spanElement = document.createElement('span'); | ||
spanElement.className = 'e-pv-maintaincontent'; | ||
spanElement.appendChild(newNode); | ||
textDiv.appendChild(spanElement); | ||
}; | ||
TextSearch.prototype.searchOnSelection = function (textDiv, node, divTextContent) { | ||
if (this.tempElementStorage.length === 1) { | ||
if (this.tempElementStorage[0].classString) { | ||
if (this.tempElementStorage[0].classString.indexOf('e-pv-maintaincontent') !== -1) { | ||
this.addSpan(node.textContent, textDiv); | ||
} | ||
} | ||
else { | ||
textDiv.appendChild(node); | ||
} | ||
} | ||
else { | ||
if (this.tempElementStorage.length > 1) { | ||
for (var i = 0; i < this.tempElementStorage.length; i++) { | ||
if (this.tempElementStorage[i].classString) { | ||
if (this.tempElementStorage[i].classString.indexOf('e-pv-maintaincontent') !== -1) { | ||
if (this.tempElementStorage[i].text === node.textContent) { | ||
this.addSpan(node.textContent, textDiv); | ||
break; | ||
} | ||
else { | ||
if (this.tempElementStorage[i].text !== node.textContent) { | ||
var currentString = node.textContent; | ||
var isClassAvailable = this.isClassAvailable(); | ||
var subString = void 0; | ||
if (isClassAvailable) { | ||
subString = divTextContent.substring(0, this.tempElementStorage[i].text.length); | ||
} | ||
else { | ||
subString = divTextContent.substring(0, this.tempElementStorage[i].text.length); | ||
} // tslint:disable-next-line | ||
if (this.tempElementStorage[i].text.indexOf(currentString) !== -1 && !this.tempElementStorage[i].classString) { | ||
this.addSpan(currentString, textDiv); | ||
break; // tslint:disable-next-line | ||
} | ||
else if (this.tempElementStorage[i].text.indexOf(subString) !== -1 && this.tempElementStorage[i].classString && subString !== '') { | ||
if (this.tempElementStorage[i].classString.indexOf('e-pv-maintaincontent') !== -1) { | ||
this.addSpan(subString, textDiv); // tslint:disable-next-line | ||
var nextSubString = divTextContent.substring(this.tempElementStorage[i].text.length, divTextContent.length); | ||
if (this.tempElementStorage[i + 1]) { // tslint:disable-next-line | ||
if (this.tempElementStorage[i + 1].text.indexOf(nextSubString) !== -1 && !this.tempElementStorage[i + 1].classString && nextSubString !== "") { | ||
node.textContent = nextSubString; | ||
textDiv.appendChild(node); | ||
} | ||
} | ||
break; | ||
} | ||
} | ||
else if (this.tempElementStorage[i + 1]) { | ||
if (divTextContent === (this.tempElementStorage[i].text + this.tempElementStorage[i + 1].text)) { | ||
this.addSpan(this.tempElementStorage[i].text, textDiv); | ||
node.textContent = this.tempElementStorage[i + 1].text; | ||
textDiv.appendChild(node); | ||
break; | ||
} | ||
else if (this.tempElementStorage[i].text.indexOf(divTextContent) !== -1) { | ||
this.addSpan(divTextContent, textDiv); | ||
break; | ||
} | ||
else { // tslint:disable-next-line | ||
var subString_1 = this.tempElementStorage[i].text.substring(textDiv.textContent.length, currentString.length); | ||
if (this.tempElementStorage[i].text.indexOf(subString_1) !== -1 && this.tempElementStorage[i].classString && // tslint:disable-next-line | ||
subString_1 !== '' && !this.tempElementStorage[i + 1].classString && divTextContent.indexOf(subString_1) !== -1) { | ||
this.addSpan(subString_1, textDiv); | ||
continue; | ||
} | ||
} | ||
} | ||
else { | ||
if (this.tempElementStorage[i].text.indexOf(divTextContent) !== -1) { | ||
this.addSpan(node.textContent, textDiv); | ||
break; | ||
} | ||
else if (this.tempElementStorage[i].text.indexOf(divTextContent.replace('\r\n', '')) !== -1) { | ||
this.addSpan(divTextContent, textDiv); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
if (this.tempElementStorage[i].text !== node.textContent) { | ||
var currentString = node.textContent; | ||
if (currentString !== '') { | ||
var isClassAvailable = this.isClassAvailable(); | ||
var subString = void 0; | ||
if (isClassAvailable) { | ||
subString = divTextContent.substring(0, this.tempElementStorage[i].text.length); | ||
} | ||
else { // tslint:disable-next-line | ||
subString = divTextContent.substring(0, this.tempElementStorage[i].text.length - textDiv.textContent.length); | ||
} // tslint:disable-next-line | ||
if (subString === currentString && !this.tempElementStorage[i].classString && this.tempElementStorage[i].text.indexOf(subString) !== -1) { | ||
node.textContent = subString; | ||
textDiv.appendChild(node); | ||
break; | ||
} | ||
else { // tslint:disable-next-line | ||
if (this.tempElementStorage[i].text.indexOf(subString) !== -1 && this.tempElementStorage[i].classString) { | ||
if (this.tempElementStorage[i].classString.indexOf('e-pv-maintaincontent') !== -1) { | ||
this.addSpan(subString, textDiv); | ||
break; | ||
} | ||
} | ||
else if (this.tempElementStorage[i + 1]) { // tslint:disable-next-line | ||
var balanceString = currentString.substring(this.tempElementStorage[i].text.length, currentString.length); | ||
var nextString = this.tempElementStorage[i + 1].text.substring(0, balanceString.length); | ||
if (currentString === (subString + this.tempElementStorage[i + 1].text)) { | ||
node.textContent = subString; | ||
textDiv.appendChild(node); | ||
this.addSpan(this.tempElementStorage[i + 1].text, textDiv); | ||
break; | ||
} | ||
else if (currentString === (subString + nextString) && nextString !== '') { | ||
node.textContent = subString; | ||
textDiv.appendChild(node); | ||
this.addSpan(balanceString, textDiv); | ||
break; | ||
} | ||
else { // tslint:disable-next-line | ||
if (this.tempElementStorage[i].text.indexOf(subString) !== -1 && !this.tempElementStorage[i].classString && subString !== '') { | ||
var newSubString = divTextContent.substring(0, subString.length); | ||
node.textContent = newSubString; | ||
textDiv.appendChild(node); // tslint:disable-next-line | ||
var nextNewSubString = divTextContent.substring(subString.length, divTextContent.length); | ||
if (nextNewSubString !== '' && this.tempElementStorage[i + 1].text.indexOf(nextNewSubString) !== -1 && this.tempElementStorage[i + 1].classString) { | ||
this.addSpan(nextNewSubString, textDiv); | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
else { // tslint:disable-next-line | ||
if (this.tempElementStorage[i].text.indexOf(currentString) !== -1 && !this.tempElementStorage[i].classString) { | ||
node.textContent = currentString; | ||
textDiv.appendChild(node); | ||
break; // tslint:disable-next-line | ||
} | ||
else if (this.tempElementStorage[i].text.indexOf(currentString.replace('\r\n', '')) !== -1 && !this.tempElementStorage[i].classString) { | ||
node.textContent = currentString; | ||
textDiv.appendChild(node); | ||
break; | ||
} | ||
else { | ||
if (divTextContent.indexOf(this.tempElementStorage[i].text) !== -1) { | ||
node.textContent = this.tempElementStorage[i].text; | ||
textDiv.appendChild(node); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
textDiv.appendChild(node); | ||
} | ||
} | ||
} | ||
} | ||
else { | ||
textDiv.appendChild(node); | ||
} | ||
} | ||
}; | ||
TextSearch.prototype.getScrollElement = function (element) { | ||
@@ -808,2 +621,19 @@ var targetElement = element; | ||
*/ | ||
TextSearch.prototype.resizeSearchElements = function (pageIndex) { | ||
var searchDivs = document.querySelectorAll('div[id*="' + this.pdfViewer.element.id + '_searchtext_' + pageIndex + '"]'); | ||
for (var i = 0; i < searchDivs.length; i++) { | ||
var textDiv = searchDivs[i]; | ||
// tslint:disable-next-line | ||
textDiv.style.width = (parseFloat(textDiv.style.width) / this.pdfViewer.magnificationModule.previousZoomFactor) * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
// tslint:disable-next-line | ||
textDiv.style.height = (parseFloat(textDiv.style.height) / this.pdfViewer.magnificationModule.previousZoomFactor) * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
// tslint:disable-next-line | ||
textDiv.style.top = (parseFloat(textDiv.style.top) / this.pdfViewer.magnificationModule.previousZoomFactor) * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
// tslint:disable-next-line | ||
textDiv.style.left = (parseFloat(textDiv.style.left) / this.pdfViewer.magnificationModule.previousZoomFactor) * this.pdfViewerBase.getZoomFactor() + 'px'; | ||
} | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
TextSearch.prototype.highlightOtherOccurrences = function (pageNumber) { | ||
@@ -820,5 +650,10 @@ this.initSearch(pageNumber, true); | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
TextSearch.prototype.clearAllOccurrences = function () { | ||
this.pdfViewerBase.textLayer.clearDivSelection(); | ||
this.applyTextSelection(); | ||
var searchTextDivs = document.querySelectorAll('div[id*="' + this.pdfViewer.element.id + '_searchtext_"]'); | ||
for (var i = 0; i < searchTextDivs.length; i++) { | ||
searchTextDivs[i].parentElement.removeChild(searchTextDivs[i]); | ||
} | ||
}; | ||
@@ -943,4 +778,2 @@ /** | ||
this.searchMatches = new Array(); | ||
// tslint:disable-next-line | ||
this.searchCollection = new Array(); | ||
}; | ||
@@ -1021,3 +854,3 @@ /** | ||
TextSearch.prototype.destroy = function () { | ||
this.searchCollection = undefined; | ||
this.searchMatches = undefined; | ||
}; | ||
@@ -1024,0 +857,0 @@ /** |
@@ -62,2 +62,3 @@ import { PdfViewer, PdfViewerBase } from '../index'; | ||
private topStoreRight; | ||
private isTextSearched; | ||
/** | ||
@@ -109,3 +110,3 @@ * @private | ||
*/ | ||
textSelectionOnMouseup(): void; | ||
textSelectionOnMouseup(event: MouseEvent): void; | ||
/** | ||
@@ -173,3 +174,6 @@ * @private | ||
private createTouchSelectElement; | ||
private calculateContextMenuPosition; | ||
/** | ||
* @private | ||
*/ | ||
calculateContextMenuPosition(top: any, left: any): any; | ||
private onLeftTouchSelectElementTouchStart; | ||
@@ -176,0 +180,0 @@ private onRightTouchSelectElementTouchStart; |
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 not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19477034
135192