Fix some more RTL issues (#2244)

* Swap flag and mark indicator position in RTL mode

* Make buttons of bottom toolbar align to edge of screen in RTL mode

* Use start instead of left and end instead of right
This commit is contained in:
Matthias Metelka 2022-12-08 13:29:56 +01:00 committed by GitHub
parent 1215ee7849
commit 6481899454
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 11 deletions

View file

@ -63,7 +63,7 @@ class CardStats:
self.txt += self.makeLine(k, v) self.txt += self.makeLine(k, v)
def makeLine(self, k: str, v: str | int) -> str: def makeLine(self, k: str, v: str | int) -> str:
txt = "<tr><td align=left style='padding-right: 3px;'>" txt = "<tr><td align=start style='padding-right: 3px;'>"
txt += f"<b>{k}</b></td><td>{v}</td></tr>" txt += f"<b>{k}</b></td><td>{v}</td></tr>"
return txt return txt
@ -909,12 +909,12 @@ when you answer "good" on a review."""
colon = ":" colon = ":"
if bold: if bold:
i.append( i.append(
("<tr><td width=200 align=right>%s%s</td><td><b>%s</b></td></tr>") ("<tr><td width=200 align=start>%s%s</td><td><b>%s</b></td></tr>")
% (a, colon, b) % (a, colon, b)
) )
else: else:
i.append( i.append(
("<tr><td width=200 align=right>%s%s</td><td>%s</td></tr>") ("<tr><td width=200 align=end>%s%s</td><td>%s</td></tr>")
% (a, colon, b) % (a, colon, b)
) )

View file

@ -241,7 +241,7 @@ class DeckBrowser:
review = nonzeroColour(node.review_count, "review-count") review = nonzeroColour(node.review_count, "review-count")
learn = nonzeroColour(node.learn_count, "learn-count") learn = nonzeroColour(node.learn_count, "learn-count")
buf += ("<td align=right>%s</td>" * 3) % ( buf += ("<td align=end>%s</td>" * 3) % (
nonzeroColour(node.new_count, "new-count"), nonzeroColour(node.new_count, "new-count"),
learn, learn,
review, review,

View file

@ -662,11 +662,11 @@ class Reviewer:
<center id=outer> <center id=outer>
<table id=innertable width=100%% cellspacing=0 cellpadding=0> <table id=innertable width=100%% cellspacing=0 cellpadding=0>
<tr> <tr>
<td align=left valign=top class=stat> <td align=start valign=top class=stat>
<button title="%(editkey)s" onclick="pycmd('edit');">%(edit)s</button></td> <button title="%(editkey)s" onclick="pycmd('edit');">%(edit)s</button></td>
<td align=center valign=top id=middle> <td align=center valign=top id=middle>
</td> </td>
<td align=right valign=top class=stat> <td align=end valign=top class=stat>
<button title="%(morekey)s" onclick="pycmd('more');"> <button title="%(morekey)s" onclick="pycmd('more');">
%(more)s %(downArrow)s %(more)s %(downArrow)s
<span id=time class=stattxt></span> <span id=time class=stattxt></span>

View file

@ -254,7 +254,7 @@ export function renderReviews(
const day = dayLabel(d.x0!, d.x1!); const day = dayLabel(d.x0!, d.x1!);
const totals = totalsForBin(d); const totals = totalsForBin(d);
const dayTotal = valueLabel(sum(totals)); const dayTotal = valueLabel(sum(totals));
let buf = `<table><tr><td>${day}</td><td align=right>${dayTotal}</td></tr>`; let buf = `<table><tr><td>${day}</td><td align=end>${dayTotal}</td></tr>`;
const lines: [BinIndex | null, string][] = [ const lines: [BinIndex | null, string][] = [
[BinIndex.Filtered, tr.statisticsCountsFilteredCards()], [BinIndex.Filtered, tr.statisticsCountsFilteredCards()],
[BinIndex.Learn, tr.statisticsCountsLearningCards()], [BinIndex.Learn, tr.statisticsCountsLearningCards()],
@ -275,7 +275,7 @@ export function renderReviews(
} }
buf += `<tr> buf += `<tr>
<td><span style="color: ${color};"></span> ${label}</td> <td><span style="color: ${color};"></span> ${label}</td>
<td align=right>${detail}</td> <td align=end>${detail}</td>
</tr>`; </tr>`;
} }
return buf; return buf;

View file

@ -1,7 +1,7 @@
/* Copyright: Ankitects Pty Ltd and contributors /* Copyright: Ankitects Pty Ltd and contributors
* License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */
@use "sass/vars"; @use "sass/vars";
hr { hr {
background-color: vars.palette(darkgray, 0); background-color: vars.palette(darkgray, 0);
@ -31,7 +31,12 @@ li {
#_flag { #_flag {
position: fixed; position: fixed;
right: 10px; [dir="ltr"] & {
right: 10px;
}
[dir="rtl"] & {
left: 10px;
}
top: 0; top: 0;
font-size: 30px; font-size: 30px;
-webkit-text-stroke-width: 1px; -webkit-text-stroke-width: 1px;
@ -40,7 +45,12 @@ li {
#_mark { #_mark {
position: fixed; position: fixed;
left: 10px; [dir="ltr"] & {
left: 10px;
}
[dir="rtl"] & {
right: 10px;
}
top: 0; top: 0;
font-size: 30px; font-size: 30px;
color: yellow; color: yellow;