@octane-xplat/tiptap 0.9.0 → 0.10.0

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 CHANGED
@@ -2,14 +2,25 @@
2
2
 
3
3
  The unified rich-text facade: one `TiptapEditor` component across web and
4
4
  native. Web renders a real tiptap `Editor` through `@octanejs/tiptap`'s
5
- `EditorContent`; native renders the `@octane-xplat/richtext` leaf (WordPress
5
+ `EditorContent`; Android renders the `@octane-xplat/richtext` leaf (WordPress
6
6
  Aztec on Android, iOS stub) and layers tiptap document JSON on top through
7
7
  the DOM-free ProseMirror slices (`@tiptap/pm`, `@tiptap/static-renderer`)
8
8
  with a `zeed-dom` parse shim. No DOM-bound tiptap code (`EditorView`) ever
9
9
  enters a native bundle — divergence lives at the file-suffix boundary.
10
10
 
11
- ```ts
11
+ ```tsx
12
+ import { useState } from 'octane'
12
13
  import { TiptapEditor, supported } from '@octane-xplat/tiptap'
14
+ import { Text } from '@octane-xplat/ui'
15
+
16
+ export function Notes() {
17
+ const [html, setHtml] = useState('<p>Trip notes</p>')
18
+ return supported ? (
19
+ <TiptapEditor value={html} onChange={setHtml} />
20
+ ) : (
21
+ <Text>Editing is unavailable on this target</Text>
22
+ )
23
+ }
13
24
  ```
14
25
 
15
26
  `value`/`onChange` exchange document HTML. `getJSON`/`setJSON` exchange
@@ -19,8 +30,50 @@ returns `null`) on runtimes that cannot host the schema modules. On native,
19
30
  HTML is the canonical interchange format; JSON output is a best-effort
20
31
  mapping of Aztec's flat span list onto ProseMirror's tree.
21
32
 
33
+ ```tsx
34
+ import { useRef, useState } from 'octane'
35
+ import { TiptapEditor, type TiptapEditorHandle } from '@octane-xplat/tiptap'
36
+ import { Button } from '@octane-xplat/ui'
37
+
38
+ export function DocumentCopy() {
39
+ const editor = useRef<TiptapEditorHandle | null>(null)
40
+ const [html, setHtml] = useState('<p>Trip notes</p>')
41
+ const [jsonReady, setJsonReady] = useState(false)
42
+ return (
43
+ <>
44
+ <TiptapEditor
45
+ value={html}
46
+ onChange={setHtml}
47
+ ref={(handle) => {
48
+ editor.current = handle
49
+ }}
50
+ onReady={() => setJsonReady(editor.current?.getJSON() != null)}
51
+ onJSONReady={setJsonReady}
52
+ />
53
+ <Button
54
+ isDisabled={!jsonReady}
55
+ onPress={() => {
56
+ const document = editor.current?.getJSON()
57
+ if (document) editor.current?.setJSON(document)
58
+ }}
59
+ >
60
+ Round-trip document
61
+ </Button>
62
+ </>
63
+ )
64
+ }
65
+ ```
66
+
22
67
  The tiptap family pins to `3.28.0` to match `@octanejs/tiptap@0.0.51` —
23
68
  extension `^` ranges float ahead of core and break (`getPreviousBlockSibling`),
24
69
  so consumers should keep the workspace override. See
25
- [`docs/rich-text.md`](../../docs/rich-text.md) for the shared contract,
70
+ [`docs/app/rich-text.md`](../../docs/app/rich-text.md) for the shared contract,
26
71
  format vocabulary, and known limits.
72
+
73
+ ## macOS AppKit
74
+
75
+ The macOS export mounts a bundled local editor document in WKWebView.
76
+ RichText uses StarterKit; Tiptap and Lexical use their existing web facades.
77
+ Wait for `onReady`; synchronous getters return the latest received snapshot
78
+ and commands cross WebKit asynchronously. The `native` handle is the Swift
79
+ host transport. See [AppKit setup and engine limits](../../docs/rich-text.md#macos-appkit-editing).
@@ -0,0 +1 @@
1
+ declare const html: string; export default html