@examplary/ui 1.56.0 → 1.58.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/components/ai/ai-icon.js +2 -25
- package/dist/components/ai/ai-prompt-suggestion.js +3 -26
- package/dist/components/brand/tick-icon.js +2 -25
- package/dist/components/chat/chat-input.js +8 -31
- package/dist/components/chat/chat-typing-indicator.js +2 -2
- package/dist/components/chat/chat-view.js +6 -34
- package/dist/components/loading/ai-spinner.js +2 -13
- package/dist/components/loading/tick-loader.js +39 -104
- package/dist/components/print/answer-box.js +2 -25
- package/dist/components/question-types/fetch-component.js +65 -106
- package/dist/components/question-types/format-question-type.d.ts +41 -41
- package/dist/components/question-types/format-question-type.js +36 -37
- package/dist/components/rich-text/minimal-rich-text-field.d.ts +2 -2
- package/dist/components/rich-text/minimal-rich-text-field.js +47 -85
- package/dist/components/rich-text/rich-text-display.js +15 -33
- package/dist/components/rich-text/rich-text-field.js +2 -25
- package/dist/components/rich-text/rich-text-toolbar.d.ts +3 -2
- package/dist/components/rich-text/rich-text-toolbar.js +5 -6
- package/dist/components/rich-text/tiptap/collaboration-caret.js +24 -34
- package/dist/components/rich-text/tiptap/comments/comment-bubble.d.ts +1 -1
- package/dist/components/rich-text/tiptap/comments/comment-bubble.js +36 -41
- package/dist/components/rich-text/tiptap/content-reference.js +6 -7
- package/dist/components/rich-text/tiptap/crop-page-clipping-modal.d.ts +3 -3
- package/dist/components/rich-text/tiptap/crop-page-clipping-modal.js +20 -25
- package/dist/components/rich-text/tiptap/extensions.d.ts +2 -2
- package/dist/components/rich-text/tiptap/extensions.js +6 -16
- package/dist/components/rich-text/tiptap/file-attachment.js +9 -11
- package/dist/components/rich-text/tiptap/file-handler.d.ts +2 -2
- package/dist/components/rich-text/tiptap/file-handler.js +110 -185
- package/dist/components/rich-text/tiptap/image.js +18 -23
- package/dist/components/rich-text/tiptap/mathematics-component.js +25 -30
- package/dist/components/rich-text/tiptap/mathematics.js +56 -82
- package/dist/components/rich-text/tiptap/page-clipping.js +3 -4
- package/dist/components/rich-text/tiptap/png-scanner.js +63 -108
- package/dist/components/rich-text/tiptap/rich-text-formatting-menu.d.ts +1 -1
- package/dist/components/rich-text/tiptap/rich-text-formatting-menu.js +31 -46
- package/dist/components/ui/alert.d.ts +3 -3
- package/dist/components/ui/alert.js +7 -32
- package/dist/components/ui/avatar.js +18 -14
- package/dist/components/ui/badge.d.ts +3 -3
- package/dist/components/ui/badge.js +4 -27
- package/dist/components/ui/button.d.ts +4 -4
- package/dist/components/ui/button.js +4 -27
- package/dist/components/ui/card.js +6 -46
- package/dist/components/ui/checkbox.js +1 -26
- package/dist/components/ui/color-picker.js +11 -22
- package/dist/components/ui/command-palette.d.ts +2 -2
- package/dist/components/ui/command-palette.js +38 -72
- package/dist/components/ui/command.js +18 -49
- package/dist/components/ui/comments.js +37 -107
- package/dist/components/ui/context-menu.js +30 -67
- package/dist/components/ui/dialog.js +15 -61
- package/dist/components/ui/dropdown.js +17 -64
- package/dist/components/ui/floating-menu.js +2 -25
- package/dist/components/ui/floating-resizable.d.ts +5 -0
- package/dist/components/ui/floating-resizable.js +24 -0
- package/dist/components/ui/help-icon.js +1 -2
- package/dist/components/ui/icon-picker.js +50 -130
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/input.js +2 -25
- package/dist/components/ui/label.d.ts +1 -1
- package/dist/components/ui/label.js +2 -27
- package/dist/components/ui/popover.d.ts +2 -2
- package/dist/components/ui/popover.js +4 -32
- package/dist/components/ui/progress-bar.js +2 -3
- package/dist/components/ui/radio-group.js +4 -28
- package/dist/components/ui/resizable.d.ts +6 -9
- package/dist/components/ui/resizable.js +13 -60
- package/dist/components/ui/select.js +12 -55
- package/dist/components/ui/separator.js +1 -26
- package/dist/components/ui/sheet.d.ts +3 -3
- package/dist/components/ui/sheet.js +11 -51
- package/dist/components/ui/skeleton.js +2 -25
- package/dist/components/ui/slider.js +7 -32
- package/dist/components/ui/sortable.d.ts +1 -1
- package/dist/components/ui/sortable.js +131 -155
- package/dist/components/ui/switch.d.ts +3 -3
- package/dist/components/ui/switch.js +3 -28
- package/dist/components/ui/table.js +8 -54
- package/dist/components/ui/tabs.js +8 -34
- package/dist/components/ui/text-selection-menu.d.ts +1 -1
- package/dist/components/ui/text-selection-menu.js +19 -25
- package/dist/components/ui/textarea.js +7 -30
- package/dist/components/ui/tooltip.js +4 -29
- package/dist/components/web-components/content-reference.js +81 -106
- package/dist/components/web-components/file-attachment.js +9 -30
- package/dist/components/web-components/index.js +1 -1
- package/dist/components/web-components/inline-comment-reply.js +3 -24
- package/dist/components/web-components/inline-comment.js +3 -24
- package/dist/components/web-components/inline-math.js +14 -36
- package/dist/components/web-components/page-clipping.js +13 -34
- package/dist/lib/compose-refs.js +10 -18
- package/dist/lib/use-spin-loop.js +19 -69
- package/dist/src/global.css +2 -2
- package/dist/utils.js +1 -5
- package/package.json +5 -4
- package/dist/components/rich-text/tiptap/comments/comment-reply.d.ts +0 -21
- package/dist/components/rich-text/tiptap/comments/comment-reply.js +0 -230
- package/dist/components/rich-text/tiptap/comments/comment.d.ts +0 -22
- package/dist/components/rich-text/tiptap/comments/comment.js +0 -198
- package/dist/components/rich-text/tiptap/comments/helpers.d.ts +0 -19
- package/dist/components/rich-text/tiptap/comments/helpers.js +0 -95
- package/dist/components/rich-text/tiptap/comments/types.d.ts +0 -29
- package/dist/components/rich-text/tiptap/comments/types.js +0 -1
|
@@ -1,47 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
import { createElement, useMemo, useRef } from "react";
|
|
25
3
|
import { convertLatexToMathMl } from "mathlive";
|
|
26
4
|
import { cn } from "../../utils";
|
|
27
|
-
export
|
|
28
|
-
var _a;
|
|
5
|
+
export const convertHtmlToRichText = (html) => {
|
|
29
6
|
// Replace <inline-math> with MathML generated from the LaTeX content
|
|
30
|
-
return (
|
|
7
|
+
return (html?.replace?.(/<inline-math>([\s\S]*?)<\/inline-math>/g, (match, content) => {
|
|
31
8
|
try {
|
|
32
|
-
return
|
|
9
|
+
return `<math>${convertLatexToMathMl(content)}</math>`;
|
|
33
10
|
}
|
|
34
|
-
catch
|
|
11
|
+
catch {
|
|
35
12
|
// If conversion fails, keep the original inline-math markup so that
|
|
36
13
|
// rendering can continue and content remains readable.
|
|
37
14
|
return match;
|
|
38
15
|
}
|
|
39
|
-
})
|
|
16
|
+
}) || html);
|
|
40
17
|
};
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var html = useMemo(function () { return convertHtmlToRichText(children); }, [children]);
|
|
18
|
+
export const RichTextDisplay = ({ as = "div", children, className = "", ...props }) => {
|
|
19
|
+
const ref = useRef(null);
|
|
20
|
+
const html = useMemo(() => convertHtmlToRichText(children), [children]);
|
|
45
21
|
// eslint-disable-next-line react-hooks/refs
|
|
46
|
-
return createElement(as,
|
|
22
|
+
return createElement(as, {
|
|
23
|
+
...props,
|
|
24
|
+
key: "rich-text-display",
|
|
25
|
+
className: cn("tiptap", className),
|
|
26
|
+
dangerouslySetInnerHTML: { __html: html },
|
|
27
|
+
ref,
|
|
28
|
+
});
|
|
47
29
|
};
|
|
@@ -1,30 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
3
|
import { MinimalRichTextField, } from "./minimal-rich-text-field";
|
|
26
4
|
import { cn } from "../../utils";
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
return (_jsx(MinimalRichTextField, __assign({ singleLine: singleLine, className: cn("box p-3 text-sm", !singleLine && "min-h-16", className) }, props)));
|
|
5
|
+
export const RichTextField = ({ singleLine, className, ...props }) => {
|
|
6
|
+
return (_jsx(MinimalRichTextField, { singleLine: singleLine, className: cn("box p-3 text-sm", !singleLine && "min-h-16", className), ...props }));
|
|
30
7
|
};
|
|
@@ -3,15 +3,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useCallback } from "react";
|
|
4
4
|
import { BoldIcon, ItalicIcon, LinkIcon, ListIcon, TextQuoteIcon, } from "lucide-react";
|
|
5
5
|
import { cn } from "../../utils";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
var setLink = useCallback(function () {
|
|
6
|
+
export const RichTextToolbar = ({ editor }) => {
|
|
7
|
+
const setLink = useCallback(() => {
|
|
9
8
|
if (editor.isActive("link")) {
|
|
10
9
|
editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
11
10
|
return;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const previousUrl = editor.getAttributes("link").href;
|
|
13
|
+
let url = window.prompt("Where do you want to link to? Enter a link that starts with 'https://'.", previousUrl);
|
|
15
14
|
// cancelled
|
|
16
15
|
if (url === null) {
|
|
17
16
|
return;
|
|
@@ -30,5 +29,5 @@ export var RichTextToolbar = function (_a) {
|
|
|
30
29
|
if (!editor) {
|
|
31
30
|
return null;
|
|
32
31
|
}
|
|
33
|
-
return (_jsxs("div", { className: "border border-border border-b-0 rounded-t-base p-1 gap-1 flex items-center", children: [_jsx("span", { onClick:
|
|
32
|
+
return (_jsxs("div", { className: "border border-border border-b-0 rounded-t-base p-1 gap-1 flex items-center", children: [_jsx("span", { onClick: () => editor.chain().focus().toggleBold().run(), className: cn("p-2 cursor-pointer", editor.isActive("bold") ? "bg-bright rounded-base" : ""), children: _jsx(BoldIcon, { size: 16 }) }), _jsx("span", { onClick: () => editor.chain().focus().toggleItalic().run(), className: cn("p-2 cursor-pointer", editor.isActive("italic") ? "bg-bright rounded-base" : ""), children: _jsx(ItalicIcon, { size: 16 }) }), _jsx("span", { onClick: setLink, className: cn("p-2 cursor-pointer", editor.isActive("link") ? "bg-bright rounded-base" : ""), children: _jsx(LinkIcon, { size: 16 }) }), _jsx("span", { onClick: () => editor.chain().focus().toggleBulletList().run(), className: cn("p-2 cursor-pointer", editor.isActive("bulletList") ? "bg-bright rounded-base" : ""), children: _jsx(ListIcon, { size: 16 }) }), _jsx("span", { onClick: () => editor.chain().focus().toggleOrderedList().run(), className: cn("p-2 cursor-pointer", editor.isActive("orderedList") ? "bg-bright rounded-base" : ""), children: _jsx(ListIcon, { size: 16 }) }), _jsx("span", { onClick: () => editor.chain().focus().toggleBlockquote().run(), className: cn("p-2 cursor-pointer", editor.isActive("blockquote") ? "bg-bright rounded-base" : ""), children: _jsx(TextQuoteIcon, { size: 16 }) })] }));
|
|
34
33
|
};
|
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { Extension } from "@tiptap/core";
|
|
13
2
|
import { defaultSelectionBuilder, yCursorPlugin } from "@tiptap/y-tiptap";
|
|
14
|
-
|
|
15
|
-
return Array.from(states.entries()).map(
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
const awarenessStatesToArray = (states) => {
|
|
4
|
+
return Array.from(states.entries()).map(([key, value]) => {
|
|
5
|
+
return {
|
|
6
|
+
clientId: key,
|
|
7
|
+
...value.user,
|
|
8
|
+
};
|
|
18
9
|
});
|
|
19
10
|
};
|
|
20
|
-
|
|
11
|
+
const getSafeColor = (color) => {
|
|
21
12
|
return typeof color === "string" ? color : "";
|
|
22
13
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
const renderCursor = (user) => {
|
|
15
|
+
const cursor = document.createElement("span");
|
|
16
|
+
const color = getSafeColor(user.color);
|
|
26
17
|
cursor.classList.add("collaboration-carets__caret");
|
|
27
18
|
cursor.style.borderColor = color;
|
|
28
|
-
|
|
19
|
+
const label = document.createElement("div");
|
|
29
20
|
label.classList.add("collaboration-carets__label");
|
|
30
21
|
label.style.backgroundColor = color;
|
|
31
22
|
label.insertBefore(document.createTextNode(user.name), null);
|
|
@@ -36,42 +27,41 @@ var renderCursor = function (user) {
|
|
|
36
27
|
* This extension allows you to add collaboration carets to your editor.
|
|
37
28
|
* @see https://tiptap.dev/api/extensions/collaboration-caret
|
|
38
29
|
*/
|
|
39
|
-
export
|
|
30
|
+
export const CollaborationCaret = Extension.create({
|
|
40
31
|
name: "collaborationCaret",
|
|
41
32
|
priority: 999,
|
|
42
|
-
addOptions
|
|
33
|
+
addOptions() {
|
|
43
34
|
return {
|
|
44
35
|
awareness: null,
|
|
45
36
|
};
|
|
46
37
|
},
|
|
47
|
-
onCreate
|
|
38
|
+
onCreate() {
|
|
48
39
|
if (!this.options.awareness) {
|
|
49
40
|
throw new Error('The "awareness" option is required for the CollaborationCaret extension');
|
|
50
41
|
}
|
|
51
42
|
},
|
|
52
|
-
addStorage
|
|
43
|
+
addStorage() {
|
|
53
44
|
return {
|
|
54
45
|
users: [],
|
|
55
46
|
updateHandler: null,
|
|
56
47
|
};
|
|
57
48
|
},
|
|
58
|
-
onDestroy
|
|
49
|
+
onDestroy() {
|
|
59
50
|
if (this.options.awareness && this.storage.updateHandler) {
|
|
60
51
|
this.options.awareness.off("update", this.storage.updateHandler);
|
|
61
52
|
this.storage.updateHandler = null;
|
|
62
53
|
}
|
|
63
54
|
},
|
|
64
|
-
addProseMirrorPlugins
|
|
65
|
-
var _this = this;
|
|
55
|
+
addProseMirrorPlugins() {
|
|
66
56
|
return [
|
|
67
|
-
yCursorPlugin((
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
yCursorPlugin((() => {
|
|
58
|
+
this.storage.users = awarenessStatesToArray(this.options.awareness.states);
|
|
59
|
+
const updateHandler = () => {
|
|
60
|
+
this.storage.users = awarenessStatesToArray(this.options.awareness.states);
|
|
71
61
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return
|
|
62
|
+
this.storage.updateHandler = updateHandler;
|
|
63
|
+
this.options.awareness.on("update", updateHandler);
|
|
64
|
+
return this.options.awareness;
|
|
75
65
|
})(), {
|
|
76
66
|
cursorBuilder: renderCursor,
|
|
77
67
|
selectionBuilder: defaultSelectionBuilder,
|
|
@@ -3,22 +3,21 @@ import { useCallback, useState } from "react";
|
|
|
3
3
|
import { Trans } from "react-i18next";
|
|
4
4
|
import { useEditorState } from "@tiptap/react";
|
|
5
5
|
import { BubbleMenu } from "@tiptap/react/menus";
|
|
6
|
-
import { findReplies } from "
|
|
6
|
+
import { findReplies, } from "tiptap-inline-comments";
|
|
7
7
|
import { Button } from "../../../ui/button";
|
|
8
8
|
import { CommentItem } from "../../../ui/comments";
|
|
9
9
|
import { FloatingMenu } from "../../../ui/floating-menu";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var onEditingChange = useCallback(function (id, editing) {
|
|
10
|
+
const CommentForm = ({ editor, comment, commentAuthor, replies, }) => {
|
|
11
|
+
const [editingIds, setEditingIds] = useState(new Set());
|
|
12
|
+
const isEditingAny = editingIds.size > 0;
|
|
13
|
+
const onEditingChange = useCallback((id, editing) => {
|
|
15
14
|
if (!id)
|
|
16
15
|
return;
|
|
17
|
-
setEditingIds(
|
|
18
|
-
|
|
16
|
+
setEditingIds((prev) => {
|
|
17
|
+
const has = prev.has(id);
|
|
19
18
|
if (editing === has)
|
|
20
19
|
return prev;
|
|
21
|
-
|
|
20
|
+
const next = new Set(prev);
|
|
22
21
|
if (editing)
|
|
23
22
|
next.add(id);
|
|
24
23
|
else
|
|
@@ -26,8 +25,8 @@ var CommentForm = function (_a) {
|
|
|
26
25
|
return next;
|
|
27
26
|
});
|
|
28
27
|
}, []);
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
const saveComment = (value) => {
|
|
29
|
+
const trimmed = value.trim();
|
|
31
30
|
if (!trimmed) {
|
|
32
31
|
editor.chain().focus().removeComment({ id: comment.id }).run();
|
|
33
32
|
return;
|
|
@@ -38,23 +37,23 @@ var CommentForm = function (_a) {
|
|
|
38
37
|
.updateComment({ id: comment.id, value: trimmed })
|
|
39
38
|
.run();
|
|
40
39
|
};
|
|
41
|
-
|
|
40
|
+
const removeComment = () => {
|
|
42
41
|
editor.chain().focus().removeComment({ id: comment.id }).run();
|
|
43
42
|
};
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const saveReply = (id) => (value) => {
|
|
44
|
+
const trimmed = value.trim();
|
|
46
45
|
if (!trimmed) {
|
|
47
|
-
editor.chain().focus().removeCommentReply({ id
|
|
46
|
+
editor.chain().focus().removeCommentReply({ id }).run();
|
|
48
47
|
return;
|
|
49
48
|
}
|
|
50
|
-
editor.chain().focus().updateCommentReply({ id
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
editor.chain().focus().removeCommentReply({ id
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
editor.chain().focus().updateCommentReply({ id, value: trimmed }).run();
|
|
50
|
+
};
|
|
51
|
+
const removeReply = (id) => () => {
|
|
52
|
+
editor.chain().focus().removeCommentReply({ id }).run();
|
|
53
|
+
};
|
|
54
|
+
const [draftOpen, setDraftOpen] = useState(false);
|
|
55
|
+
const submitDraft = (value) => {
|
|
56
|
+
const trimmed = value.trim();
|
|
58
57
|
if (trimmed) {
|
|
59
58
|
editor
|
|
60
59
|
.chain()
|
|
@@ -64,33 +63,29 @@ var CommentForm = function (_a) {
|
|
|
64
63
|
}
|
|
65
64
|
setDraftOpen(false);
|
|
66
65
|
};
|
|
67
|
-
return (_jsxs(FloatingMenu, { className: "flex flex-col w-80 ml-3 overflow-auto max-h-[70vh]", children: [_jsx(CommentItem, { comment: comment, onSave: saveComment, onResolve: removeComment, onDelete: removeComment, commentAuthor: commentAuthor, onEditingChange: onEditingChange, className: "p-3" }), replies.map(
|
|
66
|
+
return (_jsxs(FloatingMenu, { className: "flex flex-col w-80 ml-3 overflow-auto max-h-[70vh]", children: [_jsx(CommentItem, { comment: comment, onSave: saveComment, onResolve: removeComment, onDelete: removeComment, commentAuthor: commentAuthor, onEditingChange: onEditingChange, className: "p-3" }), replies.map((reply) => (_jsx(CommentItem, { comment: reply, onSave: saveReply(reply.id), onDelete: removeReply(reply.id), commentAuthor: commentAuthor, onEditingChange: onEditingChange, isTopLevel: false, className: "p-3 pl-11" }, reply.id))), draftOpen && (_jsx(CommentItem, { comment: {
|
|
68
67
|
id: "reply-draft",
|
|
69
68
|
inReplyTo: comment.id,
|
|
70
69
|
createdBy: commentAuthor,
|
|
71
|
-
}, commentAuthor: commentAuthor, onSave: submitDraft, onCancel:
|
|
70
|
+
}, commentAuthor: commentAuthor, onSave: submitDraft, onCancel: () => setDraftOpen(false), isTopLevel: false, className: "p-3 pl-11" })), !isEditingAny && !draftOpen && (_jsx("div", { className: "ml-12 pb-3", children: _jsx(Button, { size: "sm", variant: "secondary", className: "text-xs h-7", onClick: () => setDraftOpen(true), children: _jsx(Trans, { children: "formatting.comments.reply" }) }) }))] }));
|
|
72
71
|
};
|
|
73
|
-
export
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
var attrs = isComment
|
|
72
|
+
export const CommentBubble = ({ editor, commentAuthor, }) => {
|
|
73
|
+
const state = useEditorState({
|
|
74
|
+
editor,
|
|
75
|
+
selector: (ctx) => {
|
|
76
|
+
const isComment = ctx.editor.isActive("comment");
|
|
77
|
+
const attrs = isComment
|
|
80
78
|
? ctx.editor.getAttributes("comment")
|
|
81
79
|
: null;
|
|
82
|
-
|
|
83
|
-
? findReplies(ctx.editor, attrs.id).map(
|
|
80
|
+
const replies = attrs
|
|
81
|
+
? findReplies(ctx.editor, attrs.id).map((r) => r.attrs)
|
|
84
82
|
: [];
|
|
85
83
|
return {
|
|
86
|
-
isComment
|
|
87
|
-
attrs
|
|
88
|
-
replies
|
|
84
|
+
isComment,
|
|
85
|
+
attrs,
|
|
86
|
+
replies,
|
|
89
87
|
};
|
|
90
88
|
},
|
|
91
89
|
});
|
|
92
|
-
return (_jsx(BubbleMenu, { editor: editor, shouldShow:
|
|
93
|
-
var editor = _a.editor;
|
|
94
|
-
return editor.isActive("comment");
|
|
95
|
-
}, options: { placement: "bottom" }, children: state.isComment && state.attrs && (_jsx(CommentForm, { editor: editor, comment: state.attrs, commentAuthor: commentAuthor, replies: state.replies }, state.attrs.id)) }));
|
|
90
|
+
return (_jsx(BubbleMenu, { editor: editor, shouldShow: ({ editor }) => editor.isActive("comment"), options: { placement: "bottom" }, children: state.isComment && state.attrs && (_jsx(CommentForm, { editor: editor, comment: state.attrs, commentAuthor: commentAuthor, replies: state.replies }, state.attrs.id)) }));
|
|
96
91
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Mark, mergeAttributes } from "@tiptap/core";
|
|
2
|
-
|
|
2
|
+
const ContentReference = Mark.create({
|
|
3
3
|
name: "content-reference",
|
|
4
|
-
addAttributes
|
|
4
|
+
addAttributes() {
|
|
5
5
|
return {
|
|
6
6
|
quote: {
|
|
7
7
|
default: null,
|
|
8
|
-
parseHTML:
|
|
9
|
-
renderHTML:
|
|
8
|
+
parseHTML: (element) => element.getAttribute("quote"),
|
|
9
|
+
renderHTML: (attributes) => {
|
|
10
10
|
if (!attributes.quote)
|
|
11
11
|
return {};
|
|
12
12
|
return { quote: attributes.quote };
|
|
@@ -14,11 +14,10 @@ var ContentReference = Mark.create({
|
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
},
|
|
17
|
-
parseHTML
|
|
17
|
+
parseHTML() {
|
|
18
18
|
return [{ tag: "content-reference" }];
|
|
19
19
|
},
|
|
20
|
-
renderHTML
|
|
21
|
-
var HTMLAttributes = _a.HTMLAttributes;
|
|
20
|
+
renderHTML({ HTMLAttributes }) {
|
|
22
21
|
return ["content-reference", mergeAttributes(HTMLAttributes), 0];
|
|
23
22
|
},
|
|
24
23
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react-image-crop/dist/ReactCrop.css";
|
|
2
|
-
export declare const CropPageClippingModal: ({ pageClipping, onClose, onUpdate }: {
|
|
2
|
+
export declare const CropPageClippingModal: ({ pageClipping, onClose, onUpdate, }: {
|
|
3
3
|
pageClipping: any;
|
|
4
|
-
onClose:
|
|
5
|
-
onUpdate: any;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onUpdate: (clipping: any) => void;
|
|
6
6
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
2
|
import { useEffect, useState } from "react";
|
|
14
3
|
import { Trans } from "react-i18next";
|
|
15
4
|
import ReactCrop from "react-image-crop";
|
|
5
|
+
// @ts-expect-error css
|
|
16
6
|
import "react-image-crop/dist/ReactCrop.css";
|
|
17
7
|
import { Button } from "../../ui/button";
|
|
18
8
|
import { Dialog, DialogContent, DialogFooter } from "../../ui/dialog";
|
|
19
|
-
|
|
9
|
+
const normalizeCoord = (coord, defaultValue) => {
|
|
20
10
|
if (!coord && coord !== 0)
|
|
21
11
|
return defaultValue;
|
|
22
|
-
|
|
12
|
+
const num = Number(coord);
|
|
23
13
|
if (isNaN(num) || num < 0)
|
|
24
14
|
return defaultValue;
|
|
25
15
|
// Gemini by default will return a box_2d coordinate in the range 0-1000
|
|
@@ -27,18 +17,17 @@ var normalizeCoord = function (coord, defaultValue) {
|
|
|
27
17
|
return num / 1000;
|
|
28
18
|
return num;
|
|
29
19
|
};
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
page: pageClipping === null || pageClipping === void 0 ? void 0 : pageClipping.page,
|
|
20
|
+
export const CropPageClippingModal = ({ pageClipping, onClose, onUpdate, }) => {
|
|
21
|
+
const [crop, setCrop] = useState();
|
|
22
|
+
const url = `https://page-clippings.examplary.ai/?${new URLSearchParams({
|
|
23
|
+
url: pageClipping?.url,
|
|
24
|
+
page: pageClipping?.page,
|
|
36
25
|
x: "0",
|
|
37
26
|
y: "0",
|
|
38
27
|
width: "1",
|
|
39
28
|
height: "1",
|
|
40
|
-
}).toString()
|
|
41
|
-
useEffect(
|
|
29
|
+
}).toString()}`;
|
|
30
|
+
useEffect(() => {
|
|
42
31
|
if (!pageClipping)
|
|
43
32
|
return;
|
|
44
33
|
setCrop({
|
|
@@ -49,11 +38,17 @@ export var CropPageClippingModal = function (_a) {
|
|
|
49
38
|
height: normalizeCoord(pageClipping.height, 1) * 100,
|
|
50
39
|
});
|
|
51
40
|
}, [pageClipping]);
|
|
52
|
-
|
|
53
|
-
onUpdate(
|
|
41
|
+
const save = () => {
|
|
42
|
+
onUpdate({
|
|
43
|
+
...pageClipping,
|
|
44
|
+
x: (crop?.x || 0) / 100,
|
|
45
|
+
y: (crop?.y || 0) / 100,
|
|
46
|
+
width: (crop?.width || 100) / 100,
|
|
47
|
+
height: (crop?.height || 100) / 100,
|
|
48
|
+
});
|
|
54
49
|
};
|
|
55
|
-
return (_jsx(Dialog, { open: !!pageClipping, onOpenChange:
|
|
50
|
+
return (_jsx(Dialog, { open: !!pageClipping, onOpenChange: (open) => {
|
|
56
51
|
if (!open)
|
|
57
52
|
onClose();
|
|
58
|
-
}, children: _jsxs(DialogContent, { className: "sm:max-w-[725px]", showClose: false, children: [_jsx("div", { className: "flex items-center justify-center overflow-hidden mb-4", children: pageClipping && (_jsx(ReactCrop, { className: "max-h-[70vh] max-w-full", crop: crop, onChange:
|
|
53
|
+
}, children: _jsxs(DialogContent, { className: "sm:max-w-[725px]", showClose: false, children: [_jsx("div", { className: "flex items-center justify-center overflow-hidden mb-4", children: pageClipping && (_jsx(ReactCrop, { className: "max-h-[70vh] max-w-full", crop: crop, onChange: (_, c) => setCrop(c), children: _jsx("img", { src: url }) })) }), _jsx(DialogFooter, { children: _jsx(Button, { variant: "primary", type: "submit", onClick: save, children: _jsx(Trans, { children: "formatting.crop.crop" }) }) })] }) }));
|
|
59
54
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const defaultRichTextExtensions: (import("@tiptap/core").Mark<any, any> | import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any>)[];
|
|
2
|
-
export declare const htmlRenderingRichTextExtensions: (import("@tiptap/core").Mark<any, any> | import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any>)[];
|
|
1
|
+
export declare const defaultRichTextExtensions: (import("@tiptap/core").Mark<any, any> | import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any>)[];
|
|
2
|
+
export declare const htmlRenderingRichTextExtensions: (import("@tiptap/core").Mark<any, any> | import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-typography").TypographyOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-image").ImageOptions, any> | import("@tiptap/core").Extension<import("tiptap-inline-comments").CommentOptions, any>)[];
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
1
|
import Document from "@tiptap/extension-document";
|
|
11
2
|
import Highlight from "@tiptap/extension-highlight";
|
|
12
3
|
import Image from "@tiptap/extension-image";
|
|
@@ -14,13 +5,12 @@ import Link from "@tiptap/extension-link";
|
|
|
14
5
|
import { TableKit } from "@tiptap/extension-table";
|
|
15
6
|
import Typography from "@tiptap/extension-typography";
|
|
16
7
|
import StarterKit from "@tiptap/starter-kit";
|
|
17
|
-
import {
|
|
18
|
-
import { Comment } from "./comments/comment.js";
|
|
8
|
+
import { InlineComments } from "tiptap-inline-comments";
|
|
19
9
|
import ContentReference from "./content-reference.js";
|
|
20
10
|
import FileAttachment from "./file-attachment.js";
|
|
21
11
|
import { Mathematics } from "./mathematics.js";
|
|
22
12
|
import PageClipping from "./page-clipping.js";
|
|
23
|
-
export
|
|
13
|
+
export const defaultRichTextExtensions = [
|
|
24
14
|
StarterKit.configure({
|
|
25
15
|
document: false,
|
|
26
16
|
link: false,
|
|
@@ -39,9 +29,9 @@ export var defaultRichTextExtensions = [
|
|
|
39
29
|
table: { resizable: true },
|
|
40
30
|
}),
|
|
41
31
|
];
|
|
42
|
-
export
|
|
32
|
+
export const htmlRenderingRichTextExtensions = [
|
|
43
33
|
Document,
|
|
44
34
|
Image,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
]
|
|
35
|
+
InlineComments,
|
|
36
|
+
...defaultRichTextExtensions,
|
|
37
|
+
];
|
|
@@ -5,26 +5,24 @@ export default Node.create({
|
|
|
5
5
|
group: "block",
|
|
6
6
|
content: "inline*",
|
|
7
7
|
atom: true,
|
|
8
|
-
addAttributes
|
|
8
|
+
addAttributes() {
|
|
9
9
|
return {
|
|
10
10
|
href: {},
|
|
11
11
|
title: {},
|
|
12
12
|
type: {},
|
|
13
13
|
};
|
|
14
14
|
},
|
|
15
|
-
parseHTML
|
|
15
|
+
parseHTML() {
|
|
16
16
|
return [
|
|
17
17
|
{
|
|
18
18
|
tag: "file-attachment",
|
|
19
19
|
},
|
|
20
20
|
];
|
|
21
21
|
},
|
|
22
|
-
renderHTML
|
|
23
|
-
var HTMLAttributes = _a.HTMLAttributes;
|
|
22
|
+
renderHTML({ HTMLAttributes }) {
|
|
24
23
|
return ["file-attachment", mergeAttributes(HTMLAttributes)];
|
|
25
24
|
},
|
|
26
|
-
addProseMirrorPlugins
|
|
27
|
-
var _this = this;
|
|
25
|
+
addProseMirrorPlugins() {
|
|
28
26
|
// Similar to the TipTap Link extension, we disable clicking on these
|
|
29
27
|
// links in the editor, since that is annoying. We don't want to change
|
|
30
28
|
// the HTML tag though!
|
|
@@ -32,19 +30,19 @@ export default Node.create({
|
|
|
32
30
|
new Plugin({
|
|
33
31
|
key: new PluginKey("handleClickFileAttachment"),
|
|
34
32
|
props: {
|
|
35
|
-
handleClick:
|
|
33
|
+
handleClick: (view, pos, event) => {
|
|
36
34
|
if (event.button !== 0) {
|
|
37
35
|
return false;
|
|
38
36
|
}
|
|
39
37
|
if (!view.editable) {
|
|
40
38
|
return false;
|
|
41
39
|
}
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
let link = null;
|
|
41
|
+
const target = event.target;
|
|
44
42
|
if (!target) {
|
|
45
43
|
return false;
|
|
46
44
|
}
|
|
47
|
-
|
|
45
|
+
const root = this.editor.view.dom;
|
|
48
46
|
link = target.closest("file-attachment");
|
|
49
47
|
if (link && !root.contains(link)) {
|
|
50
48
|
link = null;
|
|
@@ -53,7 +51,7 @@ export default Node.create({
|
|
|
53
51
|
return false;
|
|
54
52
|
}
|
|
55
53
|
if (target !== link) {
|
|
56
|
-
|
|
54
|
+
this.editor.commands.selectParentNode();
|
|
57
55
|
}
|
|
58
56
|
return true;
|
|
59
57
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Editor } from "@tiptap/react";
|
|
2
|
-
export declare const processFilesAsString: (uploadFile: any, files:
|
|
3
|
-
export declare const processFiles: (uploadFile: any, currentEditor: Editor, files:
|
|
2
|
+
export declare const processFilesAsString: (uploadFile: any, files: File[] | FileList) => Promise<unknown>;
|
|
3
|
+
export declare const processFiles: (uploadFile: any, currentEditor: Editor, files: File[], pos: number) => void;
|
|
4
4
|
export declare const fileHandler: (uploadFile: any) => import("@tiptap/core").Extension<Omit<import("@tiptap/extension-file-handler").FileHandlePluginOptions, "key" | "editor">, any>;
|