Custom audio block for Editor plugin

I am wanting to make a custom block for the Editor plugin which will allow user to upload 1 audio file.

Following the Block extensions guide I am lost when it gets to writing the index.js for my audio-block plugin.

I am not sure how to fill the below in the index.js …


I thought I would be able to write something similar to the image-block as I am uploading a file, but don’t know what code to adapt. Any advice or documenatation out there?

thank you!

Have you checked out the examples, e.g.

Yes I have checked out the examples thanks.

They are great, but still leave me a bit lost with what to do at Methods & Template for my block to have a successful files upload field.

There is no other documentation, I’m afraid and I have very little experience with those blocks. What I’d do for starters it try to copy the image block and just replace the accept property from image to audio.

Any chance you (or someone else) made an audio block by now?

Hey @matthack, I never ended up building an audio block for the editor plugin, but I did end up making a couple simple audio blocks for the builder plugin. Would they be helpful?

Hi - I already have a solution for kirbytext, but maybe someone else could need the plugin? Anyways, thanks for getting back so soon!

nope. But since you didn’t ask about it, there’s a chance you didn’t hear about the news.
The “blocks” core field (that will supersede the editor plugin), soon to be released with kirby 3.5, will be much easier to extend, and if I’m not mistaken it should then also be able to import “editor content”.

Don’t know if you’re informed about that progress, the team is currently at an alpha version, but it’s mature enough to try it out and play with it.

thanks for letting me know!