Hello. I have hit a roadblock using the editor and have not found any posts here that address this issue. Can someone help or at least point me in the right direction?
I have been tasked to limit the content (text, rich text, image, etc) of what the user can enter in the editor to a specific sized area that corresponds to a specific region on a printout. How would I accomplish this and add an alert the user either while typing/inserting or before a save that the content would exceed a specified size?
Thank you!
I have been tasked to limit the content (text, rich text, image, etc) of what the user can enter in the editor to a specific sized area that corresponds to a specific region on a printout. How would I accomplish this and add an alert the user either while typing/inserting or before a save that the content would exceed a specified size?
Thank you!
Re: How to Limit what is entered in editor...
I think this is going to be very difficult to truly control programmatically, because it is much more difficult than a character-counter, for example. I think you can get reasonably close, but you'll have to have a printing function in your application, to print a sample confined to an area to see if it really fits or not.
To get close, I would try a template that creates DIVs and the CSS markup to go along with it, to form a fixed width and height "box" (DIV) that would give the user some visual feedback to know when they are getting close to filling the space. You'll probably need to work with specific fonts, at specific font sizes. You may want to specify the font size on screen in "ems" rather than pixels or percentages, as this might help you gain a bit more control over the correlation between screen and print sizes of text characters.
CKEditor's documentation is sparse right now, so here is a link to Templates in FCKEditor (and I assume they work exactly the same way that they did in FCKeditor.)
HTH,
Dennis
Re: How to Limit what is entered in editor...
pageHeight = parseInt(container.getComputedStyle('height'));
(currNode.$.offsetTop + currNode.$.offsetHeight - rootNode.$.offsetTop) > pageHeight;
Then there are random fixes you have to do for chrome (webkit doesn't include padding in the heights, opera does, etc).
Basically though you would just be checking if the containing element exceeded a certain height/width. I'm having to iterate through the dom objects.. but for just one container, you should be able to just do a simple check.