@myoc/common 0.19.512 → 0.19.514

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -592,6 +592,7 @@ declare class App extends React.Component<AppProps, AppState> {
592
592
  private maybeHandleCrop;
593
593
  private maybeHandleResize;
594
594
  private getContextMenuItems;
595
+ private getImageContextMenuItems;
595
596
  private handleWheel;
596
597
  private getTextWysiwygSnappedToCenterPosition;
597
598
  private savePointer;
@@ -2,7 +2,12 @@ import React from "react";
2
2
  import "./ContextMenu.scss";
3
3
  import type { ActionManager } from "../actions/manager";
4
4
  import type { Action } from "../actions/types";
5
- export type ContextMenuItem = typeof CONTEXT_MENU_SEPARATOR | Action;
5
+ export type ContextMenuCustomItem = {
6
+ key: string;
7
+ label: string;
8
+ onSelect: () => void;
9
+ };
10
+ export type ContextMenuItem = typeof CONTEXT_MENU_SEPARATOR | Action | ContextMenuCustomItem;
6
11
  export type ContextMenuItems = (ContextMenuItem | false | null | undefined)[];
7
12
  type ContextMenuProps = {
8
13
  actionManager: ActionManager;
@@ -9,7 +9,7 @@ import type { Action } from "./actions/types";
9
9
  import type { Spreadsheet } from "./charts";
10
10
  import type { ClipboardData } from "./clipboard";
11
11
  import type App from "./components/App";
12
- import type { ContextMenuItems } from "./components/ContextMenu";
12
+ import type { ContextMenuCustomItem, ContextMenuItems } from "./components/ContextMenu";
13
13
  import type { SnapLine } from "./snapping";
14
14
  import type { ImportedDataState } from "./data/types";
15
15
  import type { Language } from "./i18n";
@@ -83,6 +83,7 @@ export type BinaryFileData = {
83
83
  };
84
84
  export type BinaryFileMetadata = Omit<BinaryFileData, "dataURL">;
85
85
  export type BinaryFiles = Record<ExcalidrawElement["id"], BinaryFileData>;
86
+ export type ImageContextMenuItem = ContextMenuCustomItem;
86
87
  export type ToolType = "selection" | "lasso" | "rectangle" | "diamond" | "ellipse" | "arrow" | "line" | "freedraw" | "text" | "image" | "eraser" | "hand" | "frame" | "magicframe" | "embeddable" | "laser";
87
88
  export type ElementOrToolType = ExcalidrawElementType | ToolType | "custom";
88
89
  export type ActiveTool = {
@@ -534,6 +535,7 @@ export interface ExcalidrawProps {
534
535
  onLinkOpen?: (element: NonDeletedExcalidrawElement, event: CustomEvent<{
535
536
  nativeEvent: MouseEvent | React.PointerEvent<HTMLCanvasElement>;
536
537
  }>) => void;
538
+ imageContextMenuItems?: (imageIds: readonly ExcalidrawElement["id"][]) => readonly ImageContextMenuItem[];
537
539
  onPointerDown?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
538
540
  onPointerUp?: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState) => void;
539
541
  onScrollChange?: (scrollX: number, scrollY: number, zoom: Zoom) => void;
@@ -763,7 +765,10 @@ export interface ExcalidrawImperativeAPI {
763
765
  refresh: InstanceType<typeof App>["refresh"];
764
766
  setToast: InstanceType<typeof App>["setToast"];
765
767
  addFiles: (data: BinaryFileData[]) => void;
766
- addImageElementsToScene: (imageFiles: File[], sceneX: number, sceneY: number) => Promise<void>;
768
+ addImageElementsToScene: (imageFiles: {
769
+ file: File;
770
+ customData: Record<string, any>;
771
+ }[], sceneX: number, sceneY: number) => Promise<void>;
767
772
  id: string;
768
773
  setActiveTool: InstanceType<typeof App>["setActiveTool"];
769
774
  setCursor: InstanceType<typeof App>["setCursor"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myoc/common",
3
- "version": "0.19.512",
3
+ "version": "0.19.514",
4
4
  "type": "module",
5
5
  "types": "./dist/types/common/src/index.d.ts",
6
6
  "main": "./dist/prod/index.js",