Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep toolbar right above the page content text input #3485

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 25 additions & 10 deletions inc/Ui/Editor.php
Expand Up @@ -79,6 +79,8 @@ public function show()
'intro_locale' => $intro,
);

$this->addToolbar($data, $wr);

if ($data['target'] !== 'section') {
// Only emit event if page is writable, section edit data is valid and
// edit target is not section.
Expand Down Expand Up @@ -160,16 +162,6 @@ public function show()

echo '<div class="editBox" role="application">';

echo '<div class="toolbar group">';
echo '<div id="tool__bar" class="tool__bar">';
if ($wr && $data['media_manager']) {
echo '<a href="'.DOKU_BASE.'lib/exe/mediamanager.php?ns='.$INFO['namespace'].'" target="_blank">';
echo $lang['mediaselect'];
echo '</a>';
}
echo '</div>';
echo '</div>';

echo '<div id="draft__status" class="draft__status">';
$draft = new \dokuwiki\Draft($ID, $INFO['client']);
if ($draft->isDraftAvailable()) {
Expand Down Expand Up @@ -209,4 +201,27 @@ public function addTextarea(&$data)
->id('wiki__text')->addClass('edit');
}

/**
* Display the toolbar
*
* @param mixed[] $data
* @param bool $wr
*/
public function addToolbar(&$data, $wr)
{
global $INFO;

$html = '<div class="toolbar group">';
$html .= '<div id="tool__bar" class="tool__bar">';
if ($wr && $data['media_manager']) {
$html .= '<a href="'.DOKU_BASE.'lib/exe/mediamanager.php?ns='.$INFO['namespace'].'" target="_blank">';
$html .= $lang['mediaselect'];
$html .= '</a>';
}
$html .= '</div>';
$html .= '</div>';

/** @var dokuwiki\Form\Form $data['form'] */
$data['form']->addHTML($html);
}
}