Open RaphaelDives opened 1 month ago
AFAIK, there's not API to directly get the title: editor.getData()
will give you full HTML, and the first element will be a title. What's your use case to get them separately?
Actually, editor.plugins.get('Title').getTitle(); and editor.plugins.get('Title').getBody(); is just working fine!
I use it for a „wiki-light“ for sending the title and body of an article separately. Of course this is not really necessary, but I find it more straight forward for my php logic since I had an extra title text field before… (And I thought that’s the way how the title is working… 😅) Think I found the hint on Stackoverflow and was just wondering that it’s not mentioned in the official documentation. There is just the example with title and body but without any explanation…
If I could just set the title as readonly for existing articles, that would be even more awesome… but that’s another „issue“. 😉
Cheers! Raphael
Origin URL
https://ckeditor.com/docs/ckeditor5/latest/features/title.html
Project version
43.0.0
Is the information outdated? How?
No response
Is there something missing in the guide? What is it?
Maybe I#m missing it, as I#m just a lazy person. But maybe it would be very convenient to give an example of how to access the title and the body e.g. editor.plugins.get('Title').getTitle(); (Yes I'm using plain html and javascript...)
Is there anything else you would like to add?
Keep going on! This is just an amazing piece of code!!! :)
User agent
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0