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

Edit mode when not logged in, shows textarea field with source text "as button" (includes fix) #611

Open
johngnl opened this issue Jul 18, 2024 · 0 comments
Labels

Comments

@johngnl
Copy link

johngnl commented Jul 18, 2024

Description

Edit mode when not logged in, shows textarea field with source text "as button"

Steps to reproduce

  1. This happens on a DokuWiki page that a user can read but cannot edit
  2. Click on 'Edit' button (or add ?do=edit to the url) to view the source text.
  3. The source text will show as a <textarea> field that is partly formatted as a "success" button

Expected behavior:
As in previous versions of bootstrap 3, the source text should be shown as a grayed out field with all the text shown including newspaces between paragraphs.
(See screenshot 2)

Actual behavior: [What actually happened]
The complete source text is shown on one line, and the field looks like a green success button when one hovers over it with the mouse pointer.
(See screenshot 1)

Versions

  • [Bootstrap3 Template] - Template v2024-02-06 (stable/20240206)
  • [DokuWiki] - Release 2024-02-06a "Kaos"
  • [Plugins] - irrelevant
  • [PHP] - 8.2
  • [Browser] - Mozilla Firefox, Chrome, Edge, etc.

Screenshots or Logs

Screenshot showing issue before fix.

image

Screenshot after fix.

image

Suggested fix

File is ./lib/tpl/bootstrap3/EventHandlers.php

ORIGINAL

public function formEditOutput(\Doku_Event $event)
...
$form->getElementAt($form->findPositionByAttribute('name', 'do[save]'))
    ->addClass('btn btn-success mr-2')->attr('data-dw-icon', 'mdi:content-save');

$form->getElementAt($form->findPositionByAttribute('name', 'do[preview]'))
    ->addClass('btn btn-default mr-2')->attr('data-dw-icon', 'mdi:file-document-outline');

$form->getElementAt($form->findPositionByAttribute('name', 'do[cancel]'))
    ->addClass('btn btn-default mr-2')->attr('data-dw-icon', 'mdi:arrow-left');
...

FIX

public function formEditOutput(\Doku_Event $event)
...
if ($form->findPositionByAttribute('name', 'do[save]') != false)
  $form->getElementAt($form->findPositionByAttribute('name', 'do[save]'))
    ->addClass('btn btn-success mr-2')->attr('data-dw-icon', 'mdi:content-save');

if ($form->findPositionByAttribute('name', 'do[preview]') != false)
  $form->getElementAt($form->findPositionByAttribute('name', 'do[preview]'))
    ->addClass('btn btn-default mr-2')->attr('data-dw-icon', 'mdi:file-document-outline');

if ($form->findPositionByAttribute('name', 'do[cancel]') != false)
  $form->getElementAt($form->findPositionByAttribute('name', 'do[cancel]'))
    ->addClass('btn btn-default mr-2')->attr('data-dw-icon', 'mdi:arrow-left');
...
@johngnl johngnl added the bug label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant