-
Notifications
You must be signed in to change notification settings - Fork 935
set x-slate-fragment in PlateView #4431
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
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
🦋 Changeset detectedLatest commit: 1863d89 The changes in this PR will be included in the next version bump. This PR includes changesets to release 43 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Claude finished @felixfeng33's task —— View job Code Review for "set x-slate-fragment in plateStatic"Review Checklist
SummaryThis PR adds copy functionality to Code Review✅ Strengths
🔍 Issues Found1. Critical: Missing
|
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
/changeset |
|
Claude finished @zbeyens's task —— View job Todo List:
SummaryCreated a changeset file for the new copy functionality in PlateStatic:
The changeset documents the addition of copy functionality to the PlateStatic component, which enables proper serialization of selected content with the |
Co-authored-by: Ziad Beyens <[email protected]>
|
/test |
|
Claude finished @zbeyens's task —— View job Todo List:
SummarySuccessfully created comprehensive test coverage for the new copy functionality in PlateStatic. The tests include:
Key FindingThe tests confirm the issue identified in the previous review: |
- Add tests for setFragmentDataStatic - Add tests for getSelectedDomBlocks - Add tests for getPlainText - Add integration tests for PlateStatic copy functionality - Tests demonstrate that data-slate-id attributes are missing Co-authored-by: Ziad Beyens <[email protected]>
|
/changeset |
|
/test |
|
Claude finished @felixfeng33's task —— View job Todo List:
SummarySuccessfully created comprehensive test coverage for the new PlateStatic copy functionality. The tests include:
Known IssuesSome existing tests in the project are failing due to missing dependencies (@platejs/callout, @platejs/resizable), but the new tests for the copy functionality are working correctly. The test suite covers all the new code paths and edge cases. |
| * @param deps - Additional dependencies for the useMemo hook (default: []) | ||
| * @see {@link createStaticEditor} for detailed information on static editor creation and configuration. | ||
| */ | ||
| export function usePlateViewEditor< |
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.
@claude do you prefer usePlateViewEditor or useViewEditor? to match createStaticEditor, createViewEditor, usePlateEditor, createSlateEditor, createPlateEditor
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.
Claude finished @zbeyens's task —— View job
Todo List:
- Analyze the naming patterns in the codebase
- Provide recommendation for hook naming
Naming Recommendation
I prefer usePlateViewEditor for the following reasons:
-
Consistency with existing patterns: The codebase already has
usePlateEditoras the primary hook for creating React editors. UsingusePlateViewEditormaintains this naming convention. -
Clear namespace distinction: The "Plate" prefix distinguishes these React-enhanced hooks from base Slate functionality. This is important because:
usePlateEditorcreates a Plate editor (React-enhanced)usePlateViewEditorcreates a Plate view editor (React-enhanced, static)- Without the prefix,
useViewEditorcould be confused with a base Slate hook
-
Parallel structure: The existing create functions follow this pattern:
createPlateEditor→usePlateEditorcreateStaticEditor→usePlateViewEditor
Note: There's no
createViewEditorin the codebase - the static editor is created withcreateStaticEditor. -
Semantic clarity: The name clearly indicates this is a Plate-specific hook for view/static editors, not a generic editor hook.
The pattern useEditor* (without "Plate") is reserved for hooks that interact with existing editors (like useEditorSelector, useEditorPlugin), not for creating new editor instances.
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.
@dosu do you prefer usePlateViewEditor or useViewEditor? to match createStaticEditor, createViewEditor, usePlateEditor, createSlateEditor, createPlateEditor
- Add tests for createStaticEditor with copy plugin configuration - Add tests for CopyPlugin fragment data serialization - Add tests for DOM selection utilities (getSelectedDomBlocks, getSelectedDomNode) - Add tests for isSelectOutside editor detection - Add tests for getPlainText DOM text extraction - Add tests for PlateView component copy event handling - Add tests for usePlateViewEditor hook memoization Co-authored-by: Felix Feng <[email protected]>
|
/changeset |
|
Claude finished @felixfeng33's task —— View job Todo List:
SummarySuccessfully updated the changeset and changelog for this PR:
The changes properly document the new copy functionality for PlateStatic and all related components that enable static rendering with copy support. |
- Updated changeset from patch to minor as this adds new features - Added comprehensive changeset description covering all new components and utilities - Added changelog entry for EditorView component in registry Co-authored-by: Felix Feng <[email protected]>
Registry Changes: Changelog UpdatesWhen changes are made to Changelog Standards:
|
|
Claude finished @felixfeng33's task —— View job Todo List:
SummaryThe changelog has already been properly updated! I verified that:
The changelog entry follows the project's format and properly documents the registry component addition. No further updates are needed. |
Checklist
yarn typecheckyarn lint:fixyarn testyarn brlyarn changeset