19
Views
1
Comments
Solved
[CKEditor.Reactive] Change Default Style So It Shows In-line
ckeditor-reactive
Reactive icon
Forge asset by Fábio Fantato

Is it possible to specify the default font and size so that when the GetEditorData client action is called those styles are applied in-line? I've cloned the module and I've been trying to play around with the JS, but haven't had any luck.

When I call the GetEditorData, no matter the changes I've made to the JS for different defaults, I get this:

<p>Test</p> 

And what I want is this:

<p><span style="font-size:16px"><span style="font-family:Calibri,Helvetica,sans-serif">Test</span></span></p>

The second is what happens when the user highlights the input text and changes the font and size manually. 

How do I make those the defaults?

2024-03-23 18-16-49
Bryan Villalobos
Solution

Hi @Daniel Johnson ,

Do you only want the styles to be applied after GetDataFromEditor is called? So in your case, you want the "Test" to have no formatting inside the editor, but needs the formatting after you call the client action?

If this is your use case, then I would suggest to create a separate logic to manipulate the text you got from GetDataFromEditor (in your case, "<p>Test</p>"). And add the required formatting by using string or text manipulation. 

I have attached a sample oml for your use case.


Regards,

Bryan

TestCKEditor.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.