Skip to content

Commit

Permalink
Added double-click funnction to open dw editor when in ckgedit mode
Browse files Browse the repository at this point in the history
  • Loading branch information
turnermm committed Apr 22, 2017
1 parent 081d827 commit 1647d3e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Changes
Expand Up @@ -1037,3 +1037,6 @@ Apr 20
New setting htmlok gives option of allowing HTML_BLOCKs without setting DW's htmlok to true.

Changed option to hmtlblock_ok and set default to false.

Apr 22
Added double-click funnction to open dw editor when in ckgedit mode
24 changes: 24 additions & 0 deletions script.js 100644 → 100755
Expand Up @@ -297,3 +297,27 @@ var dokuBase = location.host + DOKU_BASE;
jQuery("div.error").hide();
}
});


jQuery(document).ready(function(){

$dokuWiki = jQuery('.dokuwiki');

/**
* If one or more edit section buttons exist?
* This makes sure this feature is enabled only on the edit page and for users with page edit rights.
*/
if (jQuery('.editbutton_section', $dokuWiki).length > 0) {

// register double click event for all headings and section divs
jQuery('[class^="sectionedit"], div[class^="level"]', $dokuWiki).dblclick(function(){
// find the closest edit button form to the element double clicked (downwards) and submit the form
var f = jQuery(this).nextAll('.editbutton_section:eq(0)').children('form:eq(0)');
//alert(jQuery(f).hasClass('button'));
jQuery('<input />').attr('type','hidden').attr('name','mode').attr('value','dwiki').appendTo(jQuery(f));
jQuery('<input />').attr('type','hidden').attr('name','fck_preview_mode').attr('value','nil').appendTo(jQuery(f));
f.submit();
})
}

});

0 comments on commit 1647d3e

Please sign in to comment.