wysiwyg

What you see is not always what you get (15)

As I've mentioned before setting up a Wysiwyg in Drupal has become a straightforward job. A popular method is using the Wysiwyg module in combination with CKEditor. Enable the module, install the editor library and make sure to allow the <img> tag in your input format and you're good to go, right? Sadly, this is not always the case. It's important to note that as a security measure all input formats except the 'Full HTML' format remove all attributes from an html tag. This means that even though the image option in your favorite Wysiwyg editor allows you to align an image to the right and setting a margin, your input format will remove these attributes. Here's a clean example of CKEditor using the standard align and margin functionality:

Using the default 'Filtered HTML' input format and allow the img tag, this renders the following output:

What we saw in the Wysiwyg is definitely not what we see in the actual output because the input format removed the attributes that we set to style and position the images.

So how can we fix this? In Drupal core, we can not: the only option you have is to enable the 'Full HTML' filter, which is not advisable. Your best option is to install the Wysiwyg Filter module which enables a whole range of extra settings for input formats, allowing you to select which attributes, classes and properties should be allowed for which html tags. Such as the 'align' attribute and 'margin' property for images.

Continue reading »

The Wysiwyg and CCK multiple value fields (9)

Setting up a Wysiwyg or rich text editor in Drupal is a straightforward task: you download the Wysiwyg module along with the library of your favorite editor and you're good to go. You will run into issues when you're using CCK multiple value fields though:

  • You will experience data loss when adding more fields: all content added to existing fields will disappearing when you click the "Add another item" button to add a new field.
  • Depending on which editor you use, there's a chance of hick-ups and data loss when using the drag-and-drop interface to rearrange fields.
  • Depending on which editor you use, you will run into different kinds of unexpected behaviors when adding your first new item after clicking the "Add another item" button. These issues can range from the editor only appearing on the first field, to only appearing on the last field, or from the editor disappearing completely.

The first two issues can be fixed by installing the Wysiwyg API CCK Integration module, which itself depends on three other modules: JS Alter, jQuery Form Update and jQuery AOP. These modules require no configuration: just enable them to fix the problems.

The third issue however is more tedious. I've tried fixing the bug with hook_form_alter() and CCK fields along with the Wysiwyg integration guide but these don't play along nicely. The added difficulty is that the problem varies depending on which editor you use. The only bulletproof "solution" I've found this far is to simply use the FCKeditor editor: it's the only editor that doesn't appear to cause any unexpected behavior. Do note that these problems are only fixed if you use the FCKeditor with the Wysiwyg module: the FCKeditor module itself still has these issues.

Continue reading »

Oh no, it's a WYSIWYG! (11)

I came across this interesting slide on Drupal Talk:

List of most downloaded Drupal 6 modules
"Drupal 6 modules" by avorio

Continue reading »

Multi-user blogging: DrupalMU (8)

Last year I did a comparison between Drupal and WordpressMU in terms of how both relate in terms of the multi-user blogging experience. The conclusion was that WordpressMU had all the bells and whistles and that it was clearly more experiences in terms of end-user friendliness and usability, but that it lacked the much more mature technical implementation that Drupal could offer. I made it my personal battle plan to set up an installation profile for Drupal, developing any missing modules in the process, to bring the best possible multi-user blogging platform both in terms of usability and technical stability. I dubbed it DrupalMU.

Continue reading »
Syndicate content