How to insert text programmatically through JS to CKEditor 5? #634
-
Hi all. I have a problem. When I click on the button, I get the generated ChatGPT text by ajax. I need to add this text with formatting. Generated text is indented How to programmatically insert text via JS in CKEditor 5? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey there @SequelONE 👋 I guess is by adding a bit of Javascript to your page. 😃 You can add a custom javascript file to your page with the code using a script widget Alternatively you can create a copy of Don't forget to change the field in your controller to use your Cheers |
Beta Was this translation helpful? Give feedback.
Hey there @SequelONE 👋
I asked our friend ChatGPT:
I guess is by adding a bit of Javascript to your page. 😃
You can add a custom javascript file to your page with the code using a script widget
Alternatively you can create a copy of
ckeditor
fieldphp artisan backpack:field ckeditor_custom --from=ckeditor
and register there some event listener that you send from the button with the generated text and you set the text on the editor.Don't forget to change the field in your controller to use your
ckeditor_custom
field.Cheers