I had posted this patch that just swapped out textarea fields named "body", but I think this new patch is an even better solution.

This patch adds a setting to choose whether all textarea fields are automatically swapped out (the normal current behavior) or whether to just add a link below each saying "turn on WYSIWYG for [textareaname]". This link triggers a JavaScript that swaps out the textarea field with the FCKeditor. Note that none of this will appear for non-supported browsers (like Safari).

I don't think that there's currently any difference between the fckeditor.module in CVS and 4.5, so this patch should work for either version of the fckeditor.module file.

The patch also adds a menu choice for a "Drupal" toolbar set. This is a set that I've found gives non-technical users enough capabilities to create content without violating site design guidelines. In other words, they can't define their own fonts or build complex tables.

In order to use this set, you'll need to add this code to the /modules/fckeditor/lib/fckconfig.js file:

FCKConfig.ToolbarSets["Drupal"] = [
	['Source'],
	['Cut','Copy','Paste','PasteText','PasteWord'],
	['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
	['Bold','Italic','Underline'],
	['OrderedList','UnorderedList','-','Outdent','Indent'],
	['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
	['Link','Unlink'],
	['Image','Rule','SpecialChar'],
	['FontFormat'],
	['TextColor','BGColor'],
	['About']
] ;

I'm still pretty new to the patching system, so please let me know if this patch works / doesn't work for you.

-Jeff

CommentFileSizeAuthor
wysiwyglink.patch3.71 KBjjeff

Comments

tulula’s picture

Just Tried this out and accidently hit the "ON for WYSIQYG..." a couple of times so it generated duplicate bodies. OOPSSSSS

Is there an ON that can be done and and OFF as well on same line.

Still very much favour what HTMLAREA had for being able to toggle on/off in the admin settings for EACH of the body text area sections.

Lisa

Anonymous’s picture

Hmmm.. I'll have to take a look at the way that the HTMLArea.module handles things.

As for the multiple editor instances... Oops is right... I'll see what I can do about that.

-Jeff

Anonymous’s picture

Anonymous’s picture

Version: » master
Anonymous’s picture

Version: master »

Jjeff,

Absolutely brilliant, Thanks! That was exactly what I was looking for toe make fckeditor viable for my site.

Anonymous’s picture

Category: feature » bug

Hi Jeff,

I've noticed one issue with your patch in Firefox on XP (SP1)--when I activate the patch, I can no longer use the 'paste as' buttons. To reproduce:

1) Open a word document;
2) Select and copy the document text;
3) In Drupal start a new page, story, whatever;
4) Click on the WYSIWYG link to activate FCKeditor;
5) Paste options are not available (including right-click and CTRL-V);

Pasting was working normally prior to patching.

Best,
Todd

Anonymous’s picture

Sorry, forgot to add that it does work in IE6.

--Todd

jjeff’s picture

Just wanted to mention here that I've just made a patch for the tinyMCE.module that does the same thing. Mathias should be incorporating it in the next few weeks. The WYSIWYG link for tinyMCE gives the ability to turn the editor on and back off again.

My patch also adds lots of settings for tinyMCE such as the ability to set the height and width of the editor as well as defining custom css for the editor area (or using css from current theme!). And lots more. The tinymce.module is going to be really cool.

1) It looks like development on the fckeditor.module is dead (so I don't know if I'll be updating this patch).
2) TinyMCE is good! Check it out.

-Jeff

ontwerpwerk’s picture

Status: Needs review » Closed (won't fix)

new formapi, new verison of drupal, new version of fckeditor .. i'll abandon this one for now