refactor(web): cleaned up web/src structure - #776
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the src/web folder structure by moving web-specific helpers into clearer subfolders (e.g., utils/, nativeMappers/, tiptapWatchers/, htmlExtensions/) and updates import paths accordingly, while also adding a few web utilities used by the editor and renderer.
Changes:
- Reorganized web code into purpose-based subdirectories and updated all affected imports.
- Added browser/DOM environment assertion for client-only components (SSR clarity).
- Added/extended web utilities: paste-image dimension reading, ordered list marker sizing, and image error fallback handling.
Reviewed changes
Copilot reviewed 16 out of 24 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/web/utils/useStableRef.ts | New hook to hold latest values via a stable ref. |
| src/web/utils/pasteImages.ts | Updated imports + uses new helper to read pasted image dimensions. |
| src/web/utils/pastedImageDimensions.ts | New helper to best-effort decode intrinsic image dimensions. |
| src/web/utils/assertBrowserEnvironment.ts | New helper to throw a clear error when DOM APIs are unavailable (SSR). |
| src/web/tiptapWatchers/useOnLinkDetected.ts | Updated import path for position mapping. |
| src/web/tiptapWatchers/useOnEditorChange.ts | Updated import path for adapted native events. |
| src/web/tiptapWatchers/useOnChangeText.ts | Updated type + position-mapping imports after refactor. |
| src/web/tiptapWatchers/useOnChangeState.ts | Updated type/import paths to new structure. |
| src/web/tiptapWatchers/useOnChangeHtml.ts | Updated type/import paths to new structure. |
| src/web/tiptapWatchers/emitLinkDetected.ts | Updated type import path. |
| src/web/pmPlugins/AutolinkPlugin/index.ts | Updated imports to new watcher/mapper locations. |
| src/web/nativeMappers/returnKeyTypeToEnterKeyHint.ts | Moved mapping utility into nativeMappers/. |
| src/web/nativeMappers/positionMapping.ts | Moved/refined PM↔native position utilities. |
| src/web/nativeMappers/adaptWebToNativeEvent.ts | Moved/refined web event → RN NativeSyntheticEvent adapter. |
| src/web/htmlExtensions/usePressInteractions.ts | Updated type import path. |
| src/web/htmlExtensions/useOrderedListMarkerWidth.ts | New hook to set --et-ol-digits for ordered list layout. |
| src/web/htmlExtensions/useImageErrorFallback.ts | New hook to mark broken images for CSS fallback. |
| src/web/formats/EnrichedLink.ts | Updated import path for position mapping. |
| src/web/formats/applyWrappingListToSelection.ts | Updated import path for position mapping. |
| src/web/EnrichedTextInput.tsx | Updated imports to new structure; uses new helpers/mappers. |
| src/web/EnrichedText.tsx | Updated imports to new structure; uses new helpers/extensions. |
| src/web/tests/returnKeyTypeToEnterKeyHint.test.ts | Updated import path after refactor. |
| src/web/tests/assertBrowserEnvironment.ssr.test.ts | Updated import path after refactor. |
| src/web/tests/assertBrowserEnvironment.dom.test.ts | Updated import path after refactor. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
exploIF
approved these changes
Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A lot of files were just dropped were just dropped into
src/webdirectory, which was messy. Grouped the files according to their existential purpose.Compatibility
Checklist