mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2026-12-03 06:43:35 +00:00
fix isSolidArrow overwritten in centerText, and fix grouping of non-autolayed out element
This commit is contained in:
1 parent
1fec09c367
commit
bcd63ad7fe
4 files changed
+26
-9
No files matched your search
@@ -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;
|
||||
})
|
||||
|
||||
@@ -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).
|
||||
|
||||
<a href="https://www.youtube.com/watch?v=ISuORbVKyhQ" target="_blank"><img src ="https://i.ytimg.com/vi/ISuORbVKyhQ/maxresdefault.jpg" style="max-width:560px; width:100%"></a>
|
||||
|
||||
`;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user