[Plugin] Add font + Modify editor behaviour

Hi,

I published a plugin yesterday that allows you to create styled (collapsible) blocks.

However, I have two questions:

  1. In order to have icons for the different block styles I added the MaterialIcons font.
    Is there a way to import this font locally?
    (I copied it into the styles folder of the plugin and reference it in the less file, see here but that doesn’t work)
    Alternatively, I could use the icon font Inkdrop uses? Or does that depend on the theme?

  2. The content in each block is determined by this | symbol in the beginning of a line. It would be convenient to automatically add a | when pressing enter while the cursor is inside of a content block. Basically the same behavior when pressing enter in a list (it automatically adds a - in the new line).
    Is that done by codemirror? Do you have any tips/links how I could do that?

Cheers :slight_smile:

Hi andi,

Wow, that’s an amazing plugin!

  1. Yes, you can specify files in your plugin with URI: inkdrop://<plugin-name>/<file-path>.
    So you should be able to use the font file like so: inkdrop://admonition/styles/MaterialIcons-Regular.woff2

    And yes, Inkdrop’s UI is built with Semantic UI. So you can use its icon set here without needing to add a font.

  2. Yes. continuelist is a good example. But it’s kind of complicated to accomplish that in Inkdrop. Let me give time to describe it.

Hi,

I looked into the current implementation of the editor and found that unfortunately it’s difficult to change the behavior to automatically add a | when pressing enter.
editor:new-line command is executed when pressing enter while the cursor is on the editor.
This command’s implementation is similar to continuelist and as you can see the process is hard-coded.
So I’m afraid that it’s hard to extend as what you want for now.

1 Like

Thank you for your feedback! :blush:

  1. OK nice, I am currently playing around with the font awesome icons and might just use those :slight_smile: and good to know how easy it is to link plugin resources!

  2. Thank you so much for looking into that! A pity that it is harder to do but luckily it is also not a super important feature, so I am happy to leave it out.

Cheers

1 Like