diff --git a/src/ExcalidrawData.ts b/src/ExcalidrawData.ts index 64416cf..a948f0f 100644 --- a/src/ExcalidrawData.ts +++ b/src/ExcalidrawData.ts @@ -51,7 +51,7 @@ import { BinaryFiles, DataURL, SceneData } from "@zsviczian/excalidraw/types/exc import { EmbeddedFile, MimeType } from "./EmbeddedFileLoader"; import { ConfirmationPrompt } from "./dialogs/Prompt"; import { getMermaidImageElements, getMermaidText, shouldRenderMermaid } from "./utils/MermaidUtils"; -import { debug } from "./utils/DebugHelper"; +import { DEBUGGING, debug } from "./utils/DebugHelper"; import { Mutable } from "@zsviczian/excalidraw/types/excalidraw/utility-types"; type SceneDataWithFiles = SceneData & { files: BinaryFiles }; @@ -992,7 +992,7 @@ export class ExcalidrawData { te.width = width; te.height = height; } catch(e) { - debug(`ExcalidrawData.updateSceneTextElements, textElement: ${te?.id}`, te, this.updateSceneTextElements); + DEBUGGING && debug(this.updateSceneTextElements, `ExcalidrawData.updateSceneTextElements, textElement:${te?.id}`, te, this.updateSceneTextElements); } } } diff --git a/src/ExcalidrawView.ts b/src/ExcalidrawView.ts index 7375fff..c1475c5 100644 --- a/src/ExcalidrawView.ts +++ b/src/ExcalidrawView.ts @@ -135,7 +135,7 @@ import { useDefaultExcalidrawFrame } from "./utils/CustomEmbeddableUtils"; import { UniversalInsertFileModal } from "./dialogs/UniversalInsertFileModal"; import { getMermaidText, shouldRenderMermaid } from "./utils/MermaidUtils"; import { nanoid } from "nanoid"; -import { CustomMutationObserver, debug, log} from "./utils/DebugHelper"; +import { CustomMutationObserver, DEBUGGING, debug, log} from "./utils/DebugHelper"; import { extractCodeBlocks, postOpenAI } from "./utils/AIUtils"; import { Mutable } from "@zsviczian/excalidraw/types/excalidraw/utility-types"; import { SelectCard } from "./dialogs/SelectCard"; @@ -684,7 +684,7 @@ export default class ExcalidrawView extends TextFileView { try { const allowSave = this.isDirty() || forcesave; //removed this.semaphores.autosaving - debug({where: "ExcalidrawView.save", allowSave, isDirty: this.isDirty(), autosaving: this.semaphores.autosaving, forcesave}); + DEBUGGING && debug(this.save, `ExcalidrawView.save, allowSave:${allowSave}, isDirty:${this.isDirty()}, isAutosaving:${this.semaphores.autosaving}, isForceSaving:${forcesave}`); if (allowSave) { const scene = this.getScene(); @@ -1307,7 +1307,7 @@ export default class ExcalidrawView extends TextFileView { const self = this; this.app.workspace.onLayoutReady(async () => { - debug(`ExcalidrawView.onload app.workspace.onLayoutReady, file: ${self.file?.name}, isActiveLeaf: ${self.app.workspace.activeLeaf === self.leaf}, is activeExcalidrawView set: ${Boolean(self.plugin.activeExcalidrawView)}`); + DEBUGGING && debug(self.onload,`ExcalidrawView.onload > app.workspace.onLayoutReady, file:${self.file?.name}, isActiveLeaf:${self.app.workspace.activeLeaf === self.leaf}, is activeExcalidrawView set:${Boolean(self.plugin.activeExcalidrawView)}`); //implemented to overcome issue that activeLeafChangeEventHandler is not called when view is initialized from a saved workspace, since Obsidian 1.6.0 let counter = 0; while(counter++<50 && !Boolean(self.plugin.activeLeafChangeEventHandler)) { @@ -1395,6 +1395,7 @@ export default class ExcalidrawView extends TextFileView { this.offsetTop = parent.offsetTop; const self = this; const observerFn = async (m: MutationRecord[]) => { + DEBUGGING && debug(observerFn, `ExcalidrawView.parentMoveObserver, file:${self.file?.name}`); const target = m[0].target; if (!(target instanceof HTMLElement)) { return; @@ -1408,7 +1409,7 @@ export default class ExcalidrawView extends TextFileView { self.offsetTop = offsetTop; } }; - this.parentMoveObserver = this.plugin.settings.isDebugMode + this.parentMoveObserver = DEBUGGING ? new CustomMutationObserver(observerFn, "parentMoveObserver") : new MutationObserver(observerFn) @@ -1585,9 +1586,11 @@ export default class ExcalidrawView extends TextFileView { const plugin = this.plugin; if (path) { setTimeout(() => { + DEBUGGING && debug(this.onunload,`ExcalidrawView.onunload > timeout, calling triggerEmbedUpdates`); plugin.triggerEmbedUpdates(path); }, 300); } + DEBUGGING && debug(this.onunload,`ExcalidrawView.onunload, completed`); } /** @@ -1845,35 +1848,36 @@ export default class ExcalidrawView extends TextFileView { this.lastSaveTimestamp = this.file.stat.mtime; this.lastLoadedFile = this.file; data = this.data = data.replaceAll("\r\n", "\n").replaceAll("\r", "\n"); + const self = this; this.app.workspace.onLayoutReady(async () => { - debug(`ExcalidrawView.setViewData app.workspace.onLayoutReady, file: ${this.file?.name}, isActiveLeaf: ${this.app.workspace.activeLeaf === this.leaf}`); + DEBUGGING && debug(self.setViewData, `ExcalidrawView.setViewData > app.workspace.onLayoutReady, file:${self.file?.name}, isActiveLeaf:${self.app.workspace.activeLeaf === self.leaf}`); let counter = 0; - while (!this.file && counter++<50) await sleep(50); - if(!this.file) return; - this.compatibilityMode = this.file.extension === "excalidraw"; - await this.plugin.loadSettings(); - if (this.compatibilityMode) { - this.plugin.enableLegacyFilePopoverObserver(); - this.textIsRaw_Element.hide(); - this.textIsParsed_Element.hide(); - this.linkAction_Element.hide(); - this.textMode = TextMode.raw; - await this.excalidrawData.loadLegacyData(data, this.file); - if (!this.plugin.settings.compatibilityMode) { + while (!self.file && counter++<50) await sleep(50); + if(!self.file) return; + self.compatibilityMode = self.file.extension === "excalidraw"; + await self.plugin.loadSettings(); + if (self.compatibilityMode) { + self.plugin.enableLegacyFilePopoverObserver(); + self.textIsRaw_Element.hide(); + self.textIsParsed_Element.hide(); + self.linkAction_Element.hide(); + self.textMode = TextMode.raw; + await self.excalidrawData.loadLegacyData(data, self.file); + if (!self.plugin.settings.compatibilityMode) { new Notice(t("COMPATIBILITY_MODE"), 4000); } - this.excalidrawData.disableCompression = true; + self.excalidrawData.disableCompression = true; } else { - this.linkAction_Element.show(); - this.excalidrawData.disableCompression = false; + self.linkAction_Element.show(); + self.excalidrawData.disableCompression = false; const textMode = getTextMode(data); - this.changeTextMode(textMode, false); + self.changeTextMode(textMode, false); try { if ( - !(await this.excalidrawData.loadData( + !(await self.excalidrawData.loadData( data, - this.file, - this.textMode, + self.file, + self.textMode, )) ) { return; @@ -1881,12 +1885,12 @@ export default class ExcalidrawView extends TextFileView { } catch (e) { errorlog({ where: "ExcalidrawView.setViewData", error: e }); if(e.message === ERROR_IFRAME_CONVERSION_CANCELED) { - this.setMarkdownView(); + self.setMarkdownView(); return; } - const file = this.file; - const plugin = this.plugin; - const leaf = this.leaf; + const file = self.file; + const plugin = self.plugin; + const leaf = self.leaf; (async () => { let confirmation:boolean = true; let counter = 0; @@ -1932,17 +1936,17 @@ export default class ExcalidrawView extends TextFileView { })(); - this.setMarkdownView(); + self.setMarkdownView(); return; } } - await this.loadDrawing(true); + await self.loadDrawing(true); - if(this.plugin.ea.onFileOpenHook) { + if(self.plugin.ea.onFileOpenHook) { try { - await this.plugin.ea.onFileOpenHook({ + await self.plugin.ea.onFileOpenHook({ ea: getEA(this), - excalidrawFile: this.file, + excalidrawFile: self.file, view: this, }); } catch(e) { @@ -1950,20 +1954,20 @@ export default class ExcalidrawView extends TextFileView { } } - const script = this.excalidrawData.getOnLoadScript(); + const script = self.excalidrawData.getOnLoadScript(); if(script) { const self = this; - const scriptname = this.file.basename+ "-onlaod-script"; + const scriptname = self.file.basename+ "-onlaod-script"; const runScript = () => { if(!self.excalidrawAPI) { //need to wait for Excalidraw to initialize setTimeout(runScript,200); return; } - self.plugin.scriptEngine.executeScript(self,script,scriptname,this.file); + self.plugin.scriptEngine.executeScript(self,script,scriptname,self.file); } runScript(); } - this.isLoaded = true; + self.isLoaded = true; }); } @@ -2281,7 +2285,7 @@ export default class ExcalidrawView extends TextFileView { public setDirty(location?:number) { if(this.semaphores.saving) return; //do not set dirty if saving - debug(`ExcalidrawView.setDirty location:${location}`); + DEBUGGING && debug(this.setDirty,`ExcalidrawView.setDirty, location:${location}`); this.semaphores.dirty = this.file?.path; this.diskIcon.querySelector("svg").addClass("excalidraw-dirty"); if(!this.semaphores.viewunload && this.toolsPanelRef?.current) { @@ -3438,9 +3442,9 @@ export default class ExcalidrawView extends TextFileView { && typeof event !== "undefined" && event !== null && DEVICE.isLinux - ) { - console.debug("Prevented what is likely middle mouse button paste.") - return false + ) { + DEBUGGING && debug(this.onPaste,`ExcalidrawView.onPaste, Prevented what is likely middle mouse button paste.`); + return false; }; if(data && data.text && hyperlinkIsImage(data.text)) { @@ -4603,7 +4607,7 @@ export default class ExcalidrawView extends TextFileView { } const json = response.json; - debug("ExcalidrawView.ttdDialog", response); + DEBUGGING && debug(ttdDialog, `ExcalidrawView.ttdDialog > onTextSubmit, openAI response`, response); if (json?.error) { log(response); diff --git a/src/MarkdownPostProcessor.ts b/src/MarkdownPostProcessor.ts index 42e72f4..995b31f 100644 --- a/src/MarkdownPostProcessor.ts +++ b/src/MarkdownPostProcessor.ts @@ -26,7 +26,7 @@ import { getParentOfClass, isObsidianThemeDark, getFileCSSClasses } from "./util import { linkClickModifierType } from "./utils/ModifierkeyHelper"; import { ImageKey, imageCache } from "./utils/ImageCache"; import { FILENAMEPARTS, PreviewImageType } from "./utils/UtilTypes"; -import { CustomMutationObserver, isDebugMode } from "./utils/DebugHelper"; +import { CustomMutationObserver, DEBUGGING } from "./utils/DebugHelper"; import { getExcalidrawFileForwardLinks } from "./utils/ExcalidrawViewUtils"; import { linkPrompt } from "./dialogs/Prompt"; @@ -714,7 +714,7 @@ const tmpObsidianWYSIWYG = async ( internalEmbedDiv.appendChild(imgDiv); }, 500); } - const observer = isDebugMode() + const observer = DEBUGGING ? new CustomMutationObserver(markdownObserverFn, "markdowPostProcessorObserverFn") : new MutationObserver(markdownObserverFn); observer.observe(internalEmbedDiv, { @@ -848,7 +848,7 @@ const legacyExcalidrawPopoverObserverFn: MutationCallback = async (m) => { node.appendChild(div); }; -export const legacyExcalidrawPopoverObserver = isDebugMode() +export const legacyExcalidrawPopoverObserver = DEBUGGING ? new CustomMutationObserver(legacyExcalidrawPopoverObserverFn, "legacyExcalidrawPopoverObserverFn") : new MutationObserver(legacyExcalidrawPopoverObserverFn); diff --git a/src/main.ts b/src/main.ts index cba68ac..396870e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -132,11 +132,10 @@ import { processLinkText } from "./utils/CustomEmbeddableUtils"; import { getEA } from "src"; import { ExcalidrawImperativeAPI } from "@zsviczian/excalidraw/types/excalidraw/types"; import { Mutable } from "@zsviczian/excalidraw/types/excalidraw/utility-types"; -import { CustomMutationObserver, debug, durationTreshold, log } from "./utils/DebugHelper"; -import { carveOutImage, carveOutPDF, createImageCropperFile, CROPPED_PREFIX } from "./utils/CarveOut"; +import { CustomMutationObserver, debug, durationTreshold, log, DEBUGGING, setDebugging } from "./utils/DebugHelper"; +import { carveOutImage, carveOutPDF, createImageCropperFile } from "./utils/CarveOut"; import { ExcalidrawConfig } from "./utils/ExcalidrawConfig"; import { EditorHandler } from "./CodeMirrorExtension/EditorHandler"; -import de from "./lang/locale/de"; declare const EXCALIDRAW_PACKAGES:string; declare const react:any; @@ -328,7 +327,7 @@ export default class ExcalidrawPlugin extends Plugin { const self = this; this.app.workspace.onLayoutReady(() => { - debug(`ExcalidrawPlugin.onload.app.workspace.onLayoutReady`); + DEBUGGING && debug(self.onload,"ExcalidrawPlugin.onload > app.workspace.onLayoutReady"); this.scriptEngine = new ScriptEngine(self); imageCache.initializeDB(self); }); @@ -337,8 +336,9 @@ export default class ExcalidrawPlugin extends Plugin { private setPropertyTypes() { const app = this.app; + const self = this; this.app.workspace.onLayoutReady(() => { - debug(`ExcalidrawPlugin.setPropertyTypes app.workspace.onLayoutReady`); + DEBUGGING && debug(self.setPropertyTypes, `ExcalidrawPlugin.setPropertyTypes > app.workspace.onLayoutReady`); Object.keys(FRONTMATTER_KEYS).forEach((key) => { if(FRONTMATTER_KEYS[key].depricated === true) return; const {name, type} = FRONTMATTER_KEYS[key]; @@ -348,8 +348,9 @@ export default class ExcalidrawPlugin extends Plugin { } public initializeFonts() { + const self = this; this.app.workspace.onLayoutReady(async () => { - debug(`ExcalidrawPlugin.initializeFonts app.workspace.onLayoutReady`); + DEBUGGING && debug(self.initializeFonts,`ExcalidrawPlugin.initializeFonts > app.workspace.onLayoutReady`); const font = await getFontDataURL( this.app, this.settings.experimantalFourthFont, @@ -404,7 +405,7 @@ export default class ExcalidrawPlugin extends Plugin { private switchToExcalidarwAfterLoad() { const self = this; this.app.workspace.onLayoutReady(() => { - debug(`ExcalidrawPlugin.switchToExcalidarwAfterLoad app.workspace.onLayoutReady`); + DEBUGGING && debug(self.switchToExcalidarwAfterLoad, `ExcalidrawPlugin.switchToExcalidarwAfterLoad > app.workspace.onLayoutReady`); let leaf: WorkspaceLeaf; for (leaf of this.app.workspace.getLeavesOfType("markdown")) { if ( leaf.view instanceof MarkdownView && self.isExcalidrawFile(leaf.view.file)) { @@ -638,7 +639,7 @@ export default class ExcalidrawPlugin extends Plugin { const self = this; this.app.workspace.onLayoutReady(() => { - debug(`ExcalidrawPlugin.addMarkdownPostProcessor app.workspace.onLayoutReady`); + DEBUGGING && debug(self.addMarkdownPostProcessor, `ExcalidrawPlugin.addMarkdownPostProcessor > app.workspace.onLayoutReady`); // internal-link quick preview self.registerEvent(self.app.workspace.on("hover-link", hoverEvent)); @@ -687,7 +688,7 @@ export default class ExcalidrawPlugin extends Plugin { }); }; - this.themeObserver = this.settings.isDebugMode + this.themeObserver = DEBUGGING ? new CustomMutationObserver(themeObserverFn, "themeObserver") : new MutationObserver(themeObserverFn); @@ -753,13 +754,13 @@ export default class ExcalidrawPlugin extends Plugin { }); }; - this.fileExplorerObserver = this.settings.isDebugMode + this.fileExplorerObserver = DEBUGGING ? new CustomMutationObserver(fileExplorerObserverFn, "fileExplorerObserver") : new MutationObserver(fileExplorerObserverFn); const self = this; this.app.workspace.onLayoutReady(() => { - debug(`ExcalidrawPlugin.experimentalFileTypeDisplay app.workspace.onLayoutReady`); + DEBUGGING && debug(self.experimentalFileTypeDisplay, `ExcalidrawPlugin.experimentalFileTypeDisplay > app.workspace.onLayoutReady`); document.querySelectorAll(".nav-file-title").forEach(insertFiletype); //apply filetype to files already displayed const container = document.querySelector(".nav-files-container"); if (container) { @@ -2473,7 +2474,7 @@ export default class ExcalidrawPlugin extends Plugin { } const self = this; this.app.workspace.onLayoutReady(async () => { - debug(`ExcalidrawPlugin.runStartupScript app.workspace.onLayoutReady: ${self.settings?.startupScriptPath}`); + DEBUGGING && debug(self.runStartupScript, `ExcalidrawPlugin.runStartupScript > app.workspace.onLayoutReady, scriptPath:${self.settings?.startupScriptPath}`); const path = self.settings.startupScriptPath.endsWith(".md") ? self.settings.startupScriptPath : `${self.settings.startupScriptPath}.md`; @@ -2496,7 +2497,7 @@ export default class ExcalidrawPlugin extends Plugin { private registerEventListeners() { const self: ExcalidrawPlugin = this; this.app.workspace.onLayoutReady(async () => { - debug("ExcalidrawPlugin.registerEventListeners app.workspace.onLayoutReady"); + DEBUGGING && debug(self.registerEventListeners,`ExcalidrawPlugin.registerEventListeners > app.workspace.onLayoutReady`); const onPasteHandler = ( evt: ClipboardEvent, editor: Editor, @@ -2885,14 +2886,14 @@ export default class ExcalidrawPlugin extends Plugin { }; if (leftWorkspaceDrawer) { - this.workspaceDrawerLeftObserver = this.settings.isDebugMode + this.workspaceDrawerLeftObserver = DEBUGGING ? new CustomMutationObserver(action, "slidingDrawerLeftObserver") : new MutationObserver(action); this.workspaceDrawerLeftObserver.observe(leftWorkspaceDrawer, options); } if (rightWorkspaceDrawer) { - this.workspaceDrawerRightObserver = this.settings.isDebugMode + this.workspaceDrawerRightObserver = DEBUGGING ? new CustomMutationObserver(action, "slidingDrawerRightObserver") : new MutationObserver(action); this.workspaceDrawerRightObserver.observe( @@ -2926,7 +2927,7 @@ export default class ExcalidrawPlugin extends Plugin { this.activeExcalidrawView.save(); }; - this.modalContainerObserver = this.settings.isDebugMode + this.modalContainerObserver = DEBUGGING ? new CustomMutationObserver(modalContainerObserverFn, "modalContainerObserver") : new MutationObserver(modalContainerObserverFn); this.activeViewDoc = this.activeExcalidrawView.ownerDocument; @@ -3100,8 +3101,9 @@ export default class ExcalidrawPlugin extends Plugin { if(opts.applyLefthandedMode) setLeftHandedMode(this.settings.isLeftHanded); if(opts.reEnableAutosave) this.settings.autosave = true; this.settings.autosaveInterval = DEVICE.isMobile - ? this.settings.autosaveIntervalMobile - : this.settings.autosaveIntervalDesktop; + ? this.settings.autosaveIntervalMobile + : this.settings.autosaveIntervalDesktop; + setDebugging(this.settings.isDebugMode); } async saveSettings() { diff --git a/src/settings.ts b/src/settings.ts index e9430b5..8e6ac24 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -35,6 +35,7 @@ import { ModifierKeySet, ModifierSetType } from "./utils/ModifierkeyHelper"; import { ModifierKeySettingsComponent } from "./dialogs/ModifierKeySettings"; import { ANNOTATED_PREFIX, CROPPED_PREFIX } from "./utils/CarveOut"; import { EDITOR_FADEOUT } from "./CodeMirrorExtension/EditorHandler"; +import { setDebugging } from "./utils/DebugHelper"; export interface ExcalidrawSettings { folder: string; @@ -2504,6 +2505,7 @@ export class ExcalidrawSettingTab extends PluginSettingTab { .setValue(this.plugin.settings.isDebugMode) .onChange((value) => { this.plugin.settings.isDebugMode = value; + setDebugging(value); this.applySettingsUpdate(); }), ); diff --git a/src/utils/CanvasNodeFactory.ts b/src/utils/CanvasNodeFactory.ts index 7ed8336..0279c5a 100644 --- a/src/utils/CanvasNodeFactory.ts +++ b/src/utils/CanvasNodeFactory.ts @@ -11,7 +11,7 @@ container.appendChild(node.contentEl) import { TFile, WorkspaceLeaf, WorkspaceSplit } from "obsidian"; import ExcalidrawView from "src/ExcalidrawView"; import { getContainerForDocument, ConstructableWorkspaceSplit, isObsidianThemeDark } from "./ObsidianUtils"; -import { CustomMutationObserver, isDebugMode } from "./DebugHelper"; +import { CustomMutationObserver, DEBUGGING } from "./DebugHelper"; declare module "obsidian" { interface Workspace { @@ -110,7 +110,7 @@ export class CanvasNodeFactory { } } }; - const observer = isDebugMode() + const observer = DEBUGGING ? new CustomMutationObserver(nodeObserverFn, "CanvasNodeFactory") : new MutationObserver(nodeObserverFn); diff --git a/src/utils/DebugHelper.ts b/src/utils/DebugHelper.ts index 082c78e..600a176 100644 --- a/src/utils/DebugHelper.ts +++ b/src/utils/DebugHelper.ts @@ -1,14 +1,14 @@ -import { EXCALIDRAW_PLUGIN } from "src/constants/constants"; - - export const durationTreshold = 0; //0.05; //ms -export const isDebugMode = () => EXCALIDRAW_PLUGIN && EXCALIDRAW_PLUGIN.settings?.isDebugMode; + +export function setDebugging(value: boolean) { + DEBUGGING = value; +} + +export let DEBUGGING = false; export const log = console.log.bind(window.console); -export const debug = (...messages: unknown[]) => { - if(isDebugMode()) { - console.log(...messages); - } +export const debug = (fn: Function, fnName: string, ...messages: unknown[]) => { + console.log(fnName,fn,...messages); }; export class CustomMutationObserver { @@ -29,7 +29,7 @@ export class CustomMutationObserver { const endTime = performance.now(); // Get end time const executionTime = endTime - startTime; if (executionTime > durationTreshold) { - console.log(`Excalidraw ${this.name} MutationObserver callback took ${executionTime}ms to execute`); + console.log(`Excalidraw ${this.name} MutationObserver callback took ${executionTime}ms to execute`, observer); } }; diff --git a/src/utils/StylesManager.ts b/src/utils/StylesManager.ts index 4151f01..36b2267 100644 --- a/src/utils/StylesManager.ts +++ b/src/utils/StylesManager.ts @@ -1,7 +1,7 @@ import { WorkspaceWindow } from "obsidian"; import ExcalidrawPlugin from "src/main"; import { getAllWindowDocuments } from "./ObsidianUtils"; -import { debug } from "./DebugHelper"; +import { DEBUGGING, debug } from "./DebugHelper"; const STYLE_VARIABLES = ["--background-modifier-cover","--background-primary-alt","--background-secondary","--background-secondary-alt","--background-modifier-border","--text-normal","--text-muted","--text-accent","--text-accent-hover","--text-faint","--text-highlight-bg","--text-highlight-bg-active","--text-selection","--interactive-normal","--interactive-hover","--interactive-accent","--interactive-accent-hover","--scrollbar-bg","--scrollbar-thumb-bg","--scrollbar-active-thumb-bg"]; const EXCALIDRAW_CONTAINER_CLASS = "excalidraw__embeddable__outer"; @@ -12,12 +12,11 @@ export class StylesManager { private styleDark: string; private plugin: ExcalidrawPlugin; - - constructor(plugin: ExcalidrawPlugin) { this.plugin = plugin; + const self = this; plugin.app.workspace.onLayoutReady(async () => { - debug("StylesManager.constructor app.workspace.onLayoutReady"); + DEBUGGING && debug(undefined, "StylesManager.constructor > app.workspace.onLayoutReady", self); await this.harvestStyles(); getAllWindowDocuments(plugin.app).forEach(doc => { this.copyPropertiesToTheme(doc);