@logora/debate 0.3.66 → 0.3.68
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/consultation/consultation_box/ConsultationBox.js +62 -41
- package/dist/components/input/text_editor/TextEditor.js +94 -92
- package/dist/components/input/text_editor/plugins/SetContentPlugin.js +13 -13
- package/dist/components/input/text_editor/plugins/SetRichContentPlugin.js +10 -10
- package/package.json +1 -1
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { jsx as t, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { useIntl as
|
|
1
|
+
import { jsx as t, Fragment as g, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import i from "classnames";
|
|
3
|
+
import { useMemo as p } from "react";
|
|
4
|
+
import { useIntl as f, FormattedMessage as h } from "react-intl";
|
|
5
5
|
import o from "./ConsultationBox.module.scss.js";
|
|
6
|
-
import { useRoutes as
|
|
7
|
-
import { useResponsive as
|
|
8
|
-
import { Link as
|
|
9
|
-
import { TranslatedContent as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
import { useRoutes as v } from "../../data/config_provider/useRoutes.js";
|
|
7
|
+
import { useResponsive as N } from "../../hooks/use_responsive/useResponsive.js";
|
|
8
|
+
import { Link as r } from "../../action/link/Link.js";
|
|
9
|
+
import { TranslatedContent as _ } from "../../translation/translated_content/TranslatedContent.js";
|
|
10
|
+
import { Tooltip as m } from "../../dialog/tooltip/Tooltip.js";
|
|
11
|
+
import { Icon as d } from "../../icons/icon/Icon.js";
|
|
12
|
+
import { ProgressBar as x } from "../../progress/progress_bar/ProgressBar.js";
|
|
13
|
+
const P = ({ consultation: e, showVoteProgress: u = !0 }) => {
|
|
14
|
+
const a = f(), l = p(() => /* @__PURE__ */ new Date()), c = new Date(e.ends_at), n = v(), { isMobile: I } = N();
|
|
15
|
+
return /* @__PURE__ */ t(g, { children: /* @__PURE__ */ s("div", { className: o.container, children: [
|
|
16
|
+
/* @__PURE__ */ s("div", { className: o.consultationImageBox, children: [
|
|
16
17
|
/* @__PURE__ */ t(
|
|
17
|
-
|
|
18
|
+
r,
|
|
18
19
|
{
|
|
19
20
|
to: n.consultationShowLocation.toUrl({
|
|
20
21
|
consultationSlug: e.slug
|
|
@@ -25,7 +26,7 @@ const D = ({ consultation: e, showVoteProgress: m = !0 }) => {
|
|
|
25
26
|
loading: "lazy",
|
|
26
27
|
className: o.consultationImage,
|
|
27
28
|
src: e.image_url,
|
|
28
|
-
alt:
|
|
29
|
+
alt: a.formatMessage({
|
|
29
30
|
id: "consultation.consultation_box.alt",
|
|
30
31
|
defaultMessage: "Presentation image for the consultation"
|
|
31
32
|
})
|
|
@@ -33,8 +34,8 @@ const D = ({ consultation: e, showVoteProgress: m = !0 }) => {
|
|
|
33
34
|
)
|
|
34
35
|
}
|
|
35
36
|
),
|
|
36
|
-
e.ends_at &&
|
|
37
|
-
|
|
37
|
+
e.ends_at && c < l && /* @__PURE__ */ t("div", { className: i(o.consultationTime, o.ended), children: /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(
|
|
38
|
+
h,
|
|
38
39
|
{
|
|
39
40
|
id: "consultation.consultation_box.consultation_ended",
|
|
40
41
|
defaultMessage: "Consultation ended"
|
|
@@ -42,13 +43,13 @@ const D = ({ consultation: e, showVoteProgress: m = !0 }) => {
|
|
|
42
43
|
) }) })
|
|
43
44
|
] }),
|
|
44
45
|
/* @__PURE__ */ t(
|
|
45
|
-
|
|
46
|
+
r,
|
|
46
47
|
{
|
|
47
48
|
to: n.consultationShowLocation.toUrl({
|
|
48
49
|
consultationSlug: e.slug
|
|
49
50
|
}),
|
|
50
51
|
children: /* @__PURE__ */ t("div", { className: o.consultationTitle, children: /* @__PURE__ */ t(
|
|
51
|
-
|
|
52
|
+
_,
|
|
52
53
|
{
|
|
53
54
|
originalContent: e.title,
|
|
54
55
|
originalLanguage: e.language,
|
|
@@ -59,42 +60,62 @@ const D = ({ consultation: e, showVoteProgress: m = !0 }) => {
|
|
|
59
60
|
}
|
|
60
61
|
),
|
|
61
62
|
/* @__PURE__ */ t(
|
|
62
|
-
|
|
63
|
+
r,
|
|
63
64
|
{
|
|
64
65
|
to: n.consultationShowLocation.toUrl({
|
|
65
66
|
consultationSlug: e.slug
|
|
66
67
|
})
|
|
67
68
|
}
|
|
68
69
|
),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
|
|
70
|
+
/* @__PURE__ */ s("div", { className: o.consultationInformations, children: [
|
|
71
|
+
/* @__PURE__ */ s("div", { className: o.consultationLeft, children: [
|
|
72
|
+
/* @__PURE__ */ t(
|
|
73
|
+
m,
|
|
73
74
|
{
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
text: a.formatMessage({
|
|
76
|
+
id: "info.votes_count",
|
|
77
|
+
defaultMessage: "Number of votes"
|
|
78
|
+
}),
|
|
79
|
+
position: "top",
|
|
80
|
+
children: /* @__PURE__ */ s(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
className: i(
|
|
84
|
+
o.consultationGroupInformation,
|
|
85
|
+
o.consultationGroupRight
|
|
86
|
+
),
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ t("span", { className: o.consultationTextInformation, children: e.total_votes }),
|
|
89
|
+
/* @__PURE__ */ t(d, { name: "votebox", width: 15, height: 20, className: o.iconVote })
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
)
|
|
82
93
|
}
|
|
83
94
|
),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
/* @__PURE__ */ t(
|
|
96
|
+
m,
|
|
97
|
+
{
|
|
98
|
+
text: a.formatMessage({
|
|
99
|
+
id: "info.proposals_count",
|
|
100
|
+
defaultMessage: "Number of proposals"
|
|
101
|
+
}),
|
|
102
|
+
position: "top",
|
|
103
|
+
children: /* @__PURE__ */ s("div", { className: o.consultationGroupInformation, children: [
|
|
104
|
+
/* @__PURE__ */ t("span", { className: o.consultationTextInformation, children: e.proposals_count }),
|
|
105
|
+
/* @__PURE__ */ t(d, { name: "chat", width: 15, height: 20, className: o.iconChat })
|
|
106
|
+
] })
|
|
107
|
+
}
|
|
108
|
+
)
|
|
88
109
|
] }),
|
|
89
|
-
|
|
110
|
+
u && e.vote_goal > 0 && c > l && /* @__PURE__ */ t(
|
|
90
111
|
"div",
|
|
91
112
|
{
|
|
92
|
-
className:
|
|
113
|
+
className: i(
|
|
93
114
|
o.consultationGroupInformation,
|
|
94
115
|
o.progressBarContainer
|
|
95
116
|
),
|
|
96
117
|
children: /* @__PURE__ */ t(
|
|
97
|
-
|
|
118
|
+
x,
|
|
98
119
|
{
|
|
99
120
|
className: o.progress,
|
|
100
121
|
innerClassName: o.bar,
|
|
@@ -110,5 +131,5 @@ const D = ({ consultation: e, showVoteProgress: m = !0 }) => {
|
|
|
110
131
|
] }) });
|
|
111
132
|
};
|
|
112
133
|
export {
|
|
113
|
-
|
|
134
|
+
P as ConsultationBox
|
|
114
135
|
};
|
|
@@ -1,111 +1,113 @@
|
|
|
1
|
-
import { jsxs as p, Fragment 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
|
|
1
|
+
import { jsxs as p, Fragment as Z, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { ListNode as oo, ListItemNode as to } from "@lexical/list";
|
|
3
|
+
import { OverflowNode as eo } from "@lexical/overflow";
|
|
4
|
+
import { CharacterLimitPlugin as ro } from "@lexical/react/LexicalCharacterLimitPlugin";
|
|
5
|
+
import { LexicalComposer as io } from "@lexical/react/LexicalComposer";
|
|
6
|
+
import { ContentEditable as no } from "@lexical/react/LexicalContentEditable";
|
|
7
|
+
import { EditorRefPlugin as so } from "@lexical/react/LexicalEditorRefPlugin";
|
|
8
|
+
import { LexicalErrorBoundary as co } from "@lexical/react/LexicalErrorBoundary";
|
|
9
|
+
import { HistoryPlugin as lo } from "@lexical/react/LexicalHistoryPlugin";
|
|
10
|
+
import { ListPlugin as mo } from "@lexical/react/LexicalListPlugin";
|
|
11
|
+
import { OnChangePlugin as ao } from "@lexical/react/LexicalOnChangePlugin";
|
|
12
|
+
import { RichTextPlugin as uo } from "@lexical/react/LexicalRichTextPlugin";
|
|
13
|
+
import { QuoteNode as fo } from "@lexical/rich-text";
|
|
14
14
|
import I from "classnames";
|
|
15
|
-
import { $getRoot as
|
|
16
|
-
import { useState as d, useId as
|
|
17
|
-
import { useIntl as
|
|
18
|
-
import
|
|
15
|
+
import { $getRoot as po } from "lexical";
|
|
16
|
+
import { useState as d, useId as ho, useEffect as go } from "react";
|
|
17
|
+
import { useIntl as So } from "react-intl";
|
|
18
|
+
import xo 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 R = (c) => c?.replace(/ /g, " "),
|
|
20
|
+
import { AutoSavePlugin as vo } from "./plugins/AutoSavePlugin.js";
|
|
21
|
+
import { FocusPlugin as Co } from "./plugins/FocusPlugin.js";
|
|
22
|
+
import { MaxLengthPlugin as Po } from "./plugins/MaxLengthPlugin.js";
|
|
23
|
+
import { ResetPlugin as To } from "./plugins/ResetPlugin.js";
|
|
24
|
+
import { SetContentPlugin as No } from "./plugins/SetContentPlugin.js";
|
|
25
|
+
import { SetRichContentPlugin as Eo } from "./plugins/SetRichContentPlugin.js";
|
|
26
|
+
import { ToolbarPlugin as Io } from "./plugins/ToolbarPlugin.js";
|
|
27
|
+
import { useModal as Ro } from "../../dialog/modal/useModal.js";
|
|
28
|
+
import { SourceModal as bo } from "../../source/source_modal/SourceModal.js";
|
|
29
|
+
import { SourceListItem as Mo } from "../../source/source_list_item/SourceListItem.js";
|
|
30
|
+
const R = (c) => c?.replace(/ /g, " "), it = ({
|
|
31
31
|
placeholder: c,
|
|
32
|
+
initialContent: b,
|
|
33
|
+
initialRichContent: M,
|
|
32
34
|
onSubmit: h,
|
|
33
35
|
sources: u,
|
|
34
|
-
hideSubmit:
|
|
35
|
-
hideSourceAction:
|
|
36
|
+
hideSubmit: y = !1,
|
|
37
|
+
hideSourceAction: w = !1,
|
|
36
38
|
onActivation: g,
|
|
37
|
-
disabled:
|
|
39
|
+
disabled: A = !1,
|
|
38
40
|
handleChange: S,
|
|
39
41
|
handleSourcesChange: f,
|
|
40
|
-
shortBar:
|
|
42
|
+
shortBar: L = !1,
|
|
41
43
|
active: x = !1,
|
|
42
44
|
maxLength: l,
|
|
43
|
-
disableRichText:
|
|
44
|
-
editorRef:
|
|
45
|
+
disableRichText: _ = !1,
|
|
46
|
+
editorRef: B,
|
|
45
47
|
uid: v,
|
|
46
|
-
allowedDomains:
|
|
47
|
-
hideCharCount:
|
|
48
|
-
disableAutoActivate:
|
|
49
|
-
...
|
|
48
|
+
allowedDomains: C = [],
|
|
49
|
+
hideCharCount: F = !1,
|
|
50
|
+
disableAutoActivate: O = !1,
|
|
51
|
+
...U
|
|
50
52
|
}) => {
|
|
51
|
-
const [n,
|
|
52
|
-
|
|
53
|
+
const [n, j] = d(!1), [k, z] = d(""), [H, J] = d(""), [m, a] = d([]), { showModal: Q } = Ro(), P = So(), T = ho();
|
|
54
|
+
go(() => {
|
|
53
55
|
u && a(u);
|
|
54
56
|
}, [u]);
|
|
55
57
|
const N = () => {
|
|
56
|
-
n || (
|
|
57
|
-
},
|
|
58
|
-
editable: !
|
|
59
|
-
theme:
|
|
58
|
+
n || (j(!0), g && g());
|
|
59
|
+
}, W = {
|
|
60
|
+
editable: !A,
|
|
61
|
+
theme: xo,
|
|
60
62
|
onError(t) {
|
|
61
63
|
console.error("TextEditor error:", t);
|
|
62
64
|
},
|
|
63
|
-
nodes: [
|
|
64
|
-
},
|
|
65
|
+
nodes: [oo, to, fo, eo]
|
|
66
|
+
}, $ = () => {
|
|
65
67
|
N();
|
|
66
|
-
},
|
|
68
|
+
}, q = (t) => {
|
|
67
69
|
t.read(() => {
|
|
68
|
-
const e =
|
|
69
|
-
|
|
70
|
+
const e = po().getTextContent(), r = R(e), s = JSON.stringify(t), E = R(s);
|
|
71
|
+
z(r), J(E), S && S(r, E);
|
|
70
72
|
});
|
|
71
|
-
},
|
|
72
|
-
const e =
|
|
73
|
+
}, D = (t) => {
|
|
74
|
+
const e = k, r = H, s = m;
|
|
73
75
|
h && (t.preventDefault(), h(e, r, s)), a([]), f?.([]);
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
+
}, G = () => {
|
|
77
|
+
Q(
|
|
76
78
|
/* @__PURE__ */ o(
|
|
77
|
-
|
|
79
|
+
bo,
|
|
78
80
|
{
|
|
79
|
-
onAddSource:
|
|
80
|
-
allowedSources:
|
|
81
|
+
onAddSource: K,
|
|
82
|
+
allowedSources: C
|
|
81
83
|
}
|
|
82
84
|
)
|
|
83
85
|
);
|
|
84
|
-
},
|
|
86
|
+
}, K = (t) => {
|
|
85
87
|
a((e) => {
|
|
86
88
|
const r = [...e, t];
|
|
87
89
|
return f?.(r), r;
|
|
88
90
|
});
|
|
89
|
-
},
|
|
91
|
+
}, V = (t) => {
|
|
90
92
|
a((e) => {
|
|
91
93
|
const r = e.filter(
|
|
92
94
|
(s) => s.source_url !== t.source_url
|
|
93
95
|
);
|
|
94
96
|
return f?.(r), r;
|
|
95
97
|
});
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
+
}, X = (t, e) => /* @__PURE__ */ o(
|
|
99
|
+
Mo,
|
|
98
100
|
{
|
|
99
101
|
publisher: t.publisher,
|
|
100
102
|
url: t.source_url,
|
|
101
103
|
title: t.title,
|
|
102
104
|
index: e,
|
|
103
|
-
onRemove: () =>
|
|
105
|
+
onRemove: () => V(t)
|
|
104
106
|
},
|
|
105
107
|
e
|
|
106
|
-
),
|
|
107
|
-
return /* @__PURE__ */ p(
|
|
108
|
-
/* @__PURE__ */ o(
|
|
108
|
+
), Y = () => /* @__PURE__ */ o("div", { className: i.editorPlaceholder, children: c });
|
|
109
|
+
return /* @__PURE__ */ p(Z, { children: [
|
|
110
|
+
/* @__PURE__ */ o(io, { initialConfig: W, children: /* @__PURE__ */ o("div", { className: i.editorContainer, onClick: $, children: /* @__PURE__ */ p(
|
|
109
111
|
"div",
|
|
110
112
|
{
|
|
111
113
|
className: I(i.editorInner, {
|
|
@@ -113,68 +115,68 @@ const R = (c) => c?.replace(/ /g, " "), et = ({
|
|
|
113
115
|
}),
|
|
114
116
|
children: [
|
|
115
117
|
/* @__PURE__ */ o(
|
|
116
|
-
|
|
118
|
+
uo,
|
|
117
119
|
{
|
|
118
120
|
contentEditable: /* @__PURE__ */ o(
|
|
119
|
-
|
|
121
|
+
no,
|
|
120
122
|
{
|
|
121
123
|
className: I(i.editorInput, {
|
|
122
124
|
[i.editorInputInactive]: !n
|
|
123
125
|
}),
|
|
124
|
-
...
|
|
126
|
+
...U
|
|
125
127
|
}
|
|
126
128
|
),
|
|
127
|
-
placeholder: c && /* @__PURE__ */ o(
|
|
128
|
-
ErrorBoundary:
|
|
129
|
+
placeholder: c && /* @__PURE__ */ o(Y, {}),
|
|
130
|
+
ErrorBoundary: co
|
|
129
131
|
}
|
|
130
132
|
),
|
|
131
133
|
/* @__PURE__ */ o(
|
|
132
|
-
|
|
134
|
+
Io,
|
|
133
135
|
{
|
|
134
|
-
hideSourceAction:
|
|
135
|
-
hideSubmit:
|
|
136
|
-
disableRichText:
|
|
137
|
-
shortBar:
|
|
138
|
-
onSubmit:
|
|
139
|
-
onAddSource:
|
|
136
|
+
hideSourceAction: w,
|
|
137
|
+
hideSubmit: y,
|
|
138
|
+
disableRichText: _,
|
|
139
|
+
shortBar: L,
|
|
140
|
+
onSubmit: D,
|
|
141
|
+
onAddSource: G,
|
|
140
142
|
isActive: n || x,
|
|
141
|
-
sourceTooltip:
|
|
143
|
+
sourceTooltip: C?.length > 0 && P.formatMessage({
|
|
142
144
|
id: "input.allowed_domains_tooltip",
|
|
143
145
|
defaultMessage: "With the new source function, you can add links to your article."
|
|
144
146
|
})
|
|
145
147
|
}
|
|
146
148
|
),
|
|
147
|
-
n && l && !
|
|
148
|
-
/* @__PURE__ */ o(
|
|
149
|
+
n && l && !F && /* @__PURE__ */ p("div", { className: i.charactersCount, children: [
|
|
150
|
+
/* @__PURE__ */ o(ro, { maxLength: l }),
|
|
149
151
|
" ",
|
|
150
|
-
|
|
152
|
+
P.formatMessage({
|
|
151
153
|
id: "input.remaining_chars",
|
|
152
154
|
defaultMessage: "remaining characters"
|
|
153
155
|
})
|
|
154
156
|
] }),
|
|
155
|
-
/* @__PURE__ */ o(
|
|
156
|
-
/* @__PURE__ */ o(
|
|
157
|
-
/* @__PURE__ */ o(
|
|
157
|
+
/* @__PURE__ */ o(mo, {}),
|
|
158
|
+
/* @__PURE__ */ o(lo, {}),
|
|
159
|
+
/* @__PURE__ */ o(ao, { onChange: q, ignoreSelectionChange: !0 }),
|
|
158
160
|
/* @__PURE__ */ o(
|
|
159
|
-
|
|
161
|
+
vo,
|
|
160
162
|
{
|
|
161
|
-
onSetContent:
|
|
163
|
+
onSetContent: O ? () => {
|
|
162
164
|
} : N,
|
|
163
165
|
storageUid: v || T
|
|
164
166
|
}
|
|
165
167
|
),
|
|
168
|
+
/* @__PURE__ */ o(No, { content: b }),
|
|
169
|
+
/* @__PURE__ */ o(Eo, { richContent: M }),
|
|
166
170
|
/* @__PURE__ */ o(Co, {}),
|
|
167
|
-
/* @__PURE__ */ o(
|
|
168
|
-
/* @__PURE__ */ o(
|
|
169
|
-
|
|
170
|
-
/* @__PURE__ */ o(Po, { storageUid: v || T }),
|
|
171
|
-
/* @__PURE__ */ o(io, { editorRef: L })
|
|
171
|
+
l && /* @__PURE__ */ o(Po, { maxLength: l }),
|
|
172
|
+
/* @__PURE__ */ o(To, { storageUid: v || T }),
|
|
173
|
+
/* @__PURE__ */ o(so, { editorRef: B })
|
|
172
174
|
]
|
|
173
175
|
}
|
|
174
176
|
) }) }),
|
|
175
|
-
m && m.length !== 0 ? /* @__PURE__ */ o("div", { className: i.sourcesBox, children: /* @__PURE__ */ o("div", { className: i.sourceList, children: m.map(
|
|
177
|
+
m && m.length !== 0 ? /* @__PURE__ */ o("div", { className: i.sourcesBox, children: /* @__PURE__ */ o("div", { className: i.sourceList, children: m.map(X) }) }) : null
|
|
176
178
|
] });
|
|
177
179
|
};
|
|
178
180
|
export {
|
|
179
|
-
|
|
181
|
+
it as TextEditor
|
|
180
182
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useLexicalComposerContext as
|
|
2
|
-
import { $getRoot as
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import { useInput as
|
|
5
|
-
const
|
|
6
|
-
const [
|
|
7
|
-
return
|
|
8
|
-
t &&
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
1
|
+
import { useLexicalComposerContext as a } from "@lexical/react/LexicalComposerContext";
|
|
2
|
+
import { $getRoot as c, $createParagraphNode as i, $createTextNode as u } from "lexical";
|
|
3
|
+
import { useEffect as f } from "react";
|
|
4
|
+
import { useInput as m } from "../../input_provider/useInput.js";
|
|
5
|
+
const x = ({ content: o }) => {
|
|
6
|
+
const [p] = a(), { inputContent: e, setInputContent: s } = m(), t = o || e;
|
|
7
|
+
return f(() => {
|
|
8
|
+
typeof t == "string" && t && p.update(() => {
|
|
9
|
+
const n = c();
|
|
10
|
+
n.clear();
|
|
11
|
+
const r = i();
|
|
12
|
+
r.append(u(t)), n.append(r), !o && e && s(null);
|
|
13
13
|
});
|
|
14
14
|
}, [t]), null;
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
|
-
|
|
17
|
+
x as SetContentPlugin
|
|
18
18
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { useLexicalComposerContext as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { useInput as
|
|
4
|
-
const m = () => {
|
|
5
|
-
const [t] =
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
t.setEditorState(
|
|
1
|
+
import { useLexicalComposerContext as s } from "@lexical/react/LexicalComposerContext";
|
|
2
|
+
import { useEffect as u } from "react";
|
|
3
|
+
import { useInput as c } from "../../input_provider/useInput.js";
|
|
4
|
+
const m = ({ richContent: e }) => {
|
|
5
|
+
const [t] = s(), { inputRichContent: n, setInputRichContent: i } = c(), o = e || n;
|
|
6
|
+
return u(() => {
|
|
7
|
+
o && t.update(() => {
|
|
8
|
+
const r = t.parseEditorState(o);
|
|
9
|
+
t.setEditorState(r), !e && n && i(null);
|
|
10
10
|
});
|
|
11
|
-
}, [
|
|
11
|
+
}, [o]), null;
|
|
12
12
|
};
|
|
13
13
|
export {
|
|
14
14
|
m as SetRichContentPlugin
|