From bcd63ad7febc481cf208c3ca2dd8b63301e4e49d Mon Sep 17 00:00:00 2001 From: zsviczian Date: Mon, 22 Dec 2025 22:15:32 +0100 Subject: [PATCH] fix isSolidArrow overwritten in centerText, and fix grouping of non-autolayed out element --- ea-scripts/Mindmap Builder.md | 19 +++++++++++++++---- ea-scripts/Shade Master.md | 2 ++ src/shared/Dialogs/Prompt.ts | 6 +----- styles.css | 8 ++++++++ 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/ea-scripts/Mindmap Builder.md b/ea-scripts/Mindmap Builder.md index 882d24bf..30fabd56 100644 --- a/ea-scripts/Mindmap Builder.md +++ b/ea-scripts/Mindmap Builder.md @@ -142,6 +142,8 @@ const INSTRUCTIONS = ` - **Coloring**: First level branches get unique colors (Multicolor mode). Descendants inherit parent's color. - **Grouping**: Enabling "Group Branches" recursively groups sub-trees from leaves up to the first level. - **Copy/Paste**: Export/Import indented Markdown lists. + +😍 If you find this script helpful, please [buy me a coffee ☕](https://ko-fi.com/zsolt). `; // --------------------------------------------------------------------------- @@ -603,16 +605,25 @@ const addNode = async (text, follow = false, skipFinalLayout = false) => { const allEls = ea.getViewElements(); const node = allEls.find(el => el.id === newNodeId); const arrow = allEls.find(a => a.type === "arrow" && a.customData?.isBranch && a.endBinding?.elementId === newNodeId); + + ea.copyViewElementsToEAforEditing(groupBranches ? allEls : (arrow ? [arrow] : [])); + if (arrow) { - ea.copyViewElementsToEAforEditing([arrow]); const eaA = ea.getElement(arrow.id); const sX = parent.x + parent.width/2, sY = parent.y + parent.height/2; const eX = node.x + node.width/2, eY = node.y + node.height/2; eaA.x = sX; eaA.y = sY; eaA.points = [[0, 0], [eX - sX, eY - sY]]; - await ea.addElementsToView(false, false, true, true); - ea.clear(); } + + if (groupBranches) { + ea.getElements().forEach(el => { el.groupIds = []; }); + const l1Nodes = getChildrenNodes(rootId, allEls); + l1Nodes.forEach(l1 => applyRecursiveGrouping(l1.id, allEls)); + } + + await ea.addElementsToView(false, false, true, true); + ea.clear(); } const finalNode = ea.getViewElements().find(el => el.id === newNodeId); @@ -1007,7 +1018,7 @@ modal.onOpen = () => { .addToggle(t => t .setValue(centerText) .onChange(v => { - isSolidArrow = v; + centerText = v; ea.setScriptSettingValue(K_CENTERTEXT, { value: v }); dirty = true; }) diff --git a/ea-scripts/Shade Master.md b/ea-scripts/Shade Master.md index 6481432f..6f5bf1c3 100644 --- a/ea-scripts/Shade Master.md +++ b/ea-scripts/Shade Master.md @@ -23,6 +23,8 @@ const HELP_TEXT = ` - Additionally if the same color is used as fill and stroke the color can only be mapped once - This is an experimental script - contributions welcome on GitHub via PRs +😍 If you find this script helpful, please [buy me a coffee ☕](https://ko-fi.com/zsolt). + `; diff --git a/src/shared/Dialogs/Prompt.ts b/src/shared/Dialogs/Prompt.ts index c0508841..578ffd72 100644 --- a/src/shared/Dialogs/Prompt.ts +++ b/src/shared/Dialogs/Prompt.ts @@ -100,6 +100,7 @@ export class LaTexPrompt extends Modal { ) { super(app); this.titleEl.setText(this.prompt_text); + this.contentEl.addClass("excalidraw-LatexPrompt"); this.latexsSuitePlugin = app.plugins.plugins["obsidian-latex-suite"]; const mainContentContainer: HTMLDivElement = this.contentEl.createDiv(); this.display(default_value, mainContentContainer); @@ -156,11 +157,6 @@ export class LaTexPrompt extends Modal { }); } - const cmContent = this.editorView.dom.querySelector('.cm-content') as HTMLElement; - if (cmContent) { - cmContent.style.caretColor = 'var(--caret-color)'; - } - const buttonBarContainer: HTMLDivElement = container.createDiv(); buttonBarContainer.addClass(`excalidraw-prompt-buttonbar-bottom`); const actionButtonContainer: HTMLDivElement = buttonBarContainer.createDiv(); diff --git a/styles.css b/styles.css index 4fb53953..2966bc2f 100644 --- a/styles.css +++ b/styles.css @@ -926,3 +926,11 @@ textarea.excalidraw-wysiwyg, .excalidraw input { .excalidraw .ToolIcon.ToolIcon__penMode { height:fit-content } + +.excalidraw-LatexPrompt .cm-content { + caret-color: var(--caret-color); +} + +.excalidraw-LatexPrompt .cm-editor { + margin-top: 90px; +} \ No newline at end of file