Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Block plugin crashes on custom folder name #262

Open
tideg opened this issue Sep 21, 2020 · 3 comments
Open

Block plugin crashes on custom folder name #262

tideg opened this issue Sep 21, 2020 · 3 comments

Comments

@tideg
Copy link

tideg commented Sep 21, 2020

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:

  1. Copy one of the provided example blocks, i.e. 'info-block' into /site/plugins/
  2. Change the name of the block inside index.php, index.js (change to download-block for example)
  3. Rename /site/plugins/info-block/snippets/info.php accordingly (download.php)

The plugin should run as expected.

  1. Now change the plugin´s folder name from 'info-block' to 'download-block'
  2. 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.

@PaulMorel
Copy link

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.

@tideg
Copy link
Author

tideg commented Sep 28, 2020

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.

@milesleif
Copy link

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. :/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants