Closed aiko-tanaka closed 2 years ago
found a workaround
Just in case someone else stumbles upon this, the solution is probably similar to what was mentioned in https://github.com/FooSoft/yomichan/issues/2097#issuecomment-1079830052:
{{#*inline "clipboard-text"}}
{{~#if
(op
"&&"
(hasMedia "clipboardText")
(op "!==" (getMedia "clipboardText") "")
)
}}
{{#regexReplace "\n(?!$)" "<br>"}}{{#getMedia "clipboardText"}}{{/getMedia}}{{/regexReplace}}
{{~else~}}
{{~#if definition.cloze}}{{definition.cloze.sentence}}{{/if~}}
{{/if~}}
{{/inline}}
(Spacing in {{#if}}
for clarity)
Was trying to find a way to automate having yomichan select between {sentence} and {clipboard-text} where yomichan would prefer {clipboard-text} if it contains something.
I guess it did work with this code. Only problem is everytime I add a new card, the last thing I copied to my clipboard will always be set as the sentence. So I guess one way to fix it would be to have the {{inline}} block clear the clipboard at the end of the code, but I'm not sure if that's possibe. Is it?