You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Validate document size before creating or replacing WaveEditor state #6
WaveEditorDocument validates selection offsets in its constructor and replace, but does not enforce the character limit used by analyzeDocument and the default transform engine.
Both entry points accept 200,001 ASCII characters. A later apply('bold') rejects the already accepted document with WaveEditor documents may contain at most 200000 characters. A successful oversized replace also changes undo/redo history.
Reproduction
constcontent='x'.repeat(200_001)newWaveEditorDocument(content)// currently succeedsconstdocument=newWaveEditorDocument('Wave')document.replace(content)// currently succeedsawaitdocument.apply('bold')// rejects
Completion criteria
Apply the existing Unicode character limit before constructor or replacement state is published.
A rejected replacement preserves the current snapshot and both history stacks.
Add core tests for exactly-at-limit and over-limit content, including supplementary Unicode characters.
Keep selection offsets in UTF-16 units and character counts in Unicode code points.
Reuse the existing limit and validation behavior without adding a separate configurable limit.
Difficulty: easy. Async transform ordering (#1) and surrogate-pair selection boundaries (#2) remain separate tasks.
Activity