[dokuwiki] Toolbar refactoring

  • From: Andreas Gohr <andi@xxxxxxxxxxxxxx>
  • To: DokuWiki Mailinglist <dokuwiki@xxxxxxxxxxxxx>
  • Date: Thu, 28 May 2009 18:11:18 +0200

Hi everybody,

I just pushed a few patches that are the start of refactoring the
whole JavaScript for the toolbar handling.

We now have two more JavaScript files called toolbar.js and textselection.js

textselection.js now streamlines all the functions to get the selected
text in a textarea (in a crossbrowser way) and to replace/insert or
modify text in it. This replaces a whole bunch of duplicated code that
was taken from different other projects.

toolbar.js contains some functions that where to be found in edit.js
before. all functions here where revamped and cleaned up. I also tried
to get rid of some of eval() calls in there. This process isn't done
yet, there are still some functions that need some love before they
are moved to the new file.

I tried to keep most function signatures as they where before, but
some plugins might choke on it nonetheless.

I also extended the handling of the toolbar array. It is now no longer
necessary to use a creator function for custom types - you can specify
a click function right away. An example would be the tb_format() and
tb_insert() functions.

Additionally it is now possible to put completely new toolbars inside
the 'list' property of a picker. This makes sub menus and
(theoretically but untested) arbitrary deep nested menu cascades
possible. The picker type now also accepts a class property which can
later be used for styling the picker and its contents individually.

The last change is the new headline buttons. I just quote the patch
description here:

  The toolbar now features three new buttons to insert a headline. Instead of
  asking the user for the headline level it asks if she wants a higher, lower
  or equally leveled section (relative to the current one).

  This means the user no longer has to count in which section she currently is
  and encourages users to use the proper order of headline levels.

  To make room in the toolbar, the old buttons have been moved in a picker.


In theory all this new JavaScript stuff should work just fine in any
browsers. But that is most probably not the case in real life. Be sure
to do a forced reload of all caches when something doesn't work, then
report bugs please.

Andi

-- 
splitbrain.org
-- 
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts:

  • » [dokuwiki] Toolbar refactoring - Andreas Gohr