2.28.0-beta.0

This commit is contained in:
zsviczian committed 2026-09-14 20:38:25 +02:00
1 parent 3dd6320b12
commit 5f68ed18bc
7 files changed
+110 -1

No files matched your search

+24
View File
@@ -476,6 +476,30 @@ export declare class ExcalidrawAutomate {
* @returns {string} The ID of the added rectangle element.
*/
addRect(topX: number, topY: number, width: number, height: number, id?: string): string;
/**
* Adds a sticky note and its optional fitted label to the ExcalidrawAutomate
* instance. Width and height default to Excalidraw's sticky-note size.
* @param {number} topX - The x-coordinate of the top-left corner.
* @param {number} topY - The y-coordinate of the top-left corner.
* @param {string} text - The sticky-note text. An empty string creates an unlabeled note.
* @param {Object} [formatting] - Sticky-note size and label formatting.
* @param {number} [formatting.width] - The initial width of the note.
* @param {number} [formatting.height] - The initial height of the note.
* @param {number} [formatting.fontSize] - The label's maximum font size.
* @param {number} [formatting.fontFamily] - The label font family.
* @param {"left" | "center" | "right"} [formatting.textAlign] - The label's horizontal alignment.
* @param {"top" | "middle" | "bottom"} [formatting.textVerticalAlign] - The label's vertical alignment.
* @param {string} [id] - The ID of the sticky-note element.
* @returns {string} The ID of the added sticky note.
*/
addStickyNote(topX: number, topY: number, text: string, formatting?: {
width?: number;
height?: number;
fontSize?: number;
fontFamily?: number;
textAlign?: "left" | "center" | "right";
textVerticalAlign?: "top" | "middle" | "bottom";
}, id?: string): string;
/**
* Adds a diamond element to the ExcalidrawAutomate instance.
* @param {number} topX - The x-coordinate of the top-left corner.
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.27.3",
"version": "2.28.0-beta.0",
"minAppVersion": "1.8.7",
"description": "Sketch Your Mind. Edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
"author": "Zsolt Viczian",
+3
View File
@@ -119,6 +119,7 @@ export let {
loadMermaid,
syncInvalidIndices,
getDefaultColorPalette,
convertToExcalidrawElements,
} = excalidrawLib;
export function updateExcalidrawLib() {
@@ -138,6 +139,7 @@ export function updateExcalidrawLib() {
"getLineHeight",
"restoreElements",
"restoreLibraryItems",
"convertToExcalidrawElements",
];
for (const fnName of requiredFunctions) {
@@ -178,6 +180,7 @@ export function updateExcalidrawLib() {
loadMermaid,
syncInvalidIndices,
getDefaultColorPalette,
convertToExcalidrawElements,
} = excalidrawLib);
} catch (error) {
if (error instanceof Error || typeof error === "string") {
+10
View File
@@ -21,7 +21,17 @@ I build this plugin as a labor of love. Curious about the philosophy behind it?
## New
- Copied Markdown image SVGs now replace embedded base64 images and fonts with short placeholders, making them smaller and easier to share with AI agents when developing custom CSS.
## New from Excalidraw.com
- Create sticky notes with the new **Sticky note** tool or the **N** shortcut. Labels automatically fit and grow with their note, with dedicated colors and a creation-date footer. [#12064](${URLs.GITHUB_COM_EXCALIDRAW_EXCALIDRAW_PULL}/12064)
## New in Excalidraw Automate
- Scripts can create native sticky notes, including automatically fitted labels:
\`\`\`ts
addStickyNote(topX: number, topY: number, text: string, formatting?: {width?: number; height?: number; fontSize?: number; fontFamily?: number; textAlign?: "left" | "center" | "right"; textVerticalAlign?: "top" | "middle" | "bottom";}, id?: string): string;
\`\`\`
## Fixed
- Drawing persistence is now more reliable during rapid edits across multiple tabs, popout moves, and immediate closing. Backups and automatic exports now track the exact successfully saved revision.
- Rapidly changing Markdown image appearance, selection, or image/embeddable conversion no longer leaves a rejected image-render promise in the console or lets a superseded render overwrite the newer element state.
`,
"2.27.3": `
+6
View File
@@ -389,6 +389,12 @@ export const EXCALIDRAW_AUTOMATE_INFO: SuggesterInfo[] = [
desc: null,
after: "",
},
{
field: "addStickyNote",
code: 'addStickyNote(topX: number, topY: number, text: string, formatting?: {width?: number; height?: number; fontSize?: number; fontFamily?: number; textAlign?: "left" | "center" | "right"; textVerticalAlign?: "top" | "middle" | "bottom";}, id?: string): string;',
desc: "Adds a sticky note using the current EA colors and styles. The optional label is fitted automatically, and the function returns the note container ID.",
after: "",
},
{
field: "addDiamond",
code: "addDiamond(topX: number, topY: number, width: number, height: number, id?:string): string;",
+65
View File
@@ -49,6 +49,7 @@ import {
mermaidToExcalidraw,
refreshTextDimensions,
getFontFamilyString,
convertToExcalidrawElements,
} from "src/constants/constants";
import {
blobToBase64,
@@ -2333,6 +2334,70 @@ export class ExcalidrawAutomate {
return id;
}
/**
* Adds a sticky note and its optional fitted label to the ExcalidrawAutomate
* instance. Width and height default to Excalidraw's sticky-note size.
* @param {number} topX - The x-coordinate of the top-left corner.
* @param {number} topY - The y-coordinate of the top-left corner.
* @param {string} text - The sticky-note text. An empty string creates an unlabeled note.
* @param {Object} [formatting] - Sticky-note size and label formatting.
* @param {number} [formatting.width] - The initial width of the note.
* @param {number} [formatting.height] - The initial height of the note.
* @param {number} [formatting.fontSize] - The label's maximum font size.
* @param {number} [formatting.fontFamily] - The label font family.
* @param {"left" | "center" | "right"} [formatting.textAlign] - The label's horizontal alignment.
* @param {"top" | "middle" | "bottom"} [formatting.textVerticalAlign] - The label's vertical alignment.
* @param {string} [id] - The ID of the sticky-note element.
* @returns {string} The ID of the added sticky note.
*/
addStickyNote(
topX: number,
topY: number,
text: string,
formatting?: {
width?: number;
height?: number;
fontSize?: number;
fontFamily?: number;
textAlign?: "left" | "center" | "right";
textVerticalAlign?: "top" | "middle" | "bottom";
},
id?: string,
): string {
id = id ?? nanoid();
const elements = convertToExcalidrawElements(
[
{
...this.boxedElement(
id,
"stickynote",
topX,
topY,
formatting?.width ?? 0,
formatting?.height ?? 0,
),
type: "stickynote" as const,
label: text
? {
text,
fontSize: formatting?.fontSize ?? this.style.fontSize,
fontFamily: formatting?.fontFamily ?? this.style.fontFamily,
textAlign:
formatting?.textAlign ?? this.style.textAlign,
verticalAlign:
formatting?.textVerticalAlign ?? this.style.verticalAlign,
}
: undefined,
},
],
{ regenerateIds: false },
);
for (const element of elements) {
this.elementsDict[element.id] = element;
}
return id;
}
/**
* Adds a diamond element to the ExcalidrawAutomate instance.
* @param {number} topX - The x-coordinate of the top-left corner.
+1
View File
@@ -303,6 +303,7 @@ declare namespace ExcalidrawLib {
} | undefined>;*/
let hashElementsVersion: typeof import("@zsviczian/excalidraw/types/excalidraw").hashElementsVersion;
let convertToExcalidrawElements: typeof import("@zsviczian/excalidraw").convertToExcalidrawElements;
let Excalidraw: typeof import("@zsviczian/excalidraw").Excalidraw;
let MainMenu: typeof import("@zsviczian/excalidraw").MainMenu;
let WelcomeScreen: typeof import("@zsviczian/excalidraw").WelcomeScreen;