Skip to content

armgit / bento

Public Imported from GitHub
0

Bento, the office suite that fits in a file

RTL chrome: flip the marks that encode a direction in their shape

nyblnet33e733499a12
diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.ts
index a770cebd..bc3be1b5 100644
--- a/slides/src/editor/editor.ts
+++ b/slides/src/editor/editor.ts
@@ -23,7 +23,7 @@ import { insertElements, insertSlides, parseClip, serializeElements, serializeSl
import { openSpeakerWindow, speakerIdleBody } from '../screens'
import { borderPoint, boxCenter, lineEndpoints, setLineEndpoints, sideMidpoint } from './lineedit'
import { ICONS } from '../icons'
-import { t, setLocale, locale, LOCALE_CHOICES, applyDirection } from '../i18n'
+import { t, setLocale, locale, LOCALE_CHOICES, applyDirection, isRtl } from '../i18n'
import { appConfig } from '../../../kernel/src/app.ts'
import { disconnectOnline, joinFromDoc, mintCollab, mintInvite, onlineTransport, rotateKeys, sharingOn, startSharing, stopSharing } from '../sync/online'
@@ -391,8 +391,11 @@ export class Editor {
private updatePanelChevrons() {
const glyph = (side: 'left' | 'right') => {
const collapsed = (side === 'left' ? this.sidebar : this.props).classList.contains('ed-collapsed')
- // chevron points where clicking will move the boundary
- return side === 'left' ? (collapsed ? '›' : '‹') : (collapsed ? '‹' : '›')
+ // chevron points where clicking will move the boundary. 'left'/'right'
+ // name the DOM order, not the screen: under an RTL chrome the slide list
+ // sits on the right, so the arrow that means "open me" turns around too.
+ const g = side === 'left' ? (collapsed ? '›' : '‹') : (collapsed ? '‹' : '›')
+ return isRtl() ? (g === '›' ? '‹' : '›') : g
}
for (const side of ['left', 'right'] as const) {
const b = this.panelToggles[side]
@@ -435,7 +438,10 @@ export class Editor {
document.body.classList.add('ed-col-resizing')
const move = (ev: MouseEvent) => {
const dx = ev.clientX - startX
- this.panelW[side] = Math.min(max, Math.max(min, startW + (side === 'left' ? dx : -dx)))
+ // clientX is physical; which way widens the panel depends on which
+ // screen edge it is docked to, and RTL swaps the two panels over.
+ const widens = (side === 'left') !== isRtl() ? dx : -dx
+ this.panelW[side] = Math.min(max, Math.max(min, startW + widens))
this.applyPanelWidths()
}
const up = () => {
diff --git a/slides/src/styles.css b/slides/src/styles.css
index c1f7602a..793d6c71 100644
--- a/slides/src/styles.css
+++ b/slides/src/styles.css
@@ -1298,7 +1298,7 @@ body.ed-col-resizing { cursor: col-resize; user-select: none; }
.sv-timer:hover { color: #f7a600; }
.sv-clock { font-size: 15px; color: #9fb0c3; }
.sv-count { font-size: 15px; color: #9fb0c3; font-variant-numeric: tabular-nums; }
-.sv-ctrls { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
+.sv-ctrls { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.sv-btn {
width: 34px;
height: 30px;
@@ -1380,7 +1380,7 @@ body.ed-col-resizing { cursor: col-resize; user-select: none; }
.sv-thumb .sv-frame { box-shadow: none; border-radius: 0; }
.sv-thumb-n {
position: absolute;
- inset-inline-start: 4px;
+ left: 4px;
bottom: 4px;
min-width: 16px;
padding: 1px 5px;
@@ -2000,3 +2000,34 @@ dialog.ed-pwdialog .ed-pwerr { color: #C33; }
.ed-stepper .ed-btn-icon { width: 24px; height: 24px; line-height: 1; font-size: 15px; padding: 0; }
.ed-stepper-val { min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; font-size: 13px; }
input.ed-toggle { width: 16px; height: 16px; accent-color: #5E7699; cursor: pointer; }
+
+/* ————— RTL chrome: the marks that don't flip themselves ————————————————————
+ Logical properties turn the LAYOUT around on their own. These are the few
+ glyphs that encode a direction in their SHAPE, so they have to be flipped by
+ hand. Every selector here is chrome — none of it can reach a slide, which
+ stays LTR-pinned (see the top of this file).
+
+ The speaker view (.sv-*) is deliberately absent: it is a separate window
+ sitting beside the projected show, and it never carries a dir attribute. */
+
+/* Accordion disclosure: a CSS triangle drawn with border-left, pointing "right"
+ at rest. Open (rotated 90°) points down either way; closed must point the way
+ the panel reads. */
+[dir="rtl"] .ed-sec-toggle.closed::before { transform: translateY(-50%) rotate(180deg); }
+
+/* Undo/redo arrows curl back toward where the text came from. */
+[dir="rtl"] .ed-group-history .ed-btn svg { transform: scaleX(-1); }
+
+/* The comment thread's "you are <name>" link rides the far edge of the head. */
+[dir="rtl"] .ed-comment-me { float: left; }
+
+/* Coordinates, sizes and JSON are LTR content whatever the interface language:
+ a base-RTL context renders "-5" as "5-" and reorders a JSON line's brackets.
+ Panel prose and every text field the user writes words into are untouched. */
+[dir="rtl"] .ed-row input[type='number'],
+[dir="rtl"] .ed-mini input,
+[dir="rtl"] .ed-axis-range input,
+[dir="rtl"] .ed-about-json,
+[dir="rtl"] .ed-chart-json {
+ direction: ltr;
+}