Skip to content

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

Merged
merged 2 commits into from
May 22, 2025
Merged

Peritext UI events location #899

merged 2 commits into from
May 22, 2025

Conversation

streamich
Copy link
Owner

No description provided.

@streamich streamich requested a review from Copilot May 22, 2025 18:04
@streamich streamich merged commit ba8052f into master May 22, 2025
3 checks passed
@streamich streamich deleted the peritext-ui-events branch May 22, 2025 18:06
Copy link

@Copilot Copilot AI left a 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 move UndoCollector 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) and UndoCollector (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 its push and undo behavior to maintain test coverage.
export interface UndoManager {

Comment on lines +3 to 10

export interface Rect {
x: number;
y: number;
width: number;
height: number;
}

Copy link
Preview

Copilot AI May 22, 2025

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.

Suggested change
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';
Copy link
Preview

Copilot AI May 22, 2025

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.

Suggested change
import type {PeritextEventDetailMap} from '../../../../../../json-crdt-extensions/peritext/events';
import type {PeritextEventDetailMap} from 'json-crdt-extensions/peritext/events';

Copilot uses AI. Check for mistakes.

Copy link

🎉 This PR is included in version 17.43.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant