Remaining character count works when in plain "text editor" mode but when in WYSIWYG mode, the count does not change as you type. This issue was also reported in http://drupal.org/node/715374 with FCKeditor.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kiwad’s picture

Same issue with Wysiwyg/Wymeditor . Works in plain text but doesn't in rich text

botris’s picture

Still an issue

muschpusch’s picture

subscribe....

muschpusch’s picture

Component: User interface » Code
Category: bug » feature
Status: Active » Needs review
FileSize
1.81 KB

I tried to create a patch so that maxlength will work with ckeditor. Maxlength shouldn't count html so i added strip_tags from php.js and added strip_tags to the count in maxlength.module. Another problem is that my selector for the ckeditor field isn't working correctly.

$('.cke_contents iframe:visible').contents().find('body').html().length;

The selector works for me in the console but not in the maxlength.js. The last step would be defining a condition to switch between the default selector and the ckeditor field.

Someone some ideas about this?

kongoji’s picture

Issue tags: +ckeditor, +maxlength
FileSize
3.25 KB

I extended muschpusch's patch and it should work now with CKEditor, but it needs reviews.
Greetings

kiwad’s picture

Version: 6.x-2.0-beta1 » 6.x-2.x-dev
Status: Needs review » Needs work

Dev version has been updated quite a bit on feb 16th. Patch should be re-rolled

kiwad’s picture

Status: Needs work » Closed (duplicate)

Marking as a duplicate of this thread : #314508: Doesn't work with WYSIWYG (tinyMCE and CKeditor)

Anonymous’s picture

Status: Closed (duplicate) » Needs review
FileSize
2.8 KB

It is not a duplicate, I don't use WYSIWYG module but the CKeditor module.
I made a patch for:
maxlenght 6.x-2.0-beta2
ckeditor 6.x-1.2

Hope it is useful

mErilainen’s picture

I couldn't get this to work. It only updates the character count when I turn "Switch to plain text editor". And if I write too long text in plain textareas, then it weirdly removes some of the last characters. Also the validation seems to go crazy, I cannot save the node even when I reduce the amount of characters. And it doesn't seem to count spaces at all when I patch it. Maybe it's because I'm trying to use it on a CCK field?

How should this work anyway in the end? I mean I can define in CCK or Maxlength maximum amount of characters, but that means html included. Naturally when I want to limit the amount of characters, it should be with all html-tags removed, right? Content producers don't need to care about the amount of html underneath, just the visible characters. So Maxlength should somehow override the defined limit when it checks the amount of actual characters without html.

soulfroys’s picture

Status: Needs review » Needs work
FileSize
23.2 KB

@Patrizio, your code works, tks!

But... the copy/paste functionality going crazy (flickers, ghost moves, etc).

held69’s picture

tried this patch as well.

the count down works well, with regular typing.

However as soon as i copy and paste text, it does not work right.

The counter doesn't work right and i cant seem to remove the pasted text anymore..

Thanks

soulfroys’s picture

@held69, did you find any solution?

held69’s picture

nope

soulfroys’s picture

Thanks @held69!

Well... I tested the @Patrizio's patch (#8) with the latest CKEditor dev and it worked. But ... with the last maxlenght dev, did not work.

I give up... I love this module, but I can no longer make it work with CKEditor... It's too much bug for my poor skills.

Best Luck to all!

thehong’s picture

Status: Needs work » Needs review
FileSize
4.51 KB

My patch for 6.x-2.x

thehong’s picture

FileSize
4.58 KB

Fix js error.

cedewey’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

The Drupal 6 version of Maxlength is no longer supported so I'm marking this Closed (won't fix).

I also encourage you, if you haven't already, to upgrade your site to Drupal 8/9. We are actively maintaining that version and you would enjoy all of the other features of the latest version of Drupal.