ckeditor icon indicating copy to clipboard operation
ckeditor copied to clipboard

Migrating Redactor Variables to CKEditor Placeholder

Open RitterKnightCreative opened this issue 1 year ago • 4 comments

Description

We received the message in the CP that Redactor is no longer being supported which is fine, CKEditor seems to be a better option overall. However, one of the breaking changes that's preventing us from migrating is Redactor has the nifty Variables plugin which allows you to put in placeholder content which later gets replaced with the actual content.

We're using this functionality to let a client customize various aspects of their emails from the CP after one of their online trainings is done, which seems to be an ideal use case for this.

Screenshot 2024-04-04 at 12 09 23 PM

After doing some digging it looks CKEditor has already built something similar, essentially using their demo project as a jump-off.

I took a stab at building this myself (and failing) - but what are the odds this plugin can make it into an official Craft CMS build at some point?

RitterKnightCreative avatar Apr 04 '24 17:04 RitterKnightCreative

It looks like those variables are just stored as [% variable name %] markers in the HTML (potentially with different start/end delimiters). So are you then replacing those with actual values in your template using the |replace filter?

If so, that should continue to work in CKEditor, albeit without the UI for automatically inserting the variable marker.

brandonkelly avatar Apr 25 '24 18:04 brandonkelly

Appreciate the response Brandon.

Yeh you are correct, we are using replace to swap in the values inserted.

The last part of your reply is most relevant, as they still need some sort of UI for creating new content.

(As an aside I see the marker itself changed between what redactor used previously.)

RitterKnightCreative avatar Apr 26 '24 13:04 RitterKnightCreative

Bump, because I really need this Plugin.

Latex88 avatar May 22 '24 11:05 Latex88