9 Commits
Author SHA1 Message Date
Tom Moor 49aee74190 feat: Add filtering to tables in the editor (#14625)
* feat: Add filtering to tables in the editor

* Show the column filter button on header hover in edit mode

* Keep the filter button shown while its menu is open

* Move focusEditor to its own module

* Anchor the filter menu to the filter button

* Address review feedback on table filtering

* Show the filter button background while its menu is open

* Always show the filter button background with its icon

* Remove value counts and hide Clear when there is no filter

* Translations

* placeholder
2026-11-18 22:37:15 -05:00
Tom Moor 9c6a940f42 Send security notice to previous address when account email changes (#13979)
* feat: Send security notice to previous address when account email changes

* refactor: Send email change notice from a users.update processor

* fix: Notify previous email address even if the user was deleted
2026-10-10 08:27:47 -04:00
Tom Moor 3014a86b99 fix: Preserve lists in table cells on Markdown round-trip (#13978)
* fix: Preserve lists in table cells on Markdown round-trip

* fix: Rebuild alpha lists and lists after a paragraph in table cells
2026-10-06 23:24:34 -04:00
964e709817 fix(editor): preserve toggle fold state across remote and local document edits (#13425)
* fix(editor): preserve toggle fold state across remote and local document edits

Fold state was re-derived from localStorage on every remote collaborative
transaction (and partially on local doc-changing ones), so a silently
failed Storage.set (quota exceeded, blocked storage) left a stale
{fold:true} and the next edit re-folded blocks the user had expanded —
the plugin seed from previous state was ineffective because
toggleFoldPluginKey.getState(newState) is always undefined during the
plugin's own apply.

Track a knownIds set alongside foldedIds and reconcile from the previous
plugin state (the second apply argument, which is reliable): existing
fold decisions are preserved verbatim and storage is only consulted for
toggle blocks seen for the first time.

Fixes #13424

* fix(editor): bound and harden toggle fold state persistence

Fold state was stored under a localStorage key per toggle block id with
no bound on how many keys accumulate, and a write that failed silently
(quota exceeded, storage unavailable) left a stale value that the next
edit would re-fold from. Two complementary changes:

- Storage falls back to session storage when a write to the primary
  interface fails at runtime, so values at least survive the browsing
  session; reads prefer the fallback copy while it is the most recent
  successful write, and successful writes drop it again.
- Toggle fold state now lives in an LRUCache mirrored to local storage,
  capping the number of stored keys and evicting the least recently used
  fold states first. The persisted key format is unchanged so fold state
  continues to sync across tabs via storage events.

Follow-up to #13425, addressing the underlying feedback in #13424.

Co-Authored-By: Claude <noreply@anthropic.com>

* docs: add development workflow best practices to CLAUDE.md

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(editor): rename persistTo option to storage in LRUCache

Rename the `persistTo` cache option to `storage` with a union type of
`"memory" | "localStorage" | "sessionStorage"` per review feedback.
The option is now required instead of optional; callers that only need
an in-memory cache pass `storage: "memory"`.

The private Storage instance field is renamed from `storage` to `store`
to avoid colliding with the new option name, and the mapping from
user-facing values to Storage constructor arguments is handled in
`hydrate()`.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(editor): eliminate redundant findBlockNodes scan in reconcileFoldState

The hot path for every local document change previously called
findBlockNodes twice on the same document — once in reconcileFoldState
and again in createDecorations.  Now reconcileFoldState collects the
blocks once and passes them directly to the decoration builder.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(editor): fix createDecorations signature to accept optional blocks parameter

The init and ACTION branches pass a NodeWithPos[] as the second argument,
which previously landed in the foldedIds parameter — a type error missed
due to missing tsc validation.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(editor): correct createDecorations argument order and NodeWithPos import

The createDecorations signature is (doc, foldedIds, blocks?) but both the
init and ACTION branches passed arguments in the old order (doc, blocks,
foldedIds). Because the Set is always truthy, the ?? fallback never fired
and buildDecorationsFromBlocks iterated over strings, crashing on
block.node.attrs. NodeWithPos is also not exported from findChildren.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(editor): address review feedback and fix CI

- Document the default-folded fallback for evicted blocks in the
  fold-state cache comment.
- Cast the Storage test mock through unknown so the type check passes.
- Provide in-memory web storage for the shared jsdom test project so the
  persistence tests run instead of crashing on a missing implementation.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(editor): scope storage fallback writes and drop unrelated changes

- Track keys mirrored to the storage fallback and clear only those,
  rather than clearing all of session storage
- Restore CLAUDE.md as a symlink to AGENTS.md
- Remove the unrelated scrollToNonce changes
- Make the fallback interface private and probe with a namespaced key

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2026-09-04 08:33:10 -04:00
Tom Moor 63486f29b8 fix: Code fence markdown serialization is not round-trip stable (#13434)
- Serialize code fences longer than any backtick run in the content, so
  content lines cannot terminate the fence early on reparse
- Reduce the fence info string and language attribute to a single safe
  token when parsing and serializing
- Share the markdown parser and serializer through the editor test helper
2026-08-14 17:56:05 -04:00
Tom MoorandClaude Fable 5 5ea63aa1a2 fix: Editor math block parsing and NaN media dimensions (#12668)
* fix: Block math not closed by trailing $$ on a content line

The closing delimiter check compared a 3-character slice against the
2-character "$$" delimiter, so block math closed on the same line as
content (e.g. "c = d$$") was never detected and the block swallowed the
rest of the document. Use the delimiter length rather than a hardcoded
slice. Also fix the indexOf sentinel comparison (!== 1 instead of
!== -1) in inline math parsing, which terminated correctly only by
coincidence.

Adds tests for the math markdown rules and moves the findNodes test
helper into shared/test/editor for reuse.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix: NaN width and height parsed for video and image nodes

Video parseDOM and parseMarkdown used parseInt on a missing attribute,
storing NaN instead of null and persisting it to markdown as NaNxNaN.
Image size syntax with a missing dimension (e.g. "=x100") hit the same
issue through optional regex groups. Parse dimensions only when
present, matching the existing guard in Image parseDOM, and correct the
video getAttrs element type.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix: Normalize non-numeric video dimensions, avoid serializing nullxnull

Review feedback: parseInt could still produce NaN when the attribute
exists but is not numeric (e.g. width="auto"), and toMarkdown wrote
null dimensions as "nullxnull". Parse dimensions through a helper that
normalizes non-finite values to null, and serialize nullish dimensions
as empty strings, which still round-trips as a video node.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 22:29:29 -04:00
Tom MoorandClaude Opus 4.7 091346dfe8 chore: Migrate to vitest (#12272)
* wip

* Remove obsolete snapshots

* simplify

* chore(test): Convert mocks to TypeScript and tighten fetch mock types

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Remove unneccessary patches

* Migrate to msw instead of custom fetch mock

* Address PR review comments

- Split chained vi.useFakeTimers().setSystemTime() into separate calls.
- Switch test setup to dynamic imports so EventEmitter.defaultMaxListeners
  assignment runs before module init (static imports were hoisted above it).
- Drop redundant NODE_ENV guard in monkeyPatchSequelizeErrorsForJest; its
  sole caller already gates on env.isTest.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-06 21:10:51 -04:00
Tom Moor fd9216541c chore: Add tests covering fixes in #11178 (#11179) 2026-01-14 08:26:26 -05:00
Apoorv Mishra 0c51bfb899 perf: reduce memory usage upon running server tests (#3949)
* perf: reduce memory usage upon running server tests

* perf: plug leaks in server/routes

* perf: plug leaks in server/scripts

* perf: plug leaks in server/policies

* perf: plug leaks in server/models

* perf: plug leaks in server/middlewares

* perf: plug leaks in server/commands

* fix: missing await on db.flush

* perf: plug leaks in server/queues

* chore: remove unused legacy funcs

* fix: await on db.flush

* perf: await on GC to run in between tests

* fix: remove db refs

* fix: revert embeds

* perf: plug leaks in shared/i18n
2022-08-11 21:39:17 +05:30