treehousedev / treehouse

https://treehouse.sh
MIT License
154 stars 12 forks source link

lib: handle onpaste and create new nodes for each line #296

Closed ArcaTech closed 1 year ago

ArcaTech commented 1 year ago

This PR adds a new onpaste handler to the TextAreaEditor component. It splits the clipboard data by newline, adds the first line using the passed in setter, and then loops though any remaining lines. At first, I had the loop call executeCommand("insert", ...), but I needed a reference to the newly created node to continue the loop, so it's done more manually.

Let me know what you think.

Closes #250