DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:doubleclickedit

Use jQuery to Enable Double-clicking to Edit


This snippet is broken. Refer to Double Click to Open a Section Edit (improved) version for a working solution.


Many WIKI's and CMS's have the ability to double-click an article to go straight to edit mode. DokuWiki doesn't have this as standard.

the following JavaScript:

jQuery(function(){
  /* Double-Click the contetnt area to go to edit */
  jQuery('#bodyContent').dblclick(function(event) {
    // console.log('calling doubleclick on tag='+this.tagName+', class='+this.className);
 
 
    if (event.target.tagName != 'TEXTAREA') {
       window.location = '?do=edit';
    }
  });
});

This binds a doubleclick event to DIV#bodyContent. As long as the event does not occur in the edit textarea (which would mean that we are already in edit mode), this redirects the browser to the edit mode for the page.

Julian Knight 2012-03-27

tips/doubleclickedit.txt · Last modified: 2017-05-30 09:05 by 43.249.187.104

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki