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!
Comments
Comment #1
twodYou 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".
Comment #2
alan d. commentedMany thanks. :)
Comment #4
smscotten commentedI'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.
Comment #5
twodThe 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.
Comment #6
smscotten commentedGot 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)"?
Comment #7
twodWhoops. 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.)
Comment #8
smscotten commentedI 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!
Comment #9
twodThe 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...)
Comment #10
twodComment #11
paskainos commentedVery 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...
Comment #12
sunLet's fix the capitalization of the label prior to committing - should be "Word count".
Powered by Dreditor.
Comment #13
sunThanks 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.