Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
this is a nice little module. thanks.
it doesn't work with tinyMCE however.
any plans to support that?
Comment | File | Size | Author |
---|---|---|---|
#48 | doesnt-work_with_wysiwyg-314508-2-48.patch | 4.56 KB | MiSc |
#47 | doesnt-work_with_wysiwyg-314508-2-47.patch | 4.52 KB | MiSc |
#37 | maxlength.dev-2011-Feb-25.patch | 3.58 KB | tseven |
#33 | 314508.patch | 3.1 KB | haggins |
#33 | wysiwyg_maxlength.tar_.gz | 2.08 KB | haggins |
Comments
Comment #1
loze CreditAttribution: loze commentedComment #2
mariuss CreditAttribution: mariuss commentedCan you give us some more details? What exactly happens when tinyMCE is present?
Can you also check the browser's JavaScript console, to see if there are any JavaScript issues?
Comment #3
loze CreditAttribution: loze commentedthis is related to http://drupal.org/node/207230
with tinyMCE enabled the javascript counter doesn't update.
Presumably, if it did, it would count the html tags that the text editor adds as characters. is that correct?
You should consider supporting not counting html tags as characters in the max chars.
Comment #4
mariuss CreditAttribution: mariuss commentedCan you please look at the JavaScript console?
Comment #5
loze CreditAttribution: loze commentedNo errors in the console.
I dont think the onkeyup event is being triggered. or tiymce is overriding it.
Comment #6
loze CreditAttribution: loze commentedsee: http://tinymce.moxiecode.com/punbb/viewtopic.php?pid=7512
and http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/handle_event_c...
Comment #7
a_c_m CreditAttribution: a_c_m commentedtinymce (and other editors) do not edit the normal form input, they copy the data from the input into their own window, which they place over the original input box. Only when the form is submitted is the new data put back. Which is why we would need to use the hooks mentioned in the wiki's above.
We would also need to detect if tinymce was being used, as well as strip out any tags used.
Comment #8
NaX CreditAttribution: NaX commentedI have sort of found a way around this problem, after many hours of messing with tiny.
What I did was write a plugin for tiny as follows.
Added the directory maxlength to tinymce/jscripts/tiny_mce/plugins
I added the attached file to that dir and duplicated the file calling it editor_plugin_src.js (don’t think this is needed).
Then I added the following to plugin_reg.php in tiny’s module dir.
I placed this at the end of the file just above the
return $plugins;
Once this is all done you should now see a new plugin that you can activate when creating your tiny profiles called "Drupal maxlength"
Hope you find that all helpful.
PS. This is all on D5.x. I don’t know if the 6.x js is different.
Comment #9
mike_gie12 CreditAttribution: mike_gie12 commentedHello,
I tried the module + patch and yes indeed a new plugin was added on tinymce, however, it didn't work. What tinymce version did you use for the patch?
Thanks!!
Comment #10
NaX CreditAttribution: NaX commentedI used TinyMCE Drupal module 5.x-1.9 and TinyMCE version 2.1.3 and Maxlength 5.x-2.0-beta2.
Comment #11
graper CreditAttribution: graper commentedI just tried this combination. It worked with CCK text fields that had tinymce turned on, but I did have issues.
Granville
Comment #12
mcload CreditAttribution: mcload commentedHave the same problem with wysiwyg API with Tinymce on Druapl 6.10. Javascript couter does not work on Tinymce box.
Subscribing.
Comment #13
jberube CreditAttribution: jberube commentedThanks so much for the TinyMCE plugin, NaX.
I modified it to work with TinyMCE 3.x.
First, open sites/all/modules/wysiwyg/editors/tinymce.inc. At the bottom of the file, add this just before " } return $plugins; "
Then save the attached file as sites/all/modules/wysiwyg/tinymce/jscripts/tiny_mce/plugins/maxlength/editor_plugin.js
Then enable the "maxlength compatibility" plugin in your WYSIWYG settings.
Comment #14
rolfmeijer CreditAttribution: rolfmeijer commentedWith the 3.5 version of TinyMCE the plugins path has changed. So the editor_plugin.js should be in sites/all/libraries/tinymce/jscripts/tiny_mce/plugins/maxlength.
I also noticed that this (comment #13) does not work with the 6.x-1.x-dev version of the maxlength module.
Comment #15
ayalon CreditAttribution: ayalon commentedToday I needed a proper TinyMCE support for the Maxlength plugin.
Thanks to all good ideas in this thread, I created a standalone module, that enables via wysiwyg API the Maxlentgh Support for TinyMCE.
With this module it is not necessary to edit any TinyMCE files nor adding plugins in the editors library.
Hope this help someone.
The module works with the beta2 and also with the latest dev version of maxlength.
Comment #16
UNarmed CreditAttribution: UNarmed commentedHey im giving it a try now so il report back =]
Comment #17
steve_uk CreditAttribution: steve_uk commentedCould this be adapted to work with FCKeditor?
Comment #18
pr0test0r CreditAttribution: pr0test0r commentedAyalon, I'm trying to use your module with Maxlength 6.x-2.0-beta1, but I can't get it to work. It's activated, and I have maxlength configured with my content type, but when I go to edit, it's the same as if I didn't have your mod installed at all. What am I missing?
Comment #19
ayalon CreditAttribution: ayalon commentedYou need to activate MaxLength also under your WYSIWYG settings in the WYSIWYG API module. Did you miss the checkbox at the end of the WYSIWYG Buttons settings?
Comment #20
pr0test0r CreditAttribution: pr0test0r commentedAh. Got it. I misunderstood that instruction. The "Maxlength compatibility" checkbox is under "Buttons and Plugins." Works great!
Comment #21
mikejonesok CreditAttribution: mikejonesok commentedThanks for the mod. Still does not count pastes until a keyboard stroke, but it always been like that. Thanks again!
Comment #22
gausarts CreditAttribution: gausarts commentedHi, maxlength now supports comment limit, but the plugin here doesn't work with the comment form. Any idea to make it compatible with the latest comment limit. This would be nice. See the issue here => http://drupal.org/node/572398
Thanks
Comment #23
gausarts CreditAttribution: gausarts commentedMy, so sorry. I forgot to check the compat mode with comment filter. So this plugin indeed works with comment as well.
Thanks
Comment #24
saulalbert CreditAttribution: saulalbert commentedAwesome, turned the plugin on in TinyMCE 3.3.6 profiles and it works like magic. aaahhhh. Thanks so much :) (using maxlength 6.x-2.0-beta1)
Comment #25
gordon CreditAttribution: gordon commentedThat wysiwyg bridge module is a bit of a pain, I have implemented as a part of the maxlength module and it works great.
I need to submit it this as a patch.
Comment #26
haggins CreditAttribution: haggins commentedSadly it also counts all html. Is this working as intended?
Comment #27
haggins CreditAttribution: haggins commentedHere's a new version which first replaces all
with ' ' and then strips all tags. The function "strip_tags()" is copied from another suggestion on drupal.org which I'm not able to find again (sorry for that!).This updated version also respects maxlength and does not allow to input longer strings.
However, this does only work 99% since sometimes you have to click around to get the counter updated. I would say it has a precision with +- 1 character.
Comment #28
NancyDruSorry for coming late to the dance. IMHO, it is simply wrong to discount the characters added by the editor, because the form's maxlength parameter is going to count them and truncate at it's limit. I encountered this issue on the user signature form element, which truncated because of those stupid editors.
Comment #29
NaX CreditAttribution: NaX commented@NancyDru
I don't know if I am properly understanding you but, I think both with and without the strip_tags function has merits. There are times you want to include markup and there are times you might just want it to be word counter regardless of markup. Most times I needed it to disregard markup. But I have not tried the latest version so I don't have any firsthand experience with the latest version. I think the difficult part is making sure that HTML is not broken by the max length limit. The last time I used max length with TinyMCE I also used the htmLawed module to mitigate HTML problems and broken teaser problems so I cant say if max length caused any HTML to be broken.
I have not tried using it with a user signature yet, but if I did I would also look into making max length count the users signature and behind the scenes adding it to the max count, without the user knowing. I just don't know how you would check if the user removes the signature and ends up getting access to more characters.
Comment #30
NancyDruWell, my most immediate use of this is on a very fragile D5 site, so I am reluctant to even try it. I'm just going to alter the db and add a simple hook_form_alter for the specific form.
Comment #31
haggins CreditAttribution: haggins commentedThe version from #27 is not working properly since maxlength module needs a patch for stripping tags, too. Otherwise it will tell you your text exceeded length. I will post the patch later.
There aren't any problems with broken html since the js doesn't count html-tags. If maxlength produces broken html anyway it gets fixed by html corrector.
I'm using this on a production site since 2 weeks and it's working pretty well so far :)
Comment #32
vrajak@gmail.com CreditAttribution: vrajak@gmail.com commentedHaggins I look forward to your patch as I am looking into using this module, and all fixes and features make it better. :)
Comment #33
haggins CreditAttribution: haggins commentedHere it is.
I propose to review it and make it more stable (e.g. sometimes the first character counts double) to merge the wysiwyg_maxlength module into the maxlength module as an optional submodule.
Patch against 6.x-2.x-dev.
Comment #34
haggins CreditAttribution: haggins commentedComment #35
haggins CreditAttribution: haggins commentedI'm sorry - I forgot to apply some changes to the tinyMCE plugin. This happened because I'm using only ckeditor. TinyMCE plugin untested!
Also, I created a new issue since this is another one than the original poster had. Please use #1027966: Do not count html markup for further development on this issue.
Comment #36
kiwad CreditAttribution: kiwad commentedMarking #859746: Countdown !remaining not dynamic with CKEditor as a duplicate and changing the title to be more general since haggins' work seems to include both TinyMCE and CKEditor
Also, the files in maxlength as gone through quite a bit of changes (feb 16th), could it be possible to re-roll this to be able to test it with latest dev ?
Comment #37
tseven CreditAttribution: tseven commentedHere is haggins patch from #33 re-worked to work with the dev version (2011-Feb-25).
The sub module:
http://drupal.org/files/issues/wysiwyg_maxlength.tar_.gz
didn't work for me. The js file isn't being loaded.
For a temporary fix, I've just included the fckeditor.js from the wysiwyg_maxlength in my theme.
Comment #38
haggins CreditAttribution: haggins commentedDid you enable the editor plugin at your editors profile?
Comment #39
haggins CreditAttribution: haggins commentedChanging title again to make this issue easier to find.
Comment #40
Anonymous (not verified) CreditAttribution: Anonymous commentedThis sub-module maybe fix the problem for the wysiwyg module, but I have a CKeditor module.
The #859746: Countdown !remaining not dynamic with CKEditor patch worked well for the previous version, no one can apply it to the new version?
Comment #41
tseven CreditAttribution: tseven commentedI did. Checking the pages source revealed the .js wasn't being included.
I'm using the admin module with the rubik theme,.. that might have something to do with it.
Comment #42
BenK CreditAttribution: BenK commentedSubscribing
Comment #43
held69 CreditAttribution: held69 commentedsubscribing
Comment #44
Anybody@ #37: I can confirm that the module works great in the current Drupal 6.x Version plus the newest Version of tinyMCE.
We use ZEN as Theme, so maybe it's really your Theme causing the incompatibility?
Comment #45
firebus CreditAttribution: firebus commentedthe module in #33 did not work for me with
ckeditor is generally broken (for example, you can hit the bold button and start writing bold text, but the bold button is not highlighted, and there's no way to turn it off - likewise for other buttons)
also, when switching the editor on and off, maxlength totally breaks and the text is not preserved by wysiwyg
I know that when haggins first posted the module, wysiwyg was at a different revision, and perhaps ckeditor was as well.
the module is working for me with tiny_mce 3.4.7.
fyi, i posted an updated patch to maxlength's strip_html feature in #1027966: Do not count html markup to fix some bugs, make it work with wysiwyg disabled, and update to maxlength 6.x-2.0-beta2
Comment #46
MiSc CreditAttribution: MiSc commentedNeed to update wyysiwyg_maxlength, so I uploaded it to a sandbox: https://drupal.org/sandbox/mikkex/2254933
Update of patch coming soon.
Comment #47
MiSc CreditAttribution: MiSc commentedHere is a patch to work with wyysiwyg_maxlength and latest dev of 6.x-2.x.
Comment #48
MiSc CreditAttribution: MiSc commentedUpdated patch, missing include
Comment #49
cedeweyThe 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.