@octane-xplat/richtext 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.
@@ -1,10 +1,4 @@
1
- import type { RichTextEditorProps } from './types'
2
-
3
- export const supported = false
4
-
5
- /** The macOS editor is deferred; the tiptap facade covers desktop needs. */
6
- export function RichTextEditor(_props: RichTextEditorProps): null {
7
- return null
8
- }
9
-
1
+ export { RichTextEditor } from './Editor.macos'
2
+ /** The AppKit/WKWebView backend is implemented. */
3
+ export const supported = true
10
4
  export type * from './types'
package/src/types.ts CHANGED
@@ -1,6 +1,7 @@
1
- /** Supported on Android today (WordPress Aztec); iOS is stubbed until the
2
- * Swift-facade bring-up. Web/macOS/Windows route through the tiptap facade
3
- * instead of this leaf. */
1
+ import type { Octane } from 'octane/jsx-runtime'
2
+
3
+ /** Android uses WordPress Aztec; AppKit uses StarterKit in WKWebView.
4
+ * iOS is stubbed. Web/Windows use the tiptap facade instead of this leaf. */
4
5
  export type RichTextFormat =
5
6
  | 'bold'
6
7
  | 'italic'
@@ -31,8 +32,9 @@ export type RichTextFormat =
31
32
  export interface RichTextEditorHandle {
32
33
  /** Serialized document HTML (Aztec's "plain" HTML — no contenteditable
33
34
  * markup). */
35
+ /** AppKit: returns the latest WebKit snapshot; commands are asynchronous. */
34
36
  getHTML(): string
35
- /** Replace the document; resets Aztec's undo history. */
37
+ /** Replace the document. Android resets Aztec history; AppKit uses engine history. */
36
38
  setHTML(html: string): void
37
39
  /** Toggle a format at the current selection. `link` needs
38
40
  * `linkTo(url, anchor)` instead. */
@@ -50,6 +52,7 @@ export interface RichTextEditorHandle {
50
52
  blur(): void
51
53
  isFocused(): boolean
52
54
  /** The platform surface — `AztecText` on Android. */
55
+ /** AppKit: the XplatEditorHost transport, not the browser engine instance. */
53
56
  native: any
54
57
  }
55
58
 
@@ -77,7 +80,7 @@ export interface RichTextEditorProps {
77
80
  onFocus?: () => void
78
81
  onBlur?: () => void
79
82
  /** Imperative handle — fires once when the native editor exists. */
80
- bind?: (handle: RichTextEditorHandle) => void
83
+ ref?: Octane.Ref<RichTextEditorHandle>
81
84
  /** Per-platform escape bag — properties are assigned onto the native
82
85
  * `AztecText` after the leaf's own props. */
83
86
  android?: Record<string, any>
@@ -0,0 +1,2 @@
1
+ /** Internal WebKit document transport installer. */
2
+ export declare function installEditorDocument(render: (props: any) => void): void
@@ -0,0 +1,5 @@
1
+ import type { UniversalComponent } from 'octane/universal'
2
+ import type { RichTextEditorProps } from '../src/types'
3
+ export declare const RichTextEditor: UniversalComponent<RichTextEditorProps>
4
+ export declare const supported: boolean
5
+ export type * from '../src/types'
@@ -0,0 +1,11 @@
1
+ import type { UniversalComponent } from 'octane/universal'
2
+ import type { RichTextEditorProps } from '../src/types'
3
+ /** Internal shared editor host. */
4
+ export declare const NativeEditor: UniversalComponent<
5
+ RichTextEditorProps & {
6
+ browser: string
7
+ json?: any
8
+ onJSONReady?: (ok: boolean) => void
9
+ onJSONChange?: (doc: any) => void
10
+ }
11
+ >
package/types/types.d.ts CHANGED
@@ -1,12 +1,13 @@
1
- /** Supported on Android today (WordPress Aztec); iOS is stubbed until the
2
- * Swift-facade bring-up. Web/macOS/Windows route through the tiptap facade
3
- * instead of this leaf. */
1
+ import type { Octane } from 'octane/jsx-runtime';
2
+ /** Android uses WordPress Aztec; AppKit uses StarterKit in WKWebView.
3
+ * iOS is stubbed. Web/Windows use the tiptap facade instead of this leaf. */
4
4
  export type RichTextFormat = 'bold' | 'italic' | 'underline' | 'strikethrough' | 'code' | 'blockquote' | 'bulletList' | 'orderedList' | 'taskList' | 'codeBlock' | 'horizontalRule' | 'highlight' | 'subscript' | 'superscript' | 'paragraph' | 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | 'alignLeft' | 'alignCenter' | 'alignRight' | 'link';
5
5
  export interface RichTextEditorHandle {
6
6
  /** Serialized document HTML (Aztec's "plain" HTML — no contenteditable
7
7
  * markup). */
8
+ /** AppKit: returns the latest WebKit snapshot; commands are asynchronous. */
8
9
  getHTML(): string;
9
- /** Replace the document; resets Aztec's undo history. */
10
+ /** Replace the document. Android resets Aztec history; AppKit uses engine history. */
10
11
  setHTML(html: string): void;
11
12
  /** Toggle a format at the current selection. `link` needs
12
13
  * `linkTo(url, anchor)` instead. */
@@ -24,6 +25,7 @@ export interface RichTextEditorHandle {
24
25
  blur(): void;
25
26
  isFocused(): boolean;
26
27
  /** The platform surface — `AztecText` on Android. */
28
+ /** AppKit: the XplatEditorHost transport, not the browser engine instance. */
27
29
  native: any;
28
30
  }
29
31
  export interface RichTextSelectionChange {
@@ -49,7 +51,7 @@ export interface RichTextEditorProps {
49
51
  onFocus?: () => void;
50
52
  onBlur?: () => void;
51
53
  /** Imperative handle — fires once when the native editor exists. */
52
- bind?: (handle: RichTextEditorHandle) => void;
54
+ ref?: Octane.Ref<RichTextEditorHandle>;
53
55
  /** Per-platform escape bag — properties are assigned onto the native
54
56
  * `AztecText` after the leaf's own props. */
55
57
  android?: Record<string, any>;