Hi everyone,
New to forum - Hope the following is sufficiently clear!
What I’m trying to do
NOT copy/cut anything when nothing is highlighted on Obsidian.
Things I have tried
Cmd+C or +X anywhere on editor causes whole block (from preceding line break to next line break) to be copied or cut.
Gone through settings, forum, discord and documentation - so far no luck at finding how to disable this behaviour of Cmd+C or Cmd+X.
Purpose / Further background
To create keyboard shortcut(s) for text formatting via Keyboard Maestro macro. Specifically, the macro should insert at cursor, or wrap highlighted text, in <font style="color: #"></font>
.
To achieve this, the macro has to identify whether any text is highlighted. Simplest way is to check whether Cmd+C is available (not applicable here since the option is always available in Obsidian). Second best is to cut or copy and test if there is any text from action. As Obsidian always cuts or copies the whole block, this method always yields a (false) positive.
For now, the closest stopgap is to regex for any line break. However:
- there are times when a line break is highlighted for formatting, causing a false false, which overwrites all highlighted contents with formatting tags, or
- at the end line / block, a false positive is always returned (since there is no line break at the end), causing macro to wrap all of end line / block in the tags instead of inserting tag pair.
=======
Any help would be greatly appreciated. Thanks all!