First of all, I'd like to thank for this cool module. It solves precisely our need - to be able to store data in markdown while editing it via CKEditor 5 wysiwyg.
Problem/Motivation
on my local environment, I run drupal instance within a subfolder (not in the root of the domain). It seems to produce issues as the `src` path for `markdown-gfm.js` plugin. Drupal core thinks that JS file specifies its path relative to the module's folder while in fact it uses basically a full path (except for the domain).
Steps to reproduce
Host a Drupal 10 instance within subfolder, install ckeditor5_markdown_editor
module. Configure it to have some markdown-driven CKEditor.
Observe console error:
CKEditorError: plugincollection-plugin-not-found {"plugin":null}
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-plugincollection-plugin-not-found
i https://localhost.com:444/drupal10/web/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=39.0.1:5
u https://localhost.com:444/drupal10/web/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=39.0.1:5
u https://localhost.com:444/drupal10/web/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=39.0.1:5
u https://localhost.com:444/drupal10/web/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=39.0.1:5
init https://localhost.com:444/drupal10/web/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=39.0.1:5
initPlugins https://localhost.com:444/drupal10/web/core/assets/vendor/ckeditor5/ckeditor5-dll/ckeditor5-dll.js?v=39.0.1:5
create https://localhost.com:444/drupal10/web/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=39.0.1:4
create https://localhost.com:444/drupal10/web/core/assets/vendor/ckeditor5/editor-classic/editor-classic.js?v=39.0.1:4
attach https://localhost.com:444/drupal10/web/core/modules/ckeditor5/js/ckeditor5.js?s5k6fh:370
editorAttach https://localhost.com:444/drupal10/web/core/modules/editor/js/editor.js?v=10.1.7:302
attach https://localhost.com:444/drupal10/web/core/modules/editor/js/editor.js?v=10.1.7:226
attach https://localhost.com:444/drupal10/web/core/modules/editor/js/editor.js?v=10.1.7:209
attachBehaviors https://localhost.com:444/drupal10/web/core/misc/drupal.js?v=10.1.7:166
attachBehaviors https://localhost.com:444/drupal10/web/core/misc/drupal.js?v=10.1.7:162
<anonymous> https://localhost.com:444/drupal10/web/core/modules/big_pipe/js/big_pipe.js?v=10.1.7:138
<anonymous> https://localhost.com:444/drupal10/web/core/modules/big_pipe/js/big_pipe.js?v=10.1.7:169
ckeditor5.js:477:19
attach https://localhost.com:444/drupal10/web/core/modules/ckeditor5/js/ckeditor5.js?s5k6fh:477
(Async: promise callback)
attach https://localhost.com:444/drupal10/web/core/modules/ckeditor5/js/ckeditor5.js?s5k6fh:471
editorAttach https://localhost.com:444/drupal10/web/core/modules/editor/js/editor.js?v=10.1.7:302
attach https://localhost.com:444/drupal10/web/core/modules/editor/js/editor.js?v=10.1.7:226
attach https://localhost.com:444/drupal10/web/core/modules/editor/js/editor.js?v=10.1.7:209
attachBehaviors https://localhost.com:444/drupal10/web/core/misc/drupal.js?v=10.1.7:166
attachBehaviors https://localhost.com:444/drupal10/web/core/misc/drupal.js?v=10.1.7:162
<anonymous> https://localhost.com:444/drupal10/web/core/modules/big_pipe/js/big_pipe.js?v=10.1.7:138
<anonymous> https://localhost.com:444/drupal10/web/core/modules/big_pipe/js/big_pipe.js?v=10.1.7:169
See it visually:
(the wysiwyg does not render).
The problem is the generated
tag:
<script src="/drupal10/web/drupal10/web/libraries/ckeditor5/plugins/markdown-gfm/build/markdown-gfm.js?s5k6fh"></script>
Proposed resolution
I believe simply declaring this library as "external" would solve it - that way Drupal core would treat the provided path as a URL, not as a filepath relative to the module's folder.
Remaining tasks
User interface changes
API changes
Data model changes