Skip to content

Commit

Permalink
Studentquiz: TinyMCE Implementation of customized Button Set for Stud…
Browse files Browse the repository at this point in the history
…entQuiz Activity #826354
  • Loading branch information
danghieu1407 authored and AnupamaSarjoshi committed Oct 4, 2024
1 parent 03c79c8 commit 5e24671
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
31 changes: 31 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -858,3 +858,34 @@
body.cm-type-studentquiz.path-question-type #fitem_id_status {
display: none;
}

/* Hide all the toolbars and buttons by default.
The child represents the following:
1: Edit in menubar
2: View in menubar
3: Insert in menubar
6: Table in menubar
7: Help in menubar
*/
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role="menubar"] button:nth-child(1),
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role="menubar"] button:nth-child(2),
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role="menubar"] button:nth-child(3),
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role="menubar"] button:nth-child(6),
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role="menubar"] button:nth-child(7),
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role='toolbar'],
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role='toolbar'] button {
display: none;
}

/* Show only the custom toolbar and button. */
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role='toolbar'] button[aria-label="Bold"],
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role='toolbar'] button[aria-label="Italic"],
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role='toolbar'] button[aria-label="Link"],
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role='toolbar'] button[aria-label="Unlink"],
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role='toolbar'] button[aria-label="Bullet list"],
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[role='toolbar'] button[aria-label="Numbered list"],
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[title="formatting"],
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[title="content"],
.path-mod-studentquiz .studentquiz-comment-container .tox-tinymce div[title="lists"] {
display: flex;
}
4 changes: 4 additions & 0 deletions tests/behat/comment_area_create.feature
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ Feature: Create comment as an user
And I press "Check"
# Wait for comment area init.
And I wait until the page is ready
# Check the custom toolbar and menubar.
And I should see "Format"
And I should see "Tools"
And "button[aria-label='Undo']" "css_element" should not be visible
# Enter "Comment 1".
And I set the field "Add public comment" to "Comment 1"
And I press "Add comment"
Expand Down

0 comments on commit 5e24671

Please sign in to comment.