Skip to content

Commit 4a904ef

Browse files
authored
Develop (#2)
* fix: update bundle identifier and enhance production build configuration * refactor(editor): improve type definitions and enhance component display names * refactor: update imports and clean up unused code across multiple components * feat: Implement animated block wrappers to enhance focus states across editor components - Added AnimatedBlockWrapper component for smooth focus animations without layout shifts. - Updated FormattedTextInput to remove minHeight to prevent layout jumps. - Enhanced ChecklistPlugin with animated focus states and background color transitions. - Integrated animated background color in CodePlugin for improved focus feedback. - Modified HeadingPlugin to include animated border color for focus indication. - Updated ListPlugin to animate background color on focus. - Enhanced ParagraphPlugin with animated border and background colors. - Improved QuotePlugin with animated bar and background colors for focus states. - Introduced BLOCK_SPACING constants and animation configurations for consistent styling. - Established a new blockStyles.ts file to centralize styling and animation logic for editor blocks. * feat: Enhance editor functionality with block action toolbar and improved quote handling - Added BlockActionToolbar to EditorCore for better block management. - Introduced readOnly prop in EditorCore to control editing capabilities. - Enhanced ChecklistPlugin and ListPlugin with visual indicators for nested levels. - Improved QuotePlugin to support multi-line quotes with depth management. - Refactored quote input handling to maintain depth state and cursor position. - Updated editor types to include quoteLineDepths for better depth tracking. * feat: Add KeyboardDock component for unified bottom dock and implement useKeyboardOffset hook for dynamic keyboard height * chore: update dependencies to latest versions - Upgraded @expo/vector-icons to 15.0.3 - Updated expo and related packages to their latest compatible versions - Upgraded react and react-dom to 19.1.0 - Updated react-native to 0.81.5 - Upgraded react-native-reanimated to 4.1.1 - Updated various other dependencies for improved performance and compatibility * feat: Implement unified EditorBottomBar with keyboard dock and contextual controls * feat(editor): enhance block management with improved logging and height handling * feat: Enhance editor with theme context and plugin architecture - Added EditorThemeContext for managing themes in the editor. - Integrated theme provider to load and save user preferences using AsyncStorage. - Updated MarkdownEditor to utilize the new theme context. - Refactored plugin registration to ensure singleton instances and prevent duplicates. - Improved Markdown serialization and deserialization to support new block types (callout, checklist, image, video). - Enhanced EditorProvider to manage block metadata effectively. - Created comprehensive documentation for the plugin architecture and usage patterns. - Updated utility functions for better markdown handling and block creation. * chore(app): update adaptive icons and splash images * chore(dependencies): update expo-dev-client and related packages * feat(editor): add FocusManager and virtualized FlatList focus/scroll system - Introduce FocusManager (components/editor/utils) to centralize block focus and post-scroll focus application. - Refactor EditorCore to use FlatList (virtualized rendering) with: - getItemLayout using measured block heights (ESTIMATED_BLOCK_HEIGHT fallback) - onScrollToIndexFailed handler that estimates offset and applies pending focus - requestBlockFocus API to request/perform focus + reveal - removed legacy ScrollView-based measure/scroll machinery and related timeouts - Track per-block heights and pass handle to FlatList for layout optimization. - Update BlockRenderer to: - register/unregister blocks with FocusManager - measure block height via onLayout and call onBlockHeightChange - attempt to focus inner component when FocusManager triggers focus - Add EditorCore.backup.tsx as a backup snapshot of the previous EditorCore implementation. Improves performance and reliability of focus + scroll behavior, and prepares editor for large documents. * feat(editor): expose focus handles on built-in block plugins and wire BlockRenderer - Convert built-in block components (Paragraph, Heading, List, Checklist, Code, Callout, Divider, Image, Video, Table, etc.) to use forwardRef + useImperativeHandle and expose a standard focus() handle for the editor FocusManager. - Update BlockRenderer to forward the component ref to block components so the FocusManager can call focus() and to treat isEditing as focused when mounting. - Add tests (plugin-focus-handles.test.tsx) to assert built-in plugins provide focus handles. - Update plugin architecture docs with a "Focus & Scroll Contract" describing ref/focus requirements. - Minor test file newline/whitespace fix. * feat(editor): add insertBlock options, plugin-driven block creation, and improved list handling - Editor API: extend insertBlock signature to accept options { meta, content } across types/editor, EditorCore, MarkdownEditor, EditorProvider and EditorScreen; forward meta/content when creating/inserting blocks. - Plugin-aware blocks: EditorProvider.createBlock now consults pluginRegistry and uses plugin.createBlock when available, preserving plugin defaults (meta/content/pluginId) on creation. - Lists: add getListSiblingIndices util; BlockActionToolbar and EditorBottomBar can toggle list type across contiguous sibling list items and restore previous meta when toggling back. - ListPlugin: add createBlock, remove inline toggle UI interaction, fix handleEnter to correctly renumber subsequent ordered siblings (respecting nesting), and rewrite reorderList to compute indices per nesting level. - TablePlugin: safer immutable updates for rows/columns (handle missing rows/cells and avoid undefined mutations). - MarkdownEditor: delegate insertBlock to underlying editor ref with fallback createBlock that applies options. - Tests: remove legacy/duplicative tests and add focused list-plugin.test.ts and markdown-serialization.test.ts covering list behavior and markdown round-trips. - Chore(deps): bump various Expo / RN / tooling deps in package.json & package-lock; add react-test-renderer devDependency. Notes: preserves existing behavior while enabling block creation with plugin-provided defaults and better list semantics (sibling-aware toggles and correct ordered indices). * feat(editor): replace empty-space footer with Add block button; clear stale unsaved state - Replace invisible "tap to add" empty space with a centered "Add block" button (icon + label) in EditorCore, add proper styles and accessibility attributes. - Fix editor effect to clear unsaved changes when no actual changes are detected and update effect deps to include clearUnsavedChanges and hasUnsavedChanges. * feat(editor): dismiss keyboard on block actions; enhance focus options & pending-focus logic Dismiss the keyboard when opening block menu or inserting a block to avoid layout/jump issues. Add viewPosition and viewOffset support and propagate them to FlatList.scrollToIndex. Improve pending-focus handling to auto-apply when a block registers and choose viewPosition/viewOffset based on keyboard and bottom-bar heights. Add debug logging around FocusManager requests/registrations and focus application. * feat(editor): integrate optional keyboard controller and improve focus/scroll reveal flow - wrap app in an optional KeyboardProvider (safe require + fallback) in _layout.tsx - add react-native-keyboard-controller dependency and update lockfiles/package.json - expose a measure() from BlockRenderer (measureInWindow) and register it with FocusManager - extend FocusManager with reveal lifecycle: awaiting flags, notifyRevealComplete, measureBlock, and improved request/apply focus timing - enhance EditorCore to track scroll offset, schedule reveal completion checks, retry fallback reveals, and adjust scrolling when keyboard appears; wire FlatList scroll events - update useKeyboardOffset to consume optional KeyboardController events when available - remove stale backup file and tweak related build/test lock entries * feat(editor): large cleanup, refactor, and feature improvements across core, plugins, ui, utils, and infra This commit contains a broad set of changes that improve formatting consistency, tighten types, fix small logic issues, and add several functional improvements (notable focus/scroll, markdown handling, plugin metadata preservation, and keyboard/drag-drop behavior). Changes are grouped below for easier review. Highlights - Editor core & rendering - Integrate FlatList virtualization improvements and robust scroll-to-index fallback in EditorCore (getItemLayout, onScrollToIndexFailed, requestBlockFocus resiliance and retry logic). - Track block heights and emit onBlockHeightChange; measure block layout in BlockRenderer and call callbacks. - Improve FocusManager usage and scheduling of reveal completion (scheduleRevealCompletionCheck). - Tidy up useImperativeHandle and many callbacks to be stable (memoize, add deps). - Better error handling via SafeBlockRenderer/BlockErrorBoundary (formatting + compacted JSX). - Text input, formatting and keyboard - Refactor FormattedText and FormattedTextInput for cleaner props, inline returns, show formatted view when not editing, add preventNewlines option, improved placeholder color and focus flow. - Keyboard handling (useEditorKeyboard, KeyboardHandler) refactored: normalized handlers (Enter/Backspace/Tab/Arrow/general keys), improved shortcut list and handling, support for EnhancedKeyboardResult, debouncing, and web compatibility fixes. - Cursor preservation and selection handling improvements. - Markdown & plugins - Introduce and tidy MarkdownRegistry utilities (serialize/parse), ensure built-in + plugin-based markdown parsing preserves block meta and uses registry serializers. - EditorProvider: ensure createBlock accepts meta, preserve meta when creating blocks, use MarkdownRegistry for import/export, plugin registration improvements and safer error handling. - PluginRegistry & PluginFactory cleanup: stronger validation, consistent insertion order for markdown plugins, minor API/format fixes. - Built-in plugins (Callout, Checklist, Code, Divider, Heading, Image, List, Paragraph, Quote, Table, Video) updated with: - Cleaner component implementations, forwardRef/useImperativeHandle usage, improved dark-mode styling and interactions. - Better markdown parsing/serialization and meta preservation. - UI improvements (controls, placeholders, edit flows, validation). - Minor behavioral fixes (e.g. checklist toggle, list/ordered index handling, quote depths, table column/row editing). - Drag & drop - Reworked EditorDragDrop: clearer state updates, consistent handlers (startDrag, handleDrag, endDrag, cancelDrag), improved external drop handling (files/text/html), cleaner props for overlay and indicators. - State management & history - EditorState and EditorProvider: normalize history shape, debounced history updates, setBlocksImmediate for instant UI updates, undo/redo enhancements and canUndo/canRedo flags. - Improvements to useEditorState public API and internal functions (generateBlockId stability, create/duplicate/move/delete block semantics). - UI, styles and design system - Numerous style cleanups, consistent trailing commas and formatting across block styles, design system and theme helpers. - Colors, DesignSystem and ThemeProvider minor adjustments and normalization. - FormattingToolbar, KeyboardDock, KeyboardDock layout/padding fixes and style unification. - Utilities & misc - markdownParser, cursorPreservation, animations, and other utils: cleaned up formatting, small algorithm/regex tweaks, newline handling improvements and robust joins. - Icon mapping fixes in IconSymbol. - Tests/jest: improved jest-setup mocks and transformIgnorePatterns trimming; jest config and setup tidy. - package.json: add Prettier formatting scripts and bump expo dev version; remove deprecated reset script file. - Storage backends (Renterd, IPFS, Local): small formatting fixes and header/body fetch formatting; IPFS remains a placeholder. - TypeScript & typings: small tsconfig include/path formatting, many plugin and editor type signatures adjusted for clarity and trailing commas. Other - Documentation update for plugin architecture clarifications - Many whitespace, style, trailing-comma, and lint-friendly changes across components and codebase to improve consistency. Notes - Mostly non-breaking behavioral improvements, but plugin authors should verify custom plugins/controllers for EnhancedKeyboardResult support and meta preservation expectations. - IPFS backend is explicitly still not implemented. - Some files contain non-functional formatting-only edits for consistency. Files touched (non-exhaustive summary) - core: EditorCore.tsx, EditorProvider.tsx, EditorState.ts, EditorContext.ts, BlockRenderer.tsx, EditorDragDrop.ts, EditorKeyboard.ts, KeyboardHandler.tsx, PluginRegistry.ts - components: FormattedText*, FormattedTextInput, FormattingToolbar, KeyboardDock, many built-in plugin components (CalloutPlugin, ChecklistPlugin, CodePlugin, DividerPlugin, HeadingPlugin, ImagePlugin, ListPlugin, ParagraphPlugin, QuotePlugin, TablePlugin, VideoPlugin) - utils: MarkdownRegistry, markdownParser, cursorPreservation, animations, PluginFactory - ui: IconSymbol - constants: Colors, DesignSystem - services/storage: RenterdBackend, LocalStorageBackend, IPFSBackend - tests & infra: jest-setup.js, jest.config.js, package.json (scripts), tsconfig.json * refactor(editor): import cleanup, typing fixes, and block rendering improvements - Reorder and consolidate imports across auth/settings; add missing storage type/context imports - Cast IconSymbol name props to any to silence type errors in UI items - Render block components via React.createElement to ensure refs work for dynamic components - Safe-cast plugin.createBlock call in EditorProvider to support plugin-provided blocks - Add EditorBlockType import and adjust mode typing in editor state - Cast callout type in MarkdownRegistry to avoid type issues - Restore ComponentType import and default controller/toolbar/settings in PluginFactory - Add tsconfig exclude for tests and update README to reference project type-check scripts * refactor(editor): clean up and reorder imports in settings, MarkdownRegistry, and PluginFactory * feat(markdown): add extended markdown features (footnotes, defs, emoji, inline formatting) - Parse & serialize footnote definitions and references; preserve footnote meta - Parse & serialize definition lists (term + ": definition") and support multiple defs - Support heading custom IDs ({#id}) and include IDs in serialization/round-trip - Add inline formatting: strikethrough (~~~~), highlight (== ==), subscript (~ ~), superscript (^ ^) - Auto-link http/https URLs and expose 'link' segment type - Add emoji shortcodes via new utils/emojiMap and replaceEmojiShortcodes integration - Extend types (EditorBlock, FormattedTextSegment) and FormattedText styles to cover new segment types - Update MarkdownRegistry / markdownParser to handle new syntaxes and serialization - Add tests (extended-markdown.test.ts) and a markdown-showcase.md example - Misc: minor import/formatting cleanups and small UI JSX formatting tweaks * feat(editor/markdown): add footnote & definition-list support, Notion-style highlight navigation, long-press link/footnote UX, and tests - Add FootnotePlugin and DefinitionListPlugin and register them as built-in block plugins - Extend MarkdownRegistry / parsing to support footnote definitions, definition-list blocks, heading IDs, and emoji; refactor built-in parsing into shared helper - Implement Notion-style block highlight + navigation: - BlockRenderer highlight overlay + animation, isHighlighted prop, propagate onFootnotePress - EditorProvider / EditorState: highlightedBlockId, highlight/clear APIs - EditorCore: requestBlockHighlight, scrollToFootnote helper, improved reveal scheduling/fallbacks and applyFocus option - FocusManager: retry when blocks not yet registered, added applyFocus flag - Wire footnote navigation end-to-end: FormattedText long-press handlers for links and footnote refs, FormattedTextInput forwards onFootnotePress, Paragraph/Footnote/DefinitionList plugins consume onFootnotePress - Heading & paragraph plugin tweaks (preserve/display heading IDs, pass footnote handlers) - Add extensive tests (under __tests__) for footnote edge-cases, parsing debug, round-trip, plugin-based parsing, and unified parser scenarios - Misc: markdown-showcase formatting fixes, small markdownParser/processInlineFormatting cleanup, editor.tsx dev logging and keyboard hook import reorder
1 parent 17f87cb commit 4a904ef

File tree

124 files changed

+16437
-11505
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+16437
-11505
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ WARP.md
4141
*.tsbuildinfo
4242

4343
app-example
44+
45+
46+
build-*.ipa

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 120,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"arrowParens": "avoid",
9+
"endOfLine": "lf"
10+
}

.vercel/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"projectName":"trae_decanotes-expo_imb5"}
1+
{ "projectName": "trae_decanotes-expo_imb5" }

README.md

Lines changed: 48 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,66 @@ A decentralized markdown editor with block-based architecture supporting multipl
55
## Build & Run
66

77
1. Install dependencies
8+
89
```bash
9-
npm install
10+
bun install
1011
```
1112

12-
2. Start development server
13+
2. Start development server (uses Expo Go by default)
1314
```bash
14-
npx expo start
15+
bun run start
1516
```
17+
3. Run on devices
1618

17-
3. Build for iOS/Android
1819
```bash
19-
npx prebuild --platform ios
20-
npx prebuild --platform android
20+
# iOS (development build)
21+
bun run ios
22+
23+
# Android (development build)
24+
bun run android
2125
```
2226

23-
4. Run on devices
27+
4. Build locally for production
28+
2429
```bash
25-
# iOS
26-
npx expo run:ios
27-
28-
# Android
29-
npx expo run:android
30+
# iOS production build
31+
eas build --platform ios --profile production --local
32+
33+
# Android production build
34+
eas build --platform android --profile production --local
3035
```
3136

37+
## Development
38+
39+
### Type checking
40+
41+
Check TypeScript compilation:
42+
43+
```bash
44+
# Type check
45+
bun run type-check
46+
47+
# Watch mode
48+
bun run type-check:watch
49+
```
50+
51+
### Testing
52+
53+
```bash
54+
# Run tests
55+
bun run test
56+
```
57+
58+
### Linting
59+
60+
```bash
61+
# Check for issues
62+
bun run lint
63+
64+
# Auto-fix issues
65+
bun run format
66+
```
67+
3268
## Features
3369

3470
- Block-based markdown editor with real-time rendering

0 commit comments

Comments
 (0)