Conversation
…patibility - Implement contenteditable-based editor with formatting toolbar (bold, italic, underline, headings, lists) - Add dark theme support with dynamic color injection - Ensure HTML output matches Tiptap structure for cross-platform compatibility - Lists use <li><p>content</p></li> structure - Empty lines as <p></p> instead of <p><br></p> - Bold uses <strong> instead of <b> - Proper HR and blockquote rendering - Fix Enter key behavior to properly handle cursor position (beginning/middle/end) - Add backspace to exit lists and convert to paragraphs - Update view note rendering with proper list, code block, and blockquote styling - Configure Sentry monitoring (org: bata-labs, project: typelets-app-mobile)
…etInterval> to ensure compatibility with browser environments where setTimeout returns number instead of NodeJS.Timeout
…ure/native-editor
Contributor
|
🎉 This PR is included in version 1.30.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Issues attributed to commits in this pull requestThis pull request was merged and Sentry observed the following issues:
|
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.
Native WebView-Based WYSIWYG Editor with Tiptap Compatibility
Summary
This PR replaces
react-native-pell-rich-editorwith a custom WebView-based editor that provides full Tiptap HTML compatibility, advanced list management, and improved mobile editing experience.Editor Implementation
contenteditablewith modern Web APIsapps/mobile/v1/editor/src/components/Editor.tsx)document.execCommandfor basic formatting (bold, italic, underline, strikethrough)<li><p>content</p></li>postMessagebetween WebView and React NativejavaScriptEnabled: true,keyboardDisplayRequiresUserAction: falseList Management
<ol>)<ul>to<ol>)<ol>to<ul>)range.setStart()andselection.addRange()<p>tag issue by checkingitem.children.length === 1 && item.children[0].tagName === 'P'<p>tags instead of wrapping content againTask List Features
data-type="taskList"attribute<li>with checkbox structure:<label><input type="checkbox"><span></span></label>data-type="taskList"anddata-type="taskItem"attributes for Tiptap compatibilitydata-checked="true/false"attributes on checkboxesdisplay: flex; align-items: center; margin: 4px 0width: 16px; height: 16px; margin: 0 8px 0 0Keyboard Interactions
\ninstead of creating new blocks<pre>tags by walking parent nodesdocument.createTextNode('\n')for proper newline insertione.preventDefault()ande.stopPropagation()range.setStartAfter(textNode)Format State Tracking
checkActiveFormats()function that walks up DOM treewindow.getSelection()andgetRangeAt(0)to get current cursor positiondocument.queryCommandState()for inline formatsdata-typeattributepostMessageas{ type: 'formats', formats }selectionchangeevent listener for continuous format trackingdocument.addEventListener('selectionchange', checkActiveFormats)for global trackingIndent/Outdent Fix
document.execCommand('indent')for paragraphs (was creating<blockquote>with italic styling)paddingLeftstyle for paragraphs and headingscurrentPadding + 20 + 'px'<ul>inside<li>)paddingLeftby 20px incrementsMath.max(0, currentPadding - 20)<ul>or<ol>tags<p>,<div>,<h1>,<h2>,<h3>tagsEditNote Screen Updates
react-native-pell-rich-editordependency and RichEditor component../../../editor/srcactiveFormats: string[]to format object with booleansonFormatChange={(formats) => setActiveFormats(formats)}activeFormats.bulletList && { backgroundColor: theme.colors.muted }<Editor value={content} onChange={setContent} />ViewNote Rendering
max-width: 100%; height: auto; display: block.image, [data-type="image"] { max-width: 100% }padding: 12px 16px 16px 16px(top: 12px, sides: 16px, bottom: 16px)ul, ol { margin: 8px 0 }ul[data-type="taskList"] { list-style: none; padding-left: 0 }li[data-type="taskItem"] { display: flex; align-items: center }WebView Caching
keyprop to WebView for cache busting:key="editor-v4.2"Workspace Configuration
pnpm-workspace.yamlwith workspace package paths:apps/*andapps/*/v1pnpm-lock.yamlwith new dependency resolutionsapps/mobile/v1/app/editor-test.tsxandapps/mobile/v1/editor/example.tsxPerformance Optimizations
setTimeoutandclearTimeoutwindow.ReactNativeWebView.postMessage(JSON.stringify({ type, data }))for efficient communicationinnerHTMLfor bulk updates instead of individual node operationsBug Fixes
<p>tags in saved HTML (was<p><p>content</p></p>, now<p>content</p>)align-items: flex-starttocenter)margin-top: 0.2em)max-width: 100%)font-style: italic)Performance Impact
Editor Performance:
Bundle Size:
react-native-pell-rich-editor(~150KB)Memory Usage:
Expected Improvements:
Testing Checklist
List Conversions:
Keyboard Interactions:
Format States:
Data Integrity:
<p>tags in outputdata-typeattributesdata-checkedattributesDark Mode:
Migration Notes
For Users:
For Developers:
react-native-pell-rich-editorfrom package.json dependencies@typelets/editorworkspace packagestring[]to object with boolean propertiesactiveFormats.includes('bold')toactiveFormats.boldFiles Changed
New Files:
apps/mobile/v1/editor/src/components/Editor.tsx(1,441 lines)apps/mobile/v1/editor/src/components/EditorToolbar.tsx(95 lines)apps/mobile/v1/editor/src/hooks/useEditor.ts(95 lines)apps/mobile/v1/editor/src/index.ts(14 lines)apps/mobile/v1/editor/src/types.ts(25 lines)apps/mobile/v1/editor/src/utils/markdown.ts(45 lines)apps/mobile/v1/editor/README.md(45 lines)Modified Files:
apps/mobile/v1/src/screens/EditNote/index.tsx(435 line changes)apps/mobile/v1/src/screens/EditNote/EditorHeader.tsx(12 line changes)apps/mobile/v1/src/screens/ViewNote/NoteContent.tsx(22 line changes)pnpm-lock.yaml(16,876 line changes)pnpm-workspace.yaml(3 lines added)Deleted Files:
apps/mobile/v1/app/editor-test.tsx(test file, 178 lines)apps/mobile/v1/editor/example.tsx(example file, 70 lines)Stats