@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.
- package/README.md +97 -4
- package/dist/macos/browser.d.ts +1 -0
- package/dist/macos/browser.js +2 -0
- package/dist/native/RichTextEditor.android.js +9 -8
- package/dist/native/octane-client-build.json +1 -1
- package/dist/web/octane-client-build.json +1 -1
- package/package.json +25 -4
- package/platforms/macos/include/XplatEditorHost.h +1 -0
- package/platforms/macos/src/XplatEditorHost.swift +63 -0
- package/src/BrowserEditor.web.ts +107 -0
- package/src/Editor.macos.tsx +9 -0
- package/src/NativeEditor.macos.tsx +81 -0
- package/src/RichTextEditor.android.tsrx +3 -2
- package/src/RichTextEditor.windows.tsrx +15 -0
- package/src/browser-transport.web.ts +119 -0
- package/src/host-session.macos.ts +133 -0
- package/src/index.macos.ts +3 -9
- package/src/types.ts +8 -5
- package/types/browser-transport.d.ts +2 -0
- package/types/index.macos.d.ts +5 -0
- package/types/macos-host.d.ts +11 -0
- package/types/types.d.ts +7 -5
package/src/index.macos.ts
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export const supported =
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
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
|
-
|
|
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,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
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
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
|
|
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
|
-
|
|
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>;
|