Implementation:0xranx OpenContext Mobile EditorApp
| Knowledge Sources | |
|---|---|
| Domains | Mobile, Editor, React |
| Last Updated | 2026-10-24 00:00 GMT |
Overview
React component that bridges the Tiptap markdown editor into a React Native WebView, using postMessage for bidirectional communication with the native iOS app.
Description
The EditorApp.jsx in src/ui/src/mobile/ is the WebView-side entry point for the iOS app's editor. It receives load messages (setting markdown content and editor ID) and setLocale messages (changing i18n language) from the native side via window.message events. On content change, it posts contentChange messages back to window.ReactNativeWebView. It renders the TiptapMarkdownEditor component with the received markdown.
Usage
Load this component as the WebView content in the iOS EditorWebView component.
Code Reference
Source Location
- Repository: 0xranx_OpenContext
- File: src/ui/src/mobile/EditorApp.jsx
- Lines: 1-79
Signature
export default function EditorApp()
Import
import EditorApp from './mobile/EditorApp';
I/O Contract
Inputs (via postMessage)
| Name | Type | Required | Description |
|---|---|---|---|
| type | string | Yes | "load" or "setLocale" |
| payload.id | string | No (load) | Editor instance ID |
| payload.markdown | string | No (load) | Initial markdown content |
| payload.locale | string | No (setLocale) | Language code |
Outputs (via postMessage)
| Name | Type | Description |
|---|---|---|
| ready | Event | Emitted on mount |
| contentChange | Event | { markdown } on content change |
Usage Examples
WebView Bridge Protocol
// Native side (React Native)
const webViewRef = useRef(null);
// Send content to editor
webViewRef.current.injectJavaScript(
`window.postMessage(JSON.stringify({ type: 'load', payload: { id: 'doc-1', markdown: '# Hello' } }))`
);
// Receive content changes
onMessage={(event) => {
const msg = JSON.parse(event.nativeEvent.data);
if (msg.type === 'contentChange') {
setContent(msg.payload.markdown);
}
}}