YUI Editor - a simple and easy WYSIWYG

Quite frankly, implementing WYSIWYG editors (and choosing the right one) for Drupal websites has been a pain in the ass the past few years.  For a while I bounced between FCK and TinyMCE - both integrated in the right fields fine and played well with IMCE for image uploads, but I remember finding their markup dirty (lotsa br tags etc..) and clients getting quite confused with line breaks in the editor not being truly mirrored on live content.  Of course, some of this is due to configuring Input Formats properly, but then there's also general interface and aesthetic issues with those mentioned editors.

Recently I've begun implementing HTMLbox on a bunch of sites - its simple, seems to markup html pretty well, and affords site users the basic buttons for simple formatting and link embeds [look out for a more in-depth review soon].  However, one downfall with it is a reliance on IMCE for facilitating embedded image uploads.  For anyone who's ever used IMCE, you'll know how confusing it can be for anyone unfamiliar with inline editing - though it integrates with the editor, its interface is still seperate and requires a lot of styling effort to pretty it up etc...

So, though HTMLbox is pretty nice, I've really been looking for an editor which installs light and easy *and* offers the ability to upload images inline - whilst editing a piece of content.  Added bonuses are future scalability and options for extending editor functionality to include things like seamless Flickr image and Youtube video embeds.

Guess what?
  I found all that in YUI Editor - a module for Drupal which lets you use the Yahoo User Interface Editor within your own site.  I highly recommend installing it and playing around; you'll be using it in no time and find that all the basic functions are there... though as Nick Lewis recently blogged, there are downsides with this Drupal implementation limiting the extensibility of the editor. 

Personally, I love the embedded image handling with YUI Editor but hate how it offers a very basic, Wordpress-esque, feature set - ultimately, there is no imagecache-style on-the-fly image sizing/thumbnailing, rotation etc...  However, as you'll be using the YUI module in order for the Editor to work, your sites can now benefit from other Yahoo User Interface widgets like their Calendar and html button override.


Was not able to get this to work.

Dan's picture

I wasn't able to get Yui editor to work.  Got Yui-2.6.0 in files/lib like the readme said. that didn't do it.  Put the library in the sites/default/files/yui-2.6.0 and that didn't work.  Enabled all the modules (YUI and YUI Editor) in drupal and there are no drupal complaints (system error messages) about it.  But it just doesn't show up when I create new nodes.  The documentation is terrible.

I'm surprised you said "you'll be using it in no time".

   -d

More of the same

Plus Size Swimwear's picture

I've also had similar problems with Drupal.

Thanks for the heads up.

Sharon's picture

Thanks for the heads up. This is great! Just starting to use Drupal, have been with WP for the longest time, and was looking for something that could replace the visual editor that Im used to  using. The only problem with the visual editor used to be that it liked to break some coding once in a while. :) Sharon

I'm with you Sharon, Drupal

Red's picture

I'm with you Sharon, Drupal is a lot more complex than I thought it would be, especially compared to easy Wordpress.  Thank you for the visual editor tip Qasim

Like everyone else is saying

Widgets Guy's picture

Like everyone else is saying here, I think people really like wordpress, but once they get used to Drupal, they are sold forever!

I've had the same experience

matt's picture

I've had the same experience with wysiwyg editors. For some reason, they like to add in a bunch of irrelevant code.  I have gone back to using html editors since I know that way I can make sure the code is clean. One funky addition, and my whole template get's broken.

My WYSIWYG Experience so far...

Scott Lahteine's picture

I love YUI's look and feel, and I wish I could completely recommend it, but it has rendering issues in Safari / Chrome, which unfortunately are the fault of the browsers themselves. Basically, if the image properties dialog is open on top of the editor and you scroll the editor you get trails as the popup's pixels are scrolled right along with the text field. Nasty... For clients that don't use Safari or Chrome this might be alright.

The ultimate solution for ease of use in my experience so far has been WYSIWYG Pro, followed by FCKeditor and IMCE. But none of these does a perfect job of integrating image uploads.

What I ultimately want for my clients is a simple WYSIWYG editor with minimal formatting options and a simple image uploader. A file-browser option, or better yet a browser of Image Nodes is a good feature to have so users can use existing site images, but users should also be able to upload an image on the fly, select the alignment and alt tags, maybe resize the image, and get back to editing quickly.

Automatic tracking of images used inside content boxes would be a great feature. The workflow should work like this:

  • A user clicks the image button.
  • Image dialog appears with upload button and image (node) browser.
  • User uploads a new image, which may or may not become a new node.
  • User selects alignment, enters alt/title/description.
  • User clicks "Insert" button to keep the image.
  • The image appears in the WYSIWYG.
  • User submits the content form.
  • At this point the image could be tracked by another Drupal module, like so:
    • Scrape the HTML code from the WYSIWYG field.
    • Collect all img tags' src attributes.
    • Keep the ones within the site, ignore external images.
    • For new content, remember all images, setting their usecount=1
    • Otherwise, see if images were added/removed from earlier content.
    • Decrement usecount of missing images, delete images with usecount==0.

This would automate image-tracking, providing you remove the ability to delete images within an image browser. You could still allow users to make use of images in nodes, or images from folders, but make exceptions for the types of images you don't want to auto-manage. By using WYSIWYG editing throughout the site, wherever content is managed, you can eliminate the need to add an image field to many nodes.

Another idea is to use the node system as the basis for remembering images in the scheme I outlined, and to allow nodes to provide either their own image or refer to an existing Image node.

Obviously there is no perfect solution. By allowing users to insert images into WYSIWYG fields, you undermine the careful management that having image fields on nodes provides. You also open up the possibility for users to accidentally delete images that are in use, and to fill up their files folder with dozens of images that aren't being used anywhere. It also makes it more difficult to take advantage of modules like ImageCache and those that allow you to size, rotate, and crop images while uploading.

It would benefit Drupal enormously to have a more unified model for managing images and other inline media, combining the best aspects of nodes, imagecache, and automated tracking, and perhaps something like this will come along in the same manner as the WYSIWYG API is now unifying the interfaces for many rich text editors.

Added bonuses are future

dating services's picture

Added bonuses are future scalability and options for extending editor
functionality to include things like seamless Flick r image and You tube
video embeds.
Regards,

Hello there. I was just

earn from your blog's picture

Hello there. I was just wondering if you could maybe give me some of the pros of using Drupal as opposed to say maybe wordpress for you blog.  I have heard a little bit about Drupal but, I am not sure if it would be right for me. Any information you can give me about it would be greatly appreciated. Thanks.

Glad I stumbleupon here.

yahoo seo's picture

Well, I’m glad I stumbleupon your blog post today. I’ve been having similar issues like yours and I think the suggestion on using YUI editor could be the answer to my nightmares. Thanks.

Nice blog, thanks for the

automobiles's picture

Nice blog, thanks for the post

Personally I find WYSIWYG

Fall Arrest Equipment's picture

Personally I find WYSIWYG editors generally deal with images very badly.  You end up with pages with huge images (like 500k) with small height and width properties to give the illusion of a thumbnail (this "thumbnail" just eats up loads of bandwidth completely unnecessarily).  You need to integrate a WYSIWYG editor with a good file manager which first resizes your images and then the WYSIWYG editor dynamically chooses the most appropriate size image based on your height/width properties of the image on the page. So if you upload 1 image, it's stored in (for example) 3 image sizes - thumbnail (e.g 150 pixels wide, maintaining aspect ratio), medium size (e.g. 350 pixels wide, maintaining aspect ratio), and actual size.  If I was to resize the image dynamically in the WYSIWYG editor down to 140 pixels in width, it would choose the thumbnail to represent this image - that way you don't waste bandwidth and also the image simply looks better (squashed huge images look awful).

The web needs a lot of

The web needs a lot of cleaning up from dodgy WYSIWYG editors that have created ugly HTML, as well as enabling non-technical people to squash large images down to thumbnail size (as above commenter noted). 

What's worse is where you

Dave DIY's picture

What's worse is where you get people copying Word documents and pasting them into WYSIWYG editors.  Makes for very messy markup. 

Also, WYSIWYG editors should disable things like text colouring - there should be no need for it.  That's what the CSS file is for.  Who needs to make a word in red for example? Why would you want to do that? It breaks accessibility and often you get web pages with multi-coloured text that's hard to read (e.g. yellow text on white background).

Gotta agree about the text

Reading Festival Fan's picture

Gotta agree about the text formatting options on WYS editors.  Get rid of optional size and colours.  No need to play around with those.  Keep your pages tidy.  Keep your text uniformly formatted. 

music movie tube

music movie tube's picture

Nice post..thanks.

movie

movie's picture

Nice post..thanks.

music

music's picture

Thanks for the info.

general

general's picture

Great post thanks.

Yui Is Awesome

simple jar's picture

Hi ya'll i've been a web developer for the longest time and i have to say YUI is awesome. You don't need to know much and you can pick it up real quick. Best part is you can become an Ajax master in a short period of time using YUI.

YUI = Best Front End JS

jack's picture

There are many JS libraries out there but if you want build rich front end Gui's YUI is way to go. It's got a lot of built widgets like accordian and carousel. It has saved me a lot of time on my projects

Awesome post!!

penny slots online's picture

Yeah, you can extend it. It's YUI. Learn the YUI way and you can add or
remove buttons at will. You can even add much more advanced
functionality such as adding a reference to a node. If you do that,
please contribute it. :-)

WYSIWYG editors need to be

WYSIWYG editors need to be simplified - many have an overkill amount of options - 90% of which the vast majority of users never use.

wysiwyg editors

PeterV's picture

Using YUI editor could be the solution to my problems. I have had the same experience with wysiwyg editors on my consumer electronics blogs. Drupal appered to be more complicated than it looks. I am a big fan of clean HTML so I'm planing to use YUI editor for my future electronics and cordless phones projects. Thanks for the info. I am very happy that I have found this page. Wysiwyg crazy formatting options made my life miserable.

I'm using it, so far so good

cooking games's picture

I'm using it, so far so good I presume.

YUI Editor is the best one,

Thomas's picture

YUI Editor is the best one, because it is very easy to work with, I used it for a while already one my electronics and cordless phones blog. Very simple, I`ve never tried the Yahoo one, but i am looking forward to try it. Great article, Thanks for keeping me up to date with technologies.

Thanks man - I was looking

sleep watch reviews's picture

Thanks man - I was looking for a good set of WYSIWYG libraries for my forum Im trying to make. This will make my life a lot easier thats for sure. I appreciate it.

bartending online

josh's picture

Thanks for sharing info.. from now i try to html buttons overriding and some magics..


  <a href="http://rapidbartender.com">bartending
online</a>



Great site

Bath Screen's picture

Great blog keep up the good work


 


Jill xx

It is even difficult to test

Deniel | cheap web hosting's picture

It is even difficult to test all those editors one by one to determine which might be the best but it is really a big pain. Thanks for your post because it always make it easy to select something.

Thanks a lot for this. Its a

wine clubs's picture

Thanks a lot for this. Its a huge help. It is amazing piece of code.
Thanks a ton once again…

I was reluctant to install

free music's picture

I was reluctant to install this plugin because it is relatively new
one. I am tired of my current captcha system because it is starting
showing some errors to users or it doesn't show any image. I searched
this in Google and landed on your blog page.Good sharing.

thanks for sharing!

tamiflu's picture

thanks for sharing!

Watch online movies

Watch online movies's picture

Thanks for the info.

The drupal gives more

gillope's picture

The drupal gives more relative information about the clients getting quite confused with line breaks in the editor not being truly mirrored on live content.
Regards,

I love the embedded image

casino en linea's picture

I love the embedded image handling with YUI Editor but hate how it
offers a very basic, Wordpress-esque, feature set - ultimately, there
is no imagecache-style on-the-fly image sizing/thumbnailing, rotation
etc...

I was just wondering if you

clubpenguin's picture

I was just wondering if you could maybe give me some of the pros of
using Drupal as opposed to say maybe wordpress for you blog.  I have
heard a little bit about Drupal but, I am not sure if it would be right
for me. Any information you can give me about it would be greatly
appreciated.

I create yui Editor in

microsoft certification's picture

I create yui Editor in drupal and now working fine i am very happy now. Thanks for helpful and useful post. Your way of describing is very good and easy to use.

i've got the same problems

tamiflu's picture

i've got the same problems with drupal