1

using the new ckeditor5 and want to include additional features https://ckeditor.com/docs/ckeditor5/latest/features/text-transformation.html

I want to convert quotes ("") to european quotes («», or „“) and as i understand, this extra features does exactly this.(?)

As this feature is not installed in the basic plugin setup i need to install it via plugin, following these steps ( am i right?) https://github.com/craftcms/ckeditor#adding-ckeditor-plugins

I have to create a custom plugin and started with the second step.

If you’re creating a custom CKEditor plugin, use CKEditor’s package generator to scaffold it, and run its dll:build command to create a DLL-compatible package.

Now i have a ckeditor plugin in my main directory and dont know what the following steps mean, or how to proceed?:

Once the CKEditor package is in place in your Craft plugin, create an asset bundle which extends BaseCkeditorPackageAsset.

What does Craft Plugin mean in this context? Where do i create and add the asset bundle?

Thanks for your help.

1 Answer 1

1

What does Craft Plugin mean in this context?

It means a normal Craft plugin – you can find documentation on Craft plugins in How to Build a Plugin. Usually, a plugin is used if you want to make it available to other people through the plugin store. However, you can also create private plugins for individual sites.

You can also create a module, which is part of one specific site / project. If you're unsure what you need, I would use a module, since it has less overhead than a plugin. You can put the asset bundle and the hook that registers it inside a module as well.

Where do i create and add the asset bundle?

You can find the documentation on Asset Bundles here. Basically, it's a class that defines some assets (e.g. static JS/CSS files) to be published. This is required for your plugin's or module's assets to be publicly accessible, since plugins and modules are not inside the web root. An asset bundle can include assets to be published, which just means they're copied to the cpresources folder in the web root.

To create the asset bundle, use the example in the CKEditor plugin's README and put it inside your module/plugin – the asset bundle documentation includes an example for the recommended folder structure. Then register it using the hook that's included in the README as well.

9
  • ah ok. thanks. normal Craft Plugin then. But module is better, i think so too. Was'nt sure, if i have to go this extra round for this little additional feature.
    – Henrik
    Commented Jun 29, 2023 at 12:18
  • @Henrik Basically every adjustment beyond templating needs to go into a module, but a simple module is really simple to create! Check out the guide I linked above, or you can also use the generator if you like.
    – MoritzLost
    Commented Jun 29, 2023 at 12:33
  • @MoitzLost i created a module and also the "DLL-compatible package", wich lives now as a folder outside the module folder (not sure if this should be different). Now i dont know where to include the extra package i would like to add. It is this one (ckeditor.com/docs/ckeditor5/latest/features/…), where i basically need the automated transform to more european quotes.
    – Henrik
    Commented Jul 3, 2023 at 17:26
  • @Henrik You can put the folder inside a resources folder in your module. Then create the asset bundle and point it to that folder – for example, by defining an alias pointing to for your module's base directory. This is all mentioned in the asset bundle documentation – see the code example and the note regarding the namespace below.
    – MoritzLost
    Commented Jul 4, 2023 at 13:49
  • (sorry for misspelling). thanks, i think i did everything right, but no luck so far. i find it quite confusing with all this different files and setup. (extend a plugin with an external package, via an own module). The last code Block on the readme page of the craft ckeditor github page: this comes into the main module.php file in the crafts module folder, right?
    – Henrik
    Commented Jul 6, 2023 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.