Allow 'button' tags to be valid in clean_html

Bug #1560780 reported by Robert Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Wishlist
Unassigned

Bug Description

If I want to add a string like:

<button type="button" class="btn btn-warning">Warning</button>

To tinymce to display a bootstrap type button it doesn't display as the clean_html() htmlpurifier strips it out

Can / should we allow <button> to be not stripped out?

See forum question: https://mahara.org/interaction/forum/topic.php?id=7550&offset=0&limit=10#post30356

Adding $def->addElement('button', 'Inline', 'Inline', 'Common'); to clean_html() will allow button to show after saving.

Changed in mahara:
status: New → Confirmed
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/8249

Robert Lyon (robertl-9)
Changed in mahara:
status: Confirmed → In Progress
milestone: none → 18.04.0
Revision history for this message
Niranjan (niranjan528) wrote :

URL: https://bugs.launchpad.net/mahara/+bug/1560780

Bug description: Allowing button tag in the tinymce

Environment to be tested: Master
Browser to be tested: Any browser

Precondition:
1. A normal user ‘User one’ should exist.
2. A group ‘Group one’ should exist.

Steps to reproduce:

1. Log in as a ‘User one’.
2. Navigate to Main menu > Portfolio > Pages and collections.
3. Click the ‘Add’ button.
4. Click the ‘Page’ button.
5. Enter the ‘Page title’ as ‘Page 01’.
6. Click the ‘Toggle toolbar’ icon under ‘Page description’ to show full list of buttons.
7. Click the ‘Source code’ button.
8. Enter the string ‘<button type=”button” class=”btn btn-warning”>warning</button>’ in the edit box.
9. Click the ‘Ok’ button

Expected result: A button with the text ‘warning’ should be displayed under the ‘Page description’.

10. Click the ‘Save’ button.
11. Click the ‘Display page’ button.

Expected result: A button with the text 'warning' should be displayed
under the page title.

Note: There is no heading "Page description" on the page when you view it.

12. Click the ‘Edit this page’ button.
13. Click the ‘Text’ label.
14. Click the ‘Add’ button.
15. Click the ‘Toggle toolbar’ icon to show full list of buttons.
16. Click the ‘Source code’ button.
17. Enter the string ‘<button type=”button” class=”btn btn-warning”>warning</button>’ in the edit box.
18. Click the ‘Ok’ button.

Expected result: A button with the text ‘warning’ should be displayed under the ‘Block content’.

19. Click the ‘Save’ button.

Expected result: A button with the text ‘warning’ should be displayed in the 'Text' block.

Note: The text is part of the block and thus is within it and not under it.

20. Navigate to Main menu > Content > Journals.
21. Click the ‘New entry’ button.
22. Enter the title ‘Entry one’.
23. Click the ‘Toggle toolbar’ icon under ‘Entry’ to show full list of buttons.
24. Click the ‘Source code’ button.
25. Enter the string ‘<button type=”button” class=”btn btn-warning”>warning</button>’ in the edit box.
26. Click the ‘Ok’ button.

Expected result: A button with the text ‘warning’ should be displayed.

27. Click the ‘Save entry’ button.

Expected result: A button with the text ‘warning’ should be displayed under the ‘Entry one’ journal.

28. Navigate to Main menu > Groups > Group one.
29. Click the ‘Forums’ tab.
30. Click the ‘New forum’ button.
31. Enter the title as ‘ Title one’.
32. Click the ‘Toggle toolbar’ icon under ‘Description’ to show full list of buttons.
33. Click the ‘Source code’ button.
34. Enter the string ‘<button type=”button” class=”btn btn-warning”>warning</button>’ in the edit box.
35. Click the ‘Ok’ button.
36. Save the entry.

Expected result: A button with the text ‘warning’ should be displayed.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/8249
Committed: https://git.mahara.org/mahara/mahara/commit/a6f2b0075b5f500be447ef89df575898e13d0985
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit a6f2b0075b5f500be447ef89df575898e13d0985
Author: Robert Lyon <email address hidden>
Date: Wed Nov 1 07:24:25 2017 +1300

Bug 1560780: Allowing 'button' tag in tinymce

behatnotneeded

Change-Id: I84b1c6286bc066ceb830732082f8dc9f8fcdbe20
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.