I haven't time to see if things have changed recently, but at last check (6 months ago), it was not possible to update the core editor config without a hack. Is this still the case?

If so, a feature request for this plugin.

<?php
    $plugins['wordcount'] = array(
      'path' => $editor['library path'] . '/plugins/wordcount',
      'extensions' => array('bbcode' => t('WordCount')),
      'url' => 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/wordcount',
      'internal' => TRUE,
      'load' => TRUE,
    ); 
?>

otherwise happy with a "see doco" response and I'll do a more comprehensive search.

Cheers

PS: This module is getting better and better all the time, great work guys!

CommentFileSizeAuthor
#10 wysiwyg-tinymce-wordcount.patch851 bytestwod

Comments

twod’s picture

Status: Active » Fixed

You can use hook_wysiwyg_plugin() to tell the editor about native plugins, where to find them, the buttons/extensions they provide, and any editor settings they need to set or override. (Basically, return the information you have above from the hook implementation.) More info in wysiwyg.api.php in your wysiwyg folder. This hook also existed in 2.0 but has less documentation.
You can also use hook_wysiwyg_editor_settings_alter() to change the settings object before it's converted to JavaScript. More information at the end of #313497: Allow configuration of advanced editor settings. This hook is new to 2.1.

Btw, it looks like you have a typo in your code, it should probably be "wordcount" instead of "bbcode".

alan d.’s picture

Many thanks. :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

smscotten’s picture

Version: 6.x-2.x-dev » 6.x-2.1
Status: Closed (fixed) » Active

I'm having trouble with this. Do I need to add an implementation of hook_wysiwyg_plugin() to my theme file? I tried adding an inc file to the plugins dir but that didn't work out so well.

I ended up adding the wordcount array (modified from the OP) in editors/tinymce.inc—it worked but I suspect editing that file is a no-no since the change will get overwritten the next time I update the wysiwyg module.

I appreciate any pointer in the right direction.

twod’s picture

Status: Active » Patch (to be ported)

The implementation of hook_wysiwyg_plugin() goes into a .module file. I often use a custom module simply called "custom" where I add all site-specific stuff which can't go in template.php (because templates can't implement all types of hooks in D6).

Create a dir "custom" in sites/default/modules (sites/all/modules works fine too, but the sites/default or site/sitename folder makes sure other sites in a multisite install can't access them).

Create "custom.info" in the new folder and add some "meta info" about your module. (Copy one from another module and modify accordingly to give it a unique name.)

Create "custom.module" and add the hook implementation to it.

Enable the module on admin/build/modules just like any other module - Wysiwyg should now be able to find and use the hook.

smscotten’s picture

Got it, thanks.

I think this is a valid feature request then. It seems odd that one would have to create a custom module in order to enable a native plugin that is part of the TinyMCE distribution. Don't get me wrong; it's a great workaround, but I don't see what would hold those seven lines back from going into new versions of the WYSIWYG module.

Or is that why the status has been changed to "patch (to be ported)"?

twod’s picture

Title: WordCount plugin? » WordCount plugin (bundled)
Version: 6.x-2.1 » 6.x-2.x-dev
Category: support » feature
Status: Patch (to be ported) » Active

Whoops. The status change wasn't intentional.

The wordcount plugin was not added until TinyMCE 3.2.6 and I didn't recognize this as an actual feature request until you pointed it out, so it has simply been overlooked.

Allowing this plugin to be enabled is trivial, but we can't provide a GUI for the settings yet. (hook_wysiwyg_editor_settings_alter() implementations won't cut it yet either because they require JavaScript Regular Expressions as values.)

smscotten’s picture

I should have changed the category from support request to feature request. Sorry about that.

Sounds totally reasonable to implement the "trivial" for those of us who are happy with it "out of the box" and let people who need to customize it jump through the customization hoops. That's saving a lot of time and research for 80% and letting the other 20% who need something more specialized do their own footwork.

Thank you!

twod’s picture

The original poster talks about this like a feature request, that's the line I missed. ;)

I'll create a patch for this when I get my dev computer up and running again. (Fan died, things almost fried...)

twod’s picture

Status: Active » Needs review
StatusFileSize
new851 bytes
paskainos’s picture

Very nice! The patch works great, of course. Word count was one of the main reasons I've begun recommending WYSIWYG + TinyMCE on all projects. Makes life easy for things like limited teaser space, etc., etc. In today's online publishing environment, not having word count is like leaving home without your cell phone - you can live without out it, but communication is in some cases severely hampered. Honestly, how did we ever live without word count - or cell phones (snicker)? - 82 words, and counting...

sun’s picture

Status: Needs review » Reviewed & tested by the community
+++ editors/tinymce.inc	23 May 2010 02:18:51 -0000
@@ -589,6 +589,15 @@ function wysiwyg_tinymce_plugins($editor
+      'extensions' => array('wordcount' => t('Word Count')),

Let's fix the capitalization of the label prior to committing - should be "Word count".

Powered by Dreditor.

sun’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for reporting, reviewing, and testing! Committed to all branches.

A new development snapshot will be available within the next 12 hours. This improvement will be available in the next official release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.