UNPKG

@mescius/dspdfviewer

Version:
94 lines (92 loc) 4.94 kB
//@ts-ignore import { DropdownItem } from "@grapecity/core-ui"; import { IGcDocumentContextMenuContext } from "./types"; import GcPdfViewer from ".."; import { GcSelectionPoint } from "../Models/GcMeasurementTypes"; /// <reference path="../vendor/i18next.d.ts" /> //@ts-ignore import { i18n } from 'i18next'; import { AnnotationBase, MarkupAnnotation } from "../Annotations/AnnotationTypes"; import { IGcSelectionCopier } from "../Models/ViewerTypes"; export type GcContextMenuParams = { mouseOverPageFlag: boolean; keyboardEventFlag: boolean; target?: HTMLElement; event?: any; doubleClick?: boolean; }; /** * Context menu specific to PDF document and current view context. **/ export declare class GcDocumentContextMenu { viewer: GcPdfViewer; container: HTMLElement; context: IGcDocumentContextMenuContext; docViewer: any; private _openParams; private _targetAnnotationId; private _opening; private _opened; private _prevAction?; private _prevColor?; in17n: i18n; static register(viewer: GcPdfViewer, container: HTMLElement, context: IGcDocumentContextMenuContext, docViewer: any): GcDocumentContextMenu | null; static unregister(container: HTMLElement): void; mousePosition: GcSelectionPoint; insertPosition: GcSelectionPoint; private constructor(); onTextMarkupContextMenu(mousePos: GcSelectionPoint, selectionCopier: IGcSelectionCopier, params: GcContextMenuParams): boolean; onCustomContextMenu(mousePos: GcSelectionPoint, selectionCopier: IGcSelectionCopier, params: GcContextMenuParams): boolean; private open; private openInternal; private close; private get contextMenuProvider(); private get useColoredIcons(); private getDropdownItems; /** * Finds all annotations that visually overlap with the target element. * @param {HTMLElement} targetElement - The element to check overlaps against * @param {string} currentAnnotationId - ID of the target element's annotation (to exclude) * @returns {string[]} Array of overlapping annotation IDs */ findOverlappingAnnotations(targetElement: HTMLElement, currentAnnotationId: string, inckudeCurrent: boolean): string[]; elementsOverlap(rect1: DOMRect, rect2: DOMRect): boolean; addShowCommentPanel(items: DropdownItem[], isMini?: boolean): void; addPasteAction(items: DropdownItem[], isMini?: boolean): void; addOverlappingAnnotationsMenuItems(items: DropdownItem[], overlappingIds: string[] | undefined, currentId: string): void; addAnnotationMenuItems(items: DropdownItem[], annotationId: string, isMini?: boolean): void; adjustRectForNewViewPort(annotation: AnnotationBase, prevPageIndex: number, newPageIndex: number, checkBoundsCollision?: boolean): void; addSplitter(items: DropdownItem[]): void; getDDColorValues(type: "highlight" | "underline" | "strikeout" | "squiggly"): { value: string; displayName: string; }[]; renderColorItems(colors: { value: string; displayName: string; }[], onClick: (colorHex: string) => void, lastSelectedColor?: string): DropdownItem[]; addHighlightFromSelection(items: DropdownItem[], selectionCopier: IGcSelectionCopier, isOverAnnotation: boolean, args: { isMini?: boolean; repeatAction?: boolean; }): void; addUnderlineFromSelection(items: DropdownItem[], selectionCopier: IGcSelectionCopier, isOverAnnotation: boolean, args: { isMini?: boolean; repeatAction?: boolean; }): void; makeTextMarkupFromSelection(markupType: "underline" | "highlight" | "strikeout" | "squiggly" | "replacetext", selectionCopier: IGcSelectionCopier, annotation?: MarkupAnnotation, colorHex?: string): Promise<boolean>; addStrikeoutFromSelection(items: DropdownItem[], selectionCopier: IGcSelectionCopier, isOverAnnotation: boolean, args: { isMini?: boolean; repeatAction?: boolean; }): void; addSquigglyFromSelection(items: DropdownItem[], selectionCopier: IGcSelectionCopier, isOverAnnotation: boolean, args: { isMini?: boolean; repeatAction?: boolean; }): void; addCreateLinkAndTextMarkupItems(items: DropdownItem[], selectionCopier: IGcSelectionCopier, isOverAnnotation: boolean, isMini?: boolean): void; addCopyText(items: DropdownItem[], selectionCopier: IGcSelectionCopier, isMini?: boolean): void; addNoteToSelection(items: DropdownItem[], selectionCopier: IGcSelectionCopier, isMini?: boolean): void; addPrint(items: DropdownItem[], selectionCopier: IGcSelectionCopier, isMini?: boolean): void; addStickyNote(items: DropdownItem[], selectionCopier: IGcSelectionCopier, isMini?: boolean): void; private _convertFromGlobalPoint; private _findTargetAnnotationElement; private _isTargetAllowsDefaultContextMenu; }