@octane-xplat/richtext 0.9.0 → 0.11.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 +117 -6
- package/dist/macos/browser.d.ts +1 -0
- package/dist/macos/browser.js +2 -0
- package/dist/native/RichTextEditor.android.js +48 -8
- package/dist/native/RichTextEditor.ios.js +194 -8
- package/dist/native/octane-client-build.json +1 -1
- package/dist/web/octane-client-build.json +1 -1
- package/nativescript.config.ts +22 -0
- package/package.json +27 -5
- package/platforms/ios/LICENSE-Aztec-MPL-2.0.txt +355 -0
- package/platforms/ios/UPSTREAM.md +14 -0
- package/platforms/ios/src/XplatAztecEditor.swift +357 -0
- 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 +42 -2
- package/src/RichTextEditor.ios.tsrx +221 -6
- package/src/RichTextEditor.windows.tsrx +15 -0
- package/src/browser-transport.web.ts +119 -0
- package/src/host-session.macos.ts +142 -0
- package/src/index.macos.ts +3 -9
- package/src/index.ts +2 -2
- package/src/types.ts +54 -9
- 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 +53 -9
package/types/types.d.ts
CHANGED
|
@@ -1,29 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
1
|
+
import type { Octane } from 'octane/jsx-runtime';
|
|
2
|
+
/** Android uses WordPress Aztec; iOS uses AztecEditor-iOS; AppKit uses
|
|
3
|
+
* StarterKit in WKWebView. Web/Windows use the tiptap facade instead of
|
|
4
|
+
* this leaf. */
|
|
4
5
|
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
6
|
export interface RichTextEditorHandle {
|
|
6
7
|
/** Serialized document HTML (Aztec's "plain" HTML — no contenteditable
|
|
7
8
|
* markup). */
|
|
9
|
+
/** AppKit: returns the latest WebKit snapshot; commands are asynchronous. */
|
|
8
10
|
getHTML(): string;
|
|
9
|
-
/** Replace the document
|
|
11
|
+
/** Replace the document. Android resets Aztec history; the iOS
|
|
12
|
+
* `setHTML` variant is likewise non-undoable; AppKit uses engine
|
|
13
|
+
* history. */
|
|
10
14
|
setHTML(html: string): void;
|
|
11
15
|
/** Toggle a format at the current selection. `link` needs
|
|
12
|
-
* `linkTo(url, anchor)` instead.
|
|
16
|
+
* `linkTo(url, anchor)` instead. iOS has no taskList or text-alignment
|
|
17
|
+
* engine support — those calls report a console warning and do not
|
|
18
|
+
* change the document. */
|
|
13
19
|
apply(format: RichTextFormat): void;
|
|
14
20
|
/** Insert or re-target a link over the current selection. */
|
|
15
21
|
linkTo(url: string, anchor?: string): void;
|
|
16
22
|
removeLink(): void;
|
|
17
|
-
/** Formats active at the selection — powers toolbar highlight state.
|
|
23
|
+
/** Formats active at the selection — powers toolbar highlight state.
|
|
24
|
+
* iOS always reports false for taskList and the align* formats (no
|
|
25
|
+
* engine support). */
|
|
18
26
|
isActive(format: RichTextFormat): boolean;
|
|
19
27
|
/** Android: Aztec's history batches keyboard input only — format
|
|
20
|
-
* toggles and programmatic edits do not register.
|
|
28
|
+
* toggles and programmatic edits do not register. iOS: the engine
|
|
29
|
+
* undoManager covers format toggles and keyboard input; `setHTML` and
|
|
30
|
+
* split/join edits sit outside it. */
|
|
21
31
|
undo(): void;
|
|
22
32
|
redo(): void;
|
|
33
|
+
/** Split the block at the caret into two siblings — the Enter-key
|
|
34
|
+
* semantic (a non-collapsed selection is deleted first). Android: a
|
|
35
|
+
* real block break through Aztec's watcher pipeline — a caret inside
|
|
36
|
+
* a list item produces a sibling `<li>`. iOS routes through Aztec's
|
|
37
|
+
* `insertText` newline handling for the same semantics. Inside hidden
|
|
38
|
+
* block markup Aztec does not understand (`<div data-*>` wrappers),
|
|
39
|
+
* this is a line break, not a new node — it serializes as `<br>`.
|
|
40
|
+
* Returns false when
|
|
41
|
+
* there is no valid selection. AppKit: returns false — the engine
|
|
42
|
+
* transport is asynchronous and cannot report application. */
|
|
43
|
+
split(): boolean;
|
|
44
|
+
/** Merge the block at the caret into the previous block — the
|
|
45
|
+
* Backspace-at-block-start semantic. Returns false unless the
|
|
46
|
+
* selection is a collapsed caret directly after a block boundary. */
|
|
47
|
+
join(): boolean;
|
|
48
|
+
/** Demote the block(s) in the selection. Aztec semantics: a list item
|
|
49
|
+
* nests under its previous sibling; a plain paragraph, heading,
|
|
50
|
+
* quote, or preformat line gains a literal `\t` indent. Hidden
|
|
51
|
+
* `<div data-*>` nodes are opaque to Aztec and cannot be demoted.
|
|
52
|
+
* iOS: `increaseIndent` acts on list/quote depth and falls back to a
|
|
53
|
+
* `\t` insert on plain blocks. Returns false when Aztec reports no
|
|
54
|
+
* indentable selection (iOS: when the view is not editable). */
|
|
55
|
+
indent(): boolean;
|
|
56
|
+
/** Promote the block(s) in the selection one level — the inverse of
|
|
57
|
+
* `indent()`. iOS has no plain-block outdent, so this applies only to
|
|
58
|
+
* list items and blockquotes. Returns false when Aztec reports no
|
|
59
|
+
* outdentable selection. */
|
|
60
|
+
outdent(): boolean;
|
|
61
|
+
/** Whether `indent()` can apply to the current selection. */
|
|
62
|
+
canIndent(): boolean;
|
|
63
|
+
/** Whether `outdent()` can apply to the current selection. */
|
|
64
|
+
canOutdent(): boolean;
|
|
23
65
|
focus(): void;
|
|
24
66
|
blur(): void;
|
|
25
67
|
isFocused(): boolean;
|
|
26
|
-
/** The platform surface — `AztecText` on Android
|
|
68
|
+
/** The platform surface — `AztecText` on Android, the
|
|
69
|
+
* `XplatAztecEditorView` facade on iOS. */
|
|
70
|
+
/** AppKit: the XplatEditorHost transport, not the browser engine instance. */
|
|
27
71
|
native: any;
|
|
28
72
|
}
|
|
29
73
|
export interface RichTextSelectionChange {
|
|
@@ -49,7 +93,7 @@ export interface RichTextEditorProps {
|
|
|
49
93
|
onFocus?: () => void;
|
|
50
94
|
onBlur?: () => void;
|
|
51
95
|
/** Imperative handle — fires once when the native editor exists. */
|
|
52
|
-
|
|
96
|
+
ref?: Octane.Ref<RichTextEditorHandle>;
|
|
53
97
|
/** Per-platform escape bag — properties are assigned onto the native
|
|
54
98
|
* `AztecText` after the leaf's own props. */
|
|
55
99
|
android?: Record<string, any>;
|