@estiva-app/ui 0.79.0 → 0.81.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/CardUnder.d.ts +24 -3
- package/dist/CardUnder.d.ts.map +1 -1
- package/dist/CommentBox.d.ts +39 -5
- package/dist/CommentBox.d.ts.map +1 -1
- package/dist/editor.d.ts +1 -1
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +115 -26
- package/dist/editor.js.map +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/registry.json +9 -9
- package/src/CardUnder.mdx +1 -0
- package/src/CardUnder.tsx +10 -6
- package/src/CommentBox.mdx +10 -2
- package/src/CommentBox.stories.tsx +63 -3
- package/src/CommentBox.test.tsx +185 -3
- package/src/CommentBox.tsx +168 -16
- package/src/editor.ts +3 -0
package/dist/CardUnder.d.ts
CHANGED
|
@@ -1,10 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one card added under a piece of text, and the ✕ that removes it (why:
|
|
3
|
+
* https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md).
|
|
4
|
+
*
|
|
5
|
+
* Under a box being written in, the ✕ always shows. Under text already sent
|
|
6
|
+
* (`revealOnHover`) it shows when the pointer is over the card or the ✕ has
|
|
7
|
+
* focus, and always on a screen that cannot hover, so a tap reaches it (Miky,
|
|
8
|
+
* 16 Oct, kickoff).
|
|
9
|
+
*/
|
|
10
|
+
import type { ReactNode } from 'react';
|
|
1
11
|
import type { LinkState } from './linked';
|
|
2
|
-
|
|
3
|
-
link: LinkState;
|
|
12
|
+
interface CardUnderBase {
|
|
4
13
|
/** Draws the ✕. Without it the card shows with none, as it does to anyone but the author. */
|
|
5
14
|
onRemove?: () => void;
|
|
6
15
|
/** The ✕ waits for hover or focus: under text already sent. Always shown on a screen that cannot hover. */
|
|
7
16
|
revealOnHover?: boolean;
|
|
8
17
|
}
|
|
9
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The card is a `LinkCard` of `link`, or the app's own card as `children`: an
|
|
20
|
+
* app that draws a sent card itself draws the one under its box the same way.
|
|
21
|
+
*/
|
|
22
|
+
export type CardUnderProps = CardUnderBase & ({
|
|
23
|
+
link: LinkState;
|
|
24
|
+
children?: never;
|
|
25
|
+
} | {
|
|
26
|
+
link?: never;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
});
|
|
29
|
+
export declare function CardUnder({ link, children, onRemove, revealOnHover }: CardUnderProps): import("react").JSX.Element;
|
|
30
|
+
export {};
|
|
10
31
|
//# sourceMappingURL=CardUnder.d.ts.map
|
package/dist/CardUnder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardUnder.d.ts","sourceRoot":"","sources":["../src/CardUnder.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CardUnder.d.ts","sourceRoot":"","sources":["../src/CardUnder.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEzC,UAAU,aAAa;IACrB,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,2GAA2G;IAC3G,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,CAAC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,IAAI,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,CAAC,CAAA;AAE5H,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAqB,EAAE,EAAE,cAAc,+BAmB5F"}
|
package/dist/CommentBox.d.ts
CHANGED
|
@@ -60,7 +60,39 @@ export interface CommentBoxEdit {
|
|
|
60
60
|
files?: BoxFile[];
|
|
61
61
|
onCancel: () => void;
|
|
62
62
|
/** Save; the box holds the words until the answer, and a refusal is said under it. */
|
|
63
|
-
onSave: (body: JSONContent, files: BoxFile[]) => Promise<SendAnswer>;
|
|
63
|
+
onSave: (body: JSONContent, files: BoxFile[], under: BoxSentUnder) => Promise<SendAnswer>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* What a draft shows under the box, as the app reads it from the box's
|
|
67
|
+
* document — `@estiva-app/conversation`'s `boxReadOf`, which reads it as the
|
|
68
|
+
* message will be sent (why:
|
|
69
|
+
* https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-link-on-words-counts-toward-the-card.md).
|
|
70
|
+
*/
|
|
71
|
+
export interface BoxUnderRead {
|
|
72
|
+
/** The one card, before any ✕: what it names, and the app's own view of it, drawn as it draws a sent one. */
|
|
73
|
+
card?: {
|
|
74
|
+
value: string;
|
|
75
|
+
view: ReactNode;
|
|
76
|
+
};
|
|
77
|
+
/** The live parts, drawn as the app draws them under a sent message. An edit carries none, so the edit box shows none. */
|
|
78
|
+
parts?: readonly {
|
|
79
|
+
key: string;
|
|
80
|
+
view: ReactNode;
|
|
81
|
+
}[];
|
|
82
|
+
/** Everything the draft names. A ✕ is forgotten once what it took off is no longer named, so a link put back gets its card again. */
|
|
83
|
+
names: readonly string[];
|
|
84
|
+
}
|
|
85
|
+
/** What the box shows under itself while something is written. */
|
|
86
|
+
export interface BoxUnder {
|
|
87
|
+
/** Read on every change, and once more as it is sent. */
|
|
88
|
+
read: (body: JSONContent) => BoxUnderRead;
|
|
89
|
+
/** Called with a listener; call it when `read` would answer differently (what a link names came back). */
|
|
90
|
+
changed?: (listener: () => void) => () => void;
|
|
91
|
+
}
|
|
92
|
+
/** What was under the box as it was sent or saved. */
|
|
93
|
+
export interface BoxSentUnder {
|
|
94
|
+
/** The card still shown, by what it names: absent when there was none, or ✕ took it off. */
|
|
95
|
+
card?: string;
|
|
64
96
|
}
|
|
65
97
|
export interface CommentBoxProps {
|
|
66
98
|
/** Who `@` and `!@` offer. */
|
|
@@ -75,8 +107,10 @@ export interface CommentBoxProps {
|
|
|
75
107
|
insert?: readonly SlashCommand[];
|
|
76
108
|
/** `/` → Code: a mark inside the line, or a block. */
|
|
77
109
|
code?: CodeFormat;
|
|
78
|
-
/** Send what is written, with the files that are ready; resolves with the relay's answer. */
|
|
79
|
-
send: (body: JSONContent, files: BoxFile[]) => Promise<SendAnswer>;
|
|
110
|
+
/** Send what is written, with the files that are ready and the card still shown; resolves with the relay's answer. */
|
|
111
|
+
send: (body: JSONContent, files: BoxFile[], under: BoxSentUnder) => Promise<SendAnswer>;
|
|
112
|
+
/** The card and parts under the box while something is written, with ✕ on the card. Absent, nothing shows under it. */
|
|
113
|
+
under?: BoxUnder;
|
|
80
114
|
/**
|
|
81
115
|
* The app shows a send before the relay answers: the box empties at once,
|
|
82
116
|
* and a refusal puts the words back. Otherwise the box holds the words, shut,
|
|
@@ -105,7 +139,7 @@ export interface CommentBoxProps {
|
|
|
105
139
|
extensions?: readonly AnyExtension[];
|
|
106
140
|
autoFocus?: boolean;
|
|
107
141
|
/** Called with what was sent once it went out: at once when `showsAtOnce`, else on the answer. */
|
|
108
|
-
onSent?: (body: JSONContent, files: BoxFile[]) => void;
|
|
142
|
+
onSent?: (body: JSONContent, files: BoxFile[], under: BoxSentUnder) => void;
|
|
109
143
|
/** Called when a send shown at once was refused, so the app takes it back. */
|
|
110
144
|
onRefused?: () => void;
|
|
111
145
|
className?: string;
|
|
@@ -115,5 +149,5 @@ export interface CommentBoxProps {
|
|
|
115
149
|
* its order, with its own after them; an edit drops File and Urgent itself.
|
|
116
150
|
*/
|
|
117
151
|
export declare const commentBoxRows: Readonly<Record<'file' | 'mention' | 'urgent' | 'reference', SlashCommand>>;
|
|
118
|
-
export declare function CommentBox({ people, references, referencesChanged, referenceIcon, insert, code, send, showsAtOnce, label, placeholder, draft, edit, upload, accept, closed, referenceView, extensions, autoFocus, onSent, onRefused, className, }: CommentBoxProps): import("react").JSX.Element;
|
|
152
|
+
export declare function CommentBox({ people, references, referencesChanged, referenceIcon, insert, code, send, under, showsAtOnce, label, placeholder, draft, edit, upload, accept, closed, referenceView, extensions, autoFocus, onSent, onRefused, className, }: CommentBoxProps): import("react").JSX.Element;
|
|
119
153
|
//# sourceMappingURL=CommentBox.d.ts.map
|
package/dist/CommentBox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentBox.d.ts","sourceRoot":"","sources":["../src/CommentBox.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"CommentBox.d.ts","sourceRoot":"","sources":["../src/CommentBox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsD,KAAK,aAAa,EAAkB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAC9H,OAAO,EAAa,KAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3D,OAAO,EAAyC,KAAK,WAAW,EAAE,MAAM,eAAe,CAAA;AAIvF,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAMrE,OAAO,EAQL,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAElB,MAAM,oBAAoB,CAAA;AAU3B;;;;;;;;;;;;;GAaG;AAEH,8DAA8D;AAC9D,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAEjF,6EAA6E;AAC7E,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,MAAM,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, releaseSelection, normalizeHref, type MarkId, type SelectionAction, type SelectionToolbarProps } from './SelectionToolbar';
|
|
11
11
|
export { ComposeBox, ComposeKeys, COMPOSE_EDITOR_CLASSES, type ComposeBoxProps } from './ComposeBox';
|
|
12
|
-
export { CommentBox, commentBoxRows, type CommentBoxProps, type CommentBoxDraft, type CommentBoxEdit, type BoxFile, type BoxFileState, type SendAnswer, type UploadAnswer, } from './CommentBox';
|
|
12
|
+
export { CommentBox, commentBoxRows, type CommentBoxProps, type CommentBoxDraft, type CommentBoxEdit, type BoxFile, type BoxFileState, type BoxUnder, type BoxUnderRead, type BoxSentUnder, type SendAnswer, type UploadAnswer, } from './CommentBox';
|
|
13
13
|
export { InlineText, type InlineTextProps, type InlineTextHandle } from './InlineText';
|
|
14
14
|
export { CommentHighlights, setCommentAnchors, commentPlace, commentElement, anchorOfSelection, quoteText, type CommentAnchor, type CommentHighlightsOptions, type CommentPlace, type CommentQuote, type SelectionAnchor, } from './CommentHighlights';
|
|
15
15
|
export { PastedImages, pastedImages, pastedImageName, type PastedImagesOptions, type ClipboardSource } from './PastedImages';
|
package/dist/editor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,KAAK,MAAM,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AACnL,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,sBAAsB,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AACpG,OAAO,EACL,UAAU,EACV,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,YAAY,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EAClB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,OAAO,EACP,SAAS,EACT,OAAO,EACP,eAAe,EACf,YAAY,EACZ,aAAa,EACb,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AACjH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/editor.js
CHANGED
|
@@ -528,8 +528,9 @@ function ComposeBox({ editor, onSend, placeholder, tools, attachments, ready = f
|
|
|
528
528
|
}
|
|
529
529
|
|
|
530
530
|
// src/CommentBox.tsx
|
|
531
|
-
import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef3, useState as useState4 } from "react";
|
|
531
|
+
import { Fragment as Fragment2, useCallback as useCallback4, useEffect as useEffect4, useRef as useRef3, useState as useState4 } from "react";
|
|
532
532
|
import { Extension as Extension9 } from "@tiptap/core";
|
|
533
|
+
import { Plugin as Plugin7, PluginKey as PluginKey8, TextSelection as TextSelection2 } from "@tiptap/pm/state";
|
|
533
534
|
import { EditorContent as EditorContent2, useEditor } from "@tiptap/react";
|
|
534
535
|
import StarterKit from "@tiptap/starter-kit";
|
|
535
536
|
import { IconLock, IconPaperclip, IconSquareRounded } from "@tabler/icons-react";
|
|
@@ -1567,6 +1568,7 @@ var Callout = Extension6.create({
|
|
|
1567
1568
|
// src/CommentBox.tsx
|
|
1568
1569
|
import { Button } from "@estiva-app/ui";
|
|
1569
1570
|
import { Card } from "@estiva-app/ui";
|
|
1571
|
+
import { CardUnder } from "@estiva-app/ui";
|
|
1570
1572
|
import { cn as cn2 } from "@estiva-app/ui";
|
|
1571
1573
|
|
|
1572
1574
|
// src/ComposerTriggers.tsx
|
|
@@ -1976,7 +1978,7 @@ var PastedImages = Extension8.create({
|
|
|
1976
1978
|
|
|
1977
1979
|
// src/CommentBox.tsx
|
|
1978
1980
|
import { ToolbarButton as ToolbarButton2 } from "@estiva-app/ui";
|
|
1979
|
-
import { Fragment as
|
|
1981
|
+
import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1980
1982
|
var ATTACH_EVENT = "commentbox:attach";
|
|
1981
1983
|
var askForFile = (editor) => editor.view.dom.dispatchEvent(new CustomEvent(ATTACH_EVENT, { bubbles: true }));
|
|
1982
1984
|
var commentBoxRows = {
|
|
@@ -1998,6 +2000,48 @@ var BoxKeys = Extension9.create({
|
|
|
1998
2000
|
};
|
|
1999
2001
|
}
|
|
2000
2002
|
});
|
|
2003
|
+
var LINK_ON_WORDS_TARGET = /^https?:\/\/[^\s)]+$/;
|
|
2004
|
+
var PasteOverWords = Extension9.create({
|
|
2005
|
+
name: "commentBoxPasteOverWords",
|
|
2006
|
+
priority: 1001,
|
|
2007
|
+
addProseMirrorPlugins() {
|
|
2008
|
+
return [
|
|
2009
|
+
new Plugin7({
|
|
2010
|
+
key: new PluginKey8("commentBoxPasteOverWords"),
|
|
2011
|
+
props: {
|
|
2012
|
+
handlePaste: (view, event) => {
|
|
2013
|
+
const url = (event.clipboardData?.getData("text/plain").trim() ?? "").replace(/[.,;:!?]+$/, "");
|
|
2014
|
+
const { state } = view;
|
|
2015
|
+
const { schema } = state;
|
|
2016
|
+
if (state.selection.empty || !schema.marks.link || !/^https?:\/\/\S+$/.test(url)) return false;
|
|
2017
|
+
const { $from, $to, from, to } = TextSelection2.between(state.selection.$from, state.selection.$to);
|
|
2018
|
+
let plain = $from.sameParent($to) && $from.parent.isTextblock && !$from.parent.type.spec.code;
|
|
2019
|
+
state.doc.nodesBetween(from, to, (node) => {
|
|
2020
|
+
if (node.isTextblock) return true;
|
|
2021
|
+
if (!node.isText || node.marks.some((m) => m.type.spec.code || m.type.name === "code")) plain = false;
|
|
2022
|
+
return false;
|
|
2023
|
+
});
|
|
2024
|
+
if (plain && LINK_ON_WORDS_TARGET.test(url) && !/[[\]\n]/.test(state.doc.textBetween(from, to))) {
|
|
2025
|
+
view.dispatch(state.tr.addMark(from, to, schema.marks.link.create({ href: url })));
|
|
2026
|
+
return true;
|
|
2027
|
+
}
|
|
2028
|
+
const before = state.doc.textBetween(Math.max(to - 1, $to.start()), to, "", "\uFFFC");
|
|
2029
|
+
const inserted = before && !/\s/.test(before) ? ` ${url}` : url;
|
|
2030
|
+
const tr = state.tr.insertText(inserted, to);
|
|
2031
|
+
view.dispatch(tr.setSelection(TextSelection2.create(tr.doc, to + inserted.length)).scrollIntoView());
|
|
2032
|
+
return true;
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
})
|
|
2036
|
+
];
|
|
2037
|
+
}
|
|
2038
|
+
});
|
|
2039
|
+
var BoxKit = StarterKit.extend({
|
|
2040
|
+
addExtensions() {
|
|
2041
|
+
return (this.parent?.() ?? []).map((extension) => extension.name === "link" ? extension.extend({ inclusive: () => false }) : extension);
|
|
2042
|
+
}
|
|
2043
|
+
});
|
|
2044
|
+
var stillNamed = (removed, names) => [...removed].every((value) => names.includes(value)) ? removed : new Set([...removed].filter((value) => names.includes(value)));
|
|
2001
2045
|
var SQUARE = /* @__PURE__ */ jsx7(IconSquareRounded, { size: 16, stroke: 1.5, className: "text-text-secondary" });
|
|
2002
2046
|
var SMALL_SQUARE = /* @__PURE__ */ jsx7(IconSquareRounded, { size: 14, stroke: 1.5 });
|
|
2003
2047
|
var fileCount = 0;
|
|
@@ -2009,6 +2053,7 @@ function CommentBox({
|
|
|
2009
2053
|
insert = [],
|
|
2010
2054
|
code = "block",
|
|
2011
2055
|
send,
|
|
2056
|
+
under,
|
|
2012
2057
|
showsAtOnce = false,
|
|
2013
2058
|
label,
|
|
2014
2059
|
placeholder,
|
|
@@ -2027,10 +2072,12 @@ function CommentBox({
|
|
|
2027
2072
|
const [files, setFiles] = useState4(edit?.files ?? []);
|
|
2028
2073
|
const [sending, setSending] = useState4(false);
|
|
2029
2074
|
const [refused, setRefused] = useState4(null);
|
|
2075
|
+
const [reading, setReading] = useState4(void 0);
|
|
2076
|
+
const [removed, setRemoved] = useState4(() => /* @__PURE__ */ new Set());
|
|
2030
2077
|
const picker = useRef3(null);
|
|
2031
2078
|
const root = useRef3(null);
|
|
2032
|
-
const latest = useRef3({ edit, people, references, referencesChanged, referenceIcon, upload, draft });
|
|
2033
|
-
latest.current = { edit, people, references, referencesChanged, referenceIcon, upload, draft };
|
|
2079
|
+
const latest = useRef3({ edit, people, references, referencesChanged, referenceIcon, upload, draft, under });
|
|
2080
|
+
latest.current = { edit, people, references, referencesChanged, referenceIcon, upload, draft, under };
|
|
2034
2081
|
const save = useRef3(() => false);
|
|
2035
2082
|
const attachFiles = useCallback4((picked) => {
|
|
2036
2083
|
const uploadOne = latest.current.upload;
|
|
@@ -2054,7 +2101,8 @@ function CommentBox({
|
|
|
2054
2101
|
const iconFor = useCallback4((uri) => latest.current.referenceIcon?.(uri), []);
|
|
2055
2102
|
const editor = useEditor({
|
|
2056
2103
|
extensions: [
|
|
2057
|
-
|
|
2104
|
+
BoxKit.configure({ link: { openOnClick: false } }),
|
|
2105
|
+
PasteOverWords,
|
|
2058
2106
|
KeptSelection,
|
|
2059
2107
|
ComposeKeys,
|
|
2060
2108
|
BoxKeys.configure({
|
|
@@ -2106,6 +2154,32 @@ function CommentBox({
|
|
|
2106
2154
|
editor.off("update", keep);
|
|
2107
2155
|
};
|
|
2108
2156
|
}, [editor, edit]);
|
|
2157
|
+
const reads = !!under;
|
|
2158
|
+
useEffect4(() => {
|
|
2159
|
+
if (!editor || !reads) {
|
|
2160
|
+
setReading(void 0);
|
|
2161
|
+
return;
|
|
2162
|
+
}
|
|
2163
|
+
const read = () => {
|
|
2164
|
+
const now = latest.current.under?.read(editor.getJSON());
|
|
2165
|
+
setReading(now);
|
|
2166
|
+
setRemoved((was) => stillNamed(was, now?.names ?? []));
|
|
2167
|
+
};
|
|
2168
|
+
read();
|
|
2169
|
+
editor.on("update", read);
|
|
2170
|
+
const unsubscribe = latest.current.under?.changed?.(read);
|
|
2171
|
+
return () => {
|
|
2172
|
+
editor.off("update", read);
|
|
2173
|
+
unsubscribe?.();
|
|
2174
|
+
};
|
|
2175
|
+
}, [editor, reads]);
|
|
2176
|
+
const underOf = useCallback4(
|
|
2177
|
+
(body) => {
|
|
2178
|
+
const card2 = latest.current.under?.read(body).card?.value;
|
|
2179
|
+
return card2 && !removed.has(card2) ? { card: card2 } : {};
|
|
2180
|
+
},
|
|
2181
|
+
[removed]
|
|
2182
|
+
);
|
|
2109
2183
|
useEffect4(() => {
|
|
2110
2184
|
editor?.setEditable(!closed && !sending);
|
|
2111
2185
|
}, [editor, closed, sending]);
|
|
@@ -2122,18 +2196,21 @@ function CommentBox({
|
|
|
2122
2196
|
return () => box.removeEventListener(ATTACH_EVENT, ask);
|
|
2123
2197
|
}, [upload, edit]);
|
|
2124
2198
|
const uploading = files.some((f) => f.state === "uploading");
|
|
2199
|
+
const failed = files.filter((f) => f.state === "failed").length;
|
|
2125
2200
|
const ready = files.some((f) => f.state === "ready");
|
|
2126
2201
|
const go = useCallback4(
|
|
2127
2202
|
(ed) => {
|
|
2128
2203
|
const body = ed.getJSON();
|
|
2129
2204
|
const sent = files.filter((f) => f.state === "ready");
|
|
2205
|
+
const sentUnder = underOf(body);
|
|
2130
2206
|
setRefused(null);
|
|
2131
2207
|
const answered = (answer) => answer.catch(() => ({ accepted: false, reason: "try again in a moment" }));
|
|
2132
2208
|
if (showsAtOnce) {
|
|
2209
|
+
const took = removed;
|
|
2133
2210
|
setFiles((all) => all.filter((f) => f.state !== "ready"));
|
|
2134
2211
|
draft?.clear();
|
|
2135
|
-
onSent?.(body, sent);
|
|
2136
|
-
void answered(send(body, sent)).then((answer) => {
|
|
2212
|
+
onSent?.(body, sent, sentUnder);
|
|
2213
|
+
void answered(send(body, sent, sentUnder)).then((answer) => {
|
|
2137
2214
|
if (answer.accepted) return;
|
|
2138
2215
|
onRefused?.();
|
|
2139
2216
|
if (ed.isDestroyed) {
|
|
@@ -2143,32 +2220,35 @@ function CommentBox({
|
|
|
2143
2220
|
if (isEmptyDoc(ed)) ed.commands.setContent(body);
|
|
2144
2221
|
else ed.commands.insertContentAt(0, body.content ?? []);
|
|
2145
2222
|
ed.commands.focus("end");
|
|
2223
|
+
setRemoved((now) => /* @__PURE__ */ new Set([...now, ...took]));
|
|
2146
2224
|
setFiles((all) => [...sent, ...all]);
|
|
2147
2225
|
setRefused(answer.reason);
|
|
2148
2226
|
});
|
|
2149
2227
|
return true;
|
|
2150
2228
|
}
|
|
2151
2229
|
setSending(true);
|
|
2152
|
-
void answered(send(body, sent)).then((answer) => {
|
|
2230
|
+
void answered(send(body, sent, sentUnder)).then((answer) => {
|
|
2153
2231
|
setSending(false);
|
|
2154
2232
|
if (!answer.accepted) {
|
|
2155
2233
|
setRefused(answer.reason);
|
|
2156
2234
|
return;
|
|
2157
2235
|
}
|
|
2158
2236
|
if (!ed.isDestroyed) ed.commands.clearContent(true);
|
|
2237
|
+
setRemoved(/* @__PURE__ */ new Set());
|
|
2159
2238
|
setFiles((all) => all.filter((f) => !sent.includes(f)));
|
|
2160
2239
|
draft?.clear();
|
|
2161
|
-
onSent?.(body, sent);
|
|
2240
|
+
onSent?.(body, sent, sentUnder);
|
|
2162
2241
|
});
|
|
2163
2242
|
return false;
|
|
2164
2243
|
},
|
|
2165
|
-
[files, showsAtOnce, send, draft, onSent, onRefused]
|
|
2244
|
+
[files, removed, underOf, showsAtOnce, send, draft, onSent, onRefused]
|
|
2166
2245
|
);
|
|
2167
2246
|
save.current = () => {
|
|
2168
2247
|
if (!editor || !edit || sending || uploading) return true;
|
|
2169
2248
|
setRefused(null);
|
|
2170
2249
|
setSending(true);
|
|
2171
|
-
|
|
2250
|
+
const body = editor.getJSON();
|
|
2251
|
+
void edit.onSave(body, files, underOf(body)).catch(() => ({ accepted: false, reason: "try again in a moment" })).then((answer) => {
|
|
2172
2252
|
setSending(false);
|
|
2173
2253
|
if (!answer.accepted) setRefused(answer.reason);
|
|
2174
2254
|
});
|
|
@@ -2189,7 +2269,7 @@ function CommentBox({
|
|
|
2189
2269
|
/* @__PURE__ */ jsx7("p", { className: "text-body-2 text-text-secondary", children: closed.reason })
|
|
2190
2270
|
] });
|
|
2191
2271
|
}
|
|
2192
|
-
const fileCards = files.length > 0 ? /* @__PURE__ */ jsx7(
|
|
2272
|
+
const fileCards = files.length > 0 ? /* @__PURE__ */ jsx7(Fragment3, { children: files.map((f) => /* @__PURE__ */ jsx7(
|
|
2193
2273
|
AttachmentCard,
|
|
2194
2274
|
{
|
|
2195
2275
|
pending: true,
|
|
@@ -2202,6 +2282,12 @@ function CommentBox({
|
|
|
2202
2282
|
},
|
|
2203
2283
|
f.id
|
|
2204
2284
|
)) }) : void 0;
|
|
2285
|
+
const card = reading?.card && !removed.has(reading.card.value) ? reading.card : void 0;
|
|
2286
|
+
const parts = edit ? [] : reading?.parts ?? [];
|
|
2287
|
+
const underBox = card || parts.length > 0 ? /* @__PURE__ */ jsxs5("div", { "data-box-under": true, className: "mt-1 flex flex-col gap-2", children: [
|
|
2288
|
+
card && /* @__PURE__ */ jsx7(CardUnder, { onRemove: () => setRemoved((was) => /* @__PURE__ */ new Set([...was, card.value])), children: card.view }),
|
|
2289
|
+
parts.map((part) => /* @__PURE__ */ jsx7(Fragment2, { children: part.view }, part.key))
|
|
2290
|
+
] }) : void 0;
|
|
2205
2291
|
const refusedLine = refused && /* @__PURE__ */ jsx7(FieldLine, { tone: "error", children: edit ? `Not saved: ${refused}. Your changes are still in the box.` : `Not sent: ${refused}. Your text is back in the box.` });
|
|
2206
2292
|
if (edit) {
|
|
2207
2293
|
return /* @__PURE__ */ jsxs5("div", { className: cn2("flex flex-col gap-1", className), children: [
|
|
@@ -2221,6 +2307,7 @@ function CommentBox({
|
|
|
2221
2307
|
] })
|
|
2222
2308
|
] })
|
|
2223
2309
|
] }),
|
|
2310
|
+
underBox,
|
|
2224
2311
|
sending && /* @__PURE__ */ jsx7(FieldLine, { children: "Saving\u2026" }),
|
|
2225
2312
|
refusedLine
|
|
2226
2313
|
] });
|
|
@@ -2241,14 +2328,16 @@ function CommentBox({
|
|
|
2241
2328
|
tools: upload ? /* @__PURE__ */ jsx7(ToolbarButton2, { tooltip: "Attach a file", "aria-label": "Attach a file", disabled: sending, onClick: () => picker.current?.click(), children: /* @__PURE__ */ jsx7(IconPaperclip, { size: 16, stroke: 1.5 }) }) : void 0,
|
|
2242
2329
|
attachments: fileCards,
|
|
2243
2330
|
ready,
|
|
2244
|
-
holding: uploading || sending,
|
|
2331
|
+
holding: uploading || failed > 0 || sending,
|
|
2245
2332
|
selection: { link: true },
|
|
2246
2333
|
className: cn2(sending && "[&_[data-composer-editor]]:text-text-muted")
|
|
2247
2334
|
}
|
|
2248
2335
|
),
|
|
2336
|
+
underBox,
|
|
2249
2337
|
upload && /* @__PURE__ */ jsx7(FilePicker, { ref: picker, multiple: true, accept, onPick: attachFiles }),
|
|
2250
2338
|
sending && /* @__PURE__ */ jsx7(FieldLine, { children: "Sending\u2026" }),
|
|
2251
2339
|
uploading && !sending && /* @__PURE__ */ jsx7(FieldLine, { children: "Uploading\u2026 Send waits for the file." }),
|
|
2340
|
+
failed > 0 && !uploading && !sending && /* @__PURE__ */ jsx7(FieldLine, { children: failed === 1 ? "Remove the file that did not upload to send." : "Remove the files that did not upload to send." }),
|
|
2252
2341
|
refusedLine
|
|
2253
2342
|
] });
|
|
2254
2343
|
}
|
|
@@ -2374,9 +2463,9 @@ function InlineText({ value, placeholder, label, onCommit, onText, onEnter, vari
|
|
|
2374
2463
|
|
|
2375
2464
|
// src/CommentHighlights.ts
|
|
2376
2465
|
import { Extension as Extension11 } from "@tiptap/core";
|
|
2377
|
-
import { Plugin as
|
|
2466
|
+
import { Plugin as Plugin8, PluginKey as PluginKey9 } from "@tiptap/pm/state";
|
|
2378
2467
|
import { Decoration as Decoration3, DecorationSet as DecorationSet3 } from "@tiptap/pm/view";
|
|
2379
|
-
var commentHighlightsKey = new
|
|
2468
|
+
var commentHighlightsKey = new PluginKey9("commentHighlights");
|
|
2380
2469
|
var COMMENT_HIGHLIGHT_CLASSES = {
|
|
2381
2470
|
rest: "cursor-pointer rounded-sm bg-warning-muted",
|
|
2382
2471
|
active: "cursor-pointer rounded-sm bg-warning-muted underline decoration-warning-default decoration-2 underline-offset-4"
|
|
@@ -2504,7 +2593,7 @@ var CommentHighlights = Extension11.create({
|
|
|
2504
2593
|
const options = this.options;
|
|
2505
2594
|
const editor = this.editor;
|
|
2506
2595
|
return [
|
|
2507
|
-
new
|
|
2596
|
+
new Plugin8({
|
|
2508
2597
|
key: commentHighlightsKey,
|
|
2509
2598
|
state: {
|
|
2510
2599
|
init: () => ({ anchors: [], active: null }),
|
|
@@ -2657,7 +2746,7 @@ function anchorOfSelection(editor) {
|
|
|
2657
2746
|
// src/PastedMarkdown.ts
|
|
2658
2747
|
import { Extension as Extension12 } from "@tiptap/core";
|
|
2659
2748
|
import { Slice } from "@tiptap/pm/model";
|
|
2660
|
-
import { Plugin as
|
|
2749
|
+
import { Plugin as Plugin9, PluginKey as PluginKey10 } from "@tiptap/pm/state";
|
|
2661
2750
|
function inTableCell($context) {
|
|
2662
2751
|
for (let depth = $context.depth; depth > 0; depth--) {
|
|
2663
2752
|
const role = $context.node(depth).type.spec.tableRole;
|
|
@@ -2674,8 +2763,8 @@ var PastedMarkdown = Extension12.create({
|
|
|
2674
2763
|
addProseMirrorPlugins() {
|
|
2675
2764
|
const options = this.options;
|
|
2676
2765
|
return [
|
|
2677
|
-
new
|
|
2678
|
-
key: new
|
|
2766
|
+
new Plugin9({
|
|
2767
|
+
key: new PluginKey10("pastedMarkdown"),
|
|
2679
2768
|
props: {
|
|
2680
2769
|
// Reached only for a text paste outside code; `plain` is the Shift paste.
|
|
2681
2770
|
clipboardTextParser: (text, $context, plain, view) => {
|
|
@@ -2721,7 +2810,7 @@ import { IconCopy, IconTrash } from "@tabler/icons-react";
|
|
|
2721
2810
|
import { BlockHandle, blockAtY } from "@estiva-app/ui";
|
|
2722
2811
|
import { Selection } from "@tiptap/pm/state";
|
|
2723
2812
|
import { MenuItem as MenuItem2, MenuSub } from "@estiva-app/ui";
|
|
2724
|
-
import { Fragment as
|
|
2813
|
+
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2725
2814
|
function editorBlocks(view) {
|
|
2726
2815
|
const out = [];
|
|
2727
2816
|
view.state.doc.forEach((node, pos) => {
|
|
@@ -2788,7 +2877,7 @@ function EditorBlockHandle({ editor, turnInto = turnIntoRows, actions, children,
|
|
|
2788
2877
|
const node = pos === void 0 ? null : editor.state.doc.nodeAt(pos);
|
|
2789
2878
|
if (pos === void 0 || !node) return null;
|
|
2790
2879
|
const turnRows = typeof turnInto === "function" ? turnInto(node, editor) : node.isTextblock ? turnInto : [];
|
|
2791
|
-
return /* @__PURE__ */ jsxs7(
|
|
2880
|
+
return /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
2792
2881
|
turnRows.length > 0 && /* @__PURE__ */ jsx9(MenuSub, { label: "Turn into", children: turnRows.map((row) => /* @__PURE__ */ jsx9(
|
|
2793
2882
|
MenuItem2,
|
|
2794
2883
|
{
|
|
@@ -2931,18 +3020,18 @@ function turnIntoRows(node, editor) {
|
|
|
2931
3020
|
|
|
2932
3021
|
// src/EditorTableControls.tsx
|
|
2933
3022
|
import { useCallback as useCallback6, useEffect as useEffect6, useRef as useRef5, useState as useState6 } from "react";
|
|
2934
|
-
import { TextSelection as
|
|
3023
|
+
import { TextSelection as TextSelection3 } from "@tiptap/pm/state";
|
|
2935
3024
|
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, deleteColumn, deleteRow, deleteTable, toggleHeader } from "@tiptap/pm/tables";
|
|
2936
3025
|
import { IconCheck as IconCheck2, IconColumnInsertLeft, IconColumnInsertRight, IconGripHorizontal, IconGripVertical, IconPlus, IconRowInsertBottom, IconRowInsertTop, IconTableRow, IconTrash as IconTrash2 } from "@tabler/icons-react";
|
|
2937
3026
|
import { cn as cn4 } from "@estiva-app/ui";
|
|
2938
3027
|
import { IconButton as IconButton2 } from "@estiva-app/ui";
|
|
2939
3028
|
import { Menu, MenuItem as MenuItem3, MenuSeparator as MenuSeparator2 } from "@estiva-app/ui";
|
|
2940
|
-
import { Fragment as
|
|
3029
|
+
import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2941
3030
|
function inCell(editor, cell, command) {
|
|
2942
3031
|
const { view } = editor;
|
|
2943
3032
|
if (!view.dom.contains(cell)) return false;
|
|
2944
3033
|
const at = view.posAtDOM(cell, 0);
|
|
2945
|
-
view.dispatch(view.state.tr.setSelection(
|
|
3034
|
+
view.dispatch(view.state.tr.setSelection(TextSelection3.near(view.state.doc.resolve(at))));
|
|
2946
3035
|
const done = command(view.state, view.dispatch, view);
|
|
2947
3036
|
editor.commands.focus();
|
|
2948
3037
|
return done;
|
|
@@ -3037,7 +3126,7 @@ function EditorTableControls({ editor, children, className }) {
|
|
|
3037
3126
|
},
|
|
3038
3127
|
children: [
|
|
3039
3128
|
children,
|
|
3040
|
-
shown && editor && /* @__PURE__ */ jsxs8(
|
|
3129
|
+
shown && editor && /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
3041
3130
|
/* @__PURE__ */ jsx10("div", { "data-table-control": true, className: cn4(HANDLE_BOX, "absolute -translate-x-1/2 -translate-y-1/2"), style: { left: shown.tableBox.left, top: shown.rowBox.top + shown.rowBox.height / 2 }, children: /* @__PURE__ */ jsxs8(
|
|
3042
3131
|
Menu,
|
|
3043
3132
|
{
|
|
@@ -3045,7 +3134,7 @@ function EditorTableControls({ editor, children, className }) {
|
|
|
3045
3134
|
onOpenChange: (open) => setMenu(open ? "row" : null),
|
|
3046
3135
|
trigger: /* @__PURE__ */ jsx10(IconButton2, { "aria-label": "Row menu", tooltip: "Row", className: "h-6 w-4 p-0", children: /* @__PURE__ */ jsx10(IconGripVertical, { size: 16, stroke: 1.5 }) }),
|
|
3047
3136
|
children: [
|
|
3048
|
-
shown.row.rowIndex === 0 && /* @__PURE__ */ jsxs8(
|
|
3137
|
+
shown.row.rowIndex === 0 && /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
3049
3138
|
/* @__PURE__ */ jsx10(
|
|
3050
3139
|
MenuItem3,
|
|
3051
3140
|
{
|