mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2025-08-06 05:46:28 +00:00
2.5.2
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "2.5.1",
|
||||
"version": "2.5.2",
|
||||
"minAppVersion": "1.1.6",
|
||||
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
|
||||
"author": "Zsolt Viczian",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "obsidian-excalidraw-plugin",
|
||||
"name": "Excalidraw",
|
||||
"version": "2.5.1",
|
||||
"version": "2.5.2",
|
||||
"minAppVersion": "1.1.6",
|
||||
"description": "An Obsidian plugin to edit and view Excalidraw drawings",
|
||||
"author": "Zsolt Viczian",
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@zsviczian/excalidraw": "0.17.1-obsidian-56",
|
||||
"@zsviczian/excalidraw": "0.17.1-obsidian-57",
|
||||
"chroma-js": "^2.4.2",
|
||||
"clsx": "^2.0.0",
|
||||
"@zsviczian/colormaster": "^1.2.2",
|
||||
|
||||
@@ -3444,7 +3444,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{
|
||||
toDelete.forEach((k) => delete files[k]);
|
||||
}
|
||||
|
||||
const activeTool = st.activeTool;
|
||||
const activeTool = {...st.activeTool};
|
||||
if(!["freedraw","hand"].includes(activeTool.type)) {
|
||||
activeTool.type = "selection";
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import { FILENAMEPARTS, PreviewImageType } from "./utils/UtilTypes";
|
||||
import { CustomMutationObserver, debug, DEBUGGING } from "./utils/DebugHelper";
|
||||
import { getExcalidrawFileForwardLinks } from "./utils/ExcalidrawViewUtils";
|
||||
import { linkPrompt } from "./dialogs/Prompt";
|
||||
import { isHTMLElement } from "./utils/typechecks";
|
||||
|
||||
interface imgElementAttributes {
|
||||
file?: TFile;
|
||||
@@ -405,12 +406,13 @@ const createImgElement = async (
|
||||
|
||||
let timer:number;
|
||||
const clickEvent = (ev:PointerEvent) => {
|
||||
if(!(ev.target instanceof Element)) {
|
||||
if (!isHTMLElement(ev.target)) {
|
||||
return;
|
||||
}
|
||||
const containerElement = ev.target.hasClass("excalidraw-embedded-img")
|
||||
const targetElement = ev.target as HTMLElement;
|
||||
const containerElement = targetElement.hasClass("excalidraw-embedded-img")
|
||||
? ev.target
|
||||
: getParentOfClass(ev.target, "excalidraw-embedded-img");
|
||||
: getParentOfClass(targetElement, "excalidraw-embedded-img");
|
||||
if (!containerElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,18 @@ I develop this plugin as a hobby, spending my free time doing this. If you find
|
||||
|
||||
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://cdn.ko-fi.com/cdn/kofi3.png?v=3" height=45></a></div>
|
||||
`,
|
||||
"2.5.2": `
|
||||
## Fixed
|
||||
- Text became disconnected from sticky notes (rectangle/ellipse/diamond + text) if the sticky note contained a link (e.g., URL or wiki link), and in some cases, triggered a save error warning. [#2054](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2054)
|
||||
- Long-clicking to open an Excalidraw drawing from a markdown note did not work when the note was in an Obsidian pop-out window.
|
||||
- Active tool was deactivated after autosave, requiring the user to reselect the tool.
|
||||
|
||||
## Minor changes to default settings
|
||||
- I adjusted some of the default settings. This change only affects new installs of Excalidraw; existing installs and settings remain unchanged:
|
||||
- **Reuse Adjacent Pane** is now the default for opening new drawings. Excalidraw will try to open the drawing in the most recently used adjacent pane, if available.
|
||||
- **Focus on Existing Tab** is the default for reopening an already open drawing. Excalidraw will switch to the existing tab where the drawing is open, instead of creating a new one.
|
||||
- **Autosave Interval** is now set to a default value of 1 minute on Desktop and 30 seconds on mobile platforms.
|
||||
`,
|
||||
"2.5.1": `
|
||||
## New
|
||||
- Excalidraw will now save images using the filename from the file system when adding an image via the image tool (in the top toolbar).
|
||||
|
||||
@@ -225,8 +225,8 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
|
||||
onceOffCompressFlagReset: false,
|
||||
onceOffGPTVersionReset: false,
|
||||
autosave: true,
|
||||
autosaveIntervalDesktop: 30000,
|
||||
autosaveIntervalMobile: 20000,
|
||||
autosaveIntervalDesktop: 60000,
|
||||
autosaveIntervalMobile: 30000,
|
||||
drawingFilenamePrefix: "Drawing ",
|
||||
drawingEmbedPrefixWithFilename: true,
|
||||
drawingFilnameEmbedPostfix: " ",
|
||||
@@ -268,9 +268,9 @@ export const DEFAULT_SETTINGS: ExcalidrawSettings = {
|
||||
done: "🗹",
|
||||
hoverPreviewWithoutCTRL: false,
|
||||
linkOpacity: 1,
|
||||
openInAdjacentPane: false,
|
||||
openInAdjacentPane: true,
|
||||
showSecondOrderLinks: true,
|
||||
focusOnFileTab: false,
|
||||
focusOnFileTab: true,
|
||||
openInMainWorkspace: true,
|
||||
showLinkBrackets: true,
|
||||
allowCtrlClick: true,
|
||||
|
||||
@@ -23,6 +23,9 @@ export function updateElementIdsInScene(
|
||||
boundEl.boundElements?.filter(x=>x.id === elementToChange.id).forEach( x => {
|
||||
(x.id as Mutable<string>) = newID;
|
||||
});
|
||||
if(boundEl.type === "text") {
|
||||
boundEl.containerId = newID;
|
||||
}
|
||||
if(boundEl.type === "arrow") {
|
||||
const arrow = boundEl as Mutable<ExcalidrawArrowElement>;
|
||||
if(arrow.startBinding?.elementId === elementToChange.id) {
|
||||
|
||||
18
src/utils/typechecks.ts
Normal file
18
src/utils/typechecks.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Checks if a given target is an HTMLElement.
|
||||
*
|
||||
* This function is necessary because `instanceof HTMLElement` can fail
|
||||
* in environments with multiple execution contexts (e.g., popout windows),
|
||||
* where `HTMLElement` comes from different global objects.
|
||||
* Instead, we use feature detection by checking for key properties
|
||||
* common to all HTML elements (nodeType and tagName).
|
||||
*
|
||||
* @param target - The target to check.
|
||||
* @returns True if the target is an HTMLElement, false otherwise.
|
||||
*/
|
||||
export function isHTMLElement (target: any): target is HTMLElement {
|
||||
return target &&
|
||||
typeof target === 'object' &&
|
||||
target.nodeType === 1 && // nodeType 1 means it's an element
|
||||
typeof target.tagName === 'string'; // tagName exists on HTML elements
|
||||
}
|
||||
Reference in New Issue
Block a user