@octane-xplat/lexical 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -7
- package/dist/macos/browser.js +1 -1
- package/dist/native/index3.js +38 -21
- package/dist/native/octane-client-build.json +1 -1
- package/dist/web/index2.js +24 -21
- package/dist/web/octane-client-build.json +1 -1
- package/package.json +7 -5
- package/src/LexicalEditor.mobile.test.ts +229 -0
- package/src/LexicalEditor.tsrx +52 -20
- package/src/LexicalEditor.web.test.tsrx +111 -0
- package/src/LexicalEditor.web.tsrx +19 -12
- package/src/types.ts +32 -6
package/README.md
CHANGED
|
@@ -64,12 +64,98 @@ export function DocumentCopy() {
|
|
|
64
64
|
}
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
On web, `web.nodes` adds custom Lexical node classes to the facade's built-in
|
|
68
|
+
nodes, and `web.plugins` renders additional Octane plugin components inside
|
|
69
|
+
the Lexical composer. Set `replaceNodes` to `true` when `web.nodes` should be
|
|
70
|
+
the full custom node registry. Set `replacePlugins` to `true` to replace the
|
|
71
|
+
default history, list, link, and autofocus plugins with your own composition;
|
|
72
|
+
the rich-text surface and facade change/ref bindings remain installed. This
|
|
73
|
+
lets a custom node keep its Lexical JSON type and HTML representation during
|
|
74
|
+
a round-trip.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import { LexicalEditor } from '@octane-xplat/lexical'
|
|
78
|
+
import { BadgeNode, BadgePlugin } from './lexical-extensions'
|
|
79
|
+
|
|
80
|
+
export function NoteEditor() {
|
|
81
|
+
return (
|
|
82
|
+
<LexicalEditor
|
|
83
|
+
value='<p><span data-badge>Voyager</span></p>'
|
|
84
|
+
web={{ nodes: [BadgeNode], plugins: <BadgePlugin /> }}
|
|
85
|
+
/>
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The `web` options are ignored on native. Native still edits with Aztec on
|
|
91
|
+
Android and uses the fixed headless conversion node set for JSON. Caller
|
|
92
|
+
plugins, custom nodes, browser views, and arbitrary JavaScript transforms do
|
|
93
|
+
not run there. Apps replacing the web defaults can set both replacement
|
|
94
|
+
options and register the node classes Lexical requires for their documents.
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { LexicalEditor } from '@octane-xplat/lexical'
|
|
98
|
+
import { BadgeNode, BadgePlugin } from './lexical-extensions'
|
|
99
|
+
|
|
100
|
+
export function NoteEditor() {
|
|
101
|
+
return (
|
|
102
|
+
<LexicalEditor
|
|
103
|
+
web={{ replaceNodes: true, nodes: [BadgeNode], replacePlugins: true, plugins: <BadgePlugin /> }}
|
|
104
|
+
/>
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Engine and feature boundary
|
|
110
|
+
|
|
111
|
+
| Target | Editing engine | `web` options | Caller plugins, custom nodes, and browser views |
|
|
112
|
+
| --- | --- | --- | --- |
|
|
113
|
+
| Web | Lexical `LexicalComposer` with the facade's default nodes and plugins | `nodes`, `plugins`, and replacement flags apply | Supported by the web Lexical engine |
|
|
114
|
+
| Android | WordPress Aztec `AztecText`; a headless Lexical editor converts serialized state to and from HTML | Ignored | Unsupported; no live Lexical editor, plugin, transform, custom node, or browser view runs |
|
|
115
|
+
| iOS | Unsupported placeholder from `@octane-xplat/richtext` | Ignored | Unsupported; `supported` is `false` |
|
|
116
|
+
| macOS AppKit | Bundled Lexical editor in WKWebView | Ignored by the AppKit host | Unsupported through this facade |
|
|
117
|
+
|
|
118
|
+
On Android, save HTML as the canonical document. Lexical serialized state is
|
|
119
|
+
a best-effort conversion through the fixed built-in node set; it is not a live
|
|
120
|
+
Lexical editor state that supports commands or plugins.
|
|
121
|
+
The 2026-10-06 [Aztec nested-tree run](../../.agents/docs/parity/nested-tree-editor.md)
|
|
122
|
+
preserved nested wrappers, attributes, and child order through synthetic text
|
|
123
|
+
edits and save/reopen, but flattened paragraphs and accumulated `<br>` elements
|
|
124
|
+
on reopen. That run exercised the shared Aztec HTML leaf, not Lexical's JSON
|
|
125
|
+
conversion or structural commands. See the
|
|
126
|
+
[per-row capability record](../../docs/notes/editor-capabilities.md).
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
import { useState } from 'octane'
|
|
130
|
+
import { LexicalEditor, supported } from '@octane-xplat/lexical'
|
|
131
|
+
import { Text } from '@octane-xplat/ui'
|
|
132
|
+
|
|
133
|
+
export function Notes() {
|
|
134
|
+
const [html, setHTML] = useState('<p>Travel notes</p>')
|
|
135
|
+
return supported ? (
|
|
136
|
+
<LexicalEditor value={html} editable onChange={setHTML} />
|
|
137
|
+
) : (
|
|
138
|
+
<Text>Editing is unavailable on this target</Text>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Focus callbacks report focus entering or leaving the editable surface.
|
|
144
|
+
`onJSONReady(true)` fires once the web editor handle exists, so `getJSON()` is
|
|
145
|
+
available from `onReady` and after readiness. On native, `onJSONReady` still
|
|
146
|
+
reports when the lazy conversion bridge settles.
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
<LexicalEditor
|
|
150
|
+
onJSONReady={(ready) => console.log('JSON ready:', ready)}
|
|
151
|
+
onFocus={() => console.log('Editor focused')}
|
|
152
|
+
onBlur={() => console.log('Editor blurred')}
|
|
153
|
+
/>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
There is no live `LexicalEditor` on Android: no `dispatchCommand`, no node
|
|
157
|
+
transforms; `native` returns the `AztecText` and the headless editor used for
|
|
158
|
+
conversions is an internal detail.
|
|
73
159
|
|
|
74
160
|
The lexical family pins to `0.51.0` and `@octanejs/lexical` to `0.2.0`
|
|
75
161
|
(peers `octane ^0.6.0`). `@lexical/link` carries a workspace patch for its
|
|
@@ -83,4 +169,4 @@ The macOS export mounts a bundled local editor document in WKWebView.
|
|
|
83
169
|
RichText uses StarterKit; Tiptap and Lexical use their existing web facades.
|
|
84
170
|
Wait for `onReady`; synchronous getters return the latest received snapshot
|
|
85
171
|
and commands cross WebKit asynchronously. The `native` handle is the Swift
|
|
86
|
-
host transport. See [AppKit setup and engine limits](../../docs/rich-text.md#macos-appkit-editing).
|
|
172
|
+
host transport. See [AppKit setup and engine limits](../../docs/app/rich-text.md#macos-appkit-editing).
|