27 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
/*
 | 
						|
## requires Excalidraw 1.5.1 or higher
 | 
						|

 | 
						|
 | 
						|
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.
 | 
						|
 | 
						|

 | 
						|
 | 
						|
Split lines of text into separate text elements for easier reorganization
 | 
						|
 | 
						|
See documentation for more details:
 | 
						|
https://zsviczian.github.io/obsidian-excalidraw-plugin/ExcalidrawScriptsEngine.html
 | 
						|
 | 
						|
```javascript
 | 
						|
*/
 | 
						|
elements = ea.getViewSelectedElements().filter((el)=>el.type==="text");
 | 
						|
elements.forEach((el)=>{
 | 
						|
  ea.style.strokeColor = el.strokeColor;
 | 
						|
  ea.style.fontFamily  = el.fontFamily;
 | 
						|
  ea.style.fontSize    = el.fontSize;
 | 
						|
  const text = el.text.split("\n");
 | 
						|
  for(i=0;i<text.length;i++) {
 | 
						|
	ea.addText(el.x,el.y+i*el.height/text.length,text[i]);
 | 
						|
  }
 | 
						|
});
 | 
						|
ea.addElementsToView(false,false);
 | 
						|
ea.deleteViewElements(elements); |