Skip to content

feat: migrate input to Quill rich-text editor with syntax highlighting - #53

Merged
onlyonehas merged 14 commits into
mainfrom
feat/react-quill-highlighting
Jul 27, 2026
Merged

feat: migrate input to Quill rich-text editor with syntax highlighting#53
onlyonehas merged 14 commits into
mainfrom
feat/react-quill-highlighting

Conversation

@onlyonehas

Copy link
Copy Markdown
Owner

What this PR does

Replaces the plain <textarea> input with a Quill rich-text editor so calculations can be colour-coded while staying editable.

Key changes

  • Rich-text input — react-quill replaces the textarea; headings green/bold, comments gray/italic, expense names amber, variable names cyan
  • defaultValue="" + editor.setText() — avoids Quills clipboard.convert() which collapsed \n into whitespace; newlines are now preserved on load
  • Scroll sync — Quills .ql-container scrolls in lockstep with the output textarea; auto-height on output so both panels grow together
  • Auto-commenting preserved — deduction-date logic still toggles // prefixes and the editor updates via setText
  • Calendar icons — positioned in a gutter between the panels, scroll-synced with Quill
  • +6 unit tests — edge cases for blank/whitespace-only lines and blank-line preservation through auto-commenting (41 total, all passing)

Spacing

  • Input/output padding: 8px 16px (breathing room after the red line and on the right)
  • Calendar gutter: w-4 mr-2 (more separation from the output panel)

Housekeeping

  • Removed [22→22] debug prefix from output
  • Removed stray console.log calls
  • Updated /about, /new-features, README with current features

- Replace textarea with ReactQuill via next/dynamic (ssr: false)
- Syntax highlighting: headings green/bold, comments gray/italic,
  expense names in amber, variable names in cyan
- Scroll sync between Quill container and output textarea
- Custom CSS overrides for transparent background, ruled lines, no toolbar
- Auto-commenting syncs back into Quill editor
- removed auto-height effect (Quill handles its own height)
react-quill v2 onChange provides UnprivilegedEditor as 4th arg
which lacks formatText(). Use ref.getEditor() instead.
ref spread bypass didn't work for class component (no forwardRef). Use
.querySelector('.ql-editor') + .closest('.ql-container') to find the
root element that has __quill set by Quill's constructor.
Change overflow:hidden to overflow-y:auto on output textarea so
user can see all lines when they don't fit in the viewport.
Scroll sync still works as a helper, but no longer required.
- .ql-editor: overflow:hidden + height:auto (grows with content, no internal scroll)
- .ql-container: overflow-y:auto (scrolls when editor content overflows)
- p { margin:0 } in .ql-editor to prevent extra spacing from user-agent styles
- Scroll listener on .ql-container for sync with output textarea
- Revert output textarea to overflow:hidden (scroll sync handles it)
- defaultValue="" (empty) to avoid clipbard.convert which collapses \n
- handleQuillChange ignores source='api' to prevent feedback loop
- sync useEffect calls editor.setText() which treats input as plain text
  preserving newlines correctly
- Attach scroll listener in useEffect on mount (not just on user input)
- Clean up scroll listener on unmount to prevent memory leaks
- 6 new unit tests: empty/whitespace lines, blank line preservation
  through auto-commenting, trailing blank lines
- .ql-editor padding: 8px 16px (left 16px to space text from red line,
  right 16px for breathing room)
- Calendar gutter: w-4 mr-2 (16px + 8px gap instead of 12px + 2px)
- Output textarea: matching padding 8px 16px for visual alignment
- Remove [22→22] debug prefix from output
- Remove unnecessary console.log in new-features.tsx and getCurrencyConversion.ts
- Update /about page with accurate feature list and usage guide
- Update /new-features page subtitle
- Update README with current tech stack and features
…request form to Firebase

- Wrap // and # in {String.fromCharCode(39)}//{String.fromCharCode(39)} to satisfy react/jsx-no-comment-textnodes
- Add setIndex to useEffect deps in useTypewriter
- Feature request form now pushes to Firebase Realtime Database under featureRequests/{pushId}
- Show thank-you message after submission
@github-actions

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit a7e9190):

https://instant-calc--pr53-feat-react-quill-hig-pmulzw3p.web.app

(expires Mon, 03 Aug 2026 00:47:38 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 6bc8ccb070bbb04b63e3a5957eef152c83a6b443

@onlyonehas
onlyonehas merged commit fa182b5 into main Jul 27, 2026
3 checks passed
@onlyonehas
onlyonehas deleted the feat/react-quill-highlighting branch July 27, 2026 09:07
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