When different content types have textareas where uploaded images are allowed, these inline images cannot be uploaded to content-specific directories by CKEditor.

In some scenarios having thousands of images from different content types in the same directory is not desirable.

(This was raised in October 2022 as an issue for the File (Field) Paths module, https://github.com/backdrop-contrib/filefield_paths/issues/16, where the discussion then was whether it might be better to enable this in the module or in core but the issue, I think, remained unresolved.)

Unless I'm missing a way of achieving this (without using the Insert module - as CKEditor is now so good), how easy would it be to allow site admins to configure text formats that use CKEditor by using tokens, and having this functionality in core? Upload directories across the site could then be specified with something like [type].

Accepted answer

I now realise that this functionality is not necessary within CKEditor as it's available within text format settings.

If one needs the ability to use CKEditor with textareas in different content types AND one wishes images within each field to be uploaded to sub-directories specific to each content type, then you only need to create a text format that is specific to each content type where you specify which upload directory to use. That way, you get the best of both worlds: CKE + content type-specific directories for images.

Comments

I think one of the complications of this is the fact that CKE is "context agnostic". You can have textareas with the editor in different types of entities, like a user field, a taxonomy term field or a node. CKE is even used in Custom Blocks, which are not entities!

So, allowing a token like [node:type] will not work well for non-node entities (or blocks). 

[EDIT] I'm looking at File (field) paths. The tokens are provided specifically for file fields that are attached to specific entities, which makes the entity itself available to the field functions that save the field content upon saving the entity (and thus the token can be rendered using that context). 

Thanks for this. I will have another a look at File (Field) Paths.

I now realise that this functionality is not necessary within CKEditor as it's available within text format settings.

If one needs the ability to use CKEditor with textareas in different content types AND one wishes images within each field to be uploaded to sub-directories specific to each content type, then you only need to create a text format that is specific to each content type where you specify which upload directory to use. That way, you get the best of both worlds: CKE + content type-specific directories for images.