mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2025-08-06 05:46:28 +00:00
30 lines
1.1 KiB
Markdown
30 lines
1.1 KiB
Markdown
/*
|
|
|
|

|
|
|
|
Download this file and save to your Obsidian Vault including the first line, or open it in "Raw" and copy the entire contents to Obsidian.
|
|
|
|

|
|
|
|
This script will add a small circle to the top left of each text element in the selection and add the text and the "bullet point" into a group.
|
|
|
|
See documentation for more details:
|
|
https://zsviczian.github.io/obsidian-excalidraw-plugin/ExcalidrawScriptsEngine.html
|
|
|
|
```javascript
|
|
*/
|
|
elements = ea.getViewSelectedElements().filter((el)=>el.type==="text");
|
|
ea.copyViewElementsToEAforEditing(elements);
|
|
const padding = 10;
|
|
elements.forEach((el)=>{
|
|
ea.style.strokeColor = el.strokeColor;
|
|
const size = el.fontSize/2;
|
|
const ellipseId = ea.addEllipse(
|
|
el.x-padding-size,
|
|
el.y+size/2,
|
|
size,
|
|
size
|
|
);
|
|
ea.addToGroup([el.id,ellipseId]);
|
|
});
|
|
ea.addElementsToView(); |