editor
editor copied to clipboard
Block plugin crashes on custom folder name
Describe the bug After changing the folder name of a custom block plugin, the editor field won´t show up in the panel anymore. The panel error is 'The field type "[name of the corresponding editor field]" does not exist'
To Reproduce Steps to reproduce the behavior:
- Copy one of the provided example blocks, i.e. 'info-block' into /site/plugins/
- Change the name of the block inside index.php, index.js (change to download-block for example)
- Rename /site/plugins/info-block/snippets/info.php accordingly (download.php)
The plugin should run as expected.
- Now change the plugin´s folder name from 'info-block' to 'download-block'
- The editor field in the panel will now be broken as described.
Kirby Version 3.4.3
Console output Uncaught ReferenceError: editor is not defined at index.js?1600444109:3
Desktop (please complete the following information):
- OS: Windows 10
- Browser: Chrome, Firefox, etc.
Tried on different server environments, too.
I've had the same problem with a custom block for alerts. Within the plugins folder, my block's folder was alert-block
. It seems like plugins are loaded in alphabetical order.
In your case download-block
gets loaded before editor
since the letter d
comes before e
, but the block depends on the editor
plugin, so it breaks the panel. My workaround was to rename the block folder to anything starting with a letter after e
. In my case I renamed alert-block
to z-alert-block
and everything worked correctly.
I'm not 100% sure this is the case, but this was my experience with the problem.
That´s it. Thanks a lot @PaulMorel! I now renamed my plugins into editor-[feature]-block
, so that they are loaded after the main editor-plugin. This should definitely be mentioned in the Block extensions page
inside the wiki @bastianallgeier.
I can confirm this issue and its workaround. The moment the folder of an editor plugin comes before e
in the alphabet, editor
is not available for the custom js. Seems like plugin folders are loaded in alphabetical order which can mess up dependencies. :/