A warning sticker on a wooden stick
The martial artist should be warned.

WYMeditor content updating

In kobudo.fi the content editing is done with a jQuery plugin called WYMeditor.

It works remarkably well in Firefox, but in the loving Internet Explorer the content of the original content container was not updated when the update event was something else than “click”. I wanted to use “mousedown” which would trigger in most cases few milliseconds earlier than “click” event, thus giving more time for the browser to do its javascript processing. Below is the current implementation shown.

$('textarea.editor').wymeditor({

    lang: 'en',

    xhtmlParser: 'xhtml_parser.min.js',

    cssParser: 'wym_css_parser.min.js',

    stylesheet: 'css/kobudo.fi.css',

    jQueryPath: 'js/jquery.set8.min.js',

    updateSelector: '#formsubmit',

    updateEvent: 'click'

});

The file called “jquery.set8.min.js” is a set of jQuery and common plugins needed througouht the site, in minified form. At the time of writing, the plugins and their versions are the following:

  • jQuery 1.2.3
  • dimensions revision 4841
  • cluetip 0.9.6 (actually using 0.9.3 since 0.9.6 has some performance issues)
  • TableSorter 2.0.3
  • validate 1.2.1
  • bgiframe 2.1.1
  • Autocomplete 1.0 beta
  • UI.datepicker 3.4.3

WYMeditor used here is the release version 0.4.

An example for testing purposes of the difference between browsers and the event handlers is available at kobudo.fi:

Using “click” event as the update handler

Using “mousedown” event as the update handler.