This is an automated archive made by the Lemmit Bot.

The original was posted on /r/foundryvtt by /u/florabtw on 2023-11-01 00:17:38.


Hey everyone,

If you copy from PDFs a lot, it’s a pain the rear to remove line breaks all the time, and the clear formatting button doesn’t do it. I spent some time writing up a macro to solve this for me:

const text = getSelection().toString().replaceAll(/\r?\n/g, ' ');
const element = getSelection().anchorNode.parentElement.closest('p');
element.innerText = text;

Macro setup:

  1. Click empty spot in macro toolbar
  2. Name your macro (e.g. “Remove Line Breaks”)
  3. Set “type” to Script
  4. Paste the above code

Steps:

  1. Copy & paste paragraph from PDF
  2. Highlight paragraph (full paragraph!) in Journal
  3. Execute macro

Tips:

  • Only works for entire paragraphs (don’t try to do this for half a paragraph)
  • Keep the macro editor open, and just click “Execute Macro” whenever you need it.