2.18.3, 0.18.0-63

This commit is contained in:
zsviczian committed 2025-12-23 12:36:40 +01:00
1 parent bcd63ad7fe
commit 296ac84f08
11 files changed
+1616 -580

No files matched your search

@@ -341,6 +341,24 @@ export declare class ExcalidrawAutomate {
* @returns {Mutable<ExcalidrawElement>} The element with the specified ID.
*/
getElement(id: string): Mutable<ExcalidrawElement>;
/**
* Returns an object describing the bound text element.
* If a text element is provided:
* - returns { eaElement } if the element is in ea.elementsDict
* - else (if searchInView is true) returns { sceneElement } if found in the targetView scene
* If a container element is provided, searches for the bound text element:
* - returns { eaElement } if found in ea.elementsDict
* - else (if searchInView is true) returns { sceneElement } if found in the targetView scene
* If not found, returns {}.
* Does not add the text element to elementsDict.
* @param element
* @param searchInView - If true, searches in the targetView elements if not found in elementsDict.
* @returns Object containing either eaElement or sceneElement or empty if not found.
*/
getBoundTextElement(element: ExcalidrawElement, searchInView?: boolean): {
eaElement?: Mutable<ExcalidrawTextElement>;
sceneElement?: ExcalidrawTextElement;
};
/**
* Creates a drawing and saves it to the specified filename.
* @param {Object} [params] - Parameters for creating the drawing.
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+132 -60
View File
@@ -2,6 +2,8 @@
# Mind Map Builder: Technical Specification & User Guide
![](https://youtu.be/dZguonMP2KU)
## 1. Overview
**Mind Map Builder** transforms the Obsidian-Excalidraw canvas into a rapid brainstorming environment, allowing users to build complex, structured, and visually organized mind maps using primarily keyboard shortcuts.
@@ -144,6 +146,8 @@ const INSTRUCTIONS = `
- **Copy/Paste**: Export/Import indented Markdown lists.
😍 If you find this script helpful, please [buy me a coffee ☕](https://ko-fi.com/zsolt).
<a href="https://www.youtube.com/watch?v=dZguonMP2KU" target="_blank"><img src ="https://i.ytimg.com/vi/dZguonMP2KU/maxresdefault.jpg" style="max-width:560px; width:100%"></a>
`;
// ---------------------------------------------------------------------------
@@ -647,34 +651,76 @@ const getTextFromNode = (all, node) => {
return textEl ? textEl.originalText : "";
};
const copyMapAsText = async () => {
const copyMapAsText = async (cut = false) => {
const sel = ea.getViewSelectedElement();
if (!sel) return;
if (!sel) {
new Notice("Select a node to copy.");
return;
}
const all = ea.getViewElements();
const info = getHierarchy(sel, all);
const rootNode = all.find(e => e.id === info.rootId);
const isRootSelected = info.rootId === sel.id;
if (isRootSelected) {
cut = false;
}
const elementsToDelete = [];
const buildList = (nodeId, depth = 0) => {
const node = all.find(e => e.id === nodeId);
if (!node) return "";
if (cut) {
elementsToDelete.push(node);
node.boundElements?.forEach(be => {
const boundEl = all.find(e => e.id === be.id);
if (boundEl) elementsToDelete.push(boundEl);
});
}
const children = getChildrenNodes(nodeId, all);
sortChildrenStable(children);
let str = "";
const text = getTextFromNode(all, node);
if (depth === 0) {
if (depth === 0 && isRootSelected) {
str += `# ${text}\n\n`;
} else {
str += `${" ".repeat(depth - (isRootSelected ? 1 : 0))}- ${text}\n`;
}
else {
str += `${" ".repeat(depth - 1)}- ${text}\n`;
}
children.forEach(c => {
if (cut) {
const arrow = all.find(a =>
a.type === "arrow" &&
a.customData?.isBranch &&
a.startBinding?.elementId === nodeId &&
a.endBinding?.elementId === c.id
);
if (arrow) elementsToDelete.push(arrow);
}
str += buildList(c.id, depth + 1);
});
return str;
};
const md = buildList(rootNode.id);
const md = buildList(sel.id);
await navigator.clipboard.writeText(md);
new Notice("Mindmap copied to clipboard.");
if (cut) {
const incomingArrow = all.find(a =>
a.type === "arrow" &&
a.customData?.isBranch &&
a.endBinding?.elementId === sel.id
);
if (incomingArrow) elementsToDelete.push(incomingArrow);
ea.deleteViewElements(elementsToDelete);
new Notice("Branch cut to clipboard.");
} else {
new Notice("Branch copied as bullet list.");
}
};
const pasteListToMap = async () => {
@@ -685,13 +731,23 @@ const pasteListToMap = async () => {
let parsed = [];
let rootTextFromHeader = null;
if (lines.length === 0 ||
!lines[0].match(/^(#+\s|\s*(?:-|\*|\d+)\s)/) ||
!lines.every((line,idx) => (idx === 0) || line.match(/^\s*(?:-|\*|\d+)\s/))
) {
new Notice("Paste aborted. Cliboard is not a bulleted list");
return;
}
const delta = lines[0].match(/^#+\s/) ? 1 : 0;
lines.forEach(line => {
if (line.startsWith("# ")) {
rootTextFromHeader = line.substring(2).trim();
if (line.match(/^#+\s/)) {
parsed.push({indent: 0, text: line.substring(2).trim()});
} else {
const match = line.match(/^(\s*)(?:-|\*|\d+\.)\s+(.*)$/);
if (match) {
parsed.push({ indent: match[1].length, text: match[2].trim() });
parsed.push({ indent: delta + match[1].length, text: match[2].trim() });
}
}
});
@@ -705,17 +761,13 @@ const pasteListToMap = async () => {
let currentParent;
if (!sel) {
if (rootTextFromHeader) {
currentParent = await addNode(rootTextFromHeader, true, true);
const minIndent = Math.min(...parsed.map(p => p.indent));
const topLevelItems = parsed.filter(p => p.indent === minIndent);
if (topLevelItems.length === 1) {
currentParent = await addNode(topLevelItems[0].text, true, true);
parsed.shift();
} else {
const minIndent = Math.min(...parsed.map(p => p.indent));
const topLevelItems = parsed.filter(p => p.indent === minIndent);
if (topLevelItems.length === 1) {
currentParent = await addNode(topLevelItems[0].text, true, true);
parsed.shift();
} else {
currentParent = await addNode("Mindmap Builder Paste", true, true);
}
currentParent = await addNode("Mindmap Builder Paste", true, true);
}
} else {
currentParent = sel;
@@ -786,9 +838,18 @@ const navigateMap = (key) => {
}
};
const setButtonDisabled = (btn, disabled) => {
if(!btn) return;
btn.disabled = disabled;
if(!btn.extraSettingsEl) return;
btn.extraSettingsEl.style.opacity = disabled ? "0.5" : "";
btn.extraSettingsEl.style.pointerEvents = disabled ? "none" : "";
}
const modal = new ea.FloatingModal(app);
modal.onOpen = () => {
const { contentEl, titleEl, modalEl, headerEl } = modal;
modalEl.style.maxHeight = "70vh";
ensureNodeSelected();
contentEl.empty();
titleEl.setText("Mind Map Builder");
@@ -800,8 +861,9 @@ modal.onOpen = () => {
const inputRow = new ea.obsidian.Setting(contentEl).setName("Node Text");
const bodyContainer = contentEl.createDiv();
bodyContainer.style.width = "100%"
let strategyDropdown, autoLayoutToggle, pinBtn;
let strategyDropdown, autoLayoutToggle, pinBtn, refreshBtn, cutBtn, copyBtn;
const updateStatus = () => {
const all = ea.getViewElements();
@@ -810,10 +872,18 @@ modal.onOpen = () => {
if (sel) {
const isPinned = sel.customData?.isPinned === true;
pinBtn?.setIcon(isPinned ? "pin" : "pin-off");
pinBtn?.setTooltip(`${isPinned ? "This element is pinned. Click to unpin" : "This element is not pinned. Click to pin"} the location of the selected element (${isMac ? "CMD" : "CTRL"}+SHIFT+Enter)`);
if(pinBtn) {
pinBtn.setIcon(isPinned ? "pin" : "pin-off");
pinBtn.setTooltip(`${isPinned ? "This element is pinned. Click to unpin" : "This element is not pinned. Click to pin"} the location of the selected element (${isMac ? "CMD" : "CTRL"}+SHIFT+Enter)`);
setButtonDisabled(pinBtn, false);
}
setButtonDisabled(refreshBtn, false);
const info = getHierarchy(sel, all);
setButtonDisabled(cutBtn,info.rootId === sel.id);
setButtonDisabled(copyBtn, false);
const root = all.find(e => e.id === info.rootId);
const mapStrategy = root.customData?.growthMode;
if (mapStrategy && mapStrategy !== currentModalGrowthMode) {
@@ -826,7 +896,11 @@ modal.onOpen = () => {
autoLayoutToggle.setValue(mapLayoutPref);
}
} else {
pinBtn?.setIcon("pin-off");
if (pinBtn) pinBtn.setIcon("pin-off");
setButtonDisabled(pinBtn, true);
setButtonDisabled(refreshBtn, true);
setButtonDisabled(copyBtn, true);
setButtonDisabled(cutBtn, true);
}
};
@@ -852,10 +926,11 @@ modal.onOpen = () => {
});
});
inputRow.addExtraButton(btn => btn
.setIcon("refresh-ccw")
.setTooltip("Force auto rearrange map. Will move all elements except for those that are pinned.")
.onClick(async () => {
inputRow.addExtraButton(btn => {
refreshBtn = btn;
btn.setIcon("refresh-ccw");
btn.setTooltip("Force auto rearrange map. Will move all elements except for those that are pinned.");
btn.onClick(async () => {
const sel = ea.getViewSelectedElement();
if (sel) {
const info = getHierarchy(sel, ea.getViewElements());
@@ -864,7 +939,7 @@ modal.onOpen = () => {
ea.clear();
}
})
);
});
inputRow.addExtraButton(btn => {
const updateIcon = () => {
@@ -919,6 +994,31 @@ modal.onOpen = () => {
inputRow.controlEl.style.width = "100%";
inputRow.controlEl.style.marginTop = "8px";
const btnGrid = bodyContainer.createDiv({ attr: {
style: "display: grid; grid-template-columns: repeat(5, 1fr); gap:6px;"
}});
btnGrid.createEl("button", { text: "Add Sibling", cls: "mod-cta", attr: {style: "padding: 2px;"}})
.onclick = async () => {
await addNode(inputEl.value, false);
inputEl.value = "";
inputEl.focus();
updateStatus();
};
btnGrid.createEl("button", { text: "Add+Follow", attr: {style: "padding: 2px;"} })
.onclick = async () => {
await addNode(inputEl.value, true);
inputEl.value = "";
inputEl.focus();
updateStatus();
};
copyBtn = btnGrid.createEl("button", { text: "Copy", attr: {style: "padding: 2px;"} });
copyBtn.onclick = copyMapAsText;
cutBtn = btnGrid.createEl("button", { text: "Cut", attr: {style: "padding: 2px;"} });
cutBtn.onclick = () => copyMapAsText(true);
btnGrid.createEl("button", { text: "Paste", attr: {style: "padding: 2px;"} })
.onclick = pasteListToMap;
new ea.obsidian.Setting(bodyContainer)
.setName("Growth Strategy")
.addDropdown(d => {
@@ -1058,34 +1158,6 @@ modal.onOpen = () => {
})
);
const btnGrid = bodyContainer.createDiv({ attr: {
style: "display: grid; grid-template-columns: repeat(5, 1fr); gap:6px; margin-top:20px;"
}});
btnGrid.createEl("button", { text: "Sibling", cls: "mod-cta" })
.onclick = async () => {
await addNode(inputEl.value, false);
inputEl.value = "";
inputEl.focus();
updateStatus();
};
btnGrid.createEl("button", { text: "Follow" })
.onclick = async () => {
await addNode(inputEl.value, true);
inputEl.value = "";
inputEl.focus();
updateStatus();
};
btnGrid.createEl("button", { text: "Close" })
.onclick = async () => {
await addNode(inputEl.value, false);
modal.close();
};
btnGrid.createEl("button", { text: "Copy" })
.onclick = copyMapAsText;
btnGrid.createEl("button", { text: "Paste" })
.onclick = pasteListToMap;
const keyHandler = async (e) => {
if (ownerWindow.document.activeElement !== inputEl) return;
+1 -57
View File
@@ -326,7 +326,7 @@ function slider(contentEl, action, min, max, step, invert) {
function showModal() {
let debounceColorPicker = true;
const modal = new ea.obsidian.Modal(app);
const modal = new ea.FloatingModal(app);
let dirty = false;
modal.onOpen = async () => {
@@ -564,8 +564,6 @@ function showModal() {
.setButtonText("Close")
.setCta(true)
.onClick(() => modal.close()));
makeModalDraggable(modalEl);
const maxHeight = Math.round(height * 0.6);
const maxWidth = Math.round(width * 0.9);
@@ -586,60 +584,6 @@ function showModal() {
modal.open();
}
/**
* Add draggable functionality to the modal element.
* @param {HTMLElement} modalEl - The modal element to make draggable.
*/
function makeModalDraggable(modalEl) {
let isDragging = false;
let startX, startY, initialX, initialY;
const header = modalEl.querySelector('.modal-titlebar') || modalEl; // Default to modalEl if no titlebar
header.style.cursor = 'move';
const onPointerDown = (e) => {
// Ensure the event target isn't an interactive element like slider, button, or input
if (e.target.tagName === 'INPUT' || e.target.tagName === 'BUTTON') return;
isDragging = true;
startX = e.clientX;
startY = e.clientY;
const rect = modalEl.getBoundingClientRect();
initialX = rect.left;
initialY = rect.top;
modalEl.style.position = 'absolute';
modalEl.style.margin = '0';
modalEl.style.left = `${initialX}px`;
modalEl.style.top = `${initialY}px`;
};
const onPointerMove = (e) => {
if (!isDragging) return;
const dx = e.clientX - startX;
const dy = e.clientY - startY;
modalEl.style.left = `${initialX + dx}px`;
modalEl.style.top = `${initialY + dy}px`;
};
const onPointerUp = () => {
isDragging = false;
};
header.addEventListener('pointerdown', onPointerDown);
document.addEventListener('pointermove', onPointerMove);
document.addEventListener('pointerup', onPointerUp);
// Clean up event listeners on modal close
modalEl.addEventListener('remove', () => {
header.removeEventListener('pointerdown', onPointerDown);
document.removeEventListener('pointermove', onPointerMove);
document.removeEventListener('pointerup', onPointerUp);
});
}
function executeChange(isDecrease, step, action) {
const modifyStroke = settings[STROKE].value;
const modifyBackground = settings[BACKGROUND].value;
+1 -1
View File
@@ -1 +1 @@
[{"fname":"Mindmap connector.md","mtime":1658686599427},{"fname":"Mindmap connector.svg","mtime":1658686599427},{"fname":"Add Connector Point.md","mtime":1735420748564},{"fname":"Add Connector Point.svg","mtime":1645944722000},{"fname":"Add Link to Existing File and Open.md","mtime":1647807918345},{"fname":"Add Link to Existing File and Open.svg","mtime":1645964261000},{"fname":"Add Link to New Page and Open.md","mtime":1654168862138},{"fname":"Add Link to New Page and Open.svg","mtime":1645960639000},{"fname":"Add Next Step in Process.md","mtime":1688304760357},{"fname":"Add Next Step in Process.svg","mtime":1645960639000},{"fname":"Box Each Selected Groups.md","mtime":1645305706000},{"fname":"Box Each Selected Groups.svg","mtime":1645967510000},{"fname":"Box Selected Elements.md","mtime":1645305706000},{"fname":"Box Selected Elements.svg","mtime":1645960639000},{"fname":"Change shape of selected elements.md","mtime":1652701169236},{"fname":"Change shape of selected elements.svg","mtime":1645960775000},{"fname":"Connect elements.md","mtime":1645305706000},{"fname":"Connect elements.svg","mtime":1645960639000},{"fname":"Convert freedraw to line.md","mtime":1645305706000},{"fname":"Convert freedraw to line.svg","mtime":1645960639000},{"fname":"Convert selected text elements to sticky notes.md","mtime":1670169501383},{"fname":"Convert selected text elements to sticky notes.svg","mtime":1645960639000},{"fname":"Convert text to link with folder and alias.md","mtime":1641639819000},{"fname":"Convert text to link with folder and alias.svg","mtime":1645960639000},{"fname":"Copy Selected Element Styles to Global.md","mtime":1642232088000},{"fname":"Copy Selected Element Styles to Global.svg","mtime":1645960639000},{"fname":"Create new markdown file and embed into active drawing.md","mtime":1640866935000},{"fname":"Create new markdown file and embed into active drawing.svg","mtime":1645960639000},{"fname":"Darken background color.md","mtime":1663059051059},{"fname":"Darken background color.svg","mtime":1645960639000},{"fname":"Elbow connectors.md","mtime":1671126911490},{"fname":"Elbow connectors.svg","mtime":1645960639000},{"fname":"Expand rectangles horizontally keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles horizontally keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles horizontally.md","mtime":1644950235000},{"fname":"Expand rectangles horizontally.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles vertically keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically.md","mtime":1658686599427},{"fname":"Expand rectangles vertically.svg","mtime":1645967510000},{"fname":"Fixed horizontal distance between centers.md","mtime":1646743234000},{"fname":"Fixed horizontal distance between centers.svg","mtime":1645960639000},{"fname":"Fixed inner distance.md","mtime":1646743234000},{"fname":"Fixed inner distance.svg","mtime":1645960639000},{"fname":"Fixed spacing.md","mtime":1646743234000},{"fname":"Fixed spacing.svg","mtime":1645967510000},{"fname":"Fixed vertical distance between centers.md","mtime":1646743234000},{"fname":"Fixed vertical distance between centers.svg","mtime":1645967510000},{"fname":"Fixed vertical distance.md","mtime":1646743234000},{"fname":"Fixed vertical distance.svg","mtime":1645967510000},{"fname":"Lighten background color.md","mtime":1663059051059},{"fname":"Lighten background color.svg","mtime":1645959546000},{"fname":"Modify background color opacity.md","mtime":1644924415000},{"fname":"Modify background color opacity.svg","mtime":1645944722000},{"fname":"Normalize Selected Arrows.md","mtime":1670403743278},{"fname":"Normalize Selected Arrows.svg","mtime":1645960639000},{"fname":"Organic Line.md","mtime":1672920172531},{"fname":"Organic Line.svg","mtime":1645964261000},{"fname":"Organic Line Legacy.md","mtime":1690607372668},{"fname":"Organic Line Legacy.svg","mtime":1690607372668},{"fname":"README.md","mtime":1645175700000},{"fname":"Repeat Elements.md","mtime":1663059051059},{"fname":"Repeat Elements.svg","mtime":1645960639000},{"fname":"Reverse arrows.md","mtime":1645305706000},{"fname":"Reverse arrows.svg","mtime":1645960639000},{"fname":"Scribble Helper.md","mtime":1747585400113},{"fname":"Scribble Helper.svg","mtime":1645944722000},{"fname":"Select Elements of Type.md","mtime":1643464321000},{"fname":"Select Elements of Type.svg","mtime":1645960639000},{"fname":"Set Dimensions.md","mtime":1645305706000},{"fname":"Set Dimensions.svg","mtime":1645944722000},{"fname":"Set Font Family.md","mtime":1645305706000},{"fname":"Set Font Family.svg","mtime":1645944722000},{"fname":"Set Grid.md","mtime":1693725826368},{"fname":"Set Grid.svg","mtime":1645960639000},{"fname":"Set Link Alias.md","mtime":1645305706000},{"fname":"Set Link Alias.svg","mtime":1645960639000},{"fname":"Set Stroke Width of Selected Elements.md","mtime":1748189277Line truncated
[{"fname":"Mindmap connector.md","mtime":1658686599427},{"fname":"Mindmap connector.svg","mtime":1658686599427},{"fname":"Add Connector Point.md","mtime":1735420748564},{"fname":"Add Connector Point.svg","mtime":1645944722000},{"fname":"Add Link to Existing File and Open.md","mtime":1647807918345},{"fname":"Add Link to Existing File and Open.svg","mtime":1645964261000},{"fname":"Add Link to New Page and Open.md","mtime":1654168862138},{"fname":"Add Link to New Page and Open.svg","mtime":1645960639000},{"fname":"Add Next Step in Process.md","mtime":1688304760357},{"fname":"Add Next Step in Process.svg","mtime":1645960639000},{"fname":"Box Each Selected Groups.md","mtime":1645305706000},{"fname":"Box Each Selected Groups.svg","mtime":1645967510000},{"fname":"Box Selected Elements.md","mtime":1645305706000},{"fname":"Box Selected Elements.svg","mtime":1645960639000},{"fname":"Change shape of selected elements.md","mtime":1652701169236},{"fname":"Change shape of selected elements.svg","mtime":1645960775000},{"fname":"Connect elements.md","mtime":1645305706000},{"fname":"Connect elements.svg","mtime":1645960639000},{"fname":"Convert freedraw to line.md","mtime":1645305706000},{"fname":"Convert freedraw to line.svg","mtime":1645960639000},{"fname":"Convert selected text elements to sticky notes.md","mtime":1670169501383},{"fname":"Convert selected text elements to sticky notes.svg","mtime":1645960639000},{"fname":"Convert text to link with folder and alias.md","mtime":1641639819000},{"fname":"Convert text to link with folder and alias.svg","mtime":1645960639000},{"fname":"Copy Selected Element Styles to Global.md","mtime":1642232088000},{"fname":"Copy Selected Element Styles to Global.svg","mtime":1645960639000},{"fname":"Create new markdown file and embed into active drawing.md","mtime":1640866935000},{"fname":"Create new markdown file and embed into active drawing.svg","mtime":1645960639000},{"fname":"Darken background color.md","mtime":1663059051059},{"fname":"Darken background color.svg","mtime":1645960639000},{"fname":"Elbow connectors.md","mtime":1671126911490},{"fname":"Elbow connectors.svg","mtime":1645960639000},{"fname":"Expand rectangles horizontally keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles horizontally keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles horizontally.md","mtime":1644950235000},{"fname":"Expand rectangles horizontally.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically keep text centered.md","mtime":1646563692000},{"fname":"Expand rectangles vertically keep text centered.svg","mtime":1645967510000},{"fname":"Expand rectangles vertically.md","mtime":1658686599427},{"fname":"Expand rectangles vertically.svg","mtime":1645967510000},{"fname":"Fixed horizontal distance between centers.md","mtime":1646743234000},{"fname":"Fixed horizontal distance between centers.svg","mtime":1645960639000},{"fname":"Fixed inner distance.md","mtime":1646743234000},{"fname":"Fixed inner distance.svg","mtime":1645960639000},{"fname":"Fixed spacing.md","mtime":1646743234000},{"fname":"Fixed spacing.svg","mtime":1645967510000},{"fname":"Fixed vertical distance between centers.md","mtime":1646743234000},{"fname":"Fixed vertical distance between centers.svg","mtime":1645967510000},{"fname":"Fixed vertical distance.md","mtime":1646743234000},{"fname":"Fixed vertical distance.svg","mtime":1645967510000},{"fname":"Lighten background color.md","mtime":1663059051059},{"fname":"Lighten background color.svg","mtime":1645959546000},{"fname":"Modify background color opacity.md","mtime":1644924415000},{"fname":"Modify background color opacity.svg","mtime":1645944722000},{"fname":"Normalize Selected Arrows.md","mtime":1670403743278},{"fname":"Normalize Selected Arrows.svg","mtime":1645960639000},{"fname":"Organic Line.md","mtime":1672920172531},{"fname":"Organic Line.svg","mtime":1645964261000},{"fname":"Organic Line Legacy.md","mtime":1690607372668},{"fname":"Organic Line Legacy.svg","mtime":1690607372668},{"fname":"README.md","mtime":1645175700000},{"fname":"Repeat Elements.md","mtime":1663059051059},{"fname":"Repeat Elements.svg","mtime":1645960639000},{"fname":"Reverse arrows.md","mtime":1645305706000},{"fname":"Reverse arrows.svg","mtime":1645960639000},{"fname":"Scribble Helper.md","mtime":1747585400113},{"fname":"Scribble Helper.svg","mtime":1645944722000},{"fname":"Select Elements of Type.md","mtime":1643464321000},{"fname":"Select Elements of Type.svg","mtime":1645960639000},{"fname":"Set Dimensions.md","mtime":1645305706000},{"fname":"Set Dimensions.svg","mtime":1645944722000},{"fname":"Set Font Family.md","mtime":1645305706000},{"fname":"Set Font Family.svg","mtime":1645944722000},{"fname":"Set Grid.md","mtime":1693725826368},{"fname":"Set Grid.svg","mtime":1645960639000},{"fname":"Set Link Alias.md","mtime":1645305706000},{"fname":"Set Link Alias.svg","mtime":1645960639000},{"fname":"Set Stroke Width of Selected Elements.md","mtime":1748189277Line truncated
+1 -1
View File
@@ -470,7 +470,7 @@ https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea
```excalidraw-script-install
https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/ea-scripts/Mindmap%20Builder.md
```
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Mindmap%20Builder.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Rapid mind mapping workflow driven by keyboard shortcuts: add sibling/child nodes, auto-layout and branch styling, quick navigation, optional recursive grouping, and Markdown copy/paste import/export for bullet-list sync.<br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-mindmap-builder.png'></td></tr></table>
<table><tr valign='top'><td class="label">Author</td><td class="data"><a href='https://github.com/zsviczian'>@zsviczian</a></td></tr><tr valign='top'><td class="label">Source</td><td class="data"><a href='https://github.com/zsviczian/obsidian-excalidraw-plugin/blob/master/ea-scripts/Mindmap%20Builder.md'>File on GitHub</a></td></tr><tr valign='top'><td class="label">Description</td><td class="data">Rapid mind mapping workflow driven by keyboard shortcuts: add sibling/child nodes, auto-layout and branch styling, quick navigation, optional recursive grouping, and Markdown copy/paste import/export for bullet-list sync.<br><a href="https://www.youtube.com/watch?v=dZguonMP2KU" target="_blank"><img src ="https://i.ytimg.com/vi/dZguonMP2KU/maxresdefault.jpg" style="width:400px;"></a><br><a href='https://youtu.be/dZguonMP2KU' target='_blank'>Link to video on YouTube</a><br><img src='https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/master/images/scripts-mindmap-builder.png'></td></tr></table>
## Mindmap connector
```excalidraw-script-install
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.18.3-beta-1",
"version": "2.18.3",
"minAppVersion": "1.5.7",
"description": "Sketch Your Mind. An Obsidian plugin to edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
"author": "Zsolt Viczian",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "obsidian-excalidraw-plugin",
"name": "Excalidraw",
"version": "2.18.2",
"version": "2.18.3",
"minAppVersion": "1.5.7",
"description": "Sketch Your Mind. An Obsidian plugin to edit and view Excalidraw drawings. Enter the world of 4D Visual PKM.",
"author": "Zsolt Viczian",
+64
View File
@@ -1,5 +1,68 @@
import { App, Modal } from "obsidian";
function getClientPoint(e: PointerEvent | TouchEvent) {
if (e.type.startsWith("touch")) {
const t = (e as TouchEvent).touches[0] ?? (e as TouchEvent).changedTouches[0];
return t ? { x: t.clientX, y: t.clientY } : null;
}
const p = e as PointerEvent;
return { x: p.clientX, y: p.clientY };
}
function pointInRect(pt: { x: number; y: number }, r: DOMRect, padding = 1): boolean {
return (
pt.x >= r.left - padding &&
pt.x <= r.right + padding &&
pt.y >= r.top - padding &&
pt.y <= r.bottom + padding
);
}
function isPointOnText(e: PointerEvent | TouchEvent): boolean {
const pt = getClientPoint(e);
if (!pt) return false;
let offsetNode: Node | null = null;
let offset: number | null = null;
// Chromium/Firefox-ish
const caretPos = (document as any).caretPositionFromPoint?.(pt.x, pt.y);
if (caretPos?.offsetNode) {
offsetNode = caretPos.offsetNode;
offset = typeof caretPos.offset === "number" ? caretPos.offset : null;
} else {
// Safari/WebKit
const caretRange = (document as any).caretRangeFromPoint?.(pt.x, pt.y);
if (caretRange?.startContainer) {
offsetNode = caretRange.startContainer;
offset = typeof caretRange.startOffset === "number" ? caretRange.startOffset : null;
}
}
if (!offsetNode || offsetNode.nodeType !== Node.TEXT_NODE || offset == null) return false;
if (!offsetNode.textContent?.trim()) return false;
const textNode = offsetNode as Text;
const len = textNode.data.length;
const at = Math.max(0, Math.min(offset, len));
const range = document.createRange();
if (at < len) {
range.setStart(textNode, at);
range.setEnd(textNode, at + 1);
} else if (at > 0) {
range.setStart(textNode, at - 1);
range.setEnd(textNode, at);
} else {
return false;
}
const rects = Array.from(range.getClientRects());
if (rects.length === 0) return false;
return rects.some((r) => pointInRect(pt, r, 1));
}
export class FloatingModal extends Modal {
private dragging = false;
private offsetX = 0;
@@ -34,6 +97,7 @@ export class FloatingModal extends Modal {
target instanceof HTMLTextAreaElement ||
target instanceof HTMLSelectElement ||
target instanceof HTMLButtonElement ||
isPointOnText(e) ||
target.closest(".clickable-icon") ||
target.closest(".modal-close-button") // ensure close button never starts drag
) {
+5 -51
View File
@@ -18,6 +18,10 @@ I build this plugin in my free time, as a labor of love. Curious about the philo
<div class="ex-coffee-div"><a href="https://ko-fi.com/zsolt"><img src="https://storage.ko-fi.com/cdn/kofi6.png?v=6" border="0" alt="Buy Me a Coffee at ko-fi.com" height=45></a></div>
`,
"2.18.3":`
<div class="excalidraw-videoWrapper">
<a href="https://www.youtube.com/watch?v=dZguonMP2KU" target="_blank"><img src ="https://i.ytimg.com/vi/dZguonMP2KU/maxresdefault.jpg" style="width:100%;"></a>
</div>
## New
- Added Mindmap Builder script to the store.
- LaTeX Suit Integration by [@TravisLEBLANC1](https://github.com/TravisLEBLANC1)
@@ -25,7 +29,7 @@ I build this plugin in my free time, as a labor of love. Curious about the philo
## Fixed
- YouTube video embeds working on iOS [#2569](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2569)
- Stroke color settings for Embeddedables (markdown notes, websites) notes is missing after 2.17 update [#2580](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2580)
- Stroke color setting for Embeddedables (markdown notes, websites) is missing after 2.17.0 update [#2580](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2580)
- Context menu paste pastes in image twice [#10542](https://github.com/excalidraw/excalidraw/issues/10542)
## New in ExcalidrawAutomate
@@ -268,54 +272,4 @@ public getViewCenterPosition(): {x:number, y:number};
):ExcalidrawElement[]
\`\`\`
`,
"2.14.3":`
<div class="excalidraw-videoWrapper">
<a href="https://www.youtube.com/watch?v=29EWeglRm7s" target="_blank"><img src ="https://i.ytimg.com/vi/29EWeglRm7s/maxresdefault.jpg" style="width:100%;"></a>
</div>
Updated the Printable Layout Wizard script with the option to exclude empty pages.
## Fixed
- If a frame is locked, elements created over the frame or dragged over the frame should not be auto-added to the frame. [#9850](https://github.com/excalidraw/excalidraw/issues/9850)
## Fixed in ExcalidrawAutomate
- Not all AppState properties were being correctly copied to the template when creating a new drawing with ea.create() [#2440](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2440)
`,
"2.14.2":`
## Fixed
- Converting Markdown to Excalidraw ("Back of note"/"Convert markdown to ExcaliDrawing") no longer appends T00:00:00.000Z to an existing date frontmatter field and handles merging of lists such as tags intelligently [#2414](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2414)
- Multi‑point line creation on touchscreens (tap–tap–tap) produced a horizontal line after using a pen. Fixed. [#9840](https://github.com/excalidraw/excalidraw/pull/9840#issuecomment-3165319266)
## New
- Zoom settings (Settings → Excalidraw → Appearance and Behavior → Zoom) [#2434](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2434):
- Zoom increment (default 5%) to fine‑tune mouse wheel / gesture precision.
- Minimum zoom (default 10%) controls how far you can zoom out (below 10% may be unstable—use with caution).
- Maximum zoom (default 3000%) defines the upper zoom limit.
- Palm Guard script (in script store): Mobile-friendly drawing mode for stylus users. Enters fullscreen, hides UI, shows a draggable minimal toolbar (toggle + exit) to prevent accidental palm taps; single tap to exit. Inspired by [#2409](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2409)
<div class="excalidraw-videoWrapper">
<a href="https://www.youtube.com/watch?v=A_udjVjgWN0" target="_blank"><img src ="https://i.ytimg.com/vi/A_udjVjgWN0/maxresdefault.jpg" style="width:100%;"></a>
</div>
## ExcalidrawAutomate
- Improved \`FloatingModal\` behavior. Floating Modal now does not trap keyboard events, the header element does not block "X" button in the top right corner, all four corners are rounded on Mobile Devices.
`,
"2.14.1":`
## Fixed
- Excalidraw broke Obsidian's UI in Arabic, Persian, and Hebrew due to LTR, RTL conflict. [#2423](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2423)
- Styling issues impacting native Obsidian search/replace dialogs. [#2420](https://github.com/zsviczian/obsidian-excalidraw-plugin/issues/2420)
- Now using native Obsidian attachment location function. 🙏 [mnaoumov](https://github.com/mnaoumov) [#2421](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2421), potentially fixes [#179](https://github.com/RainCat1998/obsidian-custom-attachment-location/issues/179) of the Obsidian Custom Attachment Location plugin issue.
## New
- New frontmatter option \`excalidraw-embed-md\`. When set to \`true\`, embedding the drawing into a markdown note will render the "back of the note" (its markdown content) instead of rendering it as an image.
- If you want to always display the drawing as an image, even when \`excalidraw-embed-md\` is enabled, use the special embed syntax: \`![[drawing#^as-image]]\`. Here, \`as-image\` is a phantom block reference that forces image rendering.
- Added Spanish translation by [@Joakim31](https://github.com/Joakim31) [#2425](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2425)
- Incremental minor updates from the main [Excalidraw project](https://github.com/excalidraw/excalidraw).
`,
"2.14.0":`
## A Big "Small" Update
- Added search to Excalidraw Settings, plus added a link to access the public NotebookLM workbook pre-loaded with everything about the plugin
- New Taiwan-idiomatic Traditional Chinese translation by [@rlan](https://github.com/rlan) [#2413](https://github.com/zsviczian/obsidian-excalidraw-plugin/pull/2413)
`,
};