mini-format-pack icon indicating copy to clipboard operation
mini-format-pack copied to clipboard

Allow users to specify a custom class to add to generated HTML elements

Open glutanimate opened this issue 5 years ago • 0 comments

It would be neat for users to be able to create custom buttons that both create an HTML element and equip it with a predefined CSS class. Coupled to Anki's templatting system, this would grant advanced users a very powerful tool to customize their card formatting.

Implementation specs:

  • expand the add-on configuration with an additional action key that allows users to specify a CSS class for a button
  • add a function that's capable of applying/removing that CSS class on selected text
  • hook everything up, so that clicking on a button with a CSS class set does the following:
    • if formatting in question present: Remove formatting and CSS class
    • if formatting in question not present: Apply formatting and CSS class

glutanimate avatar Nov 15 '20 17:11 glutanimate