github zsviczian/obsidian-excalidraw-plugin 1.6.26
Excalidraw 1.6.26

latest releases: 2.15.3, 2.15.3-beta-2, 2.15.3-beta-1...
3 years ago

Fixed

  • Dragging multiple files onto the canvas will now correctly #589
    • add multiple links
    • or if you hold the CTRL/(SHIFT on Mac) while dropping the files, then adding multiple images
  • Dropped images and links were not selectable with the selection tool until the file was saved. This is now fixed.
  • Display the linked block/section on link-hover instead of the full page. #597
  • Hover preview without CTRL/CMD works again. Requires configuration in plugin settings. #595
  • If you embed the same markdown document into a drawing multiple times, you can now display different sections of the document in each embedded object. #601.
  • If you make a copy of an equation and edit this copy, the original equation will remain unchanged #593

New Features

  • When you drag files from Dataview-results onto the canvas the obsidian:// urls will be converted into wiki links.#599
  • I added one more frontmatter key: excalidraw-linkbutton-opacity: This sets the opacity of the blue link-button in the top right corner of the element, overriding the respective setting in plugin settings. Valid values are numbers between 0 and 1, where 0 means the button is fully transparent.

Excalidraw Automate and Plugin integration

  • I added app.plugins.plugins["obsidian-excalidraw-plugin"].getAPI(). The function will generate a new instance of the ExcalidrawAutomate API interface. This provides an alternative to using window.ExcalidrawAutomate with the added benefit that you do not need to reset() the object each time you use it since this will be a dedicated instance created each time getAPI() is called. For general scripting purposes window.ExcalidrawAutomate is still the ideal solution, however, if you are building a plugin or more complex script against ExcalidrawAutomate, then this solution will have benefits.
  • published npm package for Excliadraw so that plugins can be developed against the Excalidraw-Automate API
  • New event hooks:
  /**
   * Register instance of EA to use for hooks with TargetView
   * By default ExcalidrawViews will check window.ExcalidrawAutomate for event hooks.
   * Using this event you can set a different instance of Excalidraw Automate for hooks
   */
  registerThisAsViewEA: () => void;

  /**
   * If set, this callback is triggered, when the user changes the view mode.
   * You can use this callback in case you want to do something additional when the user switches to view mode and back.
   */
  onViewModeChangeHook: (isViewModeEnabled:boolean) => void = null;

   /**
   * If set, this callback is triggered, when the user hovers a link in the scene.
   * You can use this callback in case you want to do something additional when the onLinkHover event occurs.
   * This callback must return a boolean value.
   * In case you want to prevent the excalidraw onLinkHover action you must return false, it will stop the native excalidraw onLinkHover management flow.
   */
  onLinkHoverHook: (
    element: NonDeletedExcalidrawElement,
    linkText: string,
  ) => boolean = null;

   /**
   * If set, this callback is triggered, when the user click a link in the scene.
   * You can use this callback in case you want to do something additional when the onLinkClick event occurs.
   * This callback must return a boolean value.
   * In case you want to prevent the excalidraw onLinkClick action you must return false, it will stop the native excalidraw onLinkClick management flow.
   */
  onLinkClickHook:(
    element: ExcalidrawElement,
    linkText: string,
    event: MouseEvent
  ) => boolean = null;

  /**
   * If set, this callback is triggered, when Excalidraw receives an onDrop event. 
   * You can use this callback in case you want to do something additional when the onDrop event occurs.
   * This callback must return a boolean value.
   * In case you want to prevent the excalidraw onDrop action you must return false, it will stop the native excalidraw onDrop management flow.
   */
  onDropHook: (data: {
    ea: ExcalidrawAutomate;
    event: React.DragEvent<HTMLDivElement>;
    draggable: any; //Obsidian draggable object
    type: "file" | "text" | "unknown";
    payload: {
      files: TFile[]; //TFile[] array of dropped files
      text: string; //string
    };
    excalidrawFile: TFile; //the file receiving the drop event
    view: ExcalidrawView; //the excalidraw view receiving the drop
    pointerPosition: { x: number; y: number }; //the pointer position on canvas at the time of drop
  }) => boolean = null;

Don't miss a new obsidian-excalidraw-plugin release

NewReleases is sending notifications on new releases.