diff --git a/manifest-beta.json b/manifest-beta.json index 1c01f1f..401bd19 100644 --- a/manifest-beta.json +++ b/manifest-beta.json @@ -1,7 +1,7 @@ { "id": "obsidian-excalidraw-plugin", "name": "Excalidraw", - "version": "2.6.8-beta-2", + "version": "2.6.8-beta-3", "minAppVersion": "1.1.6", "description": "An Obsidian plugin to edit and view Excalidraw drawings", "author": "Zsolt Viczian", diff --git a/package.json b/package.json index 65cbb08..d9ba926 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "license": "MIT", "dependencies": { "@popperjs/core": "^2.11.8", - "@zsviczian/excalidraw": "0.17.6-16", + "@zsviczian/excalidraw": "0.17.6-17", "chroma-js": "^2.4.2", "clsx": "^2.0.0", "@zsviczian/colormaster": "^1.2.2", diff --git a/src/ExcalidrawAutomate.ts b/src/ExcalidrawAutomate.ts index 04a8a08..7d15947 100644 --- a/src/ExcalidrawAutomate.ts +++ b/src/ExcalidrawAutomate.ts @@ -17,7 +17,7 @@ import { MimeType } from "./EmbeddedFileLoader"; import { Editor, normalizePath, Notice, OpenViewState, RequestUrlResponse, TFile, TFolder, WorkspaceLeaf } from "obsidian"; import * as obsidian_module from "obsidian"; import ExcalidrawView, { ExportSettings, TextMode, getTextMode } from "src/ExcalidrawView"; -import { ExcalidrawData, getMarkdownDrawingSection, REGEX_LINK } from "src/ExcalidrawData"; +import { ExcalidrawData, getExcalidrawMarkdownHeaderSection, getMarkdownDrawingSection, REGEX_LINK } from "src/ExcalidrawData"; import { FRONTMATTER, nanoid, @@ -654,6 +654,13 @@ export class ExcalidrawAutomate { 0 ) : null; + if (template?.plaintext) { + if(params.plaintext) { + params.plaintext = params.plaintext + "\n\n" + template.plaintext; + } else { + params.plaintext = template.plaintext; + } + } let elements = template ? template.elements : []; elements = elements.concat(this.getElements()); let frontmatter: string; @@ -679,7 +686,13 @@ export class ExcalidrawAutomate { : FRONTMATTER; } - frontmatter += params.plaintext ? params.plaintext + "\n\n" : ""; + frontmatter += params.plaintext + ? (params.plaintext.endsWith("\n\n") + ? params.plaintext + : (params.plaintext.endsWith("\n") + ? params.plaintext + "\n" + : params.plaintext + "\n\n")) + : ""; if(template?.frontmatter && params?.frontmatterKeys) { //the frontmatter tags supplyed to create take priority frontmatter = mergeMarkdownFiles(template.frontmatter,frontmatter); @@ -2930,6 +2943,7 @@ async function getTemplate( frontmatter: string; files: any; hasSVGwithBitmap: boolean; + plaintext: string; //markdown data above Excalidraw data and below YAML frontmatter }> { const app = plugin.app; const vault = app.vault; @@ -2955,6 +2969,7 @@ async function getTemplate( frontmatter: "", files: excalidrawData.scene.files, hasSVGwithBitmap, + plaintext: "", }; } @@ -3027,7 +3042,7 @@ async function getTemplate( } excalidrawData.destroy(); - const filehead = data.substring(0, trimLocation); + const filehead = getExcalidrawMarkdownHeaderSection(data); // data.substring(0, trimLocation); let files:any = {}; const sceneFilesSize = Object.values(scene.files).length; if (sceneFilesSize > 0) { @@ -3040,6 +3055,7 @@ async function getTemplate( } } + const frontmatter = filehead.match(/^---\n.*\n---\n/ms)?.[0] ?? filehead; return { elements: convertMarkdownLinksToObsidianURLs ? updateElementLinksToObsidianLinks({ @@ -3047,7 +3063,10 @@ async function getTemplate( hostFile: file, }) : groupElements, appState: scene.appState, - frontmatter: filehead.match(/^---\n.*\n---\n/ms)?.[0] ?? filehead, + frontmatter, + plaintext: frontmatter !== filehead + ? (filehead.split(/^---\n.*\n---\n/ms)?.[1] ?? "") + : "", files, hasSVGwithBitmap, }; @@ -3058,6 +3077,7 @@ async function getTemplate( frontmatter: null, files: [], hasSVGwithBitmap, + plaintext: "", }; } diff --git a/src/ExcalidrawView.ts b/src/ExcalidrawView.ts index 6fbca55..1fa195c 100644 --- a/src/ExcalidrawView.ts +++ b/src/ExcalidrawView.ts @@ -3546,7 +3546,10 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ } private clearHoverPreview() { - if (this.hoverPopover) { + //@ts-ignore + const hoverContainerEl = this.hoverPopover?.containerEl; + //don't auto hide hover-editor + if (this.hoverPopover && !hoverContainerEl?.parentElement?.hasClass("hover-editor")) { this.hoverPreviewTarget = null; //@ts-ignore if(this.hoverPopover.embed?.editor) { @@ -4659,7 +4662,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ //in compatibility mode, returns the original text, and for backward compatibility the text if originalText is not available private onBeforeTextEdit (textElement: ExcalidrawTextElement, isExistingElement: boolean): string { (process.env.NODE_ENV === 'development') && DEBUGGING && debug(this.onBeforeTextEdit, "ExcalidrawView.onBeforeTextEdit", textElement); - const api = this.excalidrawAPI as ExcalidrawImperativeAPI; + /*const api = this.excalidrawAPI as ExcalidrawImperativeAPI; const st = api.getAppState(); setDynamicStyle( this.plugin.ea, @@ -4667,7 +4670,7 @@ export default class ExcalidrawView extends TextFileView implements HoverParent{ st.viewBackgroundColor === "transparent" ? "white" : st.viewBackgroundColor, this.plugin.settings.dynamicStyling, api.getColorAtScenePoint({sceneX: this.currentPosition.x, sceneY: this.currentPosition.y}) - ); + );*/ if(!isExistingElement) { return; } diff --git a/src/dialogs/Messages.ts b/src/dialogs/Messages.ts index 5a13f6e..4d482e2 100644 --- a/src/dialogs/Messages.ts +++ b/src/dialogs/Messages.ts @@ -16,6 +16,18 @@ export const RELEASE_NOTES: { [k: string]: string } = { I develop this plugin as a hobby, spending my free time doing this. If you find it valuable, then please say THANK YOU or...
+`, +"2.6.8":` +## New +- Text Element cursor color matched the text color. + +## Fixed +- BUG: icon on the ribbon menu keeps reappearing even if you hide it every time you reopen Obsidian [#2115](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2115) +- In pen mode, when single-finger panning is enabled, allow actions with the mouse. +- When editing an Excalidraw file in split mode (drawing on one side, markdown view on the other), editing the markdown sometimes causes the drawing to re-zoom and jump away from the selected area. +- Hover-Editor compatibility +- ${String.fromCharCode(96)}ExcalidrawAutomate.create() ${String.fromCharCode(96)} will now correctly include the markdown text in templates above Excalidraw Data and below YAML front matter. This also fixes the same issue with the Deconstruct Selected Element script. + `, "2.6.7":` Hoping to finally move on to 2.7.0... but still have one last bug to fix in 2.6.x!