Auto-transforming em dash in dialogue?

Is there a way to turn on auto-transform for em dashes when an action interrupts a line of dialogue? The correct format is this:

“Words words”–someone does a thing–“more words.”

LibreOffice doesn’t auto-format the hyphens into em dashes like it should. It does so when there’s no quotation marks:

words words–some more words.

AutoCorrect needs a following space. Also see Help on Replace dash “Text will be replaced after you type a trailing white space (space, tab, or return). In the following table, the A and B represent text consisting of letters A to Z or digits 0 to 9.”

Try AutoHotKey

Record a Find and Replace macro which searches for them and changes them as required.

On LibO there is a special kind of autocorrect that does not need space surrounding it: the ones that uses colons. If you type

:---:

as soon as the second colon is introduced the three dashes will be replaced by an em-dash (the sequence :-: inserts a “minus” sign while :--: inserts an en-dash)

Note: if you prefer a shorter shortcut you can define a new one on autocorrect options, something like :_: will work fine.