mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 06:23:06 +08:00
f6a8247c48
* fix: cursor jumps to end of text when editing a comment When editing a comment mid-text, the cursor would jump to the end after every keystroke, making it impossible to insert text at any position other than the end. Root cause: on each keystroke, the comment editor's onUpdate callback updated parent state (setContent), which changed the defaultContent prop passed back to CommentEditor. A useEffect watching defaultContent then called commentEditor.commands.setContent(), which reset the entire editor content and moved the cursor to the end. Fix: - Store in-progress edits in a ref instead of state to avoid triggering React re-renders and the prop->effect->setContent cascade - Read from the ref when saving the comment - Sync the ref back into state after a successful save so the read-only view updates immediately - Guard the setContent useEffect to only run for read-only editors, so websocket-driven updates from other browsers still work Fixes #1791 Functionally tested on Firefox and Chrome: mid-text editing, saving, cross-browser live updates via websocket. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix stale content on edit cancel --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Philipinho <16838612+Philipinho@users.noreply.github.com>
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptionsproperty like this:
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
- Replace
plugin:@typescript-eslint/recommendedtoplugin:@typescript-eslint/recommended-type-checkedorplugin:@typescript-eslint/strict-type-checked - Optionally add
plugin:@typescript-eslint/stylistic-type-checked - Install eslint-plugin-react and add
plugin:react/recommended&plugin:react/jsx-runtimeto theextendslist