See the sidepanels branch for the implementation.
Fixed
- Floating modal used by Excalidraw scripts did not work correctly in Obisidian popout windows.
New in ExcalidrawAutomate
-
Implemented Excalidraw Sidepanel API for ExcalidrawAutomate. Scripts can now create custom Obsidian sidepanel tabs in the Excalidraw Sidepanel.
- New Command Palette action: "Open Excalidraw Sidepanel" will toggle the sidepanel visibility.
- The demo script making full use of the new sidepanel API is Mindmap Builder currently available in the sidepanels branch of Obsidian-Excalidraw repository. **Note: ** the version of Mindmap Builder in the script store is not updated yet to use the new sidepanel API.
- ExcalidrawAutomate full library for LLM training.md also on the sidepanels branch includes all necessary training information to use sidepanels.
New functions in ExcalidrawAutomate. See also SidepanelTab type definition in the sidepanels branch.
sidepanelTab: ExcalidrawSidepanelTab | null;
/**
* Return the active sidepanel tab for a script, if one exists.
* If scriptName is omitted the function checks ea.activeScript.
* At most one sidepanel tab may be open per script. If a tab exists this
* returns the corresponding ExcalidrawSidepanelTab; otherwise it returns
* undefined.
* The returned tab may be hosted by a different ExcalidrawAutomate instance.
* To determine whether the tab belongs to the current ea instance compare:
* sidepanelTab.getHostEA() === ea.
* In this case the script may wish to reuse the existing tab rather than create a new one.
* @param scriptName - Optional script name to query. Defaults to ea.activeScript.
* @returns The ExcalidrawSidepanelTab for the script, or undefined if none exists.
*/
checkForActiveSidepanelTabForScript(scriptName?: string): ExcalidrawSidepanelTab | null;
/**
* Creates a new sidepanel tab associated with this ExcalidrawAutomate instance.
* If a sidepanel tab already exists for this instance, it will be closed first.
* @param title - The title of the sidepanel tab.
* @param options
* @returns
*/
createSidepanelTab(title: string, persist?: boolean, reveal?: boolean): Promise<ExcalidrawSidepanelTab | null>;
/**
* Returns the WorkspaceLeaf hosting the Excalidraw sidepanel view.
* @returns {WorkspaceLeaf | null} The sidepanel leaf or null if not found.
*/
getSidepanelLeaf(): WorkspaceLeaf | null;
/**
* Toggles the visibility of the Excalidraw sidepanel view.
* If the sidepanel is not in a leaf attached to the left or right split, no action is taken.
*/
toggleSidepanelView(): void;
/**
* Pins the active script's sidepanel tab to be persistent across Obsidian restarts.
* @param options
* @returns {Promise<ExcalidrawSidepanelTab | null>} The persisted sidepanel tab or null on error.
*/
persistSidepanelTab(): ExcalidrawSidepanelTab | null;
/**
* Returns the last recorded pointer position on the Excalidraw canvas.
* @returns {{x:number, y:number}} The last recorded pointer position.
*/- setView() improvements
- Calling `setView()` now picks a sensible target automatically:
- It prefers the currently active Excalidraw view.
- If no active Excalidraw view is found (e.g., the user is focused on a different tab like the File Explorer/sidebar), it will fall back to the last active Excalidraw view (as long as it is still available) — typically the drawing the user came from.
- New selector: `"auto"` (equivalent to calling `setView()`).
- Useful when you also want to reveal/focus the view: `setView("auto", true)`.
- Deprecated selectors: `"active"` and `"first"` are deprecated and kept only for backward compatibility.
- Recommended usage is either `setView()`, `setView("auto")`, or `setView(excalidrawView)` (explicitly target a specific view).
- Calling `setView()` now picks a sensible target automatically:
setView(view?: ExcalidrawView | "auto" | "first" | "active" | null, show: boolean = false)