2.15.3-beta-2

This commit is contained in:
zsviczian committed 2025-09-11 20:45:07 +02:00
1 parent 98f065c8cc
commit 37543c6a56
10 files changed
+184 -28

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.15.3-beta-1",
"version": "2.15.3-beta-2",
"minAppVersion": "1.5.7",
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
"author": "Zsolt Viczian",
+16 -1
View File
@@ -90,6 +90,7 @@ import { CommandManager } from "./managers/CommandManager";
import { EventManager } from "./managers/EventManager";
import { UniversalInsertFileModal } from "src/shared/Dialogs/UniversalInsertFileModal";
import en from "src/lang/locale/en";
import { VersionMismatchPrompt } from "src/shared/Dialogs/VersionMismatch";
declare const PLUGIN_VERSION:string;
declare const INITIAL_TIMESTAMP: number;
@@ -423,7 +424,21 @@ export default class ExcalidrawPlugin extends Plugin {
this.logStartupEvent("Switched to Excalidraw views");
try {
if (this.settings.showReleaseNotes) {
let skipReleaseNotes = false;
if (this.settings.compareManifestToPluginVersion) {
if (this.manifest.version !== PLUGIN_VERSION) {
const versionMismatchPrompt = new VersionMismatchPrompt(this);
const result = await versionMismatchPrompt.start();
if(result) {
skipReleaseNotes = true;
this.manifest.version = PLUGIN_VERSION;
await this.app.setting.open();
this.app.setting.openTabById("community-plugins");
}
}
}
if (!skipReleaseNotes && this.settings.showReleaseNotes) {
//I am repurposing imageElementNotice, if the value is true, this means the plugin was just newly installed to Obsidian.
const obsidianJustInstalled = (this.settings.previousRelease === "0.0.0") || !this.settings.previousRelease;
+15 -1
View File
@@ -181,6 +181,7 @@ export interface ExcalidrawSettings {
defaultTrayMode: boolean;
previousRelease: string;
showReleaseNotes: boolean;
compareManifestToPluginVersion: boolean;
showNewVersionNotification: boolean;
//mathjaxSourceURL: string;
latexBoilerplate: string;
@@ -294,7 +295,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
allowPinchZoom: false,
allowWheelZoom: false,
zoomToFitOnOpen: true,
zoomToFitOnResize: true,
zoomToFitOnResize: false,
zoomToFitMaxLevel: 2,
zoomStep: 0.05,
zoomMin: 0.1,
@@ -365,6 +366,7 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
defaultTrayMode: true,
previousRelease: "0.0.0",
showReleaseNotes: true,
compareManifestToPluginVersion: true,
showNewVersionNotification: true,
//mathjaxSourceURL: "https://cdn.jsdelivr.net/npm/mathjax@3.2.1/es5/tex-svg.js",
latexBoilerplate: "\\color{blue}",
@@ -726,6 +728,18 @@ export class ExcalidrawSettingTab extends PluginSettingTab {
}),
);
new Setting(detailsEl)
.setName(t("WARN_ON_MANIFEST_MISMATCH_NAME"))
.setDesc(fragWithHTML(t("WARN_ON_MANIFEST_MISMATCH_DESC")))
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.compareManifestToPluginVersion)
.onChange(async (value) => {
this.plugin.settings.compareManifestToPluginVersion = value;
this.applySettingsUpdate();
}),
);
new Setting(detailsEl)
.setName(t("NEWVERSION_NOTIFICATION_NAME"))
.setDesc(fragWithHTML(t("NEWVERSION_NOTIFICATION_DESC")))
+15
View File
@@ -234,6 +234,8 @@ export default {
RELEASE_NOTES_DESC:
"<b><u>Toggle ON:</u></b> Display release notes each time you update Excalidraw to a newer version.<br>" +
"<b><u>Toggle OFF:</u></b> Silent mode. You can still read release notes on <a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases'>GitHub</a>.",
WARN_ON_MANIFEST_MISMATCH_NAME: "Warn about incomplete plugin updates",
WARN_ON_MANIFEST_MISMATCH_DESC: "Checks that the installed Excalidraw executable matches the version shown in Obsidian's plugin list. If they don't match (often after partial sync), you'll see a warning and can update. Disable to stop checking.",
NEWVERSION_NOTIFICATION_NAME: "Plugin update notification",
NEWVERSION_NOTIFICATION_DESC:
"<b><u>Toggle ON:</u></b> Show a notification when a new version of the plugin is available.<br>" +
@@ -1210,4 +1212,17 @@ export default {
//EmbeddableActionsMenu.tsx
BOOKMARK_PAGE: "Save current position in document",
CAPTURE_PAGE: "Capture current page as image",
//VersionMismatch.ts
//WARNING: Do not change the {VAL_RECORDED} and {VAL_ACTUAL} strings, they are replaced by the actual version values at runtime!
VERSION_MISMATCH_NOTICE: `The version recorded by Obsidian is <b>{VAL_RECORDED}</b>, but the installed Excalidraw code is <b>{VAL_ACTUAL}</b>.`,
VERSION_MISMATCH_HEADING: "Excalidraw version mismatch",
VERSION_MISMATCH_CAUSE: "This usually happens after a partial sync (e.g. Obsidian Sync Standard) where large files (main.js > 5MB) did not sync, so only <code>manifest.json</code> updated.",
VERSION_MISMATCH_OPTIONS: "Options:<br><b>1.</b> Re-download the plugin (recommended).<br><b>2.</b> Ignore for now.",
VERSION_MISMATCH_NOTE: "Note: Updating version info manually may affect tools that read manifest.json directly (e.g. Plugin Update Tracker, BRAT) until a full reinstall.",
VERSION_MISMATCH_DISABLE_NAME: "Disable future mismatch warnings",
VERSION_MISMATCH_DISABLE_DESC: "You can re-enable this under: Settings → Excalidraw → Basic → Warn about incomplete plugin updates.",
VERSION_MISMATCH_REDOWNLOAD: "Re-download plugin",
VERSION_MISMATCH_IGNORE: "Ignore",
};
+5 -1
View File
@@ -19,7 +19,11 @@ I build this plugin in my free time, as a labor of love. Curious about the philo
`,
"2.15.3":`
## Fixed
- When adding a back-of-the-note card using the context menu, the card got placed at the absolute 0,0 position in the scene instead of the current pointer position. [#9949](https://github.com/excalidraw/excalidraw/issues/9949)
- New back of the note cards are not visible until the drawing is saved. When adding a back-of-the-note card using the context menu, the card got placed at the absolute 0,0 position in the scene instead of the current pointer position. [#9949](https://github.com/excalidraw/excalidraw/issues/9949)
- Drawings created 4 years ago don't open [#2479](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2479)
## New
- Added startup check that detects when Obsidian's recorded plugin version differs from the installed Excalidraw code (e.g. after partial sync of large files) and offers to update or ignore, with a setting to disable the check.
`,
"2.15.2":`
## Fixed:
+1 -1
View File
@@ -34,7 +34,7 @@ export class SelectCard extends FuzzySuggestModal<string> {
this.close();
return;
}
addBackOfTheNoteCard(this.view, item, true, undefined, undefined, this.center);
addBackOfTheNoteCard(this.view, item, true, undefined, undefined, this.center, {x: this.x, y: this.y});
this.close();
}
}
+102
View File
@@ -0,0 +1,102 @@
import { Modal, Setting } from "obsidian";
import ExcalidrawPlugin from "src/core/main";
import { t } from "src/lang/helpers";
declare const PLUGIN_VERSION: string;
/**
* A modal dialog that informs the user about a version mismatch between the version recorded by Obsidian and the actual version of the plugin executable.
* Explain that this can be the result of a partial sync, such as an Obsidian Sync Standard plan, which does not syncronize files larger than 5MB, and the plugin executable is larger.
* Explain that changing the plugin version information in Obsidian can lead to unexpected behavior in plugins suchs as the Plugin Update Tracker plugin or the BRAT plugin.
* The user has a toggle button to disable this check in the future. There is additional information that this can be reenabled in plugin settings.
* The user can click update obsidian version info to match the plugin version, and open Obsidian settings to redownload the plugin.
* The user can click ignore to dismiss the dialog.
*/
export class VersionMismatchPrompt extends Modal {
private resolvePromise: (value: any) => void;
public promise: Promise<any>;
private resolved: boolean;
private isDirty: boolean = false;
public constructor(
private plugin: ExcalidrawPlugin,
) {
super(plugin.app);
}
async start(): Promise<any> {
this.promise = new Promise((resolve) => {
this.resolvePromise = resolve;
});
await this.plugin.loadSettings();
this.buildUI();
this.open();
return this.promise;
}
private buildUI() {
const { contentEl } = this;
contentEl.empty();
const recorded = this.plugin.manifest.version;
const actual = PLUGIN_VERSION;
contentEl.createEl("h2", { text: t("VERSION_MISMATCH_HEADING") });
const p1 = contentEl.createEl("p");
p1.innerHTML = t("VERSION_MISMATCH_NOTICE")
.replace("{VAL_RECORDED}", recorded)
.replace("{VAL_ACTUAL}", actual);
const p2 = contentEl.createEl("p");
p2.innerHTML = t("VERSION_MISMATCH_CAUSE");
const p3 = contentEl.createEl("p");
p3.innerHTML = t("VERSION_MISMATCH_OPTIONS");
const p4 = contentEl.createEl("p");
p4.innerHTML = t("VERSION_MISMATCH_NOTE");
new Setting(contentEl)
.setName(t("VERSION_MISMATCH_DISABLE_NAME"))
.setDesc(t("VERSION_MISMATCH_DISABLE_DESC"))
.addToggle(tg =>
tg.setValue(!this.plugin.settings.compareManifestToPluginVersion ? true : false)
.onChange(async (value) => {
this.plugin.settings.compareManifestToPluginVersion = !value; // invert because label is Disable ...
this.isDirty = true;
}),
);
// Buttons row
const buttonBar = contentEl.createDiv({ cls: "ex-version-mismatch-buttons" });
const redownloadBtn = buttonBar.createEl("button", { text: t("VERSION_MISMATCH_REDOWNLOAD") });
redownloadBtn.addEventListener("click", () => {
this.resolved = true; // triggers opening settings in caller
this.close();
});
const ignoreBtn = buttonBar.createEl("button", { text: t("VERSION_MISMATCH_IGNORE") });
ignoreBtn.addEventListener("click", () => {
this.resolved = false;
this.close();
});
buttonBar.style.display = "flex";
buttonBar.style.gap = "0.5rem";
buttonBar.style.marginTop = "1rem";
redownloadBtn.style.backgroundColor = "var(--interactive-accent)";
redownloadBtn.style.color = "var(--text-on-accent)";
}
async onClose() {
super.onClose();
if(this.isDirty) {
await this.plugin.saveSettings();
}
if (!this.resolved) {
this.resolvePromise && this.resolvePromise(false);
} else {
this.resolvePromise && this.resolvePromise(true);
}
}
}
+25 -21
View File
@@ -581,6 +581,10 @@ export class ExcalidrawData {
el.containerId = null;
}
if (el.type === "text" && !el.originalText) {
el.originalText = el.rawText ?? el.text ?? "";
}
//https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/494
if (el.x === null) {
el.x = 0;
@@ -760,6 +764,27 @@ export class ExcalidrawData {
this.deletedElements = this.scene.elements.filter((el:ExcalidrawElement)=>el.isDeleted);
this.scene.elements = this.scene.elements.filter((el:ExcalidrawElement)=>!el.isDeleted);
//once off migration of legacy scenes
if(this.scene?.elements?.some((el:any)=>el.type==="iframe" && !el.customData)) {
const prompt = new MultiOptionConfirmationPrompt(
this.plugin,
"This file contains embedded frames " +
"which will be migrated to a newer version for compatibility with " +
"<a href='https://excalidraw.com'>excalidraw.com</a>.<br>🔄 If you're using Obsidian on " +
"multiple devices, you may proceed now, but please, before opening this " +
"file on your other devices, update Excalidraw on those as well.<br>🔍 More info is available "+
"<a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.9.9'>here</a>.<br>🌐 " +
"<a href='https://translate.google.com/?sl=en&tl=zh-CN&text=This%20file%20contains%20embedded%20frames%20which%20will%20be%20migrated%20to%20a%20newer%20version%20for%20compatibility%20with%20excalidraw.com.%0A%0AIf%20you%27re%20using%20Obsidian%20on%20multiple%20devices%2C%20you%20may%20proceed%20now%2C%20but%20please%2C%20before%20opening%20this%20file%20on%20your%20other%20devices%2C%20update%20Excalidraw%20on%20those%20as%20well.%0A%0AMore%20info%20is%20available%20here%3A%20https%3A%2F%2Fgithub.com%2Fzsviczian%2Fobsidian-excalidraw-plugin%2Freleases%2Ftag%2F1.9.9%27%3Ehere%3C%2Fa%3E.&op=translate'>" +
"Translate</a>.",
);
prompt.contentEl.focus();
const confirmation = await prompt.waitForClose
if(!confirmation) {
throw new Error(ERROR_IFRAME_CONVERSION_CANCELED);
}
}
this.initializeNonInitializedFields();
const timer = window.setTimeout(()=>{
const notice = new Notice(t("FONT_LOAD_SLOW"),15000);
@@ -802,27 +827,6 @@ export class ExcalidrawData {
delete this.scene.appState.gridColor.MajorGridFrequency;
}
//once off migration of legacy scenes
if(this.scene?.elements?.some((el:any)=>el.type==="iframe" && !el.customData)) {
const prompt = new MultiOptionConfirmationPrompt(
this.plugin,
"This file contains embedded frames " +
"which will be migrated to a newer version for compatibility with " +
"<a href='https://excalidraw.com'>excalidraw.com</a>.<br>🔄 If you're using Obsidian on " +
"multiple devices, you may proceed now, but please, before opening this " +
"file on your other devices, update Excalidraw on those as well.<br>🔍 More info is available "+
"<a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/1.9.9'>here</a>.<br>🌐 " +
"<a href='https://translate.google.com/?sl=en&tl=zh-CN&text=This%20file%20contains%20embedded%20frames%20which%20will%20be%20migrated%20to%20a%20newer%20version%20for%20compatibility%20with%20excalidraw.com.%0A%0AIf%20you%27re%20using%20Obsidian%20on%20multiple%20devices%2C%20you%20may%20proceed%20now%2C%20but%20please%2C%20before%20opening%20this%20file%20on%20your%20other%20devices%2C%20update%20Excalidraw%20on%20those%20as%20well.%0A%0AMore%20info%20is%20available%20here%3A%20https%3A%2F%2Fgithub.com%2Fzsviczian%2Fobsidian-excalidraw-plugin%2Freleases%2Ftag%2F1.9.9%27%3Ehere%3C%2Fa%3E.&op=translate'>" +
"Translate</a>.",
);
prompt.contentEl.focus();
const confirmation = await prompt.waitForClose
if(!confirmation) {
throw new Error(ERROR_IFRAME_CONVERSION_CANCELED);
}
}
this.initializeNonInitializedFields();
data = data.substring(0, sceneJSONandPOS.pos);
//The Markdown # Text Elements take priority over the JSON text elements. Assuming the scenario in which the
+1
View File
@@ -58,6 +58,7 @@ declare global {
declare module "obsidian" {
interface App {
internalPlugins: any;
setting: any;
isMobile(): boolean;
getObsidianUrl(file:TFile): string;
metadataTypeManager: {
+3 -2
View File
@@ -234,6 +234,7 @@ export async function addBackOfTheNoteCard(
cardBody?: string,
embeddableCustomData?: EmbeddableMDCustomProps,
center: boolean = false,
position?: {x: number, y: number},
):Promise<string> {
const data = view.data;
const header = getExcalidrawMarkdownHeaderSection(data);
@@ -263,7 +264,7 @@ export async function addBackOfTheNoteCard(
}
const ea = getEA(view) as ExcalidrawAutomate;
let x,y = 0;
let {x,y} = position ?? ea.targetView.currentPosition;
if(center) {
const centerPos = ea.getViewCenterPosition();
if(centerPos) {
@@ -287,7 +288,7 @@ export async function addBackOfTheNoteCard(
window.setTimeout(()=>{
api.updateScene({appState: {activeEmbeddable: {element: el, state: "active"}}, captureUpdate: CaptureUpdateAction.NEVER,});
if(found) view.getEmbeddableLeafElementById(el.id)?.editNode?.();
});
},200);
}
ea.destroy();
return el.id;