I was wondering if there is a way to get the height of the content in the Ckeditor.
I want to limt the amount of content the user is able to put into the Ckeditor, because the div where the content will eventually be put needs to be limited in height.
I have a way of getting a charater count, but the character count could be the same whether the user has many short sentences with many bullet points or has long sentence with few bullet points, but the height would be very different.
I figured it out, it is the
I figured it out, it is the inner document of the iframe that you need to get a height off of.
var ckeditorFrame = $('#cke_1_contents iframe');
var innerDoc = (ckeditorFrame.get(0).contentDocument) ? ckeditorFrame.get(0).contentDocument : ckeditorFrame.get(0).contentWindow.document;
var descriptionHeight = innerDoc.body.scrollHeight;
Just an update, I discovered
JUst an update, I discovered that the above doesn't work in Chrome or Safari so here is a version that does work.
var ckeditorFrame = $('#cke_1_contents iframe'),
innerDoc = (ckeditorFrame.get(0).contentDocument) ? ckeditorFrame.get(0).contentDocument : ckeditorFrame.get(0).contentWindow.document,
messageHeight = $(innerDoc.body).height();
Cool, thanks for sharing!
Cool, thanks for sharing!
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!