Download & Extend

Countdown !remaining not dynamic with CKEditor

Project:Maxlength
Version:6.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Issue tags:ckeditor, maxlength

Issue Summary

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.

Comments

#1

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

#2

Still an issue

#3

subscribe....

#4

Component:User interface» Code
Category:bug report» feature request
Status:active» needs review

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?

AttachmentSize
maxlength.patch 1.81 KB

#5

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

AttachmentSize
maxlength_ckeditor.patch 3.25 KB

#6

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

#7

Status:needs work» closed (duplicate)

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

#8

Status:closed (duplicate)» needs review

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

AttachmentSize
maxlength+ckeditor_62beta2.patch 2.8 KB

#9

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.

#10

Status:needs review» needs work

@Patrizio, your code works, tks!

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

AttachmentSize
maxlenght.png 23.2 KB

#11

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

#12

@held69, did you find any solution?

#13

nope

#14

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!

nobody click here