Compare commits
2 Commits
b81e5cf6e4
...
339e171ec7
| Author | SHA1 | Date | |
|---|---|---|---|
| 339e171ec7 | |||
| e1e89b40fb |
@@ -105,8 +105,6 @@ div.picker button.toolbutton {
|
|||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
}
|
}
|
||||||
.dokuwiki .editBar .editButtons button {
|
|
||||||
}
|
|
||||||
|
|
||||||
/* summary input and minor changes checkbox */
|
/* summary input and minor changes checkbox */
|
||||||
.dokuwiki .editBar .summary {
|
.dokuwiki .editBar .summary {
|
||||||
@@ -140,9 +138,46 @@ div.picker button.toolbutton {
|
|||||||
/* section edit buttons
|
/* section edit buttons
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
/* Hidden for now - positioning was problematic */
|
.dokuwiki .section-heading-row {
|
||||||
.dokuwiki .secedit {
|
display: flex;
|
||||||
display: none;
|
align-items: baseline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dokuwiki .section-heading-row > .secedit {
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-left: .4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
[dir=rtl] .dokuwiki .section-heading-row > .secedit {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-right: .4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dokuwiki .section-heading-row > .secedit form {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dokuwiki .section-heading-row > .secedit button {
|
||||||
|
border: 0;
|
||||||
|
padding: .15em;
|
||||||
|
min-width: 1.25em;
|
||||||
|
background: transparent;
|
||||||
|
color: @ini_icons;
|
||||||
|
font-size: 0;
|
||||||
|
line-height: 1;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dokuwiki .section-heading-row > .secedit button::before {
|
||||||
|
content: '\270E edit';
|
||||||
|
opacity: 0.75;
|
||||||
|
font-style: italic;
|
||||||
|
font-size: .95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dokuwiki .section-heading-row > .secedit button:hover,
|
||||||
|
.dokuwiki .section-heading-row > .secedit button:focus {
|
||||||
|
color: @ini_link;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sidebar should never show section edit buttons */
|
/* Sidebar should never show section edit buttons */
|
||||||
|
|||||||
31
main.php
31
main.php
@@ -10,6 +10,37 @@
|
|||||||
|
|
||||||
if (!defined('DOKU_INC')) die(); /* must be run from within DokuWiki */
|
if (!defined('DOKU_INC')) die(); /* must be run from within DokuWiki */
|
||||||
|
|
||||||
|
// Replace default section edit buttons with a compact pencil icon
|
||||||
|
global $EVENT_HANDLER;
|
||||||
|
$EVENT_HANDLER->register_hook('HTML_SECEDIT_BUTTON', 'BEFORE', null, '_luxtools_secedit_button');
|
||||||
|
|
||||||
|
function _luxtools_secedit_button(\dokuwiki\Extension\Event $event, $param) {
|
||||||
|
global $ID, $INFO;
|
||||||
|
$data = $event->data;
|
||||||
|
|
||||||
|
if (!isset($data['name']) || $data['name'] === '') {
|
||||||
|
$event->preventDefault();
|
||||||
|
$event->result = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = $data['name'];
|
||||||
|
$secid = $data['secid'];
|
||||||
|
unset($data['name'], $data['secid']);
|
||||||
|
|
||||||
|
$params = array_merge(
|
||||||
|
['do' => 'edit', 'rev' => $INFO['lastmod'], 'summary' => '[' . $name . '] '],
|
||||||
|
$data
|
||||||
|
);
|
||||||
|
|
||||||
|
$html = '<div class="secedit editbutton_' . hsc($data['target']) . ' editbutton_' . (int)$secid . '">';
|
||||||
|
$html .= html_btn('secedit', $ID, '', $params, 'post', $name);
|
||||||
|
$html .= '</div>';
|
||||||
|
|
||||||
|
$event->preventDefault();
|
||||||
|
$event->result = $html;
|
||||||
|
}
|
||||||
|
|
||||||
$hasSidebar = page_findnearest($conf['sidebar']);
|
$hasSidebar = page_findnearest($conf['sidebar']);
|
||||||
$showSidebar = $hasSidebar && ($ACT == 'show');
|
$showSidebar = $hasSidebar && ($ACT == 'show');
|
||||||
?><!DOCTYPE html>
|
?><!DOCTYPE html>
|
||||||
|
|||||||
21
script.js
21
script.js
@@ -139,6 +139,27 @@ jQuery(function(){
|
|||||||
}
|
}
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
// Relocate section edit buttons next to their headings.
|
||||||
|
// DokuWiki renders the edit marker after the section content div,
|
||||||
|
// so we match by secid: .editbutton_N belongs to h*.sectioneditN.
|
||||||
|
(function enhanceSectionEditButtons() {
|
||||||
|
jQuery('#dokuwiki__content .secedit[class*="editbutton_"]').each(function () {
|
||||||
|
var $btn = jQuery(this);
|
||||||
|
var match = $btn.attr('class').match(/editbutton_(\d+)/);
|
||||||
|
if (!match) return;
|
||||||
|
|
||||||
|
var $heading = jQuery('#dokuwiki__content .sectionedit' + match[1]);
|
||||||
|
if (!$heading.length || !$heading.is('h1,h2,h3,h4,h5,h6')) return;
|
||||||
|
|
||||||
|
// Skip if already relocated
|
||||||
|
if ($heading.parent().hasClass('section-heading-row')) return;
|
||||||
|
|
||||||
|
var $wrapper = jQuery('<div/>', {'class': 'section-heading-row'});
|
||||||
|
$heading.before($wrapper);
|
||||||
|
$wrapper.append($heading, $btn);
|
||||||
|
});
|
||||||
|
}());
|
||||||
|
|
||||||
// enhance header search with suggestions and keyboard navigation
|
// enhance header search with suggestions and keyboard navigation
|
||||||
(function enhanceSearch(){
|
(function enhanceSearch(){
|
||||||
var $input = jQuery('#qsearch__in');
|
var $input = jQuery('#qsearch__in');
|
||||||
|
|||||||
Reference in New Issue
Block a user