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