markdown-input icon indicating copy to clipboard operation
markdown-input copied to clipboard

Fix inline script in field input

Open tpilewicz opened this issue 8 months ago • 1 comments

Closes https://github.com/triaeiou/markdown-input/issues/9

The idea is that we can't run an inline script anymore because the CSP forbids it. So I moved the code of the inline script to a separate init_config file. The CSP allows running any script that is located in the addons folder.

It's a bit hacky though, in the sense that the type checker won't understand where MarkdownInput comes from 😄

I noticed other inline scripts (in window_input.py) that will probably be broken by Anki's CSP. But I don't know when they're used, so I don't know how to test a fix, so I prefer not to touch it until I know how it's used.

tpilewicz avatar Jun 08 '25 21:06 tpilewicz

@triaeiou would you mind taking a look? I know the fix is hacky but it would allow running the add-on on Anki v25 :)

Also FYI here's how I tested it: npm run build then I pasted the bin folder into Anki's addon folder (in folder 904999275, the addon's id)

tpilewicz avatar Jun 25 '25 12:06 tpilewicz