@layers-app/shared 0.4.8 → 0.4.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/dist/components/AttachmentsGalleryModal/AttachmentsGalleryContext.d.ts +2 -0
- package/dist/components/AttachmentsGalleryModal/AttachmentsGalleryContext.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/AttachmentsGalleryContext.js +22 -17
- package/dist/components/AttachmentsGalleryModal/components/AttachmentVideoPlayer.d.ts +15 -0
- package/dist/components/AttachmentsGalleryModal/components/AttachmentVideoPlayer.d.ts.map +1 -0
- package/dist/components/AttachmentsGalleryModal/components/AttachmentVideoPlayer.js +36 -0
- package/dist/components/AttachmentsGalleryModal/components/GallerySlide.js +22 -22
- package/dist/components/AttachmentsGalleryModal/components/LegacyAttachmentVideoPlayer.d.ts +14 -0
- package/dist/components/AttachmentsGalleryModal/components/LegacyAttachmentVideoPlayer.d.ts.map +1 -0
- package/dist/components/AttachmentsGalleryModal/components/LegacyAttachmentVideoPlayer.js +31 -0
- package/dist/components/AttachmentsGalleryModal/components/ModalHeader.d.ts.map +1 -1
- package/dist/components/AttachmentsGalleryModal/components/ModalHeader.js +179 -120
- package/dist/components/AttachmentsGalleryModal/components/StatusVideoPlayer.d.ts +18 -0
- package/dist/components/AttachmentsGalleryModal/components/StatusVideoPlayer.d.ts.map +1 -0
- package/dist/components/AttachmentsGalleryModal/components/StatusVideoPlayer.js +35 -0
- package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.d.ts +34 -0
- package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.d.ts.map +1 -0
- package/dist/components/AttachmentsGalleryModal/components/useAttachmentVideoStatus.js +71 -0
- package/dist/components/AttachmentsGalleryModal/styles.module.css.js +31 -27
- package/dist/components/CommentComposer/CommentComposer.module.css.js +13 -9
- package/dist/components/CommentComposer/index.d.ts +2 -1
- package/dist/components/CommentComposer/index.d.ts.map +1 -1
- package/dist/components/CommentComposer/index.js +343 -325
- package/dist/components/CommentComposer/types.d.ts +4 -0
- package/dist/components/CommentComposer/types.d.ts.map +1 -1
- package/dist/components/VideoPlayer/VideoPlayer.d.ts +24 -0
- package/dist/components/VideoPlayer/VideoPlayer.d.ts.map +1 -0
- package/dist/components/VideoPlayer/VideoPlayer.js +727 -0
- package/dist/components/VideoPlayer/components/MobileDrawer/index.d.ts +8 -0
- package/dist/components/VideoPlayer/components/MobileDrawer/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/MobileDrawer/index.js +67 -0
- package/dist/components/VideoPlayer/components/SelectListOptionButton.d.ts +7 -0
- package/dist/components/VideoPlayer/components/SelectListOptionButton.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/SelectListOptionButton.js +44 -0
- package/dist/components/VideoPlayer/components/StoryboardPreview.d.ts +9 -0
- package/dist/components/VideoPlayer/components/StoryboardPreview.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/StoryboardPreview.js +38 -0
- package/dist/components/VideoPlayer/components/VideoCustomControls.d.ts +33 -0
- package/dist/components/VideoPlayer/components/VideoCustomControls.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoCustomControls.js +601 -0
- package/dist/components/VideoPlayer/components/VideoIcons.d.ts +25 -0
- package/dist/components/VideoPlayer/components/VideoIcons.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoIcons.js +145 -0
- package/dist/components/VideoPlayer/components/VideoMenu.d.ts +27 -0
- package/dist/components/VideoPlayer/components/VideoMenu.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoMenu.js +77 -0
- package/dist/components/VideoPlayer/components/VideoMobileSettingsDrawer.d.ts +17 -0
- package/dist/components/VideoPlayer/components/VideoMobileSettingsDrawer.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoMobileSettingsDrawer.js +289 -0
- package/dist/components/VideoPlayer/components/VideoQualityMenu/index.d.ts +10 -0
- package/dist/components/VideoPlayer/components/VideoQualityMenu/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoQualityMenu/index.js +55 -0
- package/dist/components/VideoPlayer/components/VideoSelect.d.ts +10 -0
- package/dist/components/VideoPlayer/components/VideoSelect.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSelect.js +168 -0
- package/dist/components/VideoPlayer/components/VideoSettingsMenu/index.d.ts +12 -0
- package/dist/components/VideoPlayer/components/VideoSettingsMenu/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsMenu/index.js +48 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.d.ts +25 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/ChaptersSection.js +384 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/CoverSection.d.ts +21 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/CoverSection.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/CoverSection.js +264 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/FooterActions.d.ts +10 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/FooterActions.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/FooterActions.js +39 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/ManualSubtitlesPanel.d.ts +14 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/ManualSubtitlesPanel.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/ManualSubtitlesPanel.js +360 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitleTrackRow.d.ts +16 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitleTrackRow.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitlesSection.d.ts +14 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/SubtitlesSection.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/context.d.ts +4 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/context.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/context.js +14 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/index.d.ts +22 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSettingsModal/index.js +211 -0
- package/dist/components/VideoPlayer/components/VideoSpeedMenu/index.d.ts +11 -0
- package/dist/components/VideoPlayer/components/VideoSpeedMenu/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSpeedMenu/index.js +41 -0
- package/dist/components/VideoPlayer/components/VideoSubtitlesMenu/index.d.ts +10 -0
- package/dist/components/VideoPlayer/components/VideoSubtitlesMenu/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/components/VideoSubtitlesMenu/index.js +69 -0
- package/dist/components/VideoPlayer/hooks/useStoryboard.d.ts +21 -0
- package/dist/components/VideoPlayer/hooks/useStoryboard.d.ts.map +1 -0
- package/dist/components/VideoPlayer/hooks/useStoryboard.js +91 -0
- package/dist/components/VideoPlayer/index.d.ts +11 -0
- package/dist/components/VideoPlayer/index.d.ts.map +1 -0
- package/dist/components/VideoPlayer/types.d.ts +101 -0
- package/dist/components/VideoPlayer/types.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/chapters.d.ts +8 -0
- package/dist/components/VideoPlayer/utils/chapters.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/chapters.js +38 -0
- package/dist/components/VideoPlayer/utils/storyboard.d.ts +5 -0
- package/dist/components/VideoPlayer/utils/storyboard.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/storyboard.js +47 -0
- package/dist/components/VideoPlayer/utils/subtitles.d.ts +18 -0
- package/dist/components/VideoPlayer/utils/subtitles.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/subtitles.js +23 -0
- package/dist/components/VideoPlayer/utils/touch.d.ts +3 -0
- package/dist/components/VideoPlayer/utils/touch.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/touch.js +5 -0
- package/dist/components/VideoPlayer/utils/videoPlayerUtils.d.ts +10 -0
- package/dist/components/VideoPlayer/utils/videoPlayerUtils.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/videoPlayerUtils.js +22 -0
- package/dist/components/VideoPlayer/utils/videoSettings.d.ts +69 -0
- package/dist/components/VideoPlayer/utils/videoSettings.d.ts.map +1 -0
- package/dist/components/VideoPlayer/utils/videoSettings.js +90 -0
- package/dist/helpers/getFileType.d.ts +1 -1
- package/dist/helpers/getFileType.d.ts.map +1 -1
- package/dist/helpers/getFileType.js +3 -2
- package/dist/hooks/useDateUtils.d.ts +3 -1
- package/dist/hooks/useDateUtils.d.ts.map +1 -1
- package/dist/hooks/useDateUtils.js +23 -18
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +585 -567
- package/dist/lang/locales/ui_en.json.js +9 -7
- package/dist/lang/locales/ui_es.json.js +6 -4
- package/dist/lang/locales/ui_ru.json.js +8 -6
- package/dist/videoSettings/createVideoSettingsDataSource.d.ts +19 -0
- package/dist/videoSettings/createVideoSettingsDataSource.d.ts.map +1 -0
- package/dist/videoSettings/createVideoSettingsDataSource.js +127 -0
- package/package.json +2 -1
|
@@ -1,355 +1,373 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { Attachment02Icon as
|
|
5
|
-
import { HugeiconsIcon as
|
|
6
|
-
import { Stack as
|
|
7
|
-
import { getMaxUploadSize as
|
|
8
|
-
import { showErrorNotification as
|
|
9
|
-
import { AttachmentsPreview as
|
|
10
|
-
import { CommentEditorHandler as
|
|
11
|
-
import { useVirtualAnchor as
|
|
12
|
-
import
|
|
13
|
-
function
|
|
14
|
-
return "id" in
|
|
1
|
+
import { jsx as r, jsxs as v } from "react/jsx-runtime";
|
|
2
|
+
import { memo as re, useState as ne, useRef as b, useMemo as U, useCallback as se, useEffect as A } from "react";
|
|
3
|
+
import { useTranslation as ie } from "react-i18next";
|
|
4
|
+
import { Attachment02Icon as le, Sent02Icon as ae } from "@hugeicons/core-free-icons";
|
|
5
|
+
import { HugeiconsIcon as B } from "@hugeicons/react";
|
|
6
|
+
import { Stack as ce, Box as de, Group as P, FileButton as me, ActionIcon as W, UnstyledButton as ue, Text as fe, Button as pe, Popover as L } from "@mantine/core";
|
|
7
|
+
import { getMaxUploadSize as he } from "../../config/envConfig.js";
|
|
8
|
+
import { showErrorNotification as j } from "../../helpers/showNotifications.js";
|
|
9
|
+
import { AttachmentsPreview as ge } from "../AttachmentsPreview/AttachmentsPreview.js";
|
|
10
|
+
import { CommentEditorHandler as xe } from "./CommentEditorHotkeys.js";
|
|
11
|
+
import { useVirtualAnchor as ye } from "./useVirtualAnchor.js";
|
|
12
|
+
import p from "./CommentComposer.module.css.js";
|
|
13
|
+
function k(n) {
|
|
14
|
+
return "id" in n;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return typeof
|
|
16
|
+
function Ee(n) {
|
|
17
|
+
return typeof n == "object" && "isTemp" in n;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
const c = URL.createObjectURL(
|
|
19
|
+
function be(n) {
|
|
20
|
+
const c = URL.createObjectURL(n);
|
|
21
21
|
return {
|
|
22
22
|
id: `temp-${crypto.randomUUID()}`,
|
|
23
|
-
name:
|
|
24
|
-
type:
|
|
25
|
-
size:
|
|
23
|
+
name: n.name,
|
|
24
|
+
type: n.type,
|
|
25
|
+
size: n.size,
|
|
26
26
|
url: c,
|
|
27
27
|
src: c,
|
|
28
|
-
isImage:
|
|
28
|
+
isImage: n.type.startsWith("image/"),
|
|
29
29
|
isTemp: !0,
|
|
30
|
-
raw:
|
|
30
|
+
raw: n
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
const M = () =>
|
|
34
|
-
function
|
|
35
|
-
return
|
|
33
|
+
const M = () => he() ?? 5 * 1024 * 1024, we = 10;
|
|
34
|
+
function Ce(n, c) {
|
|
35
|
+
return n(`composer.${c}`, { defaultValue: "" }) || n(`editor.composer.${c}`);
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (e && f) {
|
|
86
|
-
const t = e.style.overflow;
|
|
87
|
-
return e.style.overflow = "hidden", () => {
|
|
88
|
-
e.style.overflow = t;
|
|
37
|
+
const Ue = re(
|
|
38
|
+
({
|
|
39
|
+
children: n,
|
|
40
|
+
onSubmit: c,
|
|
41
|
+
initialDraft: d,
|
|
42
|
+
updateLocation: R,
|
|
43
|
+
onBlur: G,
|
|
44
|
+
setEdit: N,
|
|
45
|
+
ns: S = "comments",
|
|
46
|
+
compact: X = !1,
|
|
47
|
+
placeholder: Y,
|
|
48
|
+
autoFocus: V
|
|
49
|
+
}) => {
|
|
50
|
+
const [m, _] = ne({
|
|
51
|
+
text: d?.text ?? "",
|
|
52
|
+
files: d?.files ?? []
|
|
53
|
+
}), { t: g } = ie(S), q = Y ?? g(S === "comments" ? "composer.placeholder" : "editor.composer.placeholder"), x = b(null), u = typeof d?.text < "u", a = {
|
|
54
|
+
text: m.text,
|
|
55
|
+
files: m.files
|
|
56
|
+
}, J = b(null), h = b(null), O = b(null), K = U(
|
|
57
|
+
() => ({
|
|
58
|
+
container: document.createElement("div"),
|
|
59
|
+
elements: []
|
|
60
|
+
}),
|
|
61
|
+
[]
|
|
62
|
+
), D = b(null), f = !!R, Q = ye({
|
|
63
|
+
isFloat: f,
|
|
64
|
+
updateLocation: R,
|
|
65
|
+
selectionRef: D,
|
|
66
|
+
selectionState: K
|
|
67
|
+
}), I = 10 * 30 * 0.7, w = se(() => {
|
|
68
|
+
if (!h.current) return;
|
|
69
|
+
const e = h.current, t = e.querySelector(
|
|
70
|
+
'[class*="editorWrapper"]'
|
|
71
|
+
), s = t?.scrollHeight || 0, o = s > I, l = s > 35, i = e.closest(
|
|
72
|
+
'[class*="commentComposerFloat"]'
|
|
73
|
+
) || e;
|
|
74
|
+
f && l ? i.setAttribute("data-multiline", "true") : i.removeAttribute("data-multiline"), o && t ? (t.style.maxHeight = `${I}px`, t.style.overflowY = "auto", t.style.scrollbarWidth = "thin", i.setAttribute("data-editor-constrained", "true")) : t && (t.style.maxHeight = "", t.style.overflowY = "", t.style.scrollbarWidth = "", i.removeAttribute("data-editor-constrained"));
|
|
75
|
+
}, [h, f, I]);
|
|
76
|
+
A(() => {
|
|
77
|
+
w();
|
|
78
|
+
}, [w]), A(() => {
|
|
79
|
+
if (!h.current) return;
|
|
80
|
+
const e = new ResizeObserver(() => {
|
|
81
|
+
w();
|
|
82
|
+
});
|
|
83
|
+
return e.observe(h.current), () => {
|
|
84
|
+
e.disconnect();
|
|
89
85
|
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
R ? R({
|
|
106
|
-
id: "",
|
|
107
|
-
text: "",
|
|
108
|
-
files: []
|
|
109
|
-
}) : k?.();
|
|
110
|
-
}, T = (e, t = !1) => {
|
|
111
|
-
_((s) => {
|
|
112
|
-
if (t)
|
|
113
|
-
return { text: "", files: [] };
|
|
114
|
-
const o = typeof e == "function" ? e(s) : e;
|
|
86
|
+
}, [w]), A(() => {
|
|
87
|
+
const e = document.querySelector("main");
|
|
88
|
+
if (e && f) {
|
|
89
|
+
const t = e.style.overflow;
|
|
90
|
+
return e.style.overflow = "hidden", () => {
|
|
91
|
+
e.style.overflow = t;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}, [f]);
|
|
95
|
+
const { textChanged: Z, newFiles: ee, deletedFiles: te, hasChanges: F } = U(() => {
|
|
96
|
+
const e = d?.files || [], t = m.files, s = d?.text !== a.text, o = t.filter((i) => i.isTemp), y = new Set(
|
|
97
|
+
t.filter(
|
|
98
|
+
(i) => k(i)
|
|
99
|
+
).map((i) => i.id)
|
|
100
|
+
), l = e.filter(k).filter((i) => !y.has(i.id)), E = u ? JSON.stringify(d) === JSON.stringify(m) : a.text.trim().length > 0 || o.length > 0 || l.length > 0;
|
|
115
101
|
return {
|
|
116
|
-
|
|
117
|
-
|
|
102
|
+
textChanged: s,
|
|
103
|
+
newFiles: o,
|
|
104
|
+
deletedFiles: l,
|
|
105
|
+
hasChanges: E
|
|
118
106
|
};
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
107
|
+
}, [u, d, m, a.text]), H = () => {
|
|
108
|
+
N ? N({
|
|
109
|
+
id: "",
|
|
110
|
+
text: "",
|
|
111
|
+
files: []
|
|
112
|
+
}) : G?.();
|
|
113
|
+
}, T = (e, t = !1) => {
|
|
114
|
+
_((s) => {
|
|
115
|
+
if (t)
|
|
116
|
+
return { text: "", files: [] };
|
|
117
|
+
const o = typeof e == "function" ? e(s) : e;
|
|
118
|
+
return {
|
|
119
|
+
text: o.text,
|
|
120
|
+
files: o.files
|
|
121
|
+
};
|
|
132
122
|
});
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
files: m.files.filter(he)
|
|
154
|
-
}
|
|
123
|
+
}, oe = (e, t) => {
|
|
124
|
+
e && t((s) => {
|
|
125
|
+
const o = s.files, y = we - o.length, l = [], E = [];
|
|
126
|
+
e.forEach((z) => {
|
|
127
|
+
z.size > M() ? E.push(z) : l.push(z);
|
|
128
|
+
}), E.length > 0 && j({
|
|
129
|
+
message: g("composer.uploadErrors.fileTooLarge", {
|
|
130
|
+
defaultValue: g("editor.composer.uploadErrors.fileTooLarge", {
|
|
131
|
+
maxSize: Math.round(M() / (1024 * 1024))
|
|
132
|
+
}),
|
|
133
|
+
maxSize: Math.round(M() / (1024 * 1024))
|
|
134
|
+
})
|
|
135
|
+
}), l.length > y && j({
|
|
136
|
+
message: Ce(g, "uploadErrors.tooManyFiles")
|
|
137
|
+
});
|
|
138
|
+
const i = l.slice(0, y);
|
|
139
|
+
return {
|
|
140
|
+
...s,
|
|
141
|
+
files: [...o, ...i.map(be)]
|
|
142
|
+
};
|
|
155
143
|
});
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
144
|
+
}, C = async () => {
|
|
145
|
+
try {
|
|
146
|
+
u ? await c({
|
|
147
|
+
mode: "edit",
|
|
148
|
+
data: {
|
|
149
|
+
textChanged: Z,
|
|
150
|
+
newFiles: ee,
|
|
151
|
+
deletedFiles: te,
|
|
152
|
+
newText: a.text
|
|
153
|
+
}
|
|
154
|
+
}) : await c({
|
|
155
|
+
mode: "create",
|
|
156
|
+
data: {
|
|
157
|
+
text: a.text,
|
|
158
|
+
files: m.files.filter(Ee)
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
} catch {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
H(), x.current && x.current.update(() => {
|
|
165
|
+
const e = x.current._editorState._nodeMap.get("root");
|
|
166
|
+
if (!e) return;
|
|
167
|
+
e.clear();
|
|
168
|
+
const t = x.current._nodes.get("paragraph");
|
|
169
|
+
if (!t) return;
|
|
170
|
+
const s = new t.klass();
|
|
171
|
+
e.append(s), s.select();
|
|
172
|
+
}), T({ text: "", files: [] }, !0);
|
|
173
|
+
}, $ = /* @__PURE__ */ r(
|
|
174
|
+
ce,
|
|
175
|
+
{
|
|
176
|
+
ref: h,
|
|
177
|
+
className: `
|
|
178
|
+
${p.commentComposerWrapper}
|
|
179
|
+
${u ? p.editMode : ""}
|
|
180
|
+
${f ? p.commentComposerFloat : ""}
|
|
181
|
+
${X ? p.compact : ""}
|
|
176
182
|
`,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
commentDraft: a,
|
|
192
|
-
onBlur: H,
|
|
193
|
-
isEdit: u,
|
|
194
|
-
isFloat: f,
|
|
195
|
-
hasChanges: F,
|
|
196
|
-
ns: S,
|
|
197
|
-
forceAutoFocus: G,
|
|
198
|
-
children: r?.({
|
|
199
|
-
onSubmit: w,
|
|
200
|
-
handleBlur: () => {
|
|
201
|
-
},
|
|
202
|
-
setCommentDraft: T,
|
|
183
|
+
children: /* @__PURE__ */ v(
|
|
184
|
+
"div",
|
|
185
|
+
{
|
|
186
|
+
className: p.composerContainer,
|
|
187
|
+
style: {
|
|
188
|
+
"--placeholder-text": `"${q}"`
|
|
189
|
+
},
|
|
190
|
+
children: [
|
|
191
|
+
/* @__PURE__ */ r("div", { className: p.editorWrapper, children: /* @__PURE__ */ r(
|
|
192
|
+
xe,
|
|
193
|
+
{
|
|
194
|
+
onSubmit: C,
|
|
195
|
+
editorRef: x,
|
|
196
|
+
inputContainerRef: h,
|
|
203
197
|
commentDraft: a,
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
198
|
+
onBlur: H,
|
|
199
|
+
isEdit: u,
|
|
200
|
+
isFloat: f,
|
|
201
|
+
hasChanges: F,
|
|
202
|
+
ns: S,
|
|
203
|
+
forceAutoFocus: V,
|
|
204
|
+
children: n?.({
|
|
205
|
+
onSubmit: C,
|
|
206
|
+
handleBlur: () => {
|
|
207
|
+
},
|
|
208
|
+
setCommentDraft: T,
|
|
209
|
+
commentDraft: a,
|
|
210
|
+
editorRef: x,
|
|
211
|
+
initialContent: d?.text ?? ""
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
) }),
|
|
215
|
+
/* @__PURE__ */ r(
|
|
216
|
+
de,
|
|
217
|
+
{
|
|
218
|
+
h: 10,
|
|
219
|
+
"data-editor-spacer": !0,
|
|
220
|
+
tabIndex: 0,
|
|
221
|
+
style: { width: "100%" }
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
/* @__PURE__ */ r("div", { className: p.attachmentsSlot, children: /* @__PURE__ */ r(
|
|
225
|
+
ge,
|
|
226
|
+
{
|
|
227
|
+
files: m.files,
|
|
228
|
+
mode: "draft",
|
|
229
|
+
onRemove: (e) => _((t) => ({
|
|
230
|
+
...t,
|
|
231
|
+
files: t.files.filter((s, o) => o !== e)
|
|
232
|
+
}))
|
|
233
|
+
}
|
|
234
|
+
) }),
|
|
235
|
+
/* @__PURE__ */ v(
|
|
236
|
+
P,
|
|
237
|
+
{
|
|
238
|
+
justify: u ? "space-between" : "flex-end",
|
|
239
|
+
"data-comment-footer": !0,
|
|
240
|
+
align: "center",
|
|
241
|
+
w: "unset",
|
|
242
|
+
mt: m.files.length ? "xs" : 0,
|
|
243
|
+
tabIndex: 0,
|
|
244
|
+
gap: "4px",
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ r(
|
|
247
|
+
me,
|
|
250
248
|
{
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
cursor: "pointer",
|
|
255
|
-
padding: 0,
|
|
256
|
-
margin: 0,
|
|
257
|
-
background: "none",
|
|
258
|
-
border: "none"
|
|
249
|
+
resetRef: O,
|
|
250
|
+
onChange: (e) => {
|
|
251
|
+
oe(e, T), O.current?.();
|
|
259
252
|
},
|
|
260
|
-
|
|
253
|
+
multiple: !0,
|
|
254
|
+
children: (e) => /* @__PURE__ */ r(W, { ...e, variant: "subtle", size: "lg", color: "gray", children: /* @__PURE__ */ r(
|
|
255
|
+
B,
|
|
256
|
+
{
|
|
257
|
+
style: { transform: "rotate(35deg)" },
|
|
258
|
+
icon: le,
|
|
259
|
+
size: 20
|
|
260
|
+
}
|
|
261
|
+
) })
|
|
261
262
|
}
|
|
262
263
|
),
|
|
263
|
-
/* @__PURE__ */
|
|
264
|
-
|
|
264
|
+
u ? /* @__PURE__ */ v(P, { gap: "8px", children: [
|
|
265
|
+
/* @__PURE__ */ r(
|
|
266
|
+
ue,
|
|
267
|
+
{
|
|
268
|
+
onClick: H,
|
|
269
|
+
"data-no-focus": !0,
|
|
270
|
+
style: {
|
|
271
|
+
cursor: "pointer",
|
|
272
|
+
padding: 0,
|
|
273
|
+
margin: 0,
|
|
274
|
+
background: "none",
|
|
275
|
+
border: "none"
|
|
276
|
+
},
|
|
277
|
+
children: /* @__PURE__ */ r(fe, { size: "sm", c: "dimmed", children: g("composer.cancel") })
|
|
278
|
+
}
|
|
279
|
+
),
|
|
280
|
+
/* @__PURE__ */ r(
|
|
281
|
+
pe,
|
|
282
|
+
{
|
|
283
|
+
size: "xs",
|
|
284
|
+
radius: "md",
|
|
285
|
+
onClick: C,
|
|
286
|
+
disabled: u ? F : !F,
|
|
287
|
+
children: g("composer.save")
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
] }) : /* @__PURE__ */ r(
|
|
291
|
+
W,
|
|
265
292
|
{
|
|
266
|
-
size: "
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
293
|
+
size: "lg",
|
|
294
|
+
"data-comment-submit-button": !0,
|
|
295
|
+
variant: "filled",
|
|
296
|
+
onClick: C,
|
|
297
|
+
disabled: !a.text.trim() && a.files.length === 0,
|
|
298
|
+
children: /* @__PURE__ */ r(B, { icon: ae, size: 20 })
|
|
271
299
|
}
|
|
272
300
|
)
|
|
273
|
-
]
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
"data-comment-submit-button": !0,
|
|
278
|
-
variant: "filled",
|
|
279
|
-
onClick: w,
|
|
280
|
-
disabled: !a.text.trim() && a.files.length === 0,
|
|
281
|
-
children: /* @__PURE__ */ n($, { icon: ne, size: 20 })
|
|
282
|
-
}
|
|
283
|
-
)
|
|
284
|
-
]
|
|
285
|
-
}
|
|
286
|
-
)
|
|
287
|
-
]
|
|
288
|
-
}
|
|
289
|
-
)
|
|
290
|
-
}
|
|
291
|
-
);
|
|
292
|
-
return f ? /* @__PURE__ */ C(
|
|
293
|
-
L,
|
|
294
|
-
{
|
|
295
|
-
opened: !0,
|
|
296
|
-
position: "bottom-start",
|
|
297
|
-
offset: 10,
|
|
298
|
-
withinPortal: !1,
|
|
299
|
-
floatingStrategy: "fixed",
|
|
300
|
-
zIndex: 300,
|
|
301
|
-
middlewares: {
|
|
302
|
-
flip: { padding: 8 },
|
|
303
|
-
shift: { padding: 8 },
|
|
304
|
-
size: {
|
|
305
|
-
padding: 8,
|
|
306
|
-
apply: ({ availableHeight: e, rects: t, elements: s }) => {
|
|
307
|
-
const o = s.floating;
|
|
308
|
-
if (!o) return;
|
|
309
|
-
if (e < t.floating.height) {
|
|
310
|
-
const l = Math.max(e, 120);
|
|
311
|
-
Object.assign(o.style, {
|
|
312
|
-
maxHeight: `${l}px`,
|
|
313
|
-
overflowY: "auto"
|
|
314
|
-
}), o.setAttribute("data-constrained", "true");
|
|
315
|
-
} else
|
|
316
|
-
o.style.maxHeight = "", o.style.overflowY = "", o.removeAttribute("data-constrained");
|
|
301
|
+
]
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
]
|
|
317
305
|
}
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
return f ? /* @__PURE__ */ v(
|
|
310
|
+
L,
|
|
311
|
+
{
|
|
312
|
+
opened: !0,
|
|
313
|
+
position: "bottom-start",
|
|
314
|
+
offset: 10,
|
|
315
|
+
withinPortal: !1,
|
|
316
|
+
floatingStrategy: "fixed",
|
|
317
|
+
zIndex: 300,
|
|
318
|
+
middlewares: {
|
|
319
|
+
flip: { padding: 8 },
|
|
320
|
+
shift: { padding: 8 },
|
|
321
|
+
size: {
|
|
322
|
+
padding: 8,
|
|
323
|
+
apply: ({ availableHeight: e, rects: t, elements: s }) => {
|
|
324
|
+
const o = s.floating;
|
|
325
|
+
if (!o) return;
|
|
326
|
+
if (e < t.floating.height) {
|
|
327
|
+
const l = Math.max(e, 120);
|
|
328
|
+
Object.assign(o.style, {
|
|
329
|
+
maxHeight: `${l}px`,
|
|
330
|
+
overflowY: "auto"
|
|
331
|
+
}), o.setAttribute("data-constrained", "true");
|
|
332
|
+
} else
|
|
333
|
+
o.style.maxHeight = "", o.style.overflowY = "", o.removeAttribute("data-constrained");
|
|
338
334
|
}
|
|
339
335
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
ref: Y,
|
|
345
|
-
className: y.commentComposerFloat,
|
|
346
|
-
children: O
|
|
336
|
+
},
|
|
337
|
+
styles: {
|
|
338
|
+
dropdown: {
|
|
339
|
+
padding: 0
|
|
347
340
|
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
341
|
+
},
|
|
342
|
+
children: [
|
|
343
|
+
/* @__PURE__ */ r(L.Target, { children: /* @__PURE__ */ r(
|
|
344
|
+
"div",
|
|
345
|
+
{
|
|
346
|
+
ref: Q,
|
|
347
|
+
style: {
|
|
348
|
+
position: "fixed",
|
|
349
|
+
width: "5px",
|
|
350
|
+
height: "5px",
|
|
351
|
+
pointerEvents: "none",
|
|
352
|
+
visibility: "hidden",
|
|
353
|
+
top: 0,
|
|
354
|
+
left: 0
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
) }),
|
|
358
|
+
/* @__PURE__ */ r(
|
|
359
|
+
L.Dropdown,
|
|
360
|
+
{
|
|
361
|
+
ref: J,
|
|
362
|
+
className: p.commentComposerFloat,
|
|
363
|
+
children: $
|
|
364
|
+
}
|
|
365
|
+
)
|
|
366
|
+
]
|
|
367
|
+
}
|
|
368
|
+
) : $;
|
|
369
|
+
}
|
|
370
|
+
);
|
|
353
371
|
export {
|
|
354
|
-
|
|
372
|
+
Ue as CommentComposer
|
|
355
373
|
};
|