0

I've been using MD Character Count on a text field to force users to keep the size of a summary field short and concise. But I want to switch it to a Wygwam field so the method of adding links is the same as the Wygwam body field. I've looked at Limitee as well but it doesn't do Wygwam fields. I know I can limit the amount of text on output in the template but I need the author to now when they have hit the limit.

2 Answers 2

1

Old question but just implemented this using the latest WYGWAM (v3.3.3)

Grab the Wordcount plugin and the Notification Plugin for CK Editor, and put them into your /themes/third_party/wygwam/lib/ckeditor/plugins folder.

Create a new WYGWAM editor configuration with the extraPlugins option selected in 'Advanced Settings'. Enter wordcount in there and save/update the configuration.

To configure those settings, you'll need to add the following to your /themes/third_party/wygwam/lib/ckeditor/config.js (inside the `editorConfig' function).

config.wordcount = {

    // Whether or not you want to show the Paragraphs Count
    showParagraphs: true,

    // Whether or not you want to show the Word Count
    showWordCount: true,

    // Whether or not you want to show the Char Count
    showCharCount: true,

    // Whether or not you want to count Spaces as Chars
    countSpacesAsChars: false,

    // Whether or not to include Html chars in the Char Count
    countHTML: false,

    // Maximum allowed Word Count, -1 is default for unlimited
    maxWordCount: -1,

    // Maximum allowed Char Count, -1 is default for unlimited
    maxCharCount: -1
};

Et Voila.

enter image description here

0

I've actually created an addon which adds a similar feature to Wygwam. I've uploaded this to https://github.com/ignetic/ee-wygwam-plugins which I hope you find useful.

It has 'doksoft_stat' plugin already placed within the wygwam_plugins theme folder, though you might want to look at the 'wordcount' plugin (simply remove the dot from the folder name to enable it). While these don't limit the number of words/characters, it does the next best thing to display the stats.

Do let me know if this works for you or if you find any issues with it.

All the best...

1
  • Thanks for this and it might be useful, but I really want something to give a specific warning about going over or the option to actually stop it accepting characters over a set number. It also needs to be able to be applied to specified individual fields. It looks like some of this might be possible within the wordcount plugin as there is a lot of commented out code about limits. The renaming of the plugin folder with a preceding dot isn't allowed in OS X so I just deleted the ones not wanted.
    – Paul Frost
    Commented Sep 20, 2014 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.