-
-
Notifications
You must be signed in to change notification settings - Fork 18
Peritext UI events location #899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Centralize Peritext UI event types into the json-crdt-extensions/peritext/events
package and update UI modules to import from the new location; replace the UI’s local UndoCollector
with a new UndoManager
interface.
- Introduce
UndoManager
in the UI and moveUndoCollector
into the shared events defaults - Update dozens of import paths in UI and extension modules to point to the centralized events folder
- Add a local
Rect
definition in events defaults and adjust related imports
Reviewed Changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/json-crdt-peritext-ui/types.ts | Removed UI’s UndoCollector ; added UndoManager interface |
src/json-crdt-peritext-ui/plugins/toolbar/state/ToolbarState.tsx | Updated events imports to new centralized path |
src/json-crdt-peritext-ui/plugins/toolbar/cursor/caret/CaretBottomOverlay/index.tsx | Fixed PeritextEventDetailMap import path |
src/json-crdt-peritext-ui/plugins/minimal/RenderPeritext.tsx | Fixed ChangeDetail import path |
src/json-crdt-peritext-ui/plugins/cursor/state.ts | Fixed ChangeDetail import path |
src/json-crdt-extensions/peritext/events/types.ts | Changed relative imports to point at json-crdt-extensions root |
src/json-crdt-extensions/peritext/events/index.ts | Adjusted createDataTransfer and Peritext imports |
src/json-crdt-extensions/peritext/events/defaults/ui/types.ts | Defined a new Rect interface |
src/json-crdt-extensions/peritext/events/defaults/ui/UiHandle.ts | Consolidated imports for constants and types |
src/json-crdt-extensions/peritext/events/defaults/annals.ts | Updated imports for Anchor , Patch , and Range |
src/json-crdt-extensions/peritext/events/defaults/types.ts | Added shared UndoCollector interface |
src/json-crdt-extensions/peritext/events/defaults/PeritextEventDefaults.ts | Updated all extension imports, including Cursor , PersistedSlice |
src/json-crdt-extensions/peritext/events/clipboard/DomClipboard.ts | Updated saveSelection import path |
src/json-crdt-extensions/peritext/events/tests/marker.spec.ts | Updated test imports for setup utilities |
src/json-crdt-extensions/peritext/events/tests/insert.spec.ts | Updated test imports for setup utilities |
src/json-crdt-extensions/peritext/events/tests/inline.spec.ts | Updated test imports for setup utilities |
src/json-crdt-extensions/peritext/events/tests/delete.spec.ts | Updated test imports for setup utilities |
src/json-crdt-extensions/peritext/events/tests/cursor.spec.ts | Updated test imports for setup utilities |
src/json-crdt-extensions/peritext/events/PeritextEventTarget.ts | Fixed import for SubscriptionEventTarget |
Comments suppressed due to low confidence (3)
src/json-crdt-peritext-ui/types.ts:1
- The new UndoManager interface lacks documentation; consider adding JSDoc comments to explain the purpose and usage of push and undo methods for better clarity.
export interface UndoManager {
src/json-crdt-peritext-ui/types.ts:1
- [nitpick] The naming between
UndoManager
(UI) andUndoCollector
(shared events) is inconsistent; aligning these interface names would improve clarity across modules.
export interface UndoManager {
src/json-crdt-peritext-ui/types.ts:1
- The new
UndoManager
interface currently lacks unit tests; consider adding tests to cover itspush
andundo
behavior to maintain test coverage.
export interface UndoManager {
|
||
export interface Rect { | ||
x: number; | ||
y: number; | ||
width: number; | ||
height: number; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defining a Rect
interface here duplicates types likely defined elsewhere (e.g., in web/types
); consider reusing or aliasing a shared Rect type to prevent divergence.
export interface Rect { | |
x: number; | |
y: number; | |
width: number; | |
height: number; | |
} | |
import type { Rect } from '../../../../../web/types'; |
Copilot uses AI. Check for mistakes.
@@ -3,7 +3,7 @@ import * as React from 'react'; | |||
import {FormattingsManagePane} from '../../../formatting/FormattingsManagePane'; | |||
import {BottomPanePortal} from '../../util/BottomPanePortal'; | |||
import {useToolbarPlugin} from '../../../context'; | |||
import type {PeritextEventDetailMap} from '../../../../../events'; | |||
import type {PeritextEventDetailMap} from '../../../../../../json-crdt-extensions/peritext/events'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This long relative import path can be brittle and hard to maintain; consider configuring TypeScript path aliases to simplify and shorten imports.
import type {PeritextEventDetailMap} from '../../../../../../json-crdt-extensions/peritext/events'; | |
import type {PeritextEventDetailMap} from 'json-crdt-extensions/peritext/events'; |
Copilot uses AI. Check for mistakes.
🎉 This PR is included in version 17.43.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
No description provided.