====== Double-click code block selection ======
Adding double-click code block selection((Double-click one of the code blocks below to see what this means!)) to DokuWiki requires some modification to the core engine.
/**
* Function to select code blocks on double-click
*/
function firefive_selectCode(codeBlock) {
var range;
if (document.body.createTextRange) {
range = document.body.createTextRange();
range.moveToElementText(codeBlock);
range.select();
} else if (window.getSelection) {
range = document.createRange();
range.selectNodeContents(codeBlock);
var selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
}
}
-- Call the function when a code block is double-clicked, by adding an ''ondblclick'' attribute to the ''
'' tag that opens a code block. These tags are prepared in the ''_highlight()'' function, found in [[https://xref.dokuwiki.org/reference/dokuwiki/inc/parser/xhtml.php.html|/inc/parser/xhtml.php]]. .. Extend the start of the ''===== Where to find it ===== The line of code appears in different places for different wiki versions: ^Version ^File ^Line number ^ |Igor |inc/parser/xhtml.php | ~702 | |Greebo |inc/parser/xhtml.php | 697, 702 | {{tag> dokuwiki javascript}}