2.21.0, 0.18.0-85

This commit is contained in:
zsviczian committed 2026-03-15 19:05:32 +01:00
1 parent 4ccda30e72
commit aa200953dc
16 files changed
+3152 -1061

No files matched your search

@@ -401,6 +401,9 @@ export declare class ExcalidrawAutomate {
getElement(id: string): Mutable<ExcalidrawElement>;
/**
* Returns an object describing the bound text element.
*
* IMPORTANT: The returned object contains EITHER `eaElement` OR `sceneElement`, never both.
*
* If a text element is provided:
* - returns { eaElement } if the element is in ea.elementsDict
* - else (if searchInView is true) returns { sceneElement } if found in the targetView scene
@@ -409,6 +412,15 @@ export declare class ExcalidrawAutomate {
* - else (if searchInView is true) returns { sceneElement } if found in the targetView scene
* If not found, returns {}.
* Does not add the text element to elementsDict.
*
* Recommended usage pattern for editing:
* const boundText = ea.getBoundTextElement(container, true);
* let textEl = boundText.eaElement;
* if (!textEl && boundText.sceneElement) {
* ea.copyViewElementsToEAforEditing([boundText.sceneElement]);
* textEl = ea.getElement(boundText.sceneElement.id);
* }
* if (textEl) { ... safely modify textEl ... }
* @param element: ExcalidrawElement | ExcalidrawElement[] - The selected container with text (an array of 2 elements) to check.
* @param searchInView - If true, searches in the targetView elements if not found in elementsDict.
* @returns Object containing either eaElement or sceneElement or empty if not found.
@@ -2106,7 +2118,10 @@ export type PointsPositionUpdates = Map<Index, {
point: LocalPoint;
isDragging?: boolean;
}>;
export type Arrowhead = "arrow" | "bar" | "dot" | "circle" | "circle_outline" | "triangle" | "triangle_outline" | "diamond" | "diamond_outline" | "crowfoot_one" | "crowfoot_many" | "crowfoot_one_or_many";
export type CardinalityArrowhead = "cardinality_one" | "cardinality_many" | "cardinality_one_or_many" | "cardinality_exactly_one" | "cardinality_zero_or_one" | "cardinality_zero_or_many";
export type ArrowheadLegacy = "dot" | "crowfoot_one" | "crowfoot_many" | "crowfoot_one_or_many";
export type Arrowhead = "arrow" | "bar" | "circle" | "circle_outline" | "triangle" | "triangle_outline" | "diamond" | "diamond_outline" | CardinalityArrowhead;
export type AnyArrowhead = Arrowhead | ArrowheadLegacy;
export type ExcalidrawLinearElement = _ExcalidrawElementBase & Readonly<{
type: "line" | "arrow";
points: readonly LocalPoint[];
@@ -2314,7 +2329,7 @@ export type InteractiveCanvasAppState = Readonly<_CommonCanvasAppState & {
multiElement: AppState["multiElement"];
newElement: AppState["newElement"];
isBindingEnabled: AppState["isBindingEnabled"];
invertBindingBehaviour: AppState["invertBindingBehaviour"];
isMidpointSnappingEnabled: AppState["isMidpointSnappingEnabled"];
suggestedBinding: AppState["suggestedBinding"];
isRotating: AppState["isRotating"];
elementsToHighlight: AppState["elementsToHighlight"];
@@ -2387,7 +2402,15 @@ export interface AppState {
* - set on pointer down, updated during pointer move
*/
selectionElement: NonDeletedExcalidrawElement | null;
/**
* tracking current arrow binding editor state (takes into account
* `bindingPreference` and keyboard modifiers (ctrl/alt)
*/
isBindingEnabled: boolean;
/** user arrow binding preference */
bindingPreference: "enabled" | "disabled";
/** user preference whether arrow snap to midpoints while binding */
isMidpointSnappingEnabled: boolean;
startBoundElement: NonDeleted<ExcalidrawBindableElement> | null;
suggestedBinding: {
element: NonDeleted<ExcalidrawBindableElement>;
@@ -2496,7 +2519,7 @@ export interface AppState {
selectedElementsAreBeingDragged: boolean;
shouldCacheIgnoreZoom: boolean;
toast: {
message: string;
message: React.ReactNode;
closable?: boolean;
duration?: number;
} | null;
@@ -2518,7 +2541,7 @@ export interface AppState {
height: number;
offsetTop: number;
offsetLeft: number;
fileHandle: FileSystemHandle | null;
fileHandle: FileSystemFileHandle | null;
collaborators: Map<SocketId, Collaborator>;
stats: {
open: boolean;
@@ -2561,7 +2584,6 @@ export interface AppState {
fill: string;
nameColor: string;
};
invertBindingBehaviour: boolean;
selectedLinearElement: LinearElementEditor | null;
snapLines: readonly SnapLine[];
originSnapOffset: {
@@ -2647,11 +2669,36 @@ export type OnUserFollowedPayload = {
userToFollow: UserToFollow;
action: "FOLLOW" | "UNFOLLOW";
};
export type OnExportProgress = {
type: "progress";
message?: React.ReactNode;
/** 0-1 range */
progress?: number;
};
export interface ExcalidrawProps {
onChange?: (elements: readonly OrderedExcalidrawElement[], appState: AppState, files: BinaryFiles) => void;
/**
* note: only subscribes if the props.onIncrement is defined on initial render
*/
onIncrement?: (event: DurableIncrement | EphemeralIncrement) => void;
initialData?: (() => MaybePromise<ExcalidrawInitialDataState | null>) | MaybePromise<ExcalidrawInitialDataState | null>;
excalidrawAPI?: (api: ExcalidrawImperativeAPI) => void;
/**
* Invoked as soon as the Excalidraw API is available
* NOTE editor is not yet mounted, and state is not yet initialized
*/
onExcalidrawAPI?: (api: ExcalidrawImperativeAPI | null) => void;
/**
* Invoked once the editor root is mounted.
*/
onMount?: (payload: ExcalidrawMountPayload) => void;
/**
* Invoked when the editor root is unmounted.
*/
onUnmount?: () => void;
/**
* Invoked once the initial scene is loaded.
*/
onInitialize?: (api: ExcalidrawImperativeAPI) => void;
isCollaborating?: boolean;
onPointerUpdate?: (payload: {
pointer: {
@@ -2724,6 +2771,29 @@ export interface ExcalidrawProps {
showDeprecatedFonts?: boolean;
insertLinkAction?: (linkVal: string) => void;
renderScrollbars?: boolean;
/**
* Called before exporting to a file.
*
* Allows the host app to intercept and delay saving until async operations
* (e.g., images are loaded) complete.
*
* If Promise/AsyncGenerator is returned, a progress toast will be shown
* until the operation completes. Generator can yield progress updates.
*/
onExport?: (
/** type of export. Currently we only call for JSON exports or
* JSON-embedded PNG (which is also identified as `json` type here)*/
type: "json", data: {
elements: readonly ExcalidrawElement[];
appState: AppState;
files: BinaryFiles;
}, options: {
/** signal that gets aborted if user cancels the export (e.g. closes
* the native file picker dialog). In that case, you can either
* return immediately, or throw AbortError.
*/
signal: AbortSignal;
}) => MaybePromise<void> | AsyncGenerator<OnExportProgress, void>;
}
export type SceneData = {
elements?: ImportedDataState["elements"];
@@ -2776,6 +2846,8 @@ export type AppProps = Merge<ExcalidrawProps, {
export type AppClassProperties = {
props: AppProps;
state: AppState;
api: App["api"];
sessionExportThemeOverride: App["sessionExportThemeOverride"];
interactiveCanvas: HTMLCanvasElement | null;
/** static canvas */
canvas: HTMLCanvasElement;
@@ -2817,8 +2889,11 @@ export type AppClassProperties = {
onPointerUpEmitter: App["onPointerUpEmitter"];
updateEditorAtom: App["updateEditorAtom"];
onPointerDownEmitter: App["onPointerDownEmitter"];
onEvent: App["onEvent"];
onStateChange: App["onStateChange"];
lastPointerMoveCoords: App["lastPointerMoveCoords"];
bindModeHandler: App["bindModeHandler"];
setAppState: App["setAppState"];
};
export type PointerDownState = Readonly<{
origin: Readonly<{
@@ -2879,7 +2954,18 @@ export type PointerDownState = Readonly<{
};
}>;
export type UnsubscribeCallback = () => void;
export type ExcalidrawMountPayload = {
excalidrawAPI: ExcalidrawImperativeAPI;
container: HTMLDivElement | null;
};
export type ExcalidrawImperativeAPIEventMap = {
"editor:mount": [payload: ExcalidrawMountPayload];
"editor:initialize": [api: ExcalidrawImperativeAPI];
"editor:unmount": [];
};
export interface ExcalidrawImperativeAPI {
/** Whether the editor has been unmounted and the API is no longer usable. */
isDestroyed: boolean;
updateScene: InstanceType<typeof App>["updateScene"];
applyDeltas: InstanceType<typeof App>["applyDeltas"];
mutateElement: InstanceType<typeof App>["mutateElement"];
@@ -2936,6 +3022,8 @@ export interface ExcalidrawImperativeAPI {
onPointerUp: (callback: (activeTool: AppState["activeTool"], pointerDownState: PointerDownState, event: PointerEvent) => void) => UnsubscribeCallback;
onScrollChange: (callback: (scrollX: number, scrollY: number, zoom: Zoom) => void) => UnsubscribeCallback;
onUserFollow: (callback: (payload: OnUserFollowedPayload) => void) => UnsubscribeCallback;
onStateChange: InstanceType<typeof App>["onStateChange"];
onEvent: InstanceType<typeof App>["onEvent"];
}
export type FrameNameBounds = {
x: number;
@@ -3020,7 +3108,7 @@ export declare const getBoundsFromPoints: (points: ExcalidrawFreeDrawElement["po
export declare const getArrowheadSize: (arrowhead: Arrowhead) => number;
/** @returns number in degrees */
export declare const getArrowheadAngle: (arrowhead: Arrowhead) => Degrees;
export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead) => number[] | null;
export declare const getArrowheadPoints: (element: ExcalidrawLinearElement, shape: Drawable[], position: "start" | "end", arrowhead: Arrowhead, offsetMultiplier?: number) => number[] | null;
export declare const getElementBounds: (element: ExcalidrawElement, elementsMap: ElementsMap, nonRotated?: boolean) => Bounds;
export declare const getCommonBounds: (elements: ElementsMapOrArray, elementsMap?: ElementsMap) => Bounds;
export declare const getDraggedElementsBounds: (elements: ExcalidrawElement[], dragOffset: {
@@ -3060,10 +3148,26 @@ export declare const elementCenterPoint: (element: ExcalidrawElement, elementsMa
/* ************************************** */
/* node_modules/@zsviczian/excalidraw/types/excalidraw/components/App.d.ts */
/* ************************************** */
declare const editorLifecycleEventBehavior: {
readonly "editor:mount": {
readonly cardinality: "once";
readonly replay: "last";
};
readonly "editor:initialize": {
readonly cardinality: "once";
readonly replay: "last";
};
readonly "editor:unmount": {
readonly cardinality: "once";
readonly replay: "last";
};
};
export declare const ExcalidrawContainerContext: React.Context<{
container: HTMLDivElement | null;
id: string | null;
}>;
export declare const ExcalidrawAPIContext: React.Context<ExcalidrawImperativeAPI | null>;
export declare const ExcalidrawAPISetContext: React.Context<((api: ExcalidrawImperativeAPI | null) => void) | null>;
export declare const useApp: () => AppClassProperties;
export declare const useAppProps: () => AppProps;
export declare const useEditorInterface: () => Readonly<{
@@ -3086,9 +3190,14 @@ export declare const useExcalidrawElements: () => readonly NonDeletedExcalidrawE
export declare const useExcalidrawAppState: () => AppState;
export declare const useExcalidrawSetAppState: () => <K extends keyof AppState>(state: AppState | ((prevState: Readonly<AppState>, props: Readonly<any>) => AppState | Pick<AppState, K> | null) | Pick<AppState, K> | null, callback?: (() => void) | undefined) => void;
export declare const useExcalidrawActionManager: () => ActionManager;
/**
* Requires wrapping your component in <ExcalidrawAPIContext.Provider>
*/
export declare const useExcalidrawAPI: () => ExcalidrawImperativeAPI | null;
declare class App extends React.Component<AppProps, AppState> {
canvas: AppClassProperties["canvas"];
interactiveCanvas: AppClassProperties["interactiveCanvas"];
sessionExportThemeOverride: AppState["theme"] | undefined;
rc: RoughCanvas;
unmounted: boolean;
actionManager: ActionManager;
@@ -3123,8 +3232,12 @@ declare class App extends React.Component<AppProps, AppState> {
/** embeds that have been inserted to DOM (as a perf optim, we don't want to
* insert to DOM before user initially scrolls to them) */
private initializedEmbeds;
private handleToastClose;
private elementsPendingErasure;
private _initialized;
private readonly editorLifecycleEvents;
onEvent: AppEventBus<ExcalidrawImperativeAPIEventMap, typeof editorLifecycleEventBehavior>["on"];
private appStateObserver;
onStateChange: OnStateChange;
flowChartCreator: FlowChartCreator;
private flowChartNavigator;
bindModeHandler: ReturnType<typeof setTimeout> | null;
@@ -3282,6 +3395,8 @@ declare class App extends React.Component<AppProps, AppState> {
}>]>;
missingPointerEventCleanupEmitter: Emitter<[event: PointerEvent | null]>;
onRemoveEventListenersEmitter: Emitter<[]>;
api: ExcalidrawImperativeAPI;
private createExcalidrawAPI;
constructor(props: AppProps);
updateEditorAtom: <Value, Args extends unknown[], Result>(atom: WritableAtom<Value, Args, Result>, ...args: Args) => Result;
private onWindowMessage;
@@ -3437,11 +3552,7 @@ declare class App extends React.Component<AppProps, AppState> {
startLineEditor: (el: ExcalidrawLinearElement, selectedPointsIndices?: number[] | null) => void;
refreshAllArrows: () => void;
updateContainerSize: (containers: NonDeletedExcalidrawElement[]) => void;
setToast: (toast: {
message: string;
closable?: boolean;
duration?: number;
} | null) => void;
setToast: (toast: AppState["toast"]) => void;
restoreFileFromShare: () => Promise<void>;
/**
* adds supplied files to existing files in the appState.
@@ -3599,13 +3710,12 @@ declare class App extends React.Component<AppProps, AppState> {
/** generally you should use `addNewImagesToImageCache()` directly if you need
* to render new images. This is just a failsafe */
private scheduleImageRefresh;
private updateBindingEnabledOnPointerMove;
setSelection(elements: readonly NonDeletedExcalidrawElement[]): void;
private clearSelection;
private handleInteractiveCanvasRef;
private insertImages;
private handleAppOnDrop;
loadFileToCanvas: (file: File, fileHandle: FileSystemHandle | null) => Promise<void>;
loadFileToCanvas: (file: File, fileHandle: FileSystemFileHandle | null) => Promise<void>;
private handleCanvasContextMenu;
private maybeDragNewGenericElement;
private maybeHandleCrop;
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -171,7 +171,7 @@ Key values include:
- `ADD`, `ADD_SIBLING_AFTER`, `ADD_SIBLING_BEFORE`,
- `ADD_FOLLOW`, `ADD_FOLLOW_FOCUS`, `ADD_FOLLOW_ZOOM`,
- `EDIT`, `PIN`, `BOX`, `TOGGLE_BOUNDARY`, `TOGGLE_SUBMAP_ROOT`, `TOGGLE_GROUP`,
- `EDIT`, `PIN`, `BOX`, `TOGGLE_EMBED`, `TOGGLE_BOUNDARY`, `TOGGLE_SUBMAP_ROOT`, `TOGGLE_GROUP`,
- `FOLD`, `FOLD_L1`, `FOLD_ALL`,
- `COPY`, `CUT`, `PASTE`,
- `ZOOM`, `FOCUS`,
+1
View File
@@ -10476,6 +10476,7 @@ const performAction = async (action, event) => {
TOGGLE_CHECKBOX: ACTION_TOGGLE_CHECKBOX,
PIN: ACTION_PIN,
BOX: ACTION_BOX,
TOGGLE_EMBED: ACTION_TOGGLE_EMBED,
TOGGLE_BOUNDARY: ACTION_TOGGLE_BOUNDARY,
TOGGLE_SUBMAP_ROOT: ACTION_TOGGLE_SUBMAP_ROOT,
TOGGLE_GROUP: ACTION_TOGGLE_GROUP,
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -1 +1 @@
[{"fname":"Mindmap connector.md","mtime":1658686599427},{"fname":"Mindmap connector.svg","mtime":1658686599427},{"fname":"Add Connector Point.md","mtime":1735420748564},{"fname":"Add Connector Point.svg","mtime":1645944722000},{"fname":"Add Link to Existing File and Open.md","mtime":1647807918345},{"fname":"Add Link to Existing File and Open.svg","mtime":1645964261000},{"fname":"Add Link to New Page and Open.md","mtime":1654168862138},{"fname":"Add Link to New Page and Open.svg","mtime":1645960639000},{"fname":"Add Next Step in Process.md","mtime":1688304760357},{"fname":"Add Next Step in Process.svg","mtime":1645960639000},{"fname":"Box Each Selected Groups.md","mtime":1645305706000},{"fname":"Box Each Selected Groups.svg","mtime":1645967510000},{"fname":"Box Selected Elements.md","mtime":1645305706000},{"fname":"Box Selected Elements.svg","mtime":1645960639000},{"fname":"Change shape of selected elements.md","mtime":1652701169236},{"fname":"Change shape of selected elements.svg","mtime":1645960775000},{"fname":"Connect elements.md","mtime":1645305706000},{"fname":"Connect elements.svg","mtime":1645960639000},{"fname":"Convert freedraw to line.md","mtime":1645305706000},{"fname":"Convert freedraw to line.svg","mtime":1645960639000},{"fname":"Convert selected text elements to sticky notes.md","mtime":1670169501383},{"fname":"Convert selected text elements to sticky notes.svg","mtime":1645960639000},{"fname":"Convert text to link with folder and alias.md","mtime":1641639819000},{"fname":"Convert text to link with folder and alias.svg","mtime":1645960639000},{"fname":"Copy Selected Element Styles to Global.md","mtime":1642232088000},{"fname":"Copy Selected Element Styles to Global.svg","mtime":1645960639000},{"fname":"Create new markdown file and embed into active drawing.md","mtime":1640866935000},{"fname":"Create new markdown file and embed into active drawing.svg","mtime":1645960639000},{"fname":"Darken background color.md","mtime":1663059051059},{"fname":"Darken background color.svg","mtime":1645960639000},{"fname":"Elbow connectors.md","mtime":1671126911490},{"fname":"Elbow connectors.svg","mtime":1645960639000},{"fname":"Expand rectangles horizontally keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles horizontally keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles horizontally.md","mtime":1644950235000},{"fname":"Expand rectangles horizontally.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles vertically keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically.md","mtime":1658686599427},{"fname":"Expand rectangles vertically.svg","mtime":1645967510000},{"fname":"Fixed horizontal distance between centers.md","mtime":1646743234000},{"fname":"Fixed horizontal distance between centers.svg","mtime":1645960639000},{"fname":"Fixed inner distance.md","mtime":1646743234000},{"fname":"Fixed inner distance.svg","mtime":1645960639000},{"fname":"Fixed spacing.md","mtime":1646743234000},{"fname":"Fixed spacing.svg","mtime":1645967510000},{"fname":"Fixed vertical distance between centers.md","mtime":1646743234000},{"fname":"Fixed vertical distance between centers.svg","mtime":1645967510000},{"fname":"Fixed vertical distance.md","mtime":1646743234000},{"fname":"Fixed vertical distance.svg","mtime":1645967510000},{"fname":"Lighten background color.md","mtime":1663059051059},{"fname":"Lighten background color.svg","mtime":1645959546000},{"fname":"Modify background color opacity.md","mtime":1644924415000},{"fname":"Modify background color opacity.svg","mtime":1645944722000},{"fname":"Normalize Selected Arrows.md","mtime":1670403743278},{"fname":"Normalize Selected Arrows.svg","mtime":1645960639000},{"fname":"Organic Line.md","mtime":1672920172531},{"fname":"Organic Line.svg","mtime":1645964261000},{"fname":"Organic Line Legacy.md","mtime":1690607372668},{"fname":"Organic Line Legacy.svg","mtime":1690607372668},{"fname":"README.md","mtime":1645175700000},{"fname":"Repeat Elements.md","mtime":1663059051059},{"fname":"Repeat Elements.svg","mtime":1645960639000},{"fname":"Reverse arrows.md","mtime":1645305706000},{"fname":"Reverse arrows.svg","mtime":1645960639000},{"fname":"Scribble Helper.md","mtime":1767536720161},{"fname":"Scribble Helper.svg","mtime":1645944722000},{"fname":"Select Elements of Type.md","mtime":1643464321000},{"fname":"Select Elements of Type.svg","mtime":1645960639000},{"fname":"Set Dimensions.md","mtime":1645305706000},{"fname":"Set Dimensions.svg","mtime":1645944722000},{"fname":"Set Font Family.md","mtime":1645305706000},{"fname":"Set Font Family.svg","mtime":1645944722000},{"fname":"Set Grid.md","mtime":1693725826368},{"fname":"Set Grid.svg","mtime":1645960639000},{"fname":"Set Link Alias.md","mtime":1645305706000},{"fname":"Set Link Alias.svg","mtime":1645960639000},{"fname":"Set Stroke Width of Selected Elements.md","mtime":1748189277Line truncated
[{"fname":"Mindmap connector.md","mtime":1658686599427},{"fname":"Mindmap connector.svg","mtime":1658686599427},{"fname":"Add Connector Point.md","mtime":1735420748564},{"fname":"Add Connector Point.svg","mtime":1645944722000},{"fname":"Add Link to Existing File and Open.md","mtime":1647807918345},{"fname":"Add Link to Existing File and Open.svg","mtime":1645964261000},{"fname":"Add Link to New Page and Open.md","mtime":1654168862138},{"fname":"Add Link to New Page and Open.svg","mtime":1645960639000},{"fname":"Add Next Step in Process.md","mtime":1688304760357},{"fname":"Add Next Step in Process.svg","mtime":1645960639000},{"fname":"Box Each Selected Groups.md","mtime":1645305706000},{"fname":"Box Each Selected Groups.svg","mtime":1645967510000},{"fname":"Box Selected Elements.md","mtime":1645305706000},{"fname":"Box Selected Elements.svg","mtime":1645960639000},{"fname":"Change shape of selected elements.md","mtime":1652701169236},{"fname":"Change shape of selected elements.svg","mtime":1645960775000},{"fname":"Connect elements.md","mtime":1645305706000},{"fname":"Connect elements.svg","mtime":1645960639000},{"fname":"Convert freedraw to line.md","mtime":1645305706000},{"fname":"Convert freedraw to line.svg","mtime":1645960639000},{"fname":"Convert selected text elements to sticky notes.md","mtime":1670169501383},{"fname":"Convert selected text elements to sticky notes.svg","mtime":1645960639000},{"fname":"Convert text to link with folder and alias.md","mtime":1641639819000},{"fname":"Convert text to link with folder and alias.svg","mtime":1645960639000},{"fname":"Copy Selected Element Styles to Global.md","mtime":1642232088000},{"fname":"Copy Selected Element Styles to Global.svg","mtime":1645960639000},{"fname":"Create new markdown file and embed into active drawing.md","mtime":1640866935000},{"fname":"Create new markdown file and embed into active drawing.svg","mtime":1645960639000},{"fname":"Darken background color.md","mtime":1663059051059},{"fname":"Darken background color.svg","mtime":1645960639000},{"fname":"Elbow connectors.md","mtime":1671126911490},{"fname":"Elbow connectors.svg","mtime":1645960639000},{"fname":"Expand rectangles horizontally keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles horizontally keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles horizontally.md","mtime":1644950235000},{"fname":"Expand rectangles horizontally.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles vertically keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically.md","mtime":1658686599427},{"fname":"Expand rectangles vertically.svg","mtime":1645967510000},{"fname":"Fixed horizontal distance between centers.md","mtime":1646743234000},{"fname":"Fixed horizontal distance between centers.svg","mtime":1645960639000},{"fname":"Fixed inner distance.md","mtime":1646743234000},{"fname":"Fixed inner distance.svg","mtime":1645960639000},{"fname":"Fixed spacing.md","mtime":1646743234000},{"fname":"Fixed spacing.svg","mtime":1645967510000},{"fname":"Fixed vertical distance between centers.md","mtime":1646743234000},{"fname":"Fixed vertical distance between centers.svg","mtime":1645967510000},{"fname":"Fixed vertical distance.md","mtime":1646743234000},{"fname":"Fixed vertical distance.svg","mtime":1645967510000},{"fname":"Lighten background color.md","mtime":1663059051059},{"fname":"Lighten background color.svg","mtime":1645959546000},{"fname":"Modify background color opacity.md","mtime":1644924415000},{"fname":"Modify background color opacity.svg","mtime":1645944722000},{"fname":"Normalize Selected Arrows.md","mtime":1670403743278},{"fname":"Normalize Selected Arrows.svg","mtime":1645960639000},{"fname":"Organic Line.md","mtime":1672920172531},{"fname":"Organic Line.svg","mtime":1645964261000},{"fname":"Organic Line Legacy.md","mtime":1690607372668},{"fname":"Organic Line Legacy.svg","mtime":1690607372668},{"fname":"README.md","mtime":1645175700000},{"fname":"Repeat Elements.md","mtime":1663059051059},{"fname":"Repeat Elements.svg","mtime":1645960639000},{"fname":"Reverse arrows.md","mtime":1645305706000},{"fname":"Reverse arrows.svg","mtime":1645960639000},{"fname":"Scribble Helper.md","mtime":1767536720161},{"fname":"Scribble Helper.svg","mtime":1645944722000},{"fname":"Select Elements of Type.md","mtime":1643464321000},{"fname":"Select Elements of Type.svg","mtime":1645960639000},{"fname":"Set Dimensions.md","mtime":1645305706000},{"fname":"Set Dimensions.svg","mtime":1645944722000},{"fname":"Set Font Family.md","mtime":1645305706000},{"fname":"Set Font Family.svg","mtime":1645944722000},{"fname":"Set Grid.md","mtime":1693725826368},{"fname":"Set Grid.svg","mtime":1645960639000},{"fname":"Set Link Alias.md","mtime":1645305706000},{"fname":"Set Link Alias.svg","mtime":1645960639000},{"fname":"Set Stroke Width of Selected Elements.md","mtime":1748189277Line truncated
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.20.6",
"version": "2.21.0",
"minAppVersion": "1.5.7",
"description": "Sketch Your Mind. An Obsidian plugin to edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
"author": "Zsolt Viczian",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.20.6",
"version": "2.21.0",
"minAppVersion": "1.5.7",
"description": "Sketch Your Mind. An Obsidian plugin to edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
"author": "Zsolt Viczian",
+1 -1
View File
@@ -25,7 +25,7 @@
"license": "MIT",
"dependencies": {
"@popperjs/core": "^2.11.8",
"@zsviczian/excalidraw": "0.18.0-84",
"@zsviczian/excalidraw": "0.18.0-85",
"chroma-js": "^3.1.2",
"clsx": "^2.0.0",
"@zsviczian/colormaster": "^1.2.2",
+2 -2
View File
@@ -40,8 +40,8 @@ The script balances **automation** (auto-layout, recursive grouping, and contras
const FOOTER = `
const VERSION = "v${new Date().toISOString().slice(2, 10).replace(/-/g, ".")}";
if (!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("2.20.6")) {
new Notice("Please update the Excalidraw Plugin to version 2.20.6 or higher.");
if (!ea.verifyMinimumPluginVersion || !ea.verifyMinimumPluginVersion("2.21.0")) {
new Notice("Please update the Excalidraw Plugin to version 2.21.0 or higher.");
return;
}
+27 -9
View File
@@ -18,18 +18,36 @@ I build this plugin in my free time, as a labor of love. Curious about the philo
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://storage.ko-fi.com/cdn/kofi6.png?v=6" border="0" alt="Buy Me a Coffee at ko-fi.com" height=45></a></div>
`,
"2.21.0":`
## Fixed
- Sizing of embedded images in Markdown when image type is set to SVG. [#2685](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2685)
- Fixed Enter, Up/Down arrows, and TAB keys stop working in text element after deleting the \`#\` character [#2704](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2704)
- Context menu styling [#2697](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2697) 🙏[@heinrich26](https://github.com/heinrich26)
## New
- LaTeX editor is now floating [#2684](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2684) 🙏[@TravisLEBLANC1](https://github.com/TravisLEBLANC1), [#2698](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2698) 🙏[@heinrich26](https://github.com/heinrich26)
- Inline link suggester now supports triggers \`![[drawing#^frame=\` and \`![[drawing#^clippedframe=\`, thus it is easy to reference frames like slides or parts of images in your different drawings.
- Support for mermaid Entity Relationship Diagrams, new ERD/cardinality arrowheads [#10940](https://github.com/excalidraw/excalidraw/pull/10940)
- New Context Menu options to disable arrow binding and midpoint snapping. [#10906](https://github.com/excalidraw/excalidraw/pull/10906)
- Icons aligned with Obsidian style [#2703](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2703) 🙏[@heinrich26](https://github.com/heinrich26)
- Inline link suggester supports new triggers \`![[drawing#^frame=\` and \`![[drawing#^clippedframe=\`, thus it is easy to reference frames like pdf pages, slides or other parts of your scene marked using marker frames.
- Support for mermaid Entity Relationship Diagrams, and new ERD/cardinality arrowheads [#10940](https://github.com/excalidraw/excalidraw/pull/10940)
- New Context Menu options to disable arrow binding and midpoint snapping [#10906](https://github.com/excalidraw/excalidraw/pull/10906)
- Improved UI styling and icons are better aligned with Obsidian [#2703](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2703), [#2687](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2687), [#2697](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2697) 🙏[@heinrich26](https://github.com/heinrich26)
## Fixed
- Sizing of embedded images in Markdown when image type is set to SVG [#2685](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2685)
- Fixed Enter, Up/Down arrows, and TAB keys stopped working in text elements after deleting the \`#\` character [#2704](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2704)
## MindMap Builder
- Fixed navigation (arrow keys) scoping and recognition
- Added new feature to paste images and single Excalidraw elements like container with text, text element, or image element directly as a map leaf (using the MindMap Builder default paste shortcut: ALT/OPT+V)
- Added new action to toggle a markdown link between markdown embeddable and link as text. Default shortcut is ALT/OPT+E.
## New in ExcalidrawAutomate
\`\`\`ts
/**
* Parses text using the target view's ExcalidrawData parser.
*
* This reuses ExcalidrawData parsing logic directly, including transclusion
* resolution, link bracket rendering, and link/url prefixes based on the
* target file's frontmatter.
*
* @param {string} text - Raw text to parse.
* @returns {Promise<string | undefined>} Parsed text, or undefined when input/view is unavailable.
*/
public async parseText (text: string): Promise<string | undefined>;
\`\`\`
`,
"2.20.6":`
<div class="excalidraw-videoWrapper">
+6
View File
@@ -982,6 +982,12 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
desc: "Attaches an inline [[link]] suggester to an input. Optionally align width to a wrapper element. Returns a KeyBlocker so host scripts can skip their own keydown handlers while the suggester is active via isBlockingKeys(); call close() on the returned suggester to detach.",
after: "",
},
{
field: "parseText",
code: "async parseText(text: string): Promise<string | undefined>;",
desc: "Parses raw text through targetView.excalidrawData using the same parsing pipeline as ExcalidrawData (including transclusion resolution, link brackets, and link/url prefixes from frontmatter). Works only when ea.targetView is set and loaded.",
after: "",
},
{
field: "getleaf",
code: "getLeaf(origo: WorkspaceLeaf, targetPane?: PaneTarget): WorkspaceLeaf;",
+21 -1
View File
@@ -17,7 +17,10 @@ import { ColorMap, MimeType } from "../types/embeddedFileLoaderTypes";
import { Editor, Notice, OpenViewState, RequestUrlResponse, TFile, TFolder, WorkspaceLeaf } from "obsidian";
import * as obsidian_module from "obsidian";
import ExcalidrawView, { TextMode } from "src/view/ExcalidrawView";
import { ExcalidrawData, getMarkdownDrawingSection } from "./ExcalidrawData";
import {
ExcalidrawData,
getMarkdownDrawingSection,
} from "./ExcalidrawData";
import {
FRONTMATTER,
nanoid,
@@ -695,6 +698,23 @@ export class ExcalidrawAutomate {
return new InlineLinkSuggester(this.plugin.app, this.plugin, inputEl, getSourcePath, widthWrapper);
}
/**
* Parses text using the target view's ExcalidrawData parser.
*
* This reuses ExcalidrawData parsing logic directly, including transclusion
* resolution, link bracket rendering, and link/url prefixes based on the
* target file's frontmatter.
*
* @param {string} text - Raw text to parse.
* @returns {Promise<string | undefined>} Parsed text, or undefined when input/view is unavailable.
*/
public async parseText (text: string): Promise<string | undefined> {
if(!text) return;
if (!this.targetView || !this.targetView?._loaded) return;
if (!this.targetView.excalidrawData) return;
return await this.targetView.excalidrawData.parseText(text);
}
/**
* Returns the last recorded pointer position on the Excalidraw canvas.
* @returns {{x:number, y:number}} The last recorded pointer position.
+14
View File
@@ -1368,6 +1368,20 @@ export class ExcalidrawData {
return { parsed: outString, link };
}
/**
* Public wrapper around the internal text parser.
*
* This reuses existing ExcalidrawData parsing behavior, including
* transclusions, link formatting, and prefix handling.
* @param text Raw text to parse.
* @returns Parsed text string.
*/
public async parseText(text: string): Promise<string> {
if(!text) return;
const res = await this.parse(text);
return res.parsed;
}
private parseCheckbox(text:string):string {
return this.plugin.settings.parseTODO
? text
+76 -1
View File
@@ -448,4 +448,79 @@ class ImageCache {
}
export const imageCache = new ImageCache(DB_NAME, CACHE_STORE, BACKUP_STORE);
export const imageCache = new ImageCache(DB_NAME, CACHE_STORE, BACKUP_STORE);
/* -------------------------------------------------------- */
/* Legacy cleanup */
// early implementation used localStorage as the image cache,
// which if not cleaned can cause Obsidian performance issues
/* -------------------------------------------------------- */
const LEGACY_LS_PURGE_MARKER = "excalidraw-legacy-ls-purge-v1";
type LegacyKeyShape = {
filepath: unknown;
blockref: unknown;
isDark: unknown;
isSVG: unknown;
scale: unknown;
};
const isObject = (value: unknown): value is Record<string, unknown> =>
typeof value === "object" && value !== null && !Array.isArray(value);
const hasLegacyShape = (value: unknown): value is LegacyKeyShape => {
if (!isObject(value)) return false;
return (
"filepath" in value &&
"blockref" in value &&
"isDark" in value &&
"isSVG" in value &&
"scale" in value
);
};
export const purgeLegacyLocalStorageImageCache = (): string | null => {
try {
if (typeof window === "undefined" || !window.localStorage) {
return null;
}
if (localStorage.getItem(LEGACY_LS_PURGE_MARKER) === "1") {
return null;
}
const keys = Object.keys(localStorage);
let deleted = 0;
for (const key of keys) {
let parsed: unknown;
try {
parsed = JSON.parse(key);
} catch {
continue;
}
if (!hasLegacyShape(parsed)) {
continue;
}
localStorage.removeItem(key);
deleted += 1;
}
localStorage.setItem(LEGACY_LS_PURGE_MARKER, "1");
if (deleted === 0) {
return null;
}
return "Purged " + deleted + " legacy localStorage image cache entr" + (deleted === 1 ? "y." : "ies.");
} catch {
return null;
}
};
const report = purgeLegacyLocalStorageImageCache();
if (report) {
console.info(report);
}