Skip to content

UI Update: RTL/LTR Toggle Reposition & Behavior Improvement#95

Merged
ThisIs-Developer merged 1 commit intomainfrom
devin/1778216070-rtl-ltr-toggle-reposition
May 8, 2026
Merged

UI Update: RTL/LTR Toggle Reposition & Behavior Improvement#95
ThisIs-Developer merged 1 commit intomainfrom
devin/1778216070-rtl-ltr-toggle-reposition

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented May 8, 2026

Summary

Moves the RTL/LTR direction toggle from the header toolbar (next to Share) into the markdown formatting toolbar, directly beside the Align Right button. Changes the toggle's visual from an ambiguous icon to a clear text label: L when in LTR mode, R when in RTL mode. Most importantly, scopes the dir attribute change to only the editor textarea (#markdown-editor) and preview area (#markdown-preview) instead of document.documentElement, so the toolbar, sidebar, modals, and overall app layout are no longer affected by the toggle.

Changes:

  • index.html: Removed direction-toggle from header toolbar; added it to the alignment group in the formatting toolbar as a markdown-tool-btn text-tool
  • script.js: Introduced applyDirectionToContent() helper that sets dir on only the editor and preview elements. Updated updateDirectionToggleUI() to set textContent ("L"/"R") instead of swapping icons. Updated both desktop and mobile click handlers to read/write direction on the editor element rather than document.documentElement.

Review & Testing Checklist for Human

  • Scoping correctness: Toggle RTL/LTR and verify the app header, tab bar, formatting toolbar, and modals remain LTR — only the editor textarea and rendered preview should change direction.
  • Visual placement: Confirm the L/R button appears in the formatting toolbar directly after the Align Right button and is visually consistent with neighboring text-tool buttons (Aa, A, a).
  • Mobile menu: Open the hamburger menu on a narrow viewport, tap "Switch to RTL", and verify it correctly toggles direction in editor/preview without affecting the mobile menu layout itself.
  • Persistence: Toggle to RTL, reload the page, and confirm the editor/preview restore to RTL while the rest of the app remains LTR.

Notes

  • No CSS changes were needed; the button reuses existing .markdown-tool-btn.text-tool styles.
  • The mobile menu direction toggle delegates to the desktop button via .click() when present; the standalone fallback path also uses the new applyDirectionToContent().
  • direction state is still read from markdownEditor.getAttribute("dir") — if markdownEditor is ever null, it defaults to "ltr".

Link to Devin session: https://app.devin.ai/sessions/4ffa89663674457e98ce1644dec5cd81
Requested by: @ThisIs-Developer


Open in Devin Review

…to editor/preview only

- Move direction toggle from header toolbar to markdown formatting toolbar,
  placed directly after the Align Right button
- Change toggle display from icon to text: L (LTR mode) / R (RTL mode)
- Scope direction changes to only editor textarea and preview area,
  no longer affects full document/toolbar/sidebar/modals
- Update mobile direction toggle to use the same scoped behavior

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying markdownviewer with  Cloudflare Pages  Cloudflare Pages

Latest commit: 32a0a3e
Status: ✅  Deploy successful!
Preview URL: https://c7962223.markdownviewer.pages.dev
Branch Preview URL: https://devin-1778216070-rtl-ltr-tog.markdownviewer.pages.dev

View logs

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
markdown-viwer Ready Ready Preview, Comment May 8, 2026 4:55am

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying markdown-viewer with  Cloudflare Pages  Cloudflare Pages

Latest commit: 32a0a3e
Status: ✅  Deploy successful!
Preview URL: https://ffb0b8d2.markdown-viewer.pages.dev
Branch Preview URL: https://devin-1778216070-rtl-ltr-tog.markdown-viewer.pages.dev

View logs

Copy link
Copy Markdown
Contributor Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

End-to-End Test Results

Tested on preview deployment: https://ffb0b8d2.markdown-viewer.pages.dev
Devin session

All 7 tests passed.

Test Results
Test Result
Toggle button placed next to Align Right in formatting toolbar Passed
Toggle shows "L" in LTR mode with "Switch to RTL" tooltip Passed
Clicking L switches to RTL, label changes to R Passed
Toolbar/header remain LTR when RTL is active (scoping) Passed
Clicking R toggles back to LTR Passed
RTL persists across page reload Passed
Mobile menu "Switch to RTL" works without affecting menu layout Passed
Screenshots

LTR mode (default) — L button in formatting toolbar:
LTR mode

RTL mode active — editor and preview RTL, toolbar stays LTR:
RTL mode

Persistence after reload — RTL preserved:
Persistence

Mobile menu — before and after toggle:
Mobile before
Mobile after

@ThisIs-Developer ThisIs-Developer merged commit 121ceef into main May 8, 2026
7 checks passed
@ThisIs-Developer ThisIs-Developer deleted the devin/1778216070-rtl-ltr-toggle-reposition branch May 8, 2026 05:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant