@g9tm/lynxcontrols-richtext 0.0.0-stage → 2.5.9
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 +32 -2
- package/catalog/cards/G9RichLines.md +16 -0
- package/catalog/cards/G9RichText.md +17 -0
- package/catalog/cards/G9RichTextEditor.md +17 -0
- package/catalog/catalog.json +1667 -0
- package/catalog/index.md +7 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/bidi.d.ts +24 -0
- package/dist/bidi.d.ts.map +1 -0
- package/dist/bidi.jsx +102 -0
- package/dist/editor.d.ts +111 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/editor.jsx +556 -0
- package/dist/element-core.d.ts +60 -0
- package/dist/element-core.d.ts.map +1 -0
- package/dist/element-core.jsx +173 -0
- package/dist/element-types.d.ts +31 -0
- package/dist/element-types.d.ts.map +1 -0
- package/dist/element-types.jsx +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.jsx +8 -0
- package/dist/lines-view.d.ts +27 -0
- package/dist/lines-view.d.ts.map +1 -0
- package/dist/lines-view.jsx +100 -0
- package/dist/mentions.d.ts +30 -0
- package/dist/mentions.d.ts.map +1 -0
- package/dist/mentions.jsx +40 -0
- package/dist/ot.d.ts +49 -0
- package/dist/ot.d.ts.map +1 -0
- package/dist/ot.jsx +306 -0
- package/dist/protocol.d.ts +199 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.jsx +11 -0
- package/dist/rich-text.d.ts +48 -0
- package/dist/rich-text.d.ts.map +1 -0
- package/dist/rich-text.jsx +186 -0
- package/dist/richtext.css +411 -0
- package/dist/richtext.css.map +1 -0
- package/dist/session.d.ts +142 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.jsx +665 -0
- package/dist/yjs.d.ts +3 -0
- package/dist/yjs.d.ts.map +1 -0
- package/dist/yjs.jsx +2 -0
- package/dist/ymodel.d.ts +178 -0
- package/dist/ymodel.d.ts.map +1 -0
- package/dist/ymodel.jsx +1379 -0
- package/package.json +68 -4
package/README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @g9tm/lynxcontrols-richtext
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Rich text for G9LynxControls (from G9Hub's documents): an editor over the host's `<g9-richtext>` element, which edits
|
|
4
|
+
the text natively (IME, selection, Persian and mixed directions) while the document model stays in the app. Opt-in:
|
|
5
|
+
none of it is in the cost of `@g9tm/lynxcontrols`.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { G9RichTextEditor, useG9RichTextSession } from '@g9tm/lynxcontrols-richtext';
|
|
9
|
+
import { G9RichTextSession } from '@g9tm/lynxcontrols-richtext/yjs';
|
|
10
|
+
|
|
11
|
+
function Doc({ doc, awareness, me }) {
|
|
12
|
+
const { session, port, version } = useG9RichTextSession(
|
|
13
|
+
(port, onState) => new G9RichTextSession({ doc, awareness, user: me, port, onState }),
|
|
14
|
+
[doc],
|
|
15
|
+
);
|
|
16
|
+
return (
|
|
17
|
+
<G9RichTextEditor session={session} port={port} version={version} editable placeholder="Write…"
|
|
18
|
+
people={(q) => searchPeople(q)} links={(q) => searchLinks(q)} uploadImage={pickPicture}
|
|
19
|
+
promptLink={askForAddress} onOpenLink={open} />
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
| Part | What it is |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| **`G9RichTextEditor`** | The toolbar (undo, redo, style, marks, link, lists with indent, quote, callout and tone, direction, insert), `/` blocks, `@` people and `[[` links while typing, collaborators' carets. The toolbar sits at a phone's bottom while the text has the focus. |
|
|
27
|
+
| **`G9RichText`** | The element bound to a session through a `G9RichTextPort`; `surface="drawn"` on a host without the element (the desktop): the lines drawn with views, the line being edited a text field. |
|
|
28
|
+
| **`G9RichLines`** | A document's lines drawn read-only (a version, a preview). |
|
|
29
|
+
| **`./yjs`** | `G9RichTextSession` and `G9RichDocModel`: a Yjs document (TipTap's schema) behind the element, with operational transforms, undo, markdown shortcuts and awareness carets. Needs `yjs` (and `y-protocols` for carets). |
|
|
30
|
+
| **`./protocol`** | The element's contract (`RtMessage`, `RtEdit`, `RtLine` …) for an app with its own model. |
|
|
31
|
+
|
|
32
|
+
The element: Android `G9RichTextBehaviors.create()` and iOS `G9LCRichTextUI` in `@g9tm/lynxcontrols-native`, web
|
|
33
|
+
`registerG9RichText()` in `@g9tm/lynxcontrols-web`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# G9RichLines
|
|
2
|
+
|
|
3
|
+
`import { G9RichLines } from '@g9tm/lynxcontrols-richtext';`
|
|
4
|
+
|
|
5
|
+
The styled lines of a text (`text` split at `\n`, one `RtLine` each).
|
|
6
|
+
|
|
7
|
+
Props:
|
|
8
|
+
- `lines`: object[]
|
|
9
|
+
- `text`: string
|
|
10
|
+
- `direction?`: 'ltr' | 'rtl' = "ltr"
|
|
11
|
+
- `onTapLine?`: (index: number) => void
|
|
12
|
+
- `onToggleCheck?`: (index: number) => void
|
|
13
|
+
- `renderLine?`: (index, line, text) => ReactNode
|
|
14
|
+
- `editing?`: number
|
|
15
|
+
|
|
16
|
+
Example: `<G9RichLines lines={lines} text="Label" />`
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# G9RichText
|
|
2
|
+
|
|
3
|
+
`import { G9RichText } from '@g9tm/lynxcontrols-richtext';`
|
|
4
|
+
|
|
5
|
+
An editable rich text on the host's element (or drawn, on the desktop).
|
|
6
|
+
|
|
7
|
+
Props:
|
|
8
|
+
- `editable`: boolean
|
|
9
|
+
- `placeholder`: string
|
|
10
|
+
- `port`: object
|
|
11
|
+
- `session`: object
|
|
12
|
+
- `onFocusChange?`: (focused: boolean) => void
|
|
13
|
+
- `onTapObject?`: (pos: number) => void
|
|
14
|
+
- `bottomInset?`: number
|
|
15
|
+
- `palette?`: object
|
|
16
|
+
|
|
17
|
+
Example: `<G9RichText editable placeholder="placeholder" port={port} session={session} />`
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# G9RichTextEditor
|
|
2
|
+
|
|
3
|
+
`import { G9RichTextEditor } from '@g9tm/lynxcontrols-richtext';`
|
|
4
|
+
|
|
5
|
+
The live document's editor: the element, the toolbar and the suggestions.
|
|
6
|
+
|
|
7
|
+
Props:
|
|
8
|
+
- `editable`: boolean
|
|
9
|
+
- `placeholder`: string
|
|
10
|
+
- `port`: object
|
|
11
|
+
- `session`: object
|
|
12
|
+
- `version`: number
|
|
13
|
+
- `links?`: (query: string) => void
|
|
14
|
+
- `onOpenLink?`: (href: string) => void
|
|
15
|
+
- `people?`: (query: string) => void
|
|
16
|
+
|
|
17
|
+
Example: `<G9RichTextEditor editable placeholder="placeholder" port={port} session={session} version={1} />`
|