User Tools

Site Tools


synology:dokuwiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
synology:dokuwiki [2023/02/21 22:58] – [Theme Adjustment] Wuffsynology:dokuwiki [2026/07/26 13:57] (current) Wuff
Line 1: Line 1:
-====== DokuWiki on Synology ======+====== DokuWiki Configuration ======
  
 Admin, extensions: Admin, extensions:
Line 255: Line 255:
 </code> </code>
 insert after line 23 relating to favicon: insert after line 23 relating to favicon:
-<code>+<code php>
 <?php <?php
     $look = array(':wiki:apple-touch-icon.png', ':apple-touch-icon.png', 'images/apple-touch-icon.png');     $look = array(':wiki:apple-touch-icon.png', ':apple-touch-icon.png', 'images/apple-touch-icon.png');
Line 264: Line 264:
  
 ===== Allow additional file types ===== ===== Allow additional file types =====
-Log into synology via ssh or access the dokuwiki folder.\\  
 <code> <code>
-cd /volume1/web/dokuwiki/conf +cd dokuwiki/conf 
-sudo cp mime.conf mime.local.conf +cp mime.conf mime.local.conf 
-sudo vi mime.local.conf+vi mime.local.conf
 #delete all but the text files towards the end of the file and enable them #delete all but the text files towards the end of the file and enable them
 #add json text/json #add json text/json
Line 285: Line 284:
  
 Adjustment hack to show parent namespace: Adjustment hack to show parent namespace:
-dokuwiki/lib/plugins/pagelist/helper.php line 487 (as of Feb 2023+dokuwiki/lib/plugins/pagelist/helper.php line 656 function printPageCell (as of Feb 2024
-<code> +<code php
-        / produce output +// produce output 
-        $parentnamespace = getNS($id); +        $parentnamespace = getNS($id);
         if(useHeading('navigation')) {         if(useHeading('navigation')) {
             // get page title             // get page title
Line 299: Line 298:
             $parentnamespace.=' -> ';             $parentnamespace.=' -> ';
         }         }
-        $content '<a href="'.wl($id).($this->page['section'] ? '#'.$this->page['section'] : ''). +        $section !empty($this->page['section']? '#' . $this->page['section'] : ''
-            '" class="'.$class.'" title="'.$id.'">'.$parentnamespace.$title.'</a>'; +        $content = '<a href="' . wl($id) . $section . '" class="' . $class . '" title="' . $id . '"  data-wiki-id="' . $id . '">' . $parentnamespace.$title . '</a>'; 
 +        if ($this->style == 'list') { 
 +            $content = '<ul><li>' . $content . '</li></ul>'; 
 +        } 
 +        return $this->printCell('page', $content); 
 +    }
 </code> </code>
  
Line 310: Line 313:
 php bin/plugin.php extension install https://github.com/.../support_keycloak10.zip # installs from the URL php bin/plugin.php extension install https://github.com/.../support_keycloak10.zip # installs from the URL
 php bin/plugin.php extension install addnewpage # finds the download URL, install from it php bin/plugin.php extension install addnewpage # finds the download URL, install from it
 +</code>
 +
 +===== Fix code copy =====
 +
 +The code copying replaces empty new lines with space (nbsp;) which are copied via selection or using the copy button. To replace the spaces with actual newlines, create conf/userscript.js and copy the following code, then save and hard-refresh the browser:
 +<code javascript conf/userscript.js>
 +jQuery(function() {
 +    // Helper function to sanitize text formatting
 +    function cleanDokuWikiCodeSpaces(text) {
 +        return text
 +            .replace(/\r\n/g, '\n'             // Standardize linebreaks
 +            .replace(/\n[ \u00A0]+(?=\n)/g, '\n') // Remove spaces sitting completely alone on a line
 +            .replace(/^[ \u00A0]+\n/, '\n'      // Clean leading blank lines
 +            .replace(/\n[ \u00A0]+$/, '\n');      // Clean trailing blank lines
 +    }
 +
 +    // FIX 1: Handle standard user manual mouse selections (Ctrl+C)
 +    document.addEventListener('copy', function(e) {
 +        const selection = window.getSelection();
 +        if (selection.rangeCount > 0 && selection.anchorNode.parentElement.closest('pre.code')) {
 +            let cleanedText = cleanDokuWikiCodeSpaces(selection.toString());
 +            e.clipboardData.setData('text/plain', cleanedText);
 +            e.preventDefault();
 +        }
 +    });
 +
 +    // FIX 2: Handle DokuWiki Core's Native Async Copy Button
 +    document.addEventListener('click', function(e) {
 +        // Targets DokuWiki's core copy elements (like .button-copy or data targets)
 +        const btn = e.target.closest('button, a, div') && e.target.closest('[class*="copy"], [id*="copy"], [data-clipboard-target]');
 +        if (!btn) return;
 +
 +        // Force monitor the system clipboard immediately following the click
 +        let attempts = 0;
 +        const maxAttempts = 10;
 +
 +        const checkAndCleanClipboard = setInterval(async () => {
 +            attempts++;
 +            try {
 +                let currentText = await navigator.clipboard.readText();
 +
 +                // If clipboard contains data and has the raw space error, rewrite it immediately
 +                if (currentText && (currentText.includes('\n ') || currentText.includes('\n\u00A0'))) {
 +                    let cleanedText = cleanDokuWikiCodeSpaces(currentText);
 +                    await navigator.clipboard.writeText(cleanedText);
 +                    clearInterval(checkAndCleanClipboard); // Success, stop looping
 +                }
 +            } catch (err) {
 +                // Clipboard permissions might delay slightly, keep trying
 +            }
 +
 +            if (attempts >= maxAttempts) {
 +                clearInterval(checkAndCleanClipboard); // Timeout safety fallback
 +            }
 +        }, 30); // Check every 30ms for immediate execution
 +    });
 +});
 +
 </code> </code>
  
synology/dokuwiki.1677020305.txt.gz · Last modified: (external edit)