Skip to content

Support RTL by auto detect direction - #206

Closed
ATofighi wants to merge 3 commits into
docmost:mainfrom
ATofighi:patch-1
Closed

ATofighi wants to merge 3 commits into
docmost:mainfrom
ATofighi:patch-1

Conversation

@ATofighi

@ATofighi ATofighi commented Aug 26, 2024 •

Copy link
Copy Markdown

With this change, the browser detect the direction of each element of editor, so If we write in RTL language in a paragraph, the direction change automatically to RTL for that paragraph.

I test it only using inspect element and add this style.

The result is here, paragraphs with RTL text automatically aligned from right and the direction is correct for both LTR and RTL texts.

image

@CLAassistant

CLAassistant commented Aug 26, 2024 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ATofighi ATofighi changed the title simply support RTL by auto detect direction Support RTL by auto detect direction Aug 26, 2024
@Philipinho

Copy link
Copy Markdown
Member

I hesitate because I am unsure if unicode-bidi: plaintext would break anything.
I am also considering this Tiptap extension https://github.com/amirhhashemi/tiptap-text-direction.

@ATofighi

ATofighi commented Jan 16, 2025 •

Copy link
Copy Markdown
Author

I hesitate because I am unsure if unicode-bidi: plaintext would break anything. I am also considering this Tiptap extension https://github.com/amirhhashemi/tiptap-text-direction.

I have changed the code based on your advise and used tiptap-text-direction extension.

But in title editor and page titles, unfortunately, I can't adjust perfectly with this extension, in these two places, I use the unicode-bidi: plaintext for direction: auto.

Can you review the code again please?

Screenshots:
image
image
image
image
image

@ATofighi

Copy link
Copy Markdown
Author

@Philipinho I change the code. Can you review it please?

@Philipinho

Copy link
Copy Markdown
Member

Hi @ATofighi, thank you for your work. I will find some time to test it soon.
I appreciate your patience.

@Philipinho

Copy link
Copy Markdown
Member

Are you able to use the forward slash "/"?

@ATofighi

ATofighi commented Jan 30, 2025 •

Copy link
Copy Markdown
Author

Are you able to use the forward slash "/"?

yes.
image

Is forward slash not working for you?!

@Philipinho

Copy link
Copy Markdown
Member

Sorry. I mean when the keyboard is set a RTL language like Arabic. "/" gives me "\" and "\" gives me "ء" on Mac.

@ATofighi

ATofighi commented Jan 30, 2025 •

Copy link
Copy Markdown
Author

Sorry. I mean when the keyboard is set a RTL language like Arabic. "/" gives me "\" and "\" gives me "ء" on Mac.

My main language is Persian and it has "/" in the keyboard layout (exactly on the key which "/" placed on English"), I asked chatgpt and it says that Arabic's keyboard layout also has "/" character, but its position may be differ from English.

@ATofighi

Copy link
Copy Markdown
Author

Sorry. I mean when the keyboard is set a RTL language like Arabic. "/" gives me "\" and "\" gives me "ء" on Mac.

My OS is Ubuntu, Shift + L is slash for me in Arabic keyboad

@ATofighi

ATofighi commented Feb 6, 2025

Copy link
Copy Markdown
Author

@Philipinho 😅

@Philipinho

Copy link
Copy Markdown
Member

Got it for Mac. It's Option + /.

@mikinushu

Copy link
Copy Markdown

Is this also relevant to the Hebrew language? Because it's still left to right.. 🤔
image

@ATofighi

Copy link
Copy Markdown
Author

Is this also relevant to the Hebrew language? Because it's still left to right.. 🤔 image

I think it should be. can you give me an example text that help me to reproduce the issue?

@mikinushu

Copy link
Copy Markdown

Here:
שורה עם כמה מילים בעברית

@Philipinho

Copy link
Copy Markdown
Member

Not yet merged due to a reported bug in the text-direction extension amirhhashemi/tiptap-text-direction#18 which may affect Japanese users.

ATofighi and others added 2 commits February 28, 2025 22:06
 - TextDirection extendion in editor
 - text-align: start in styles
 - unicode-bidi: plaintext in page tree
@ATofighi

Copy link
Copy Markdown
Author

שורה עם כמה מילים בעברית

Are you sure that you test the code of this branch? I test "שורה עם כמה מילים בעברית" and it become RTL!

@ATofighi

Copy link
Copy Markdown
Author

Not yet merged due to a reported bug in the text-direction extension amirhhashemi/tiptap-text-direction#18 which may affect Japanese users.

Thanks, I suggest a fix to the tiptap-text-direction author for this issue.

@ATofighi

Copy link
Copy Markdown
Author

I also add an temporary commit that move the code of plugin to the project and do my fix on it to have a bug free version.

@ATofighi

ATofighi commented Jun 3, 2025

Copy link
Copy Markdown
Author

@Philipinho It seems that maintainer of https://github.com/amirhhashemi/tiptap-text-direction isn't available. May I copy the fixed version of plugin to docmost repository and create a fully functional PR without dependency on https://github.com/amirhhashemi/tiptap-text-direction ?

@neuodev

neuodev commented Jun 20, 2025

Copy link
Copy Markdown

I hope that this pull request will be merged soon.

@ATofighi

Copy link
Copy Markdown
Author

@Philipinho It seems that maintainer of https://github.com/amirhhashemi/tiptap-text-direction isn't available. May I copy the fixed version of plugin to docmost repository and create a fully functional PR without dependency on https://github.com/amirhhashemi/tiptap-text-direction ?

@Philipinho ? 😁

@msshn

msshn commented Jan 26, 2026

Copy link
Copy Markdown

Any chance this gets merged? Thanks.

@AsimNet

AsimNet commented Jun 2, 2026

Copy link
Copy Markdown

Any chance this gets merged? Thanks.

@ATofighi

ATofighi commented Jun 6, 2026

Copy link
Copy Markdown
Author

at end, I migrated to https://github.com/outline/outline due to this issue and other features that are enterprise or not available in docmost.

vvzvlad pushed a commit to vvzvlad/gitmost that referenced this pull request Jun 26, 2026
…icate (docmost#206)

attach-1: when the same attachmentId was referenced by more than one page
in a duplicated subtree, the per-attachmentId map held only a single copy
entry, so the last page processed clobbered the others. The downstream
ownership guard (`attachment.pageId !== oldPageId`) then matched at most one
page and skipped the lone DB row entirely: no blob copied, no new row, every
copy's image 404'd. Key the map to a list of entries and copy one blob/row
per referencing page; drop the now-incorrect ownership guard.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
vvzvlad pushed a commit to vvzvlad/gitmost that referenced this pull request Jun 26, 2026
…op subtrees (docmost#206)

ui-state-races-1: the server-authoritative move path (placeByPosition, via
applyMoveTreeNode) lacked the isDescendant cycle guard that drag-drop `move`
has. When move events arrive out of order so the destination parent is still
nested inside the moved node's own subtree, remove(source) dropped the whole
subtree (incl. the future parent) and insertByPosition could not re-place it —
the node and all descendants silently vanished with no error/refetch.

Add the isDescendant guard to placeByPosition (returns same ref, like its other
no-op cases) and short-circuit applyMoveTreeNode on the same condition BEFORE
the placed===prev remove-fallback (which would otherwise still drop the
subtree). Leave the tree untouched so a later corrective event / reconnect
reconcile fixes it.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
vvzvlad pushed a commit to vvzvlad/gitmost that referenced this pull request Jun 26, 2026
…lost (docmost#206)

persist-1: onStoreDocument wrapped the page write in a try/catch that only
logged and swallowed the error, then resolved "successfully". hocuspocus
destroys/unloads the in-memory Y.Doc right after the hook resolves (the only
copy of the latest edit), so a transient DB error (deadlock, serialization
failure, dropped connection) silently lost the edit. Worse, the post-store
branch ran on the partially-assigned `page`, broadcasting a phantom
"page.updated" and enqueueing a history snapshot for content never written.

Wrap the write in a small bounded retry (3 attempts) so the save is
re-attempted while we still hold the doc, and clear `page` on failure so the
success-only side effects never report a save that didn't happen.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
vvzvlad pushed a commit to vvzvlad/gitmost that referenced this pull request Jun 26, 2026
…most#206)

editor-pm-7: addUniqueIdsToDoc only FILLED missing ids and never deduplicated
existing ones, so a copy/paste or bulk-JSON duplicate that kept its attrs.id
produced two nodes sharing an id. MCP addressed edits (patch_node /
delete_node "before/after id") then hit the wrong node or both.

Walk the configured-type nodes in document order: the first occurrence of an
id keeps it (stable anchor), later duplicates are reassigned a fresh id.
transclusionSource ids are cross-reference keys (references resolve a source by
this id), so they are only filled-when-missing, never reassigned, to avoid
orphaning their references.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
vvzvlad pushed a commit to vvzvlad/gitmost that referenced this pull request Jun 26, 2026
…the bug-fix batch (docmost#161 docmost#190 docmost#207 docmost#206 docmost#159)

Document the new per-workspace rolling-day token-budget env var in
.env.example alongside the existing share-assistant cost knobs, and add
[Unreleased] Fixed entries for docmost#161/docmost#190/docmost#207/docmost#206 plus a Security entry
for the docmost#159 token budget.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
vvzvlad pushed a commit to vvzvlad/gitmost that referenced this pull request Jun 26, 2026
…id dedupe (docmost#206)

A colliding transclusionSource id is deliberately NOT reassigned (its id is a
cross-reference key), while a missing id is still filled. Add coverage for both:
two sources sharing an id keep it (red if the NO_REASSIGN guard is removed), and
a source with no id gets a fresh one.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
vvzvlad pushed a commit to vvzvlad/gitmost that referenced this pull request Jun 27, 2026
, docmost#204

Additive test coverage across server, editor-ext, client and mcp.

docmost#192 — AiChatService.stream integration (Section 3, against real Postgres):
- new apps/server/test/integration/ai-chat-stream.int-spec.ts drives the real
  streamText through a seeded ai/test MockLanguageModelV3 and a real Node
  ServerResponse, covering: onError persists an assistant error record
  (status 'error' + partial answer + provider cause in metadata); external MCP
  client closed exactly once on BOTH onFinish and onError; anti-tamper —
  history is rebuilt from the DB transcript, not from body.messages.

docmost#206 — red-team findings (most already fixed+tested in docmost#212):
- mdrt-2 (UNFIXED, data loss): turndown.dataloss.test.ts documents that
  pageBreak / transclusionReference / mention are silently dropped on Markdown
  export (characterization + it.fails for the desired survive-export contract).
- persist-6 (UNFIXED, data loss): persistence-store.spec.ts adds an it.failing
  documenting that a momentarily-empty live doc overwrites non-empty content
  (left unfixed — a store-side empty-guard is a behaviour change).

docmost#204 — test-strategy plan, highest-priority subset:
- Phase 1: mcp-clients.lease.spec.ts covers the external MCP client
  lease/refcount/eviction lifecycle (leak / premature-close / double-close).
- Phase 2 data-integrity pure functions: editor-ext table-utils
  (transpose/moveRow/convert round-trip) and math tokenizer false-positive
  guard; client emoji-menu (+ it.fails for the unguarded localStorage
  JSON.parse bug), sort-cells, normalizeTableColumnWidths; mcp htmlEmbed/
  pageBreak markdown data-loss + footnote-diff; server export
  getInternalLinkPageName extensionless-path bug — FIXED (small/clear) + tested.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
vvzvlad pushed a commit to vvzvlad/gitmost that referenced this pull request Jun 27, 2026
… helper, tests

Review follow-ups for the combined QA-UI fixes (docmost#216/docmost#206/docmost#204/docmost#218/docmost#192):

- export/utils: correct the misleading getInternalLinkPageName comment — a
  bare `v1.2` loses its last dot-segment (`v1`); dots survive only in
  multi-segment names like `v1.2.md` -> `v1.2`.
- share: extract toPublicSharePayload(page, share): PublicSharePayload, an
  explicit allowlist type+mapper replacing the inline literal in the
  /shares/page-info anonymous path (docmost#218). Add share.controller.spec.ts that
  stubs getSharedPage returning internal fields and asserts the response key
  set EXACTLY equals the whitelist (page + share), so any `...shareData`
  regression or new leaking field fails. Also key-tests the extracted mapper.
- breadcrumb: extract pure resolveBreadcrumbNodes(treeData, ancestors, pageId)
  (tree-hit -> tree; tree-miss -> map ancestors via canonical pageToTreeNode,
  dropping the as-any casts; else null) and unit-test all three branches.
- share-modal: RTL test asserting enabling a share calls mutateAsync with
  includeSubPages: false (docmost#216 security default).
- share.service: one-line note at getSharedPage on the deferred consolidation
  of the ancestor-aware match into resolveReadableSharePage.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
vvzvlad pushed a commit to vvzvlad/gitmost that referenced this pull request Jun 27, 2026
…wed error, i18n, docs

Approve-with-comments follow-ups:

- breadcrumb: fix the reverse regression where navigating A->B to a page absent
  from the lazily-built tree (before its ancestors load) left the previous
  page's clickable chain on screen. New pure computeBreadcrumbState clears a
  stale chain that doesn't end at the current page, while keeping one that does
  (no blank flash for an already-resolved page); unit-tested for the
  navigated-to-absent-page case.
- share.service: getShareAncestorPage no longer swallows DB errors silently —
  now a live public-share path (isPageReachableThroughShare), so a transient
  error is logged with ancestor/child ids and still fails closed (caller 404s)
  instead of becoming a traceless misleading "not found".
- i18n: register the new "Connecting… (read-only)" key (U+2026 ellipsis) in
  en-US (source of truth) and ru-RU (Подключение… (только чтение)).
- share.service: correct the FUTURE note — 3 callers pass no shareId
  (share-alias.controller/.service, share-seo.controller); the two ai-chat
  callers already pass a real shareId.
- CHANGELOG: add Unreleased Changed/Fixed/Security entries for docmost#216 opt-in
  sub-pages default, docmost#218 trimmed page-info payload + forged-shareId 404, docmost#204
  export internal-link name, docmost#206/docmost#218 breadcrumb, docmost#192 callout paste, docmost#218
  editor pre-sync read-only gate.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@Philipinho

Copy link
Copy Markdown
Member

See #2389.

@Philipinho Philipinho closed this Aug 12, 2026
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.

7 participants