@logora/debate 0.3.77 → 0.3.79
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/assets/components/proposal/proposal_box/ProposalBox.module-C9BaTFDH.css +1 -0
- package/dist/components/argument/argument/Argument.js +1 -0
- package/dist/components/input/argument_input/ArgumentInput.js +125 -124
- package/dist/components/input/text_editor/TextEditor.js +134 -131
- package/dist/components/input/text_editor/plugins/FocusPlugin.js +12 -8
- package/dist/components/proposal/proposal_box/ProposalBox.js +59 -48
- package/dist/components/proposal/proposal_box/ProposalBox.module.scss.js +14 -12
- package/dist/components/source/context_source_box/ContextSourceBox.js +7 -7
- package/dist/components/source/context_source_list/ContextSourceList.js +10 -14
- package/package.json +1 -1
- package/dist/assets/components/proposal/proposal_box/ProposalBox.module-T4ms_LQ7.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._proposalBoxContainer_5d6lc_3{display:flex!important;flex-direction:column!important;justify-content:space-between!important;position:relative;box-shadow:var(--box-shadow, 0px 2px 5px rgba(7, 42, 68, .1));border:var(--box-border, 1px solid rgba(7, 42, 68, .1));color:var(--text-primary, #222222);border-radius:var(--box-border-radius, 6px);background-color:var(--background-color-primary, white);scroll-margin-top:150px;padding:var(--box-spacing, var(--space-unit, 1em));gap:var(--box-spacing, var(--space-unit, 1em))}._proposalBoxContainer_5d6lc_3._flash_5d6lc_17{-webkit-transition:box-shadow .8s ease-in-out;-moz-transition:box-shadow .8s ease-in-out;-o-transition:box-shadow .8s ease-in-out;transition:box-shadow .8s ease-in-out;box-shadow:0 0 15px var(--call-primary-color, #434343)}._edited_5d6lc_25{font-size:var(--font-size-extra-small, 14px);color:var(--text-secondary, #5F5F5F);line-height:var(--line-height-loose, 1.38em);margin-bottom:var(--spacer-xs, calc(var(--space-unit, 1em) * .325))!important}._proposalBoxContent_5d6lc_32{text-align:left;white-space:pre-line;line-height:var(--line-height-loose, 1.38em);font-size:var(--font-size-small, 16px)}@container (min-width: 768px){._proposalBoxContent_5d6lc_32{min-height:185px}}._proposalBoxContent_5d6lc_32 ._proposalTitle_5d6lc_44{font-size:var(--font-size-normal, 16px);font-weight:var(--font-weight-bold, 700);padding-bottom:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important}._proposalBoxContent_5d6lc_32 ._proposalTitle_5d6lc_44:first-letter{text-transform:uppercase}._proposalBoxContent_5d6lc_32 ._proposalContent_5d6lc_52 *{font-size:var(--font-size-small, 16px)}._proposalSourcesList_5d6lc_56{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;font-size:var(--font-size-extra-small, 14px);font-weight:var(--font-weight-normal, 400)}._proposalSourcesList_5d6lc_56 a{text-decoration:none}._fixedHeight_5d6lc_68{height:200px;overflow:hidden;position:relative}._fixedHeight_5d6lc_68:after{content:"";position:absolute;z-index:1;bottom:0;left:0;right:0;pointer-events:none;background-image:linear-gradient(to bottom,#fff0,#fff 90%);width:100%;height:5em}
|
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
import { jsxs as M, jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import { useLocation as
|
|
1
|
+
import { jsxs as M, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import De from "@rooks/use-sessionstorage-state";
|
|
3
|
+
import { useRef as We, useState as l, useEffect as v, Suspense as Ye, lazy as ke } from "react";
|
|
4
|
+
import { useIntl as Re, FormattedMessage as fe } from "react-intl";
|
|
5
|
+
import { useLocation as je } from "react-router";
|
|
6
6
|
import I from "classnames";
|
|
7
7
|
import n from "./ArgumentInput.module.scss.js";
|
|
8
|
-
import { useDataProvider as
|
|
9
|
-
import { useList as
|
|
10
|
-
import { useConfig as
|
|
11
|
-
import { useInput as
|
|
12
|
-
import { useAuth as
|
|
13
|
-
import { useFormValidation as
|
|
14
|
-
import { useResponsive as
|
|
15
|
-
import { useAuthRequired as
|
|
16
|
-
import { useModal as
|
|
17
|
-
import { useToast as
|
|
18
|
-
import { TogglePosition as
|
|
19
|
-
import { Avatar as
|
|
20
|
-
import { AuthorBox as
|
|
21
|
-
import { TextEditor as
|
|
22
|
-
import { Icon as
|
|
23
|
-
const
|
|
8
|
+
import { useDataProvider as ze } from "../../data/data_provider/useDataProvider.js";
|
|
9
|
+
import { useList as Oe } from "../../list/list_provider/useList.js";
|
|
10
|
+
import { useConfig as Je } from "../../data/config_provider/useConfig.js";
|
|
11
|
+
import { useInput as Ke } from "../input_provider/useInput.js";
|
|
12
|
+
import { useAuth as Ge } from "../../auth/use_auth/useAuth.js";
|
|
13
|
+
import { useFormValidation as He } from "../../forms/use_form_validation/useFormValidation.js";
|
|
14
|
+
import { useResponsive as Qe } from "../../hooks/use_responsive/useResponsive.js";
|
|
15
|
+
import { useAuthRequired as Xe } from "../../hooks/use_auth_required/useAuthRequired.js";
|
|
16
|
+
import { useModal as Ze } from "../../dialog/modal/useModal.js";
|
|
17
|
+
import { useToast as et } from "../../dialog/toast_provider/useToast.js";
|
|
18
|
+
import { TogglePosition as tt } from "../toggle_position/TogglePosition.js";
|
|
19
|
+
import { Avatar as nt } from "../../user/avatar/Avatar.js";
|
|
20
|
+
import { AuthorBox as at } from "../../user/author_box/AuthorBox.js";
|
|
21
|
+
import { TextEditor as st } from "../text_editor/TextEditor.js";
|
|
22
|
+
import { Icon as it } from "../../icons/icon/Icon.js";
|
|
23
|
+
const ot = ke(() => import("../../modal/side_modal/index.js").then((S) => ({ default: S.SideModal }))), yt = ({
|
|
24
24
|
argumentListId: S,
|
|
25
|
-
avatarSize:
|
|
26
|
-
disabled:
|
|
25
|
+
avatarSize: ge = 48,
|
|
26
|
+
disabled: j = !1,
|
|
27
27
|
positions: a = [],
|
|
28
28
|
disabledPositions: x = [],
|
|
29
29
|
groupId: b,
|
|
30
|
-
groupName:
|
|
31
|
-
groupType:
|
|
32
|
-
hideSourceAction:
|
|
30
|
+
groupName: he,
|
|
31
|
+
groupType: z,
|
|
32
|
+
hideSourceAction: pe = !1,
|
|
33
33
|
isReply: r = !1,
|
|
34
|
-
onSubmit:
|
|
34
|
+
onSubmit: O,
|
|
35
35
|
parentId: F,
|
|
36
|
-
placeholder:
|
|
36
|
+
placeholder: _e,
|
|
37
37
|
positionId: A,
|
|
38
|
-
focusOnInit:
|
|
38
|
+
focusOnInit: Me = !1,
|
|
39
39
|
activeOnInit: P = !1,
|
|
40
|
-
userGuideUrl:
|
|
41
|
-
hideUserGuideLink:
|
|
42
|
-
hideCharCount:
|
|
43
|
-
disableAutoActivate:
|
|
40
|
+
userGuideUrl: J,
|
|
41
|
+
hideUserGuideLink: ve = !1,
|
|
42
|
+
hideCharCount: be = !1,
|
|
43
|
+
disableAutoActivate: Ae = !1
|
|
44
44
|
}) => {
|
|
45
|
-
const o =
|
|
46
|
-
focus:
|
|
47
|
-
setFocus:
|
|
48
|
-
setReset:
|
|
45
|
+
const o = Re(), K = ze(), N = Oe(), h = Je(), {
|
|
46
|
+
focus: G,
|
|
47
|
+
setFocus: H,
|
|
48
|
+
setReset: Ce,
|
|
49
49
|
inputContent: B,
|
|
50
50
|
setInputContent: Q,
|
|
51
|
-
setInputRichContent:
|
|
52
|
-
} =
|
|
51
|
+
setInputRichContent: we
|
|
52
|
+
} = Ke(), { isLoggedIn: C, currentUser: u } = Ge(), { errors: E, validate: V } = He(), { isMobile: m } = Qe(), Ie = je(), X = We(null), [U, $] = l([]), [q, D] = l(""), [Z, W] = l(null), [d, p] = l(null), [ee, te] = l(null), [ne, ae] = l(!1), [w, se] = l(!1), [_, ie] = l({}), [Se, oe] = l(!1), [f, xe] = De(
|
|
53
53
|
"userSide",
|
|
54
54
|
{}
|
|
55
|
-
), [g,
|
|
55
|
+
), [g, Ne] = l(
|
|
56
56
|
!C && h?.actions?.disableInputForVisitor
|
|
57
|
-
), Y =
|
|
58
|
-
typeof window < "u" ? window.location.search :
|
|
57
|
+
), Y = Xe(), { showModal: Te } = Ze(), { toast: k } = et() || {}, re = new URLSearchParams(
|
|
58
|
+
typeof window < "u" ? window.location.search : Ie.search
|
|
59
59
|
);
|
|
60
60
|
v(() => {
|
|
61
|
-
|
|
61
|
+
Ne(
|
|
62
62
|
!C && h?.actions?.disableInputForVisitor
|
|
63
63
|
);
|
|
64
64
|
}, [C, h]);
|
|
65
|
-
const R = u?.role === "editor" || u?.role === "moderator",
|
|
65
|
+
const R = u?.role === "editor" || u?.role === "moderator", ue = u?.moderation_status === "banned";
|
|
66
66
|
v(() => {
|
|
67
67
|
let e = null;
|
|
68
|
-
typeof window < "u" && (e =
|
|
68
|
+
typeof window < "u" && (e = re.get("positionId")), A && A != a[2]?.id && a?.find((t) => t.id === A) ? p(A) : e && e != a[2]?.id ? p(e) : f && f.groupId == b && f.positionId != a[2]?.id && p(f.positionId);
|
|
69
69
|
}, [A]), v(() => {
|
|
70
|
-
P && (
|
|
70
|
+
P && (oe(!0), T());
|
|
71
71
|
}, [P]), v(() => {
|
|
72
72
|
if (typeof window < "u") {
|
|
73
|
-
const e =
|
|
74
|
-
(e === !0 || e === "true") && (
|
|
73
|
+
const e = Me || re.get("initArgument");
|
|
74
|
+
(e === !0 || e === "true") && (oe(!0), T(), Ue());
|
|
75
75
|
}
|
|
76
76
|
}, []), v(() => {
|
|
77
|
-
|
|
78
|
-
}, [
|
|
79
|
-
B?.id && (
|
|
77
|
+
G && (T(), H(!1));
|
|
78
|
+
}, [G]), v(() => {
|
|
79
|
+
B?.id && (ye(B), H(!0));
|
|
80
80
|
}, [B]);
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
},
|
|
81
|
+
const ye = (e) => {
|
|
82
|
+
ie(e), se(!0), $(e.sources), D(e.content), W(e.rich_content), te(e.id), T(), p(e.position?.id), JSON.parse(e.rich_content).hasOwnProperty("root") ? we(e.rich_content) : Q(e.content);
|
|
83
|
+
}, T = () => {
|
|
84
84
|
X.current.scrollIntoView(!1);
|
|
85
85
|
}, de = () => {
|
|
86
|
-
D(""), W(null),
|
|
87
|
-
},
|
|
86
|
+
D(""), W(null), ie({}), te(null), $([]), Ce(!0), Q(null);
|
|
87
|
+
}, Le = (e) => {
|
|
88
88
|
p(e), ce(e);
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
89
|
+
}, Fe = () => {
|
|
90
|
+
Te(
|
|
91
|
+
/* @__PURE__ */ s(Ye, { fallback: null, children: /* @__PURE__ */ s(
|
|
92
|
+
ot,
|
|
93
93
|
{
|
|
94
94
|
modalTitle: o.formatMessage({
|
|
95
95
|
id: "modal.side_modal.modal_title",
|
|
96
96
|
defaultMessage: "Choose your side"
|
|
97
97
|
}),
|
|
98
|
-
onChooseSide:
|
|
98
|
+
onChooseSide: Le,
|
|
99
99
|
positions: a,
|
|
100
|
-
title:
|
|
100
|
+
title: he,
|
|
101
101
|
disabledPositions: !r && x,
|
|
102
102
|
isNeutral: f && f.groupId == b && f.positionId === a[2]?.id
|
|
103
103
|
}
|
|
104
104
|
) })
|
|
105
105
|
);
|
|
106
|
-
},
|
|
107
|
-
C ? ee ?
|
|
108
|
-
},
|
|
106
|
+
}, Pe = () => {
|
|
107
|
+
C ? ee ? Ve() : !a || a?.length === 0 || !x?.find((e) => e?.id === d) && d || R && r ? ce(r && R && a[0]?.id) : Fe() : Y({ loginAction: "argument" });
|
|
108
|
+
}, Be = (e, t) => {
|
|
109
109
|
g ? Y({ loginAction: "argument" }) : (D(e), W(t), V({ content: e }, [{ content: ["url", null] }]));
|
|
110
|
-
},
|
|
110
|
+
}, Ee = (e) => {
|
|
111
111
|
$(e);
|
|
112
112
|
}, le = [
|
|
113
113
|
{ content: ["length", 3] },
|
|
@@ -115,23 +115,23 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
115
115
|
{ content: ["url", null] },
|
|
116
116
|
...!a || a?.length === 0 ? [] : [{ position_id: ["required", null] }]
|
|
117
117
|
], ce = (e) => {
|
|
118
|
-
const t = e || d,
|
|
118
|
+
const t = e || d, c = {
|
|
119
119
|
content: q,
|
|
120
120
|
rich_content: Z,
|
|
121
121
|
group_id: b,
|
|
122
|
-
...
|
|
122
|
+
...z && { group_type: z },
|
|
123
123
|
...t && { position_id: t },
|
|
124
124
|
is_reply: !!F,
|
|
125
125
|
message_id: F || null,
|
|
126
|
-
source_ids: U?.map((
|
|
126
|
+
source_ids: U?.map((i) => i.id)
|
|
127
127
|
};
|
|
128
|
-
V(
|
|
128
|
+
V(c, le) && (t && a && a.map((i) => i.id).includes(t) && xe({
|
|
129
129
|
groupId: b,
|
|
130
130
|
positionId: t
|
|
131
|
-
}), de(),
|
|
132
|
-
if (
|
|
131
|
+
}), de(), K.create("messages", c).then((i) => {
|
|
132
|
+
if (i.data.success) {
|
|
133
133
|
if (F)
|
|
134
|
-
|
|
134
|
+
O(i.data.data.resource), k(
|
|
135
135
|
o.formatMessage({
|
|
136
136
|
id: "alert.argument_create",
|
|
137
137
|
defaultMessage: "Your contribution has been sent !"
|
|
@@ -145,11 +145,11 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
145
145
|
}
|
|
146
146
|
);
|
|
147
147
|
else {
|
|
148
|
-
const y =
|
|
148
|
+
const y = i.data.data.resource;
|
|
149
149
|
let L = S;
|
|
150
|
-
t && !m && (L = `argumentList${y.position.id}`),
|
|
150
|
+
t && !m && (L = `argumentList${y.position.id}`), O?.(
|
|
151
151
|
q,
|
|
152
|
-
a.find((
|
|
152
|
+
a.find((qe) => qe.id === t) || null
|
|
153
153
|
), N.add(L, [y]), k(
|
|
154
154
|
o.formatMessage({
|
|
155
155
|
id: "alert.argument_create",
|
|
@@ -169,34 +169,34 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
169
169
|
typeof window < "u" && window.dispatchEvent(
|
|
170
170
|
new CustomEvent("logora:user_content:created", {
|
|
171
171
|
detail: {
|
|
172
|
-
content:
|
|
172
|
+
content: i.data.data?.resource
|
|
173
173
|
}
|
|
174
174
|
})
|
|
175
175
|
);
|
|
176
176
|
}
|
|
177
177
|
}));
|
|
178
|
-
},
|
|
178
|
+
}, Ve = () => {
|
|
179
179
|
const e = {
|
|
180
180
|
content: q,
|
|
181
181
|
rich_content: Z,
|
|
182
182
|
source_ids: U?.map((t) => t.id),
|
|
183
183
|
...d && { position_id: d }
|
|
184
184
|
};
|
|
185
|
-
V(e, le) &&
|
|
185
|
+
V(e, le) && K.update("messages", ee, e).then((t) => {
|
|
186
186
|
if (t.data.success) {
|
|
187
|
-
const
|
|
188
|
-
let
|
|
189
|
-
if (_?.is_reply && _?.message_id ?
|
|
190
|
-
const y = `argumentList${_.position.id}`, L = `argumentList${
|
|
191
|
-
N.remove(y, [
|
|
187
|
+
const c = t.data.data.resource;
|
|
188
|
+
let i = S;
|
|
189
|
+
if (_?.is_reply && _?.message_id ? i = `argument_${_.message_id}_reply_list` : d && !m && (i = `argumentList${c.position?.id}`), !_?.is_reply && _?.position?.id != c.position?.id && !m) {
|
|
190
|
+
const y = `argumentList${_.position.id}`, L = `argumentList${c.position.id}`;
|
|
191
|
+
N.remove(y, [c]), N.add(L, [c]);
|
|
192
192
|
} else
|
|
193
|
-
N.update(
|
|
193
|
+
N.update(i, [c]);
|
|
194
194
|
k(o.formatMessage({ id: "alert.argument_modify" }), {
|
|
195
195
|
type: "success"
|
|
196
196
|
}), de();
|
|
197
197
|
}
|
|
198
198
|
});
|
|
199
|
-
},
|
|
199
|
+
}, Ue = () => {
|
|
200
200
|
if (!ne) {
|
|
201
201
|
ae(!0);
|
|
202
202
|
const e = setTimeout(() => {
|
|
@@ -204,9 +204,9 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
204
204
|
}, 2e3);
|
|
205
205
|
return () => clearTimeout(e);
|
|
206
206
|
}
|
|
207
|
-
},
|
|
208
|
-
g ? Y({ loginAction: "argument" }) :
|
|
209
|
-
},
|
|
207
|
+
}, me = () => {
|
|
208
|
+
g ? Y({ loginAction: "argument" }) : se(!0);
|
|
209
|
+
}, $e = () => {
|
|
210
210
|
const e = x.find(
|
|
211
211
|
(t) => t.id === d
|
|
212
212
|
);
|
|
@@ -220,28 +220,28 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
220
220
|
);
|
|
221
221
|
};
|
|
222
222
|
return /* @__PURE__ */ M("div", { className: n.inputContainer, children: [
|
|
223
|
-
|
|
223
|
+
j && /* @__PURE__ */ s("div", { className: n.disabledInputMask, children: ue ? o.formatMessage({
|
|
224
224
|
id: "input.argument_input.user_banned",
|
|
225
225
|
defaultMessage: "You are banned from the debate space."
|
|
226
226
|
}) : o.formatMessage({
|
|
227
227
|
id: "info.debate_is_inactive",
|
|
228
228
|
defaultMessage: "Debate is closed"
|
|
229
229
|
}) }),
|
|
230
|
-
/* @__PURE__ */
|
|
230
|
+
/* @__PURE__ */ s(
|
|
231
231
|
"div",
|
|
232
232
|
{
|
|
233
233
|
className: I(n.argumentInput, {
|
|
234
234
|
[n.flash]: ne,
|
|
235
235
|
[n.replyInputContainer]: r
|
|
236
236
|
}),
|
|
237
|
-
children: /* @__PURE__ */
|
|
237
|
+
children: /* @__PURE__ */ s("div", { "data-tid": "action_add_argument", ref: X, children: /* @__PURE__ */ M("div", { className: n.argumentInputBox, children: [
|
|
238
238
|
a.length > 0 && C && (!r || !R) && /* @__PURE__ */ M("div", { className: n.userPosition, children: [
|
|
239
|
-
/* @__PURE__ */
|
|
239
|
+
/* @__PURE__ */ s("div", { children: o.formatMessage({
|
|
240
240
|
id: "input.position",
|
|
241
241
|
defaultMessage: "Your position"
|
|
242
242
|
}) }),
|
|
243
|
-
/* @__PURE__ */
|
|
244
|
-
|
|
243
|
+
/* @__PURE__ */ s(
|
|
244
|
+
tt,
|
|
245
245
|
{
|
|
246
246
|
activeLabel: d === a[0].id ? 0 : d === a[1].id ? 1 : null,
|
|
247
247
|
firstLabel: a[0],
|
|
@@ -258,22 +258,22 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
258
258
|
[n.replyEditorRow]: r
|
|
259
259
|
}),
|
|
260
260
|
children: [
|
|
261
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ s(
|
|
262
262
|
"div",
|
|
263
263
|
{
|
|
264
264
|
className: I(n.argumentAuthorContainer, {
|
|
265
265
|
[n.argumentAuthorContainerMobile]: m,
|
|
266
266
|
[n.argumentAuthorContainerActivated]: !m && w || r
|
|
267
267
|
}),
|
|
268
|
-
children: !m && w || r ? /* @__PURE__ */
|
|
269
|
-
|
|
268
|
+
children: !m && w || r ? /* @__PURE__ */ s(
|
|
269
|
+
nt,
|
|
270
270
|
{
|
|
271
271
|
avatarUrl: u.image_url,
|
|
272
272
|
userName: u.full_name,
|
|
273
|
-
size:
|
|
273
|
+
size: ge
|
|
274
274
|
}
|
|
275
|
-
) : /* @__PURE__ */
|
|
276
|
-
|
|
275
|
+
) : /* @__PURE__ */ s(
|
|
276
|
+
at,
|
|
277
277
|
{
|
|
278
278
|
fullName: u?.full_name || o.formatMessage({ id: "default_author.full_name" }),
|
|
279
279
|
avatarUrl: u?.image_url,
|
|
@@ -286,44 +286,45 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
286
286
|
/* @__PURE__ */ M(
|
|
287
287
|
"div",
|
|
288
288
|
{
|
|
289
|
-
onClick:
|
|
289
|
+
onClick: me,
|
|
290
290
|
"data-testid": "argument-input",
|
|
291
291
|
className: I(n.textEditorBox, {
|
|
292
292
|
[n.replyTextEditorBox]: r
|
|
293
293
|
}),
|
|
294
294
|
children: [
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
|
|
295
|
+
/* @__PURE__ */ s(
|
|
296
|
+
st,
|
|
297
297
|
{
|
|
298
298
|
handleChange: (e, t) => {
|
|
299
|
-
|
|
299
|
+
Be(e, t);
|
|
300
300
|
},
|
|
301
301
|
handleSourcesChange: (e) => {
|
|
302
|
-
|
|
302
|
+
Ee(e);
|
|
303
303
|
},
|
|
304
|
-
placeholder:
|
|
304
|
+
placeholder: _e,
|
|
305
305
|
"aria-label": o.formatMessage({
|
|
306
306
|
id: "input.argument_input.aria_label",
|
|
307
307
|
defaultMessage: "Message input field"
|
|
308
308
|
}),
|
|
309
|
-
onSubmit:
|
|
309
|
+
onSubmit: Pe,
|
|
310
310
|
sources: U,
|
|
311
|
-
hideSourceAction:
|
|
311
|
+
hideSourceAction: pe || g,
|
|
312
312
|
uid: `Argument${b}`,
|
|
313
|
-
onActivation:
|
|
313
|
+
onActivation: me,
|
|
314
314
|
showStylesControls: w,
|
|
315
|
-
disabled:
|
|
315
|
+
disabled: j || g || ue,
|
|
316
316
|
maxLength: g ? !1 : h?.actions?.argumentMaxLength,
|
|
317
317
|
disableRichText: h?.actions?.disableRichText || g,
|
|
318
318
|
shortBar: r,
|
|
319
319
|
hideSubmit: g,
|
|
320
320
|
allowedDomains: h?.allowed_sources,
|
|
321
321
|
active: P,
|
|
322
|
-
|
|
323
|
-
|
|
322
|
+
autoFocus: Se,
|
|
323
|
+
hideCharCount: be,
|
|
324
|
+
disableAutoActivate: Ae
|
|
324
325
|
}
|
|
325
326
|
),
|
|
326
|
-
E?.content && /* @__PURE__ */
|
|
327
|
+
E?.content && /* @__PURE__ */ s("div", { className: n.argumentInputWarning, children: E && Object.values(E).map((e, t) => /* @__PURE__ */ s("div", { children: e }, t)) }),
|
|
327
328
|
w && x?.find(
|
|
328
329
|
(e) => e.id === d
|
|
329
330
|
) && /* @__PURE__ */ M(
|
|
@@ -334,8 +335,8 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
334
335
|
n.disabledPositionWarning
|
|
335
336
|
),
|
|
336
337
|
children: [
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
-
|
|
338
|
+
/* @__PURE__ */ s(
|
|
339
|
+
it,
|
|
339
340
|
{
|
|
340
341
|
name: "announcement",
|
|
341
342
|
className: n.warningIcon,
|
|
@@ -343,25 +344,25 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
343
344
|
width: 20
|
|
344
345
|
}
|
|
345
346
|
),
|
|
346
|
-
/* @__PURE__ */
|
|
347
|
+
/* @__PURE__ */ s("div", { className: n.argumentInputWarningText, children: $e() })
|
|
347
348
|
]
|
|
348
349
|
}
|
|
349
350
|
),
|
|
350
|
-
w &&
|
|
351
|
-
|
|
351
|
+
w && J && !ve && /* @__PURE__ */ s("div", { className: n.guideMessage, children: /* @__PURE__ */ s(
|
|
352
|
+
fe,
|
|
352
353
|
{
|
|
353
354
|
id: "alert.guide_message",
|
|
354
355
|
defaultMessage: "Contributions must comply with our {userCharter}.",
|
|
355
356
|
values: {
|
|
356
|
-
userCharter: /* @__PURE__ */
|
|
357
|
+
userCharter: /* @__PURE__ */ s(
|
|
357
358
|
"a",
|
|
358
359
|
{
|
|
359
360
|
className: n.guideMessage,
|
|
360
|
-
href:
|
|
361
|
+
href: J,
|
|
361
362
|
target: "_blank",
|
|
362
363
|
rel: "noreferrer",
|
|
363
|
-
children: /* @__PURE__ */
|
|
364
|
-
|
|
364
|
+
children: /* @__PURE__ */ s(
|
|
365
|
+
fe,
|
|
365
366
|
{
|
|
366
367
|
id: "alert.user_charter",
|
|
367
368
|
defaultMessage: "user charter"
|
|
@@ -384,5 +385,5 @@ const it = We(() => import("../../modal/side_modal/index.js").then((S) => ({ def
|
|
|
384
385
|
] });
|
|
385
386
|
};
|
|
386
387
|
export {
|
|
387
|
-
|
|
388
|
+
yt as ArgumentInput
|
|
388
389
|
};
|
|
@@ -1,182 +1,185 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { ListNode as
|
|
3
|
-
import { OverflowNode as
|
|
4
|
-
import { CharacterLimitPlugin as
|
|
5
|
-
import { LexicalComposer as
|
|
6
|
-
import { ContentEditable as
|
|
7
|
-
import { EditorRefPlugin as
|
|
8
|
-
import { LexicalErrorBoundary as
|
|
9
|
-
import { HistoryPlugin as
|
|
10
|
-
import { ListPlugin as
|
|
11
|
-
import { OnChangePlugin as
|
|
12
|
-
import { RichTextPlugin as
|
|
13
|
-
import { QuoteNode as
|
|
14
|
-
import
|
|
15
|
-
import { $getRoot as
|
|
16
|
-
import { useState as
|
|
17
|
-
import { useIntl as
|
|
18
|
-
import
|
|
1
|
+
import { jsxs as S, Fragment as oe, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { ListNode as re, ListItemNode as ie } from "@lexical/list";
|
|
3
|
+
import { OverflowNode as ne } from "@lexical/overflow";
|
|
4
|
+
import { CharacterLimitPlugin as se } from "@lexical/react/LexicalCharacterLimitPlugin";
|
|
5
|
+
import { LexicalComposer as ce } from "@lexical/react/LexicalComposer";
|
|
6
|
+
import { ContentEditable as le } from "@lexical/react/LexicalContentEditable";
|
|
7
|
+
import { EditorRefPlugin as me } from "@lexical/react/LexicalEditorRefPlugin";
|
|
8
|
+
import { LexicalErrorBoundary as ae } from "@lexical/react/LexicalErrorBoundary";
|
|
9
|
+
import { HistoryPlugin as de } from "@lexical/react/LexicalHistoryPlugin";
|
|
10
|
+
import { ListPlugin as ue } from "@lexical/react/LexicalListPlugin";
|
|
11
|
+
import { OnChangePlugin as fe } from "@lexical/react/LexicalOnChangePlugin";
|
|
12
|
+
import { RichTextPlugin as pe } from "@lexical/react/LexicalRichTextPlugin";
|
|
13
|
+
import { QuoteNode as he } from "@lexical/rich-text";
|
|
14
|
+
import b from "classnames";
|
|
15
|
+
import { $getRoot as ge } from "lexical";
|
|
16
|
+
import { useState as f, useId as Se, useRef as xe, useEffect as M } from "react";
|
|
17
|
+
import { useIntl as Ce } from "react-intl";
|
|
18
|
+
import Pe from "./EditorTheme.js";
|
|
19
19
|
import i from "./TextEditor.module.scss.js";
|
|
20
|
-
import { AutoSavePlugin as
|
|
21
|
-
import { FocusPlugin as
|
|
22
|
-
import { MaxLengthPlugin as
|
|
23
|
-
import { ResetPlugin as
|
|
24
|
-
import { SetContentPlugin as
|
|
25
|
-
import { SetRichContentPlugin as
|
|
26
|
-
import { ToolbarPlugin as
|
|
27
|
-
import { useModal as
|
|
28
|
-
import { SourceModal as
|
|
29
|
-
import { SourceListItem as
|
|
30
|
-
const
|
|
31
|
-
placeholder:
|
|
32
|
-
initialContent:
|
|
33
|
-
initialRichContent:
|
|
34
|
-
onSubmit:
|
|
35
|
-
sources:
|
|
36
|
-
hideSubmit:
|
|
37
|
-
hideSourceAction:
|
|
38
|
-
onActivation:
|
|
39
|
-
disabled:
|
|
40
|
-
handleChange:
|
|
41
|
-
handleSourcesChange:
|
|
42
|
-
shortBar:
|
|
43
|
-
active:
|
|
44
|
-
maxLength:
|
|
45
|
-
disableRichText:
|
|
46
|
-
editorRef:
|
|
47
|
-
uid:
|
|
48
|
-
allowedDomains:
|
|
49
|
-
hideCharCount:
|
|
50
|
-
disableAutoActivate:
|
|
51
|
-
|
|
20
|
+
import { AutoSavePlugin as Te } from "./plugins/AutoSavePlugin.js";
|
|
21
|
+
import { FocusPlugin as Ne } from "./plugins/FocusPlugin.js";
|
|
22
|
+
import { MaxLengthPlugin as ve } from "./plugins/MaxLengthPlugin.js";
|
|
23
|
+
import { ResetPlugin as Ee } from "./plugins/ResetPlugin.js";
|
|
24
|
+
import { SetContentPlugin as Ie } from "./plugins/SetContentPlugin.js";
|
|
25
|
+
import { SetRichContentPlugin as Re } from "./plugins/SetRichContentPlugin.js";
|
|
26
|
+
import { ToolbarPlugin as be } from "./plugins/ToolbarPlugin.js";
|
|
27
|
+
import { useModal as Me } from "../../dialog/modal/useModal.js";
|
|
28
|
+
import { SourceModal as ye } from "../../source/source_modal/SourceModal.js";
|
|
29
|
+
import { SourceListItem as we } from "../../source/source_list_item/SourceListItem.js";
|
|
30
|
+
const y = (l) => l?.replace(/ /g, " "), st = ({
|
|
31
|
+
placeholder: l,
|
|
32
|
+
initialContent: w,
|
|
33
|
+
initialRichContent: L,
|
|
34
|
+
onSubmit: x,
|
|
35
|
+
sources: p,
|
|
36
|
+
hideSubmit: _ = !1,
|
|
37
|
+
hideSourceAction: A = !1,
|
|
38
|
+
onActivation: n,
|
|
39
|
+
disabled: B = !1,
|
|
40
|
+
handleChange: C,
|
|
41
|
+
handleSourcesChange: h,
|
|
42
|
+
shortBar: O = !1,
|
|
43
|
+
active: g = !1,
|
|
44
|
+
maxLength: m,
|
|
45
|
+
disableRichText: U = !1,
|
|
46
|
+
editorRef: j,
|
|
47
|
+
uid: P,
|
|
48
|
+
allowedDomains: T = [],
|
|
49
|
+
hideCharCount: k = !1,
|
|
50
|
+
disableAutoActivate: z = !1,
|
|
51
|
+
autoFocus: a = !1,
|
|
52
|
+
...H
|
|
52
53
|
}) => {
|
|
53
|
-
const [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}, [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
const [s, J] = f(a || g), [Q, W] = f(""), [$, q] = f(""), [d, u] = f([]), { showModal: D } = Me(), N = Ce(), v = Se(), E = xe(!1);
|
|
55
|
+
M(() => {
|
|
56
|
+
a && !E.current && n && (E.current = !0, n());
|
|
57
|
+
}, [a, n]), M(() => {
|
|
58
|
+
p && u(p);
|
|
59
|
+
}, [p]);
|
|
60
|
+
const I = () => {
|
|
61
|
+
s || (J(!0), n && n());
|
|
62
|
+
}, F = {
|
|
63
|
+
editable: !B,
|
|
64
|
+
theme: Pe,
|
|
62
65
|
onError(t) {
|
|
63
66
|
console.error("TextEditor error:", t);
|
|
64
67
|
},
|
|
65
|
-
nodes: [
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
},
|
|
68
|
+
nodes: [re, ie, he, ne]
|
|
69
|
+
}, G = () => {
|
|
70
|
+
I();
|
|
71
|
+
}, K = (t) => {
|
|
69
72
|
t.read(() => {
|
|
70
|
-
const
|
|
71
|
-
|
|
73
|
+
const o = ge().getTextContent(), r = y(o), c = JSON.stringify(t), R = y(c);
|
|
74
|
+
W(r), q(R), C && C(r, R);
|
|
72
75
|
});
|
|
73
|
-
},
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
|
|
76
|
+
}, V = (t) => {
|
|
77
|
+
const o = Q, r = $, c = d;
|
|
78
|
+
x && (t.preventDefault(), x(o, r, c)), u([]), h?.([]);
|
|
79
|
+
}, X = () => {
|
|
80
|
+
D(
|
|
81
|
+
/* @__PURE__ */ e(
|
|
82
|
+
ye,
|
|
80
83
|
{
|
|
81
|
-
onAddSource:
|
|
82
|
-
allowedSources:
|
|
84
|
+
onAddSource: Y,
|
|
85
|
+
allowedSources: T
|
|
83
86
|
}
|
|
84
87
|
)
|
|
85
88
|
);
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
const r = [...
|
|
89
|
-
return
|
|
89
|
+
}, Y = (t) => {
|
|
90
|
+
u((o) => {
|
|
91
|
+
const r = [...o, t];
|
|
92
|
+
return h?.(r), r;
|
|
90
93
|
});
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
const r =
|
|
94
|
-
(
|
|
94
|
+
}, Z = (t) => {
|
|
95
|
+
u((o) => {
|
|
96
|
+
const r = o.filter(
|
|
97
|
+
(c) => c.source_url !== t.source_url
|
|
95
98
|
);
|
|
96
|
-
return
|
|
99
|
+
return h?.(r), r;
|
|
97
100
|
});
|
|
98
|
-
},
|
|
99
|
-
|
|
101
|
+
}, ee = (t, o) => /* @__PURE__ */ e(
|
|
102
|
+
we,
|
|
100
103
|
{
|
|
101
104
|
publisher: t.publisher,
|
|
102
105
|
url: t.source_url,
|
|
103
106
|
title: t.title,
|
|
104
|
-
index:
|
|
105
|
-
onRemove: () =>
|
|
107
|
+
index: o,
|
|
108
|
+
onRemove: () => Z(t)
|
|
106
109
|
},
|
|
107
|
-
|
|
108
|
-
),
|
|
109
|
-
return /* @__PURE__ */
|
|
110
|
-
/* @__PURE__ */
|
|
110
|
+
o
|
|
111
|
+
), te = () => /* @__PURE__ */ e("div", { className: i.editorPlaceholder, children: l });
|
|
112
|
+
return /* @__PURE__ */ S(oe, { children: [
|
|
113
|
+
/* @__PURE__ */ e(ce, { initialConfig: F, children: /* @__PURE__ */ e("div", { className: i.editorContainer, onClick: G, children: /* @__PURE__ */ S(
|
|
111
114
|
"div",
|
|
112
115
|
{
|
|
113
|
-
className:
|
|
114
|
-
[i.editorInnerInactive]: !
|
|
116
|
+
className: b(i.editorInner, {
|
|
117
|
+
[i.editorInnerInactive]: !s && !g
|
|
115
118
|
}),
|
|
116
119
|
children: [
|
|
117
|
-
/* @__PURE__ */
|
|
118
|
-
|
|
120
|
+
/* @__PURE__ */ e(
|
|
121
|
+
pe,
|
|
119
122
|
{
|
|
120
|
-
contentEditable: /* @__PURE__ */
|
|
121
|
-
|
|
123
|
+
contentEditable: /* @__PURE__ */ e(
|
|
124
|
+
le,
|
|
122
125
|
{
|
|
123
|
-
className:
|
|
124
|
-
[i.editorInputInactive]: !
|
|
126
|
+
className: b(i.editorInput, {
|
|
127
|
+
[i.editorInputInactive]: !s
|
|
125
128
|
}),
|
|
126
|
-
...
|
|
129
|
+
...H
|
|
127
130
|
}
|
|
128
131
|
),
|
|
129
|
-
placeholder:
|
|
130
|
-
ErrorBoundary:
|
|
132
|
+
placeholder: l && /* @__PURE__ */ e(te, {}),
|
|
133
|
+
ErrorBoundary: ae
|
|
131
134
|
}
|
|
132
135
|
),
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
136
|
+
/* @__PURE__ */ e(
|
|
137
|
+
be,
|
|
135
138
|
{
|
|
136
|
-
hideSourceAction:
|
|
137
|
-
hideSubmit:
|
|
138
|
-
disableRichText:
|
|
139
|
-
shortBar:
|
|
140
|
-
onSubmit:
|
|
141
|
-
onAddSource:
|
|
142
|
-
isActive:
|
|
143
|
-
sourceTooltip:
|
|
139
|
+
hideSourceAction: A,
|
|
140
|
+
hideSubmit: _,
|
|
141
|
+
disableRichText: U,
|
|
142
|
+
shortBar: O,
|
|
143
|
+
onSubmit: V,
|
|
144
|
+
onAddSource: X,
|
|
145
|
+
isActive: s || g,
|
|
146
|
+
sourceTooltip: T?.length > 0 && N.formatMessage({
|
|
144
147
|
id: "input.allowed_domains_tooltip",
|
|
145
148
|
defaultMessage: "With the new source function, you can add links to your article."
|
|
146
149
|
})
|
|
147
150
|
}
|
|
148
151
|
),
|
|
149
|
-
|
|
150
|
-
/* @__PURE__ */
|
|
152
|
+
s && m && !k && /* @__PURE__ */ S("div", { className: i.charactersCount, children: [
|
|
153
|
+
/* @__PURE__ */ e(se, { maxLength: m }),
|
|
151
154
|
" ",
|
|
152
|
-
|
|
155
|
+
N.formatMessage({
|
|
153
156
|
id: "input.remaining_chars",
|
|
154
157
|
defaultMessage: "remaining characters"
|
|
155
158
|
})
|
|
156
159
|
] }),
|
|
157
|
-
/* @__PURE__ */
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
|
|
160
|
+
/* @__PURE__ */ e(ue, {}),
|
|
161
|
+
/* @__PURE__ */ e(de, {}),
|
|
162
|
+
/* @__PURE__ */ e(fe, { onChange: K, ignoreSelectionChange: !0 }),
|
|
163
|
+
/* @__PURE__ */ e(
|
|
164
|
+
Te,
|
|
162
165
|
{
|
|
163
|
-
onSetContent:
|
|
164
|
-
} :
|
|
165
|
-
storageUid:
|
|
166
|
+
onSetContent: z ? () => {
|
|
167
|
+
} : I,
|
|
168
|
+
storageUid: P || v
|
|
166
169
|
}
|
|
167
170
|
),
|
|
168
|
-
/* @__PURE__ */
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ e(Ie, { content: w }),
|
|
172
|
+
/* @__PURE__ */ e(Re, { richContent: L }),
|
|
173
|
+
/* @__PURE__ */ e(Ne, { autoFocus: a }),
|
|
174
|
+
m && /* @__PURE__ */ e(ve, { maxLength: m }),
|
|
175
|
+
/* @__PURE__ */ e(Ee, { storageUid: P || v }),
|
|
176
|
+
/* @__PURE__ */ e(me, { editorRef: j })
|
|
174
177
|
]
|
|
175
178
|
}
|
|
176
179
|
) }) }),
|
|
177
|
-
|
|
180
|
+
d && d.length !== 0 ? /* @__PURE__ */ e("div", { className: i.sourcesBox, children: /* @__PURE__ */ e("div", { className: i.sourceList, children: d.map(ee) }) }) : null
|
|
178
181
|
] });
|
|
179
182
|
};
|
|
180
183
|
export {
|
|
181
|
-
|
|
184
|
+
st as TextEditor
|
|
182
185
|
};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { useLexicalComposerContext as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { useInput as
|
|
4
|
-
const
|
|
5
|
-
const [o] =
|
|
6
|
-
return
|
|
7
|
-
|
|
1
|
+
import { useLexicalComposerContext as u } from "@lexical/react/LexicalComposerContext";
|
|
2
|
+
import { useRef as c, useEffect as s } from "react";
|
|
3
|
+
import { useInput as f } from "../../input_provider/useInput.js";
|
|
4
|
+
const E = ({ autoFocus: t = !1 }) => {
|
|
5
|
+
const [o] = u(), { focus: e } = f(), r = c(!1);
|
|
6
|
+
return s(() => {
|
|
7
|
+
e && o.focus(() => {
|
|
8
8
|
o.getRootElement().focus();
|
|
9
9
|
});
|
|
10
|
+
}, [e, o]), s(() => {
|
|
11
|
+
t && !r.current && (r.current = !0, o.focus(() => {
|
|
12
|
+
o.getRootElement().focus();
|
|
13
|
+
}));
|
|
10
14
|
}, [t, o]), null;
|
|
11
15
|
};
|
|
12
16
|
export {
|
|
13
|
-
|
|
17
|
+
E as FocusPlugin
|
|
14
18
|
};
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
1
|
+
import { jsx as t, jsxs as u, Fragment as S } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useEffect as I } from "react";
|
|
3
|
+
import p from "classnames";
|
|
4
4
|
import { useIntl as N } from "react-intl";
|
|
5
5
|
import o from "./ProposalBox.module.scss.js";
|
|
6
|
-
import { useConfig as
|
|
7
|
-
import { useAuth as
|
|
8
|
-
import { useTranslatedContent as
|
|
9
|
-
import { lexicalToHtml as
|
|
10
|
-
import { HashScroll as
|
|
6
|
+
import { useConfig as y } from "../../data/config_provider/useConfig.js";
|
|
7
|
+
import { useAuth as L } from "../../auth/use_auth/useAuth.js";
|
|
8
|
+
import { useTranslatedContent as C } from "../../translation/translated_content/useTranslatedContent.js";
|
|
9
|
+
import { lexicalToHtml as B } from "../../input/text_editor/lexicalToHtml.js";
|
|
10
|
+
import { HashScroll as H } from "../../tools/hash_scroll/HashScroll.js";
|
|
11
11
|
import { ContentHeader as U } from "../../user_content/content_header/ContentHeader.js";
|
|
12
12
|
import { ReadMore as D } from "../../text/read_more/ReadMore.js";
|
|
13
13
|
import { TranslationButton as P } from "../../translation/translation_button/TranslationButton.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
14
|
+
import { SourceListItem as R } from "../../source/source_list_item/SourceListItem.js";
|
|
15
|
+
import { ContentFooter as $ } from "../../user_content/content_footer/ContentFooter.js";
|
|
16
|
+
import { UpDownVoteBox as F } from "../../vote/up_down_vote_box/UpDownVoteBox.js";
|
|
17
|
+
const ee = ({
|
|
17
18
|
proposal: e,
|
|
18
|
-
disabled:
|
|
19
|
-
fixedContentHeight:
|
|
19
|
+
disabled: d = !1,
|
|
20
|
+
fixedContentHeight: _,
|
|
20
21
|
enableEdition: T = !0,
|
|
21
|
-
hideFooter:
|
|
22
|
+
hideFooter: v = !1
|
|
22
23
|
}) => {
|
|
23
|
-
const [
|
|
24
|
+
const [c, x] = g(null), [M, w] = g(!1), s = N(), n = y(), { currentUser: m } = L(), h = m?.moderation_status === "banned", f = `proposal_${e.id}`, i = C(
|
|
24
25
|
e.title,
|
|
25
26
|
e.language,
|
|
26
27
|
"title",
|
|
27
28
|
e.translation_entries
|
|
28
|
-
),
|
|
29
|
+
), a = C(
|
|
29
30
|
e.content,
|
|
30
31
|
e.language,
|
|
31
32
|
"content",
|
|
@@ -33,21 +34,21 @@ const Y = ({
|
|
|
33
34
|
);
|
|
34
35
|
I(() => {
|
|
35
36
|
if (e.rich_content) {
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
|
|
37
|
+
const r = JSON.parse(e.rich_content);
|
|
38
|
+
if (r.hasOwnProperty("root")) {
|
|
39
|
+
const l = B(r);
|
|
40
|
+
x(l);
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
}, [e.rich_content]);
|
|
43
|
-
const
|
|
44
|
-
|
|
44
|
+
const b = () => {
|
|
45
|
+
i.toggleContent(), a.toggleContent();
|
|
45
46
|
};
|
|
46
|
-
return /* @__PURE__ */ t(
|
|
47
|
+
return /* @__PURE__ */ t(H, { elementId: f, onScroll: () => w(!0), children: /* @__PURE__ */ u(
|
|
47
48
|
"div",
|
|
48
49
|
{
|
|
49
|
-
className:
|
|
50
|
-
id:
|
|
50
|
+
className: p(o.proposalBoxContainer, { [o.flash]: M }),
|
|
51
|
+
id: f,
|
|
51
52
|
children: [
|
|
52
53
|
/* @__PURE__ */ t(
|
|
53
54
|
U,
|
|
@@ -61,39 +62,39 @@ const Y = ({
|
|
|
61
62
|
/* @__PURE__ */ t(
|
|
62
63
|
"div",
|
|
63
64
|
{
|
|
64
|
-
className:
|
|
65
|
-
[o.fixedHeight]:
|
|
65
|
+
className: p(o.proposalBoxContent, {
|
|
66
|
+
[o.fixedHeight]: _
|
|
66
67
|
}),
|
|
67
68
|
children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
|
|
68
69
|
D,
|
|
69
70
|
{
|
|
70
|
-
content: /* @__PURE__ */
|
|
71
|
-
e.is_edited && /* @__PURE__ */ t("div", { className: o.edited, children:
|
|
71
|
+
content: /* @__PURE__ */ u(S, { children: [
|
|
72
|
+
e.is_edited && /* @__PURE__ */ t("div", { className: o.edited, children: s.formatMessage({
|
|
72
73
|
id: "proposal.updated",
|
|
73
74
|
defaultMessage: "Updated proposal"
|
|
74
75
|
}) }),
|
|
75
|
-
/* @__PURE__ */ t("div", { className: o.proposalTitle, children:
|
|
76
|
-
|
|
76
|
+
/* @__PURE__ */ t("div", { className: o.proposalTitle, children: i.translatedContent }),
|
|
77
|
+
c && !a.isTranslated ? /* @__PURE__ */ t(
|
|
77
78
|
"div",
|
|
78
79
|
{
|
|
79
80
|
className: o.proposalContent,
|
|
80
|
-
dangerouslySetInnerHTML: { __html:
|
|
81
|
+
dangerouslySetInnerHTML: { __html: c }
|
|
81
82
|
}
|
|
82
|
-
) : /* @__PURE__ */ t("div", { className: o.proposalContent, children:
|
|
83
|
-
(
|
|
83
|
+
) : /* @__PURE__ */ t("div", { className: o.proposalContent, children: a.translatedContent }),
|
|
84
|
+
(a.isTranslated || i.isTranslated) && /* @__PURE__ */ t(
|
|
84
85
|
P,
|
|
85
86
|
{
|
|
86
87
|
language: e.language,
|
|
87
|
-
callback: () =>
|
|
88
|
+
callback: () => b()
|
|
88
89
|
}
|
|
89
90
|
)
|
|
90
91
|
] }),
|
|
91
92
|
lineCount: 7,
|
|
92
|
-
readMoreText:
|
|
93
|
+
readMoreText: s.formatMessage({
|
|
93
94
|
id: "action.read_more",
|
|
94
95
|
defaultMessage: "Read more"
|
|
95
96
|
}),
|
|
96
|
-
readLessText:
|
|
97
|
+
readLessText: s.formatMessage({
|
|
97
98
|
id: "action.read_less",
|
|
98
99
|
defaultMessage: "Read less"
|
|
99
100
|
})
|
|
@@ -101,31 +102,41 @@ const Y = ({
|
|
|
101
102
|
) })
|
|
102
103
|
}
|
|
103
104
|
),
|
|
104
|
-
|
|
105
|
+
e.sources?.length > 0 && /* @__PURE__ */ t("div", { className: o.proposalSourcesList, children: e.sources.map((r, l) => /* @__PURE__ */ t(
|
|
105
106
|
R,
|
|
107
|
+
{
|
|
108
|
+
publisher: r.publisher,
|
|
109
|
+
url: r.source_url,
|
|
110
|
+
title: r.title,
|
|
111
|
+
index: l
|
|
112
|
+
},
|
|
113
|
+
r.id
|
|
114
|
+
)) }),
|
|
115
|
+
!v && /* @__PURE__ */ t(
|
|
116
|
+
$,
|
|
106
117
|
{
|
|
107
118
|
resource: e,
|
|
108
|
-
disabled:
|
|
119
|
+
disabled: d || h,
|
|
109
120
|
reportType: "Proposal",
|
|
110
121
|
deleteType: "proposals",
|
|
111
122
|
deleteListId: "proposalsList",
|
|
112
|
-
shareModalTitle:
|
|
123
|
+
shareModalTitle: s.formatMessage({ id: "share.proposal" }),
|
|
113
124
|
shareUrl: `https://app.logora.fr/share/p/${e.id}`,
|
|
114
|
-
shareTitle:
|
|
115
|
-
shareText:
|
|
116
|
-
shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${
|
|
117
|
-
showShareCode:
|
|
125
|
+
shareTitle: s.formatMessage({ id: "share.proposal.title" }),
|
|
126
|
+
shareText: s.formatMessage({ id: "share.proposal.text" }),
|
|
127
|
+
shareCode: `<iframe src="https://cdn.logora.com/embed.html?shortname=${n.shortname}&id=${e.id}&resource=proposal" frameborder="0" width="100%" height="335px" scrolling="no"></iframe>`,
|
|
128
|
+
showShareCode: n?.actions?.hideCodeShare !== !0,
|
|
118
129
|
showActions: !e.author.consultation_id,
|
|
119
130
|
enableEdition: T,
|
|
120
131
|
children: /* @__PURE__ */ t(
|
|
121
|
-
|
|
132
|
+
F,
|
|
122
133
|
{
|
|
123
134
|
voteableType: "Proposal",
|
|
124
135
|
voteableId: e.id,
|
|
125
136
|
totalUpvote: e.total_upvotes,
|
|
126
137
|
totalDownvote: e.total_downvotes,
|
|
127
|
-
disabled:
|
|
128
|
-
hideDownvotes:
|
|
138
|
+
disabled: d || m?.id === e?.author?.id || h,
|
|
139
|
+
hideDownvotes: n?.actions?.hideDownvotes
|
|
129
140
|
}
|
|
130
141
|
)
|
|
131
142
|
}
|
|
@@ -135,5 +146,5 @@ const Y = ({
|
|
|
135
146
|
) });
|
|
136
147
|
};
|
|
137
148
|
export {
|
|
138
|
-
|
|
149
|
+
ee as ProposalBox
|
|
139
150
|
};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import '../../../assets/components/proposal/proposal_box/ProposalBox.module-
|
|
1
|
+
import '../../../assets/components/proposal/proposal_box/ProposalBox.module-C9BaTFDH.css';const o = "_proposalBoxContainer_5d6lc_3", t = "_flash_5d6lc_17", s = "_edited_5d6lc_25", l = "_proposalBoxContent_5d6lc_32", p = "_proposalTitle_5d6lc_44", e = "_proposalContent_5d6lc_52", n = "_proposalSourcesList_5d6lc_56", _ = "_fixedHeight_5d6lc_68", a = {
|
|
2
2
|
proposalBoxContainer: o,
|
|
3
3
|
flash: t,
|
|
4
|
-
edited:
|
|
5
|
-
proposalBoxContent:
|
|
6
|
-
proposalTitle:
|
|
7
|
-
proposalContent:
|
|
8
|
-
|
|
4
|
+
edited: s,
|
|
5
|
+
proposalBoxContent: l,
|
|
6
|
+
proposalTitle: p,
|
|
7
|
+
proposalContent: e,
|
|
8
|
+
proposalSourcesList: n,
|
|
9
|
+
fixedHeight: _
|
|
9
10
|
};
|
|
10
11
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
a as default,
|
|
13
|
+
s as edited,
|
|
14
|
+
_ as fixedHeight,
|
|
14
15
|
t as flash,
|
|
15
16
|
o as proposalBoxContainer,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
n as
|
|
17
|
+
l as proposalBoxContent,
|
|
18
|
+
e as proposalContent,
|
|
19
|
+
n as proposalSourcesList,
|
|
20
|
+
p as proposalTitle
|
|
19
21
|
};
|
|
@@ -2,13 +2,13 @@ import { jsxs as a, Fragment as n, jsx as s } from "react/jsx-runtime";
|
|
|
2
2
|
import "react";
|
|
3
3
|
import { useIntl as l, FormattedDate as m } from "react-intl";
|
|
4
4
|
import e from "./ContextSourceBox.module.scss.js";
|
|
5
|
-
const
|
|
5
|
+
const x = ({ title: r, imageUrl: c, date: i, author: t }) => {
|
|
6
6
|
const o = l();
|
|
7
7
|
return /* @__PURE__ */ a("div", { className: e.container, children: [
|
|
8
8
|
/* @__PURE__ */ a("div", { className: e.content, children: [
|
|
9
9
|
/* @__PURE__ */ a("div", { className: e.infos, children: [
|
|
10
|
-
|
|
11
|
-
/* @__PURE__ */ s("span", { className: e.sourceAuthor, children:
|
|
10
|
+
t && /* @__PURE__ */ a(n, { children: [
|
|
11
|
+
/* @__PURE__ */ s("span", { className: e.sourceAuthor, children: t }),
|
|
12
12
|
/* @__PURE__ */ s("span", { className: e.separator, children: "·" })
|
|
13
13
|
] }),
|
|
14
14
|
/* @__PURE__ */ s("span", { className: e.sourcePublishedDate, children: /* @__PURE__ */ s(
|
|
@@ -21,21 +21,21 @@ const g = ({ title: t, imageUrl: c, date: i, author: r }) => {
|
|
|
21
21
|
}
|
|
22
22
|
) })
|
|
23
23
|
] }),
|
|
24
|
-
/* @__PURE__ */ s("div", { className: e.sourceTitle, children:
|
|
24
|
+
/* @__PURE__ */ s("div", { className: e.sourceTitle, children: r })
|
|
25
25
|
] }),
|
|
26
26
|
/* @__PURE__ */ s(
|
|
27
27
|
"img",
|
|
28
28
|
{
|
|
29
29
|
src: c,
|
|
30
30
|
alt: o.formatMessage({
|
|
31
|
-
id: "source.context_source_box.alt"
|
|
32
|
-
defaultMessage: "Debate source image"
|
|
31
|
+
id: "source.context_source_box.alt"
|
|
33
32
|
}),
|
|
33
|
+
"data-testid": "context-source-image",
|
|
34
34
|
className: e.image
|
|
35
35
|
}
|
|
36
36
|
)
|
|
37
37
|
] });
|
|
38
38
|
};
|
|
39
39
|
export {
|
|
40
|
-
|
|
40
|
+
x as ContextSourceBox
|
|
41
41
|
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import m from "classnames";
|
|
3
3
|
import "react";
|
|
4
|
-
import { useIntl as c } from "react-intl";
|
|
5
4
|
import e from "./ContextSourceList.module.scss.js";
|
|
6
5
|
import { useResponsive as p } from "../../hooks/use_responsive/useResponsive.js";
|
|
7
|
-
import { SectionBox as
|
|
6
|
+
import { SectionBox as c } from "../../section/section_box/SectionBox.js";
|
|
8
7
|
import { Link as d } from "../../action/link/Link.js";
|
|
9
|
-
import { ContextSourceBox as
|
|
10
|
-
const
|
|
11
|
-
const
|
|
8
|
+
import { ContextSourceBox as u } from "../context_source_box/ContextSourceBox.js";
|
|
9
|
+
const C = ({ sources: i = [], title: r = "" }) => {
|
|
10
|
+
const { isMobile: l, isTablet: s, isDesktop: n } = p(), a = (t) => /* @__PURE__ */ o(
|
|
12
11
|
d,
|
|
13
12
|
{
|
|
14
13
|
className: e.listItem,
|
|
@@ -16,7 +15,7 @@ const M = ({ sources: i = [] }) => {
|
|
|
16
15
|
target: "_blank",
|
|
17
16
|
external: !0,
|
|
18
17
|
children: /* @__PURE__ */ o(
|
|
19
|
-
|
|
18
|
+
u,
|
|
20
19
|
{
|
|
21
20
|
imageUrl: t.origin_image_url,
|
|
22
21
|
author: t.publisher,
|
|
@@ -28,22 +27,19 @@ const M = ({ sources: i = [] }) => {
|
|
|
28
27
|
t.id
|
|
29
28
|
);
|
|
30
29
|
return /* @__PURE__ */ o(
|
|
31
|
-
|
|
30
|
+
c,
|
|
32
31
|
{
|
|
33
32
|
className: e.sectionBox,
|
|
34
33
|
isCollapsible: !0,
|
|
35
34
|
isCollapsedByDefault: !1,
|
|
36
|
-
title: r
|
|
37
|
-
id: "source.context_source_list.title",
|
|
38
|
-
defaultMessage: "Debate context"
|
|
39
|
-
}),
|
|
35
|
+
title: r,
|
|
40
36
|
children: /* @__PURE__ */ o(
|
|
41
37
|
"div",
|
|
42
38
|
{
|
|
43
39
|
className: m(e.content, {
|
|
44
40
|
[e.contentDesktop]: n,
|
|
45
|
-
[e.contentTablet]:
|
|
46
|
-
[e.contentMobile]:
|
|
41
|
+
[e.contentTablet]: s,
|
|
42
|
+
[e.contentMobile]: l
|
|
47
43
|
}),
|
|
48
44
|
children: i.map(a)
|
|
49
45
|
}
|
|
@@ -52,5 +48,5 @@ const M = ({ sources: i = [] }) => {
|
|
|
52
48
|
);
|
|
53
49
|
};
|
|
54
50
|
export {
|
|
55
|
-
|
|
51
|
+
C as ContextSourceList
|
|
56
52
|
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._proposalBoxContainer_awwcm_3{display:flex!important;flex-direction:column!important;justify-content:space-between!important;position:relative;box-shadow:var(--box-shadow, 0px 2px 5px rgba(7, 42, 68, .1));border:var(--box-border, 1px solid rgba(7, 42, 68, .1));color:var(--text-primary, #222222);border-radius:var(--box-border-radius, 6px);background-color:var(--background-color-primary, white);scroll-margin-top:150px;padding:var(--box-spacing, var(--space-unit, 1em));gap:var(--box-spacing, var(--space-unit, 1em))}._proposalBoxContainer_awwcm_3._flash_awwcm_17{-webkit-transition:box-shadow .8s ease-in-out;-moz-transition:box-shadow .8s ease-in-out;-o-transition:box-shadow .8s ease-in-out;transition:box-shadow .8s ease-in-out;box-shadow:0 0 15px var(--call-primary-color, #434343)}._edited_awwcm_25{font-size:var(--font-size-extra-small, 14px);color:var(--text-secondary, #5F5F5F);line-height:var(--line-height-loose, 1.38em);margin-bottom:var(--spacer-xs, calc(var(--space-unit, 1em) * .325))!important}._proposalBoxContent_awwcm_32{text-align:left;white-space:pre-line;line-height:var(--line-height-loose, 1.38em);font-size:var(--font-size-small, 16px)}@container (min-width: 768px){._proposalBoxContent_awwcm_32{min-height:185px}}._proposalBoxContent_awwcm_32 ._proposalTitle_awwcm_44{font-size:var(--font-size-normal, 16px);font-weight:var(--font-weight-bold, 700);padding-bottom:var(--spacer-sm, calc(var(--space-unit, 1em) * .5))!important}._proposalBoxContent_awwcm_32 ._proposalTitle_awwcm_44:first-letter{text-transform:uppercase}._proposalBoxContent_awwcm_32 ._proposalContent_awwcm_52 *{font-size:var(--font-size-small, 16px)}._fixedHeight_awwcm_56{height:200px;overflow:hidden;position:relative}._fixedHeight_awwcm_56:after{content:"";position:absolute;z-index:1;bottom:0;left:0;right:0;pointer-events:none;background-image:linear-gradient(to bottom,#fff0,#fff 90%);width:100%;height:5em}
|