@logora/debate 0.4.72 → 0.4.73
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as C, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { useRef as
|
|
2
|
+
import We from "@rooks/use-sessionstorage-state";
|
|
3
|
+
import { useRef as Ye, useState as c, useEffect as p, Suspense as Re, lazy as je } from "react";
|
|
4
4
|
import { useIntl as ze, FormattedMessage as he } from "react-intl";
|
|
5
5
|
import { useLocation as Oe } from "react-router";
|
|
6
6
|
import x from "classnames";
|
|
@@ -51,12 +51,12 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
51
51
|
inputContent: B,
|
|
52
52
|
setInputContent: te,
|
|
53
53
|
setInputRichContent: Ie
|
|
54
|
-
} = He(), { isLoggedIn: S, currentUser: u } = Qe(), { errors: E, validate: $ } = Xe(), { isMobile: m } = Ze(), xe = Oe(), ne =
|
|
54
|
+
} = He(), { isLoggedIn: S, currentUser: u } = Qe(), { errors: E, validate: $ } = Xe(), { isMobile: m } = Ze(), xe = Oe(), ne = Ye(null), [V, k] = c([]), [q, D] = c(""), [ae, U] = c(null), [d, b] = c(null), [se, ie] = c(null), [oe, re] = c(!1), [I, ue] = c(!1), [A, de] = c({}), [Ne, W] = c(!1), [f, ye] = We(
|
|
55
55
|
"userSide",
|
|
56
56
|
{}
|
|
57
57
|
), [g, Te] = c(
|
|
58
58
|
!S && v?.actions?.disableInputForVisitor
|
|
59
|
-
),
|
|
59
|
+
), Y = et(), { showModal: Le } = tt(), { toast: R } = nt() || {}, le = new URLSearchParams(
|
|
60
60
|
typeof window < "u" ? window.location.search : xe.search
|
|
61
61
|
);
|
|
62
62
|
p(() => {
|
|
@@ -69,13 +69,13 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
69
69
|
let e = null;
|
|
70
70
|
typeof window < "u" && (e = le.get("positionId")), w && w != a[2]?.id && a?.find((t) => t.id === w) ? b(w) : e && e != a[2]?.id ? b(e) : f && f.groupId == _ && f.positionId != a[2]?.id && b(f.positionId);
|
|
71
71
|
}, [w]), p(() => {
|
|
72
|
-
Q &&
|
|
72
|
+
Q && W(!0);
|
|
73
73
|
}, [Q]), p(() => {
|
|
74
|
-
P && (z(),
|
|
74
|
+
P && (z(), W(!0), L());
|
|
75
75
|
}, [P]), p(() => {
|
|
76
76
|
if (typeof window < "u") {
|
|
77
77
|
const e = be || le.get("initArgument");
|
|
78
|
-
(e === !0 || e === "true") && (
|
|
78
|
+
(e === !0 || e === "true") && (W(!0), L(), qe());
|
|
79
79
|
}
|
|
80
80
|
}, []), p(() => {
|
|
81
81
|
Z && (L(), ee(!1));
|
|
@@ -83,11 +83,11 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
83
83
|
B?.id && (Fe(B), ee(!0));
|
|
84
84
|
}, [B]);
|
|
85
85
|
const Fe = (e) => {
|
|
86
|
-
de(e), ue(!0),
|
|
86
|
+
de(e), ue(!0), k(e.sources), D(e.content), U(e.rich_content), ie(e.id), L(), b(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? Ie(e.rich_content) : te(e.content);
|
|
87
87
|
}, L = () => {
|
|
88
|
-
ne.current.scrollIntoView(
|
|
88
|
+
ne.current.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
89
89
|
}, me = () => {
|
|
90
|
-
|
|
90
|
+
D(""), U(null), de({}), ie(null), k([]), Se(!0), te(null);
|
|
91
91
|
}, Pe = (e) => {
|
|
92
92
|
b(e), ge(e);
|
|
93
93
|
}, Be = () => {
|
|
@@ -108,11 +108,11 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
108
108
|
) })
|
|
109
109
|
);
|
|
110
110
|
}, Ee = () => {
|
|
111
|
-
S ? se ?
|
|
111
|
+
S ? se ? ke() : !a || a?.length === 0 || !y?.find((e) => e?.id === d) && d || j && r ? ge(r && j && a[0]?.id) : Be() : Y({ loginAction: "argument" });
|
|
112
112
|
}, $e = (e, t) => {
|
|
113
|
-
g ?
|
|
113
|
+
g ? Y({ loginAction: "argument" }) : (D(e), U(t), $({ content: e }, [{ content: ["url", null] }]));
|
|
114
114
|
}, Ve = (e) => {
|
|
115
|
-
|
|
115
|
+
k(e);
|
|
116
116
|
}, fe = [
|
|
117
117
|
{ content: ["length", 3] },
|
|
118
118
|
{ content: ["required", null] },
|
|
@@ -120,7 +120,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
120
120
|
...!a || a?.length === 0 ? [] : [{ position_id: ["required", null] }]
|
|
121
121
|
], ge = (e) => {
|
|
122
122
|
const t = e || d, l = {
|
|
123
|
-
content:
|
|
123
|
+
content: q,
|
|
124
124
|
rich_content: ae,
|
|
125
125
|
group_id: _,
|
|
126
126
|
...J && { group_type: J },
|
|
@@ -152,8 +152,8 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
152
152
|
const h = i.data.data.resource;
|
|
153
153
|
let F = N;
|
|
154
154
|
t && !m && (F = `argumentList${h.position.id}`), K?.(
|
|
155
|
-
|
|
156
|
-
a.find((
|
|
155
|
+
q,
|
|
156
|
+
a.find((Ue) => Ue.id === t) || null
|
|
157
157
|
), T.add(F, [h]), R(
|
|
158
158
|
o.formatMessage({
|
|
159
159
|
id: "alert.argument_create",
|
|
@@ -179,9 +179,9 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
181
|
}));
|
|
182
|
-
},
|
|
182
|
+
}, ke = () => {
|
|
183
183
|
const e = {
|
|
184
|
-
content:
|
|
184
|
+
content: q,
|
|
185
185
|
rich_content: ae,
|
|
186
186
|
source_ids: V?.map((t) => t.id),
|
|
187
187
|
...d && { position_id: d }
|
|
@@ -204,7 +204,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
204
204
|
}), me();
|
|
205
205
|
}
|
|
206
206
|
});
|
|
207
|
-
},
|
|
207
|
+
}, qe = () => {
|
|
208
208
|
if (!oe) {
|
|
209
209
|
re(!0);
|
|
210
210
|
const e = setTimeout(() => {
|
|
@@ -213,8 +213,8 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
213
213
|
return () => clearTimeout(e);
|
|
214
214
|
}
|
|
215
215
|
}, z = () => {
|
|
216
|
-
g ?
|
|
217
|
-
},
|
|
216
|
+
g ? Y({ loginAction: "argument" }) : ue(!0);
|
|
217
|
+
}, De = () => {
|
|
218
218
|
const e = y.find(
|
|
219
219
|
(t) => t.id === d
|
|
220
220
|
);
|
|
@@ -352,7 +352,7 @@ const ut = je(() => import("../../modal/side_modal/index.js").then((N) => ({ def
|
|
|
352
352
|
width: 20
|
|
353
353
|
}
|
|
354
354
|
),
|
|
355
|
-
/* @__PURE__ */ s("div", { className: n.argumentInputWarningText, children:
|
|
355
|
+
/* @__PURE__ */ s("div", { className: n.argumentInputWarningText, children: De() })
|
|
356
356
|
]
|
|
357
357
|
}
|
|
358
358
|
),
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { useLexicalComposerContext as u } from "@lexical/react/LexicalComposerContext";
|
|
2
|
-
import { useRef as c, useEffect as
|
|
3
|
-
import { useInput as
|
|
4
|
-
const
|
|
5
|
-
const [
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { useRef as c, useEffect as n } from "react";
|
|
3
|
+
import { useInput as l } from "../../input_provider/useInput.js";
|
|
4
|
+
const p = ({ autoFocus: o = !1 }) => {
|
|
5
|
+
const [e] = u(), { focus: t } = l(), r = c(!1);
|
|
6
|
+
return n(() => {
|
|
7
|
+
t && e.focus(() => {
|
|
8
|
+
e.getRootElement().focus({ preventScroll: !0 });
|
|
9
9
|
});
|
|
10
|
-
}, [
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
}, [t, e]), n(() => {
|
|
11
|
+
o && !r.current && (r.current = !0, e.focus(() => {
|
|
12
|
+
e.getRootElement().focus({ preventScroll: !0 });
|
|
13
13
|
}));
|
|
14
|
-
}, [
|
|
14
|
+
}, [o, e]), null;
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
p as FocusPlugin
|
|
18
18
|
};
|
|
@@ -21,25 +21,25 @@ const ve = ({
|
|
|
21
21
|
userGuideUrl: d,
|
|
22
22
|
hideUserGuideLink: N = !1
|
|
23
23
|
}) => {
|
|
24
|
-
const o = K(), C = Q(), x = W(), { toast: T } = X() || {}, { isLoggedIn: y } = Z(), { focus: f, setFocus: q } = $(), { errors: p, validate: F } = G(), [h, E] = l(!0), [Y, v] = l(!1), [i, a] = l(""), [S,
|
|
24
|
+
const o = K(), C = Q(), x = W(), { toast: T } = X() || {}, { isLoggedIn: y } = Z(), { focus: f, setFocus: q } = $(), { errors: p, validate: F } = G(), [h, E] = l(!0), [Y, v] = l(!1), [i, a] = l(""), [S, k, A] = z("userSuggestion", {}), R = b(null), u = b(null), V = U();
|
|
25
25
|
c(() => {
|
|
26
26
|
S?.suggestion && a(S.suggestion);
|
|
27
27
|
}, []), c(() => {
|
|
28
28
|
if (h) {
|
|
29
29
|
const s = setInterval(() => {
|
|
30
|
-
i?.length > 0 &&
|
|
30
|
+
i?.length > 0 && k({
|
|
31
31
|
suggestion: i
|
|
32
32
|
});
|
|
33
33
|
}, 1e3);
|
|
34
34
|
return () => clearInterval(s);
|
|
35
35
|
}
|
|
36
36
|
}, [h, i]), c(() => {
|
|
37
|
-
f && (
|
|
37
|
+
f && (j(), w(), O(), q(!1));
|
|
38
38
|
}, [f]);
|
|
39
|
-
const
|
|
40
|
-
u.current.scrollIntoView({ behavior: "smooth" });
|
|
39
|
+
const j = () => {
|
|
40
|
+
u.current.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
41
41
|
}, w = () => {
|
|
42
|
-
u.current.focus();
|
|
42
|
+
u.current.focus({ preventScroll: !0 });
|
|
43
43
|
}, O = () => {
|
|
44
44
|
if (!Y) {
|
|
45
45
|
v(!0);
|
|
@@ -49,7 +49,7 @@ const ve = ({
|
|
|
49
49
|
return () => clearTimeout(s);
|
|
50
50
|
}
|
|
51
51
|
}, L = () => {
|
|
52
|
-
a(""),
|
|
52
|
+
a(""), A();
|
|
53
53
|
}, B = () => {
|
|
54
54
|
if (y) {
|
|
55
55
|
const s = {
|
|
@@ -80,13 +80,13 @@ const ve = ({
|
|
|
80
80
|
}
|
|
81
81
|
}));
|
|
82
82
|
} else
|
|
83
|
-
|
|
83
|
+
V({});
|
|
84
84
|
};
|
|
85
85
|
return /* @__PURE__ */ e(
|
|
86
86
|
"div",
|
|
87
87
|
{
|
|
88
88
|
className: t.suggestionInputContainer,
|
|
89
|
-
ref:
|
|
89
|
+
ref: R,
|
|
90
90
|
children: /* @__PURE__ */ g(P, { children: [
|
|
91
91
|
/* @__PURE__ */ g("div", { className: H(t.suggestionInputItem), children: [
|
|
92
92
|
/* @__PURE__ */ e("div", { className: t.suggestionInputTitle, children: /* @__PURE__ */ e(
|