@estiva-app/ui 0.67.0 → 0.68.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/dist/BlockNodes.d.ts +12 -1
- package/dist/BlockNodes.d.ts.map +1 -1
- package/dist/LinkChips.d.ts +82 -0
- package/dist/LinkChips.d.ts.map +1 -0
- package/dist/ReferenceCards.d.ts +77 -0
- package/dist/ReferenceCards.d.ts.map +1 -0
- package/dist/ReferenceMenu.d.ts +18 -0
- package/dist/ReferenceMenu.d.ts.map +1 -0
- package/dist/RichText.d.ts +9 -2
- package/dist/RichText.d.ts.map +1 -1
- package/dist/SelectionToolbar.d.ts +9 -1
- package/dist/SelectionToolbar.d.ts.map +1 -1
- package/dist/editor.d.ts +3 -0
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +589 -20
- package/dist/editor.js.map +4 -4
- package/dist/index.js +39 -19
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/registry.json +290 -3
- package/src/BlockNodes.test.tsx +2 -1
- package/src/BlockNodes.tsx +51 -9
- package/src/LinkChips.mdx +57 -0
- package/src/LinkChips.stories.tsx +67 -0
- package/src/LinkChips.test.tsx +178 -0
- package/src/LinkChips.ts +243 -0
- package/src/ReferenceCards.mdx +79 -0
- package/src/ReferenceCards.stories.tsx +64 -0
- package/src/ReferenceCards.test.tsx +143 -0
- package/src/ReferenceCards.ts +225 -0
- package/src/ReferenceMenu.mdx +75 -0
- package/src/ReferenceMenu.stories.tsx +59 -0
- package/src/ReferenceMenu.test.tsx +289 -0
- package/src/ReferenceMenu.tsx +346 -0
- package/src/RichText.test.tsx +17 -0
- package/src/RichText.tsx +34 -3
- package/src/SelectionToolbar.tsx +10 -2
- package/src/editor.ts +13 -0
- package/src/pages.test.ts +3 -0
- package/src/registry/registry.test.ts +6 -6
- package/stories/Choosing.mdx +3 -0
package/dist/BlockNodes.d.ts
CHANGED
|
@@ -44,9 +44,10 @@ import { type Transaction } from '@tiptap/pm/state';
|
|
|
44
44
|
* loaded from a stored document has none.
|
|
45
45
|
*/
|
|
46
46
|
export declare const BlockId: Extension<any, any>;
|
|
47
|
-
/** What a reference's view is handed: the `nostr:` URI it stands for. */
|
|
47
|
+
/** What a reference's view is handed: the `nostr:` URI it stands for, and the URL a URL chip was written as. */
|
|
48
48
|
export interface ReferenceViewProps {
|
|
49
49
|
uri: string;
|
|
50
|
+
href?: string;
|
|
50
51
|
}
|
|
51
52
|
export interface ReferenceNodeOptions {
|
|
52
53
|
/**
|
|
@@ -62,6 +63,16 @@ export interface ReferenceNodeOptions {
|
|
|
62
63
|
* nobody edits half a `naddr`. Selecting it selects the whole reference, which
|
|
63
64
|
* is also how deleting one works. `marks` carries the run's other marks, so a
|
|
64
65
|
* bold reference comes back bold.
|
|
66
|
+
*
|
|
67
|
+
* `embed` is the card its writer chose to draw after its block — `compact`,
|
|
68
|
+
* `detailed`, or null for none (SPEC §13.3, "A reference's card") — and `extra`
|
|
69
|
+
* every key of the mark this version does not know. Both are declared so that
|
|
70
|
+
* ProseMirror keeps them: an undeclared attribute is dropped when the node is
|
|
71
|
+
* made, and the card with it. `ReferenceCards` draws the cards.
|
|
72
|
+
*
|
|
73
|
+
* `href` makes it a **URL chip**: an app URL that reads as the chip of what it
|
|
74
|
+
* names, and is that URL on the wire (§13.3). `uri` is what it names, filled in
|
|
75
|
+
* by `LinkChips` once the app has resolved it; until then it draws as the URL.
|
|
65
76
|
*/
|
|
66
77
|
export declare const ReferenceNode: Node<ReferenceNodeOptions, any>;
|
|
67
78
|
/**
|
package/dist/BlockNodes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockNodes.d.ts","sourceRoot":"","sources":["../src/BlockNodes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"BlockNodes.d.ts","sourceRoot":"","sources":["../src/BlockNodes.tsx"],"names":[],"mappings":"AAAA,OAAO,KA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|
+
*
|
|
5
|
+
* The URL stays the URL: the chip is the `reference` node with `href` set (a
|
|
6
|
+
* URL chip, `ReferenceNode`), which a document writes back as the URL it was,
|
|
7
|
+
* plain text with no card and a `link` mark with one. Never a `nostr:`
|
|
8
|
+
* reference in its place: the URL is how a person addresses the object.
|
|
9
|
+
*
|
|
10
|
+
* What a URL names is the app's to say — its manifests and its relay — so the
|
|
11
|
+
* app hands this extension two functions: `referenceOf`, what it has resolved
|
|
12
|
+
* so far, and `ask`, to look up the URLs it has not. A URL that names nothing,
|
|
13
|
+
* or whose answer has not come back, stays text; when `ask` settles the
|
|
14
|
+
* document is looked at again.
|
|
15
|
+
*
|
|
16
|
+
* The URL being typed stays text while the caret is in it or at its end, so a
|
|
17
|
+
* half-typed address never turns into a chip under the person's fingers. A
|
|
18
|
+
* pasted URL is whole, so it is asked about and made a chip at once, the caret
|
|
19
|
+
* still at its end — where `ReferenceMenu` opens its menu.
|
|
20
|
+
*/
|
|
21
|
+
import { Extension, type Editor } from '@tiptap/core';
|
|
22
|
+
import type { Node as PmNode } from '@tiptap/pm/model';
|
|
23
|
+
import { type Selection } from '@tiptap/pm/state';
|
|
24
|
+
export interface LinkChipsOptions {
|
|
25
|
+
/**
|
|
26
|
+
* The `nostr:` reference an app URL names, from what the app has resolved
|
|
27
|
+
* (§7.7) — protocol's `referenceOfLink(url, resolveLink)`. Undefined while it
|
|
28
|
+
* names nothing, or its answer has not come back.
|
|
29
|
+
*/
|
|
30
|
+
referenceOf: ((url: string) => string | undefined) | null;
|
|
31
|
+
/** Look up what these URLs name. When it settles, the document is looked at again. */
|
|
32
|
+
ask: ((urls: string[]) => Promise<unknown> | void) | null;
|
|
33
|
+
/**
|
|
34
|
+
* How many URLs one editor asks about in its life, the first ones; the rest
|
|
35
|
+
* stay text. An app's answer can cost a relay query, and a document pasted
|
|
36
|
+
* full of links must not spend the writer's quota. Default 24.
|
|
37
|
+
*/
|
|
38
|
+
limit: number;
|
|
39
|
+
}
|
|
40
|
+
/** The meta on the transaction that made chips: `{ pasted }`. */
|
|
41
|
+
export declare const CHIPS_MADE = "linkChipsMade";
|
|
42
|
+
interface Found {
|
|
43
|
+
/** Text URLs that name something: made chips. */
|
|
44
|
+
chips: {
|
|
45
|
+
from: number;
|
|
46
|
+
to: number;
|
|
47
|
+
url: string;
|
|
48
|
+
uri: string;
|
|
49
|
+
marks: string[];
|
|
50
|
+
pasted: boolean;
|
|
51
|
+
}[];
|
|
52
|
+
/** URL chips whose URL is answered now: given their reference. */
|
|
53
|
+
fills: {
|
|
54
|
+
pos: number;
|
|
55
|
+
uri: string;
|
|
56
|
+
}[];
|
|
57
|
+
/** Every URL still waiting for an answer, or naming nothing. */
|
|
58
|
+
open: string[];
|
|
59
|
+
}
|
|
60
|
+
/** Where something was pasted: a URL wholly inside one was not typed, so the caret at its end does not hold it as text. */
|
|
61
|
+
export interface PastedRange {
|
|
62
|
+
from: number;
|
|
63
|
+
to: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* What to change in a document, and what to ask. `selection` null treats no
|
|
67
|
+
* URL as being typed; a URL inside one of `pasted` is never being typed.
|
|
68
|
+
*/
|
|
69
|
+
export declare function findLinkChips(doc: PmNode, selection: Selection | null, referenceOf: LinkChipsOptions['referenceOf'], pasted?: readonly PastedRange[]): Found;
|
|
70
|
+
/**
|
|
71
|
+
* Look at the document again — after the app learned what more URLs name some
|
|
72
|
+
* other way. Dispatches only when there is a chip to make: an empty
|
|
73
|
+
* transaction would wake every other plugin (a trailing paragraph appears).
|
|
74
|
+
*/
|
|
75
|
+
export declare function refreshLinkChips(editor: Editor): void;
|
|
76
|
+
/**
|
|
77
|
+
* Turns the app URLs in a document into URL chips. Pair it with `ReferenceNode`;
|
|
78
|
+
* `ReferenceCards` then draws a card a URL chip asks for.
|
|
79
|
+
*/
|
|
80
|
+
export declare const LinkChips: Extension<LinkChipsOptions, any>;
|
|
81
|
+
export {};
|
|
82
|
+
//# sourceMappingURL=LinkChips.d.ts.map
|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X;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,EAAE,WAAW,EAAE,gBAAgB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAE,SAAS,WAAW,EAAO,GAAG,KAAK,CAmChK;AAoBD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAMrD;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,kCAyEpB,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cards a block document's writer chose, drawn after the line that holds
|
|
3
|
+
* each reference — SPEC §13.3, "A reference's card".
|
|
4
|
+
*
|
|
5
|
+
* The choice is `embed` on the `reference` node (`ReferenceNode`), so the card
|
|
6
|
+
* moves and goes with its chip. What a card looks like is the app's — it knows
|
|
7
|
+
* how to resolve an object and draw its row or its card — so this extension
|
|
8
|
+
* draws nothing itself: after every textblock whose chips ask for a card it
|
|
9
|
+
* places one empty, non-editable slot, and `useReferenceCards` hands the app
|
|
10
|
+
* those slots to portal its cards into. A portal, rather than a React root per
|
|
11
|
+
* slot, keeps the app's providers around the card.
|
|
12
|
+
*
|
|
13
|
+
* **A slot keeps its element while its block lives.** It is keyed by the
|
|
14
|
+
* nearest block id (the `blockId` attribute), so typing above a card does not
|
|
15
|
+
* re-make its element, and the card does not reload on every keystroke.
|
|
16
|
+
*
|
|
17
|
+
* The slot sits at the end of the textblock, inside it: a paragraph's card is
|
|
18
|
+
* under the paragraph, a list item's under the item at its indent, a table
|
|
19
|
+
* cell's in the cell.
|
|
20
|
+
*/
|
|
21
|
+
import { Extension, type Editor } from '@tiptap/core';
|
|
22
|
+
import type { Node as PmNode } from '@tiptap/pm/model';
|
|
23
|
+
import { type EditorState } from '@tiptap/pm/state';
|
|
24
|
+
/** A layout a writer can choose; `none` is no card. */
|
|
25
|
+
export type ReferenceCardLayout = 'none' | 'compact' | 'detailed';
|
|
26
|
+
/** One card to draw: the reference's `nostr:` URI and how much to show. */
|
|
27
|
+
export interface ReferenceCard {
|
|
28
|
+
uri: string;
|
|
29
|
+
layout: Exclude<ReferenceCardLayout, 'none'>;
|
|
30
|
+
}
|
|
31
|
+
/** One slot: where an app draws the cards of one line. */
|
|
32
|
+
export interface ReferenceCardSlot {
|
|
33
|
+
key: string;
|
|
34
|
+
element: HTMLElement;
|
|
35
|
+
cards: ReferenceCard[];
|
|
36
|
+
}
|
|
37
|
+
interface Placement {
|
|
38
|
+
key: string;
|
|
39
|
+
/** The end of the textblock's content, where the slot goes. */
|
|
40
|
+
pos: number;
|
|
41
|
+
cards: ReferenceCard[];
|
|
42
|
+
}
|
|
43
|
+
/** Every line that asks for a card, in document order. */
|
|
44
|
+
export declare function referenceCardPlacements(doc: PmNode): Placement[];
|
|
45
|
+
interface ReferenceCardsStorage {
|
|
46
|
+
/** One element per slot key, made once and reused, so the app's portal stays put. */
|
|
47
|
+
elements: Map<string, HTMLElement>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Places a slot after each line whose chips ask for a card. Pair it with
|
|
51
|
+
* `ReferenceNode`, and draw the cards with `useReferenceCards`.
|
|
52
|
+
*/
|
|
53
|
+
export declare const ReferenceCards: Extension<Record<string, never>, ReferenceCardsStorage>;
|
|
54
|
+
/**
|
|
55
|
+
* The slots to draw cards into, kept current as the document changes. Draw
|
|
56
|
+
* each with `createPortal(<cards/>, slot.element)`, keyed by `slot.key`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function useReferenceCards(editor: Editor | null): ReferenceCardSlot[];
|
|
59
|
+
/**
|
|
60
|
+
* The chip the person has selected, with what it names and its card — or null.
|
|
61
|
+
*
|
|
62
|
+
* Selected as a node (a click, where a click on the chip does not follow its
|
|
63
|
+
* link), or inside a selected range that holds that one chip and nothing but
|
|
64
|
+
* spaces besides (Shift+arrow over it, or a drag across it): an app whose chip
|
|
65
|
+
* is a link has no other way to select it.
|
|
66
|
+
*/
|
|
67
|
+
export declare function referenceAtSelection(state: EditorState): {
|
|
68
|
+
pos: number;
|
|
69
|
+
uri: string;
|
|
70
|
+
layout: ReferenceCardLayout;
|
|
71
|
+
} | null;
|
|
72
|
+
/** Sets the card of the selected chip. `none` removes it. The selection stays as it was. */
|
|
73
|
+
export declare function setReferenceCard(editor: Editor, layout: ReferenceCardLayout): boolean;
|
|
74
|
+
/** Sets the card of the chip at `pos` — one that names something. `none` removes it. The selection stays as it was. */
|
|
75
|
+
export declare function setReferenceCardAt(editor: Editor, pos: number, layout: ReferenceCardLayout): boolean;
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=ReferenceCards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReferenceCards.d.ts","sourceRoot":"","sources":["../src/ReferenceCards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,KAAK,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAoC,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAIrF,uDAAuD;AACvD,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAA;AAEjE,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAA;CAC7C;AAED,0DAA0D;AAC1D,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,WAAW,CAAA;IACpB,KAAK,EAAE,aAAa,EAAE,CAAA;CACvB;AAED,UAAU,SAAS;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,aAAa,EAAE,CAAA;CACvB;AAQD,0DAA0D;AAC1D,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,CAuBhE;AAED,UAAU,qBAAqB;IAC7B,qFAAqF;IACrF,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;CACnC;AAmBD;;;GAGG;AACH,eAAO,MAAM,cAAc,yDA+BzB,CAAA;AAEF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,iBAAiB,EAAE,CAyB5E;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,mBAAmB,CAAA;CAAE,GAAG,IAAI,CA2BzH;AAED,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAGrF;AAED,uHAAuH;AACvH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CASpG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Extension, type Editor } from '@tiptap/core';
|
|
2
|
+
import { type EditorState } from '@tiptap/pm/state';
|
|
3
|
+
/** Whether the menu is open, for an editor's own Escape: while it is, Escape closes it rather than leaving. */
|
|
4
|
+
export declare function isReferenceMenuOpen(state: EditorState): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* A click on the chip at `pos`, from its node view: while editing, with the
|
|
7
|
+
* menu installed, it opens the menu, and the caller stops the click there.
|
|
8
|
+
* Returns false when the click should go on to the chip.
|
|
9
|
+
*/
|
|
10
|
+
export declare function referenceMenuClick(editor: Editor, pos: number): boolean;
|
|
11
|
+
/** Which chip the menu is open on: see the module comment. */
|
|
12
|
+
export declare const ReferenceMenu: Extension<any, any>;
|
|
13
|
+
export interface ReferenceMenuViewProps {
|
|
14
|
+
editor: Editor | null;
|
|
15
|
+
}
|
|
16
|
+
/** The menu `ReferenceMenu` holds, hung under its chip. Render it always, beside `EditorContent`. */
|
|
17
|
+
export declare function ReferenceMenuView({ editor }: ReferenceMenuViewProps): import("react").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=ReferenceMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReferenceMenu.d.ts","sourceRoot":"","sources":["../src/ReferenceMenu.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAA;AAErD,OAAO,EAAmD,KAAK,WAAW,EAAoB,MAAM,kBAAkB,CAAA;AAmHtH,+GAA+G;AAC/G,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAMvE;AAWD,8DAA8D;AAC9D,eAAO,MAAM,aAAa,qBAuExB,CAAA;AAUF,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED,qGAAqG;AACrG,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAAE,sBAAsB,+BAyFnE"}
|
package/dist/RichText.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Formatted text, drawn: headings, paragraphs, lists, a quote, code, a divider,
|
|
4
4
|
* a table and links.
|
|
@@ -75,6 +75,13 @@ export interface RichTextProps {
|
|
|
75
75
|
* `undefined` to leave it to the part, which draws its words.
|
|
76
76
|
*/
|
|
77
77
|
renderBlock?: (block: RichTextBlock) => ReactNode | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Draws something after a line of text: after a paragraph, a heading or a
|
|
80
|
+
* quote, and inside a list item or a table cell after its words — where a
|
|
81
|
+
* document's chip asks for its card (SPEC §13.3). Asked of every such line;
|
|
82
|
+
* return nothing for most.
|
|
83
|
+
*/
|
|
84
|
+
renderAfter?: (block: RichTextBlock) => ReactNode;
|
|
78
85
|
/**
|
|
79
86
|
* Ticks or unticks a checklist item, by its block id: its box is then a
|
|
80
87
|
* control, one click where the text is read. Without it the box is a picture
|
|
@@ -89,5 +96,5 @@ export interface RichTextProps {
|
|
|
89
96
|
export declare function richTextClassName(size?: RichTextSize, className?: string): string;
|
|
90
97
|
/** The tone a callout is drawn in: its own, or `note` for one this part does not know (§13.3). */
|
|
91
98
|
export declare function calloutLook(tone: string): string;
|
|
92
|
-
export declare function RichText({ blocks, size, renderText, renderReference, renderBlock, onTick, }: RichTextProps): import("react").JSX.Element | null;
|
|
99
|
+
export declare function RichText({ blocks, size, renderText, renderReference, renderBlock, renderAfter, onTick, }: RichTextProps): import("react").JSX.Element | null;
|
|
93
100
|
//# sourceMappingURL=RichText.d.ts.map
|
package/dist/RichText.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../src/RichText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../src/RichText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAMjE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,yEAAyE;AACzE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAA;CAC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C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CACrD;AA6CD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,YAAwB,EAAE,SAAS,CAAC,EAAE,MAAM,UAGnF;AAmDD,kGAAkG;AAClG,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGhD;AA6ND,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,IAAgB,EAChB,UAA2B,EAC3B,eAA+C,EAC/C,WAAW,EACX,WAAW,EACX,MAAM,GACP,EAAE,aAAa,sCAQf"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import type { Editor } from '@tiptap/react';
|
|
2
3
|
import { Extension } from '@tiptap/core';
|
|
3
4
|
import { PluginKey } from '@tiptap/pm/state';
|
|
@@ -57,6 +58,13 @@ export interface SelectionToolbarProps {
|
|
|
57
58
|
marks?: readonly MarkId[];
|
|
58
59
|
/** The Link button and its address field. Needs a link mark in the editor and `KeptSelection`. Default off. */
|
|
59
60
|
link?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* More of the strip, after the marks: the app's own `ToolbarButton`s for what
|
|
63
|
+
* is selected — a chip's card, say. Each keeps the selection by preventing
|
|
64
|
+
* its press's default, as the marks do. Nothing is added when it renders
|
|
65
|
+
* nothing.
|
|
66
|
+
*/
|
|
67
|
+
children?: ReactNode;
|
|
60
68
|
}
|
|
61
|
-
export declare function SelectionToolbar({ editor, marks, link }: SelectionToolbarProps): import("react").JSX.Element | null;
|
|
69
|
+
export declare function SelectionToolbar({ editor, marks, link, children }: SelectionToolbarProps): import("react").JSX.Element | null;
|
|
62
70
|
//# sourceMappingURL=SelectionToolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionToolbar.d.ts","sourceRoot":"","sources":["../src/SelectionToolbar.tsx"],"names":[],"mappings":"
|
|
1
|
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E,SAAS,MAAM,EAAE,CAAA;IACzB,+GAA+G;IAC/G,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,KAAuC,EAAE,IAAY,EAAE,QAAQ,EAAE,EAAE,qBAAqB,sCAsQlI"}
|
package/dist/editor.d.ts
CHANGED
|
@@ -15,4 +15,7 @@ export { EditorBlockHandle, blockDropCursor, deleteBlock, moveBlock, duplicateBl
|
|
|
15
15
|
export { EditorTableControls, appendTableRow, appendTableColumn, deleteTableRow, deleteTableColumn, type EditorTableControlsProps } from './EditorTableControls';
|
|
16
16
|
export { PersonMention, UrgentPersonMention, CaptionedReference, ReferenceTrigger, SlashCommands, peopleMenu, referenceMenu, filterPeople, urgentPubkeys, filterReferences, formatSection, applyFormat, typeTrigger, filterSlashSections, FORMATS, type MentionPerson, type PersonMentionOptions, type CaptionedItem, type CaptionedReferenceOptions, type ReferenceTriggerOptions, type ReferenceMenuOptions, type SlashCommand, type SlashSection, type SlashCommandsOptions, type FormatId, type FormatDef, type CodeFormat, } from './ComposerTriggers';
|
|
17
17
|
export { BlockId, Checklist, Callout, isChecklistTick, UnknownBlock, ReferenceNode, AttachmentNode, type ReferenceNodeOptions, type ReferenceViewProps, type AttachmentNodeOptions, type AttachmentViewProps, } from './BlockNodes';
|
|
18
|
+
export { ReferenceCards, useReferenceCards, referenceAtSelection, referenceCardPlacements, setReferenceCard, setReferenceCardAt, type ReferenceCard, type ReferenceCardLayout, type ReferenceCardSlot, } from './ReferenceCards';
|
|
19
|
+
export { LinkChips, findLinkChips, refreshLinkChips, type LinkChipsOptions, type PastedRange } from './LinkChips';
|
|
20
|
+
export { ReferenceMenu, ReferenceMenuView, isReferenceMenuOpen, referenceMenuClick, type ReferenceMenuViewProps } from './ReferenceMenu';
|
|
18
21
|
//# sourceMappingURL=editor.d.ts.map
|
package/dist/editor.d.ts.map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