dvargas92495 / SmartBlocks

Useful examples from developer community for Roam42 SmartBlocks
147 stars 7 forks source link

Replace new lines with space #70

Open gijigae opened 3 years ago

gijigae commented 3 years ago

✂️ Copy of your #42SmartBlock from Roam

📋 Describe the SmartBlock

Have seen many inquiries on unnecessary line breaks while copying text from PDF into Roam. This SB will replace new lines in the clipboard with space.

  1. Copy text from PDF
  2. Run SB
  3. Paste into Roam

✅ Describe any prerequisites or dependencies that are required for this SmartBlock

None

📷 Screenshot of your #42SmartBlock workflow/template from Roam

image

💡 Additional Info

newline

Rhizomyx commented 3 years ago

It does not seem to be working for me. Any idea why?

theremaxpro commented 3 years ago

very similar to this script but a little different: i copy a small snippet of text with several breaks from say facebook... when i paste it the text default to several blocks.
what i need is a script that combines all the copied text into one block in Roam.
bonus if the script can place shift+enter breaks instead of the automatic block breaks.

bjburch commented 3 years ago

very similar to this script but a little different: i copy a small snippet of text with several breaks from say facebook... when i paste it the text default to several blocks. what i need is a script that combines all the copied text into one block in Roam. bonus if the script can place shift+enter breaks instead of the automatic block breaks.

Does command-shift-V not work for this case? I also use command-alt/opt-shift-V, but that's a really "raw" paste.

gijigae commented 3 years ago

Updated the regex to handle various linebreaks. Please see the details in the following thread.

https://twitter.com/yvettepyne/status/1375495353282273291?s=20

fbgallet commented 3 years ago

Edit (May 26): simply change last line code by return cbText; for automatic pasting.

Old message: And add this two lines at the end of the SmartBlock for automatic pasting (by @yvettepyne , same Twitter thread as mentionned in previous comment)

- <%SET:Text,<%CLIPBOARDPASTETEXT%>%> <%NOBLOCKOUTPUT%>
- <%GET:Text%>