Opened 8 years ago

Closed 8 years ago

#8624 closed Task (invalid)

Maximum characters and maximum line limit for CKEditor

Reported by: Pavan Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

Hi,

I am using CKEditor i want to set a character limit and number limit for the text area. If any one of the limit reached the user should be blocked.

For this i need to set max limit for CKEditor.

Please Help.

Regards, Pavan.

Change History (1)

comment:1 Changed 8 years ago by Jakub Ś

Keywords: Character limit and Line limit removed
Resolution: invalid
Status: newclosed
Version: 3.6.2

First of all if you are seeking help please use one of our forums (http://cksource.com/forums/index.php) and not bug tracker!!!

Second - To make it you will have to combine pure JavaScript method of character limiter and some CKEditor methods:

Here are the links that might help:

  1. http://www.google.pl/#sclient=psy-ab&hl=en&source=hp&q=js+char+limiter&pbx=1&oq=js+char+limiter&aq=f&aqi=&aql=&gs_sm=e&gs_upl=951060l958596l2l958927l19l15l3l0l0l0l207l1933l6.6.3l18l0&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=e8fba20529fa8695&biw=1920&bih=899
  1. http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.event.html#on
  1. http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html (The event summary section)

And a code that might be used as a jump start (it can be used as in page, config.js or inside a plugin)

				// catches changes in WYSIWYG mode.
				editor.on( 'contentDom', function()
				{
					editor.document.on( 'keydown', function( event )
					{							
						if ( event.data.$.ctrlKey || event.data.$.metaKey )
							return;

						var keyCode = event.data.$.keyCode;
						// Filter movement keys and related
						if ( keyCode == 8 || keyCode == 13 || keyCode == 32 || 
							( keyCode >= 46 && keyCode <= 90 ) || 
							( keyCode >= 96 && keyCode <= 111 ) || 
							( keyCode >= 186 && keyCode <= 222 ) )
								window.setTimeout( function()
								{
                                                                  somemethod( editor );
								}, 100 );	
					} );					
				} );
				// If you won't fire this event keydowns won't work
				// until you switch to source and back.
				editor.fire( 'contentDom' );
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy