/// import { TFile, Plugin, WorkspaceLeaf, App, PluginManifest, FrontMatterCache } from "obsidian"; import ExcalidrawView from "./ExcalidrawView"; import { ExcalidrawSettings } from "./settings"; import { InsertLinkDialog } from "./dialogs/InsertLinkDialog"; import { InsertImageDialog } from "./dialogs/InsertImageDialog"; import { ImportSVGDialog } from "./dialogs/ImportSVGDialog"; import { InsertMDDialog } from "./dialogs/InsertMDDialog"; import { ExcalidrawAutomate } from "./ExcalidrawAutomate"; import { FileId } from "@zsviczian/excalidraw/types/element/types"; import { ScriptEngine } from "./Scripts"; import { Packages } from "./types"; import Taskbone from "./ocr/Taskbone"; import { PaneTarget } from "./utils/ModifierkeyHelper"; export default class ExcalidrawPlugin extends Plugin { taskbone: Taskbone; private excalidrawFiles; excalidrawFileModes: { [file: string]: string; }; private _loaded; settings: ExcalidrawSettings; private openDialog; insertLinkDialog: InsertLinkDialog; insertImageDialog: InsertImageDialog; importSVGDialog: ImportSVGDialog; insertMDDialog: InsertMDDialog; activeExcalidrawView: ExcalidrawView; lastActiveExcalidrawFilePath: string; hover: { linkText: string; sourcePath: string; }; private observer; private themeObserver; private fileExplorerObserver; private modalContainerObserver; private workspaceDrawerLeftObserver; private workspaceDrawerRightObserver; opencount: number; ea: ExcalidrawAutomate; filesMaster: Map; equationsMaster: Map; mathjax: any; private mathjaxDiv; mathjaxLoaderFinished: boolean; scriptEngine: ScriptEngine; fourthFontDef: string; private packageMap; leafChangeTimeout: NodeJS.Timeout; private forceSaveCommand; private removeEventLisnters; constructor(app: App, manifest: PluginManifest); getPackage(win: Window): Packages; onload(): Promise; initializeFourthFont(): void; loadMathJax(): void; private switchToExcalidarwAfterLoad; private forceSaveActiveView; private registerInstallCodeblockProcessor; /** * Displays a transcluded .excalidraw image in markdown preview mode */ private addMarkdownPostProcessor; private addThemeObserver; experimentalFileTypeDisplayToggle(enabled: boolean): void; /** * Display characters configured in settings, in front of the filename, if the markdown file is an excalidraw drawing */ private experimentalFileTypeDisplay; private registerCommands; convertSingleExcalidrawToMD(file: TFile, replaceExtension?: boolean, keepOriginal?: boolean): Promise; convertExcalidrawToMD(replaceExtension?: boolean, keepOriginal?: boolean): Promise; private registerMonkeyPatches; private popScope; private registerEventListeners; addFileSaveTriggerEventHandlers(): void; updateFileCache(file: TFile, frontmatter?: FrontMatterCache, deleted?: boolean): void; onunload(): void; embedDrawing(file: TFile): Promise; loadSettings(opts?: { applyLefthandedMode?: boolean; reEnableAutosave?: boolean; }): Promise; saveSettings(): Promise; getStencilLibrary(): {}; setStencilLibrary(library: {}): void; triggerEmbedUpdates(filepath?: string): void; openDrawing(drawingFile: TFile, location: PaneTarget, active?: boolean, subpath?: string, justCreated?: boolean): void; getBlankDrawing(): Promise; /** * Extracts the text elements from an Excalidraw scene into a string of ids as headers followed by the text contents * @param {string} data - Excalidraw scene JSON string * @returns {string} - Text starting with the "# Text Elements" header and followed by each "## id-value" and text */ exportSceneToMD(data: string): Promise; createDrawing(filename: string, foldername?: string, initData?: string): Promise; createAndOpenDrawing(filename: string, location: PaneTarget, foldername?: string, initData?: string): Promise; setMarkdownView(leaf: WorkspaceLeaf): Promise; setExcalidrawView(leaf: WorkspaceLeaf): Promise; isExcalidrawFile(f: TFile): boolean; exportLibrary(): Promise; }