Skip to content

Commit 47054b1

Browse files
committed
Set dir auto via js on all p tags in applications.
1 parent 0230125 commit 47054b1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

hypha/static_src/javascript/submission-text-cleanup.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,20 @@
22
// Select all rich text answers.
33
const richtextanswers = document.querySelector(".rich-text--answers");
44

5-
// Remove p tags with only whitespace inside.
5+
// Select all rich text answers paragraphes.
66
const richtextanswers_paras = richtextanswers.querySelectorAll("p");
77
richtextanswers_paras.forEach(function (para) {
8+
// Remove p tags with only whitespace inside.
89
if (para.textContent.trim() === "") {
910
para.remove();
1011
}
12+
// Set dir="auto" so browsers sets the correct directionality (ltr/rtl).
13+
para.setAttribute('dir', 'auto');
1114
});
1215

13-
// Wrap all tables in a div so overflow auto works.
16+
// Select all rich text answers tables.
1417
const richtextanswers_tables = richtextanswers.querySelectorAll("table");
18+
// Wrap all tables in a div so overflow auto works.
1519
richtextanswers_tables.forEach(function (table) {
1620
const table_wrapper = document.createElement("div");
1721
table_wrapper.classList.add("rich-text__table");

0 commit comments

Comments
 (0)