@myoc/element 0.19.528 → 0.19.529

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.
@@ -457,6 +457,8 @@ declare class App extends React.Component<AppProps, AppState> {
457
457
  private onTouchStart;
458
458
  private onTouchEnd;
459
459
  private insertClipboardContent;
460
+ private containsImagePaste;
461
+ private shouldInsertImageInViewMode;
460
462
  pasteFromClipboard: (event: ClipboardEvent) => Promise<void>;
461
463
  addElementsFromPasteOrLibrary: (opts: {
462
464
  elements: readonly ExcalidrawElement[];
@@ -723,6 +723,24 @@ export interface ExcalidrawProps {
723
723
  pointersMap: Gesture["pointers"];
724
724
  }) => void;
725
725
  onPaste?: (data: ClipboardData, event: ClipboardEvent | null) => Promise<boolean> | boolean;
726
+ /**
727
+ * Controls image paste/drop while the editor is in view mode and not
728
+ * `viewModeOnly`.
729
+ *
730
+ * - `exit-view-mode`: leave view mode and insert the image.
731
+ * - `reject`: keep view mode and call `onViewModeImageInsertRejected`.
732
+ *
733
+ * `viewModeOnly` always rejects because view mode is forced.
734
+ *
735
+ * @default "exit-view-mode"
736
+ */
737
+ viewModeImageInsertBehavior?: "exit-view-mode" | "reject";
738
+ onViewModeImageInsertRejected?: (payload: {
739
+ source: "paste" | "drop";
740
+ files: readonly File[];
741
+ data?: ClipboardData;
742
+ event: ClipboardEvent | React.DragEvent<HTMLDivElement> | null;
743
+ }) => void;
726
744
  /**
727
745
  * Called when element(s) are duplicated so you can listen or modify as
728
746
  * needed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myoc/element",
3
- "version": "0.19.528",
3
+ "version": "0.19.529",
4
4
  "type": "module",
5
5
  "types": "./dist/types/element/src/index.d.ts",
6
6
  "main": "./dist/prod/index.js",
@@ -64,9 +64,9 @@
64
64
  "build:esm": "rimraf dist && node ../../scripts/buildBase.js && yarn gen:types"
65
65
  },
66
66
  "dependencies": {
67
- "@excalidraw/common": "npm:@myoc/common@0.19.528",
68
- "@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.19.528",
69
- "@excalidraw/math": "npm:@myoc/math@0.19.528",
67
+ "@excalidraw/common": "npm:@myoc/common@0.19.529",
68
+ "@excalidraw/fractional-indexing": "npm:@myoc/fractional-indexing@0.19.529",
69
+ "@excalidraw/math": "npm:@myoc/math@0.19.529",
70
70
  "thumbhash": "0.1.1"
71
71
  }
72
72
  }