Skip to content

feat(notebook): support text direction controls - #6293

Merged
ajnart merged 2 commits into
homarr-labs:devfrom
arturict:fix/3871-notebook-text-direction
Jul 12, 2026
Merged

ajnart merged 2 commits into
homarr-labs:devfrom
arturict:fix/3871-notebook-text-direction

Conversation

@arturict

@arturict arturict commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #3871.

What changed

  • add left-to-right and right-to-left controls to the notebook toolbar
  • persist the selected direction as a dir attribute on paragraphs and headings
  • document the controls and add English labels
  • cover direction updates and HTML round-tripping with focused tests

Why

Text alignment alone does not set the Unicode bidirectional base direction. This made mixed RTL/LTR content render incorrectly when Homarr's interface language used the opposite direction.

Validation

  • pnpm exec vitest run packages/widgets/src/notebook/text-direction.spec.ts
  • pnpm --filter @homarr/widgets typecheck
  • pnpm exec oxlint packages/widgets/src/notebook/notebook.tsx packages/widgets/src/notebook/text-direction.ts packages/widgets/src/notebook/text-direction.spec.ts (passes with pre-existing warnings in notebook.tsx)
  • git diff --check

Summary by CodeRabbit

  • New Features
    • Added left-to-right and right-to-left text direction controls to the notebook toolbar.
    • Notebook headings and paragraphs now persist and reflect the selected text direction.
    • Added localized labels for the new direction controls.
  • Bug Fixes
    • Corrected text and spacing issues in notebook toolbar/documentation text (e.g., spelling and alignment).
  • Tests
    • Added coverage to verify text direction behavior and persistence in notebook output.
  • Documentation
    • Reformatted the notebook widget documentation for consistent structure and readability.

@dokploy-homarr-labs

Copy link
Copy Markdown

🚨 Preview Deployment Blocked - Security Protection

Your pull request was blocked from triggering preview deployments

Why was this blocked?

  • User: arturict
  • Repository: homarr
  • Permission Level: read
  • Required Level: write, maintain, or admin

How to resolve this:

Option 1: Get Collaborator Access (Recommended)
Ask a repository maintainer to invite you as a collaborator with write permissions or higher.

Option 2: Request Permission Override
Ask a repository administrator to disable security validation for this specific application if appropriate.

For Repository Administrators:

To disable this security check (⚠️ not recommended for public repositories):
Enter to preview settings and disable the security check.


This security measure protects against malicious code execution in preview deployments. Only trusted collaborators should have the ability to trigger deployments.

🛡️ Learn more about this security feature

This protection prevents unauthorized users from:

  • Executing malicious code on the deployment server
  • Accessing environment variables and secrets
  • Potentially compromising the infrastructure

Preview deployments are powerful but require trust. Only users with repository write access can trigger them.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1cb2e736-2a18-4916-ac28-d4e517e814e6

📥 Commits

Reviewing files that changed from the base of the PR and between 6f96f62 and 3f77782.

📒 Files selected for processing (1)
  • apps/docs/docs/widgets/notebook/index.mdx

📝 Walkthrough

Walkthrough

The notebook now supports LTR and RTL text direction for headings and paragraphs, exposes toolbar controls with translated labels, tests direction persistence and updates, and reformats the notebook widget documentation.

Changes

Notebook text direction

Layer / File(s) Summary
Text direction extension and behavior
packages/widgets/src/notebook/text-direction.ts, packages/widgets/src/notebook/text-direction.spec.ts
Adds the TextDirection type, TipTap dir attributes for headings and paragraphs, the setTextDirection command helper, and tests for RTL/LTR HTML output.
Toolbar integration and translations
packages/widgets/src/notebook/notebook.tsx, packages/translation/src/lang/en.json
Registers the extension and adds LTR/RTL toolbar controls with active states, command handlers, icons, and English labels.
Notebook documentation formatting
apps/docs/docs/widgets/notebook/index.mdx
Reformats notebook documentation frontmatter, JSX, section spacing, formatting content, image controls, table controls, and list placement.

Sequence Diagram(s)

sequenceDiagram
  participant NotebookToolbar
  participant setTextDirection
  participant TipTapEditor
  participant NotebookTextDirection
  NotebookToolbar->>setTextDirection: Request LTR or RTL
  setTextDirection->>TipTapEditor: Focus and update active node attributes
  TipTapEditor->>NotebookTextDirection: Apply the dir attribute
  NotebookTextDirection-->>TipTapEditor: Serialize dir in editor HTML
Loading

Suggested reviewers: manuel-rw

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: notebook text direction controls.
Linked Issues check ✅ Passed The PR adds RTL/LTR controls and persists dir attributes, satisfying the notebook RTL layout request.
Out of Scope Changes check ✅ Passed The changes stay within notebook text-direction support, docs, translations, and tests.
Yagni / Over-Engineering ✅ Passed Adds only the needed toolbar controls and a tiny TipTap extension/test; no new deps or extra abstraction beyond persisting dir on heading/paragraph.
Docs Are Up To Date ✅ Passed apps/docs/docs/widgets/notebook/index.mdx adds a Text direction section for the new LTR/RTL controls, matching the notebook feature changes.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@arturict
arturict marked this pull request as ready for review July 12, 2026 00:07
@arturict
arturict requested a review from a team as a code owner July 12, 2026 00:07

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/docs/docs/widgets/notebook/index.mdx`:
- Line 47: Correct the spelling errors in the changed notebook documentation:
update “variaty” to “variety” and normalize “Alignement” and “alignement” to
“Alignment” and “alignment” respectively.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8ec2390e-75c7-4534-b52c-45efe2344feb

📥 Commits

Reviewing files that changed from the base of the PR and between def3ede and 6f96f62.

📒 Files selected for processing (5)
  • apps/docs/docs/widgets/notebook/index.mdx
  • packages/translation/src/lang/en.json
  • packages/widgets/src/notebook/notebook.tsx
  • packages/widgets/src/notebook/text-direction.spec.ts
  • packages/widgets/src/notebook/text-direction.ts


### Notebook toolbar functions

The notebook offers a variaty of functions to edit the text and more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix spelling errors in changed documentation lines.

Three spelling errors are present on reformatted lines:

  • Line 47: "variaty" → "variety"
  • Line 67: "Alignement" → "Alignment"
  • Line 69: "alignement" → "alignment"
📝 Proposed spelling fixes
-The notebook offers a variaty of functions to edit the text and more.
+The notebook offers a variety of functions to edit the text and more.
-#### Text Alignement
+#### Text Alignment
-Select the alignement on the line. Left, center or right.
+Select the alignment on the line. Left, center or right.

Also applies to: 67-67, 69-69

🧰 Tools
🪛 LanguageTool

[grammar] ~47-~47: Ensure spelling is correct
Context: ...oolbar functions The notebook offers a variaty of functions to edit the text and more....

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/docs/widgets/notebook/index.mdx` at line 47, Correct the spelling
errors in the changed notebook documentation: update “variaty” to “variety” and
normalize “Alignement” and “alignement” to “Alignment” and “alignment”
respectively.

Source: Linters/SAST tools

@ajnart

ajnart commented Jul 12, 2026

Copy link
Copy Markdown
Member

Thank you for this ;)

@ajnart
ajnart merged commit d44bc06 into homarr-labs:dev Jul 12, 2026
3 checks passed
@arturict
arturict deleted the fix/3871-notebook-text-direction branch July 12, 2026 09:43
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.

feat: add the option to switch to RTL layout in the notebook

2 participants