@lets-events/react 12.2.0 → 12.2.2
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +35 -9
- package/dist/index.mjs +35 -9
- package/package.json +1 -1
- package/src/components/Drawer/index.tsx +10 -1
- package/src/components/Drawer/styledComponents.ts +6 -0
- package/src/components/MultiSelect/index.tsx +5 -4
- package/src/components/MultiSelect/styledComponents.ts +3 -1
- package/src/components/RichEditor/QuillComponent.tsx +20 -7
- package/src/components/RichEditor/styledComponents.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @lets-events/react@12.2.
|
|
3
|
+
> @lets-events/react@12.2.2 build
|
|
4
4
|
> tsup src/index.tsx --format esm,cjs --dts --external react
|
|
5
5
|
|
|
6
6
|
[1G[0K[34mCLI[39m Building entry: src/index.tsx
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
[34mCLI[39m Target: es6
|
|
11
11
|
[34mESM[39m Build start
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m379.06 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 419ms
|
|
15
|
+
[32mCJS[39m [1mdist/index.js [22m[32m393.01 KB[39m
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 420ms
|
|
17
17
|
DTS Build start
|
|
18
|
-
DTS ⚡️ Build success in
|
|
19
|
-
DTS dist/index.d.mts
|
|
20
|
-
DTS dist/index.d.ts
|
|
18
|
+
DTS ⚡️ Build success in 6505ms
|
|
19
|
+
DTS dist/index.d.mts 389.04 KB
|
|
20
|
+
DTS dist/index.d.ts 389.04 KB
|
|
21
21
|
[1G[0K⠙[1G[0K
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -5054,8 +5054,10 @@ type DrawerProps = ComponentProps<typeof DrawerOverlayStyled> & {
|
|
|
5054
5054
|
backgroundColor?: keyof Colors;
|
|
5055
5055
|
title: string;
|
|
5056
5056
|
children?: ReactNode;
|
|
5057
|
+
goBackIcon?: ReactNode;
|
|
5058
|
+
goBackAction: () => void;
|
|
5057
5059
|
};
|
|
5058
|
-
declare function Drawer({ isOpen, onClose, width, backgroundColor, title, children, }: DrawerProps): react_jsx_runtime.JSX.Element | null;
|
|
5060
|
+
declare function Drawer({ isOpen, onClose, width, backgroundColor, title, children, goBackIcon, goBackAction }: DrawerProps): react_jsx_runtime.JSX.Element | null;
|
|
5059
5061
|
|
|
5060
5062
|
declare const TimePickerStyled: _stitches_react_types_styled_component.StyledComponent<"div", {
|
|
5061
5063
|
expand?: boolean | "true" | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -5054,8 +5054,10 @@ type DrawerProps = ComponentProps<typeof DrawerOverlayStyled> & {
|
|
|
5054
5054
|
backgroundColor?: keyof Colors;
|
|
5055
5055
|
title: string;
|
|
5056
5056
|
children?: ReactNode;
|
|
5057
|
+
goBackIcon?: ReactNode;
|
|
5058
|
+
goBackAction: () => void;
|
|
5057
5059
|
};
|
|
5058
|
-
declare function Drawer({ isOpen, onClose, width, backgroundColor, title, children, }: DrawerProps): react_jsx_runtime.JSX.Element | null;
|
|
5060
|
+
declare function Drawer({ isOpen, onClose, width, backgroundColor, title, children, goBackIcon, goBackAction }: DrawerProps): react_jsx_runtime.JSX.Element | null;
|
|
5059
5061
|
|
|
5060
5062
|
declare const TimePickerStyled: _stitches_react_types_styled_component.StyledComponent<"div", {
|
|
5061
5063
|
expand?: boolean | "true" | undefined;
|
package/dist/index.js
CHANGED
|
@@ -8112,6 +8112,12 @@ var DrawerHeaderCloseButton = styled("button", {
|
|
|
8112
8112
|
border: "none",
|
|
8113
8113
|
cursor: "pointer"
|
|
8114
8114
|
});
|
|
8115
|
+
var GoBackButtonStyled = styled("button", {
|
|
8116
|
+
background: "none",
|
|
8117
|
+
padding: "0",
|
|
8118
|
+
border: "none",
|
|
8119
|
+
cursor: "pointer"
|
|
8120
|
+
});
|
|
8115
8121
|
|
|
8116
8122
|
// src/components/Drawer/index.tsx
|
|
8117
8123
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
@@ -8121,7 +8127,9 @@ function Drawer({
|
|
|
8121
8127
|
width,
|
|
8122
8128
|
backgroundColor,
|
|
8123
8129
|
title,
|
|
8124
|
-
children
|
|
8130
|
+
children,
|
|
8131
|
+
goBackIcon,
|
|
8132
|
+
goBackAction
|
|
8125
8133
|
}) {
|
|
8126
8134
|
if (!isOpen) return null;
|
|
8127
8135
|
const drawerContainerRef = (0, import_react8.useRef)(null);
|
|
@@ -8175,7 +8183,10 @@ function Drawer({
|
|
|
8175
8183
|
},
|
|
8176
8184
|
children: [
|
|
8177
8185
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DrawerHeaderDiv, { children: [
|
|
8178
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.
|
|
8186
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex2, { gap: 8, align: "center", children: [
|
|
8187
|
+
goBackIcon && goBackIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(GoBackButtonStyled, { type: "button", onClick: goBackAction, children: goBackIcon }),
|
|
8188
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DrawerHeaderTitle, { children: title })
|
|
8189
|
+
] }),
|
|
8179
8190
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DrawerHeaderCloseButton, { onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon_default, { size: "xl", color: "$dark600", name: "xmark" }) })
|
|
8180
8191
|
] }),
|
|
8181
8192
|
children
|
|
@@ -9455,8 +9466,10 @@ var itemStyle = {
|
|
|
9455
9466
|
}
|
|
9456
9467
|
};
|
|
9457
9468
|
var StyledItem2 = styled("div", __spreadValues({}, itemStyle));
|
|
9458
|
-
var
|
|
9459
|
-
cursor: "pointer"
|
|
9469
|
+
var CloseBtnStyled = styled("button", {
|
|
9470
|
+
cursor: "pointer",
|
|
9471
|
+
background: "none",
|
|
9472
|
+
border: "none"
|
|
9460
9473
|
});
|
|
9461
9474
|
var StyledFlexWithMaxHeight = styled(Flex2, {
|
|
9462
9475
|
variants: {
|
|
@@ -9682,6 +9695,7 @@ var MultiSelect = import_react16.default.forwardRef(
|
|
|
9682
9695
|
{
|
|
9683
9696
|
css: itemStyle,
|
|
9684
9697
|
onClick: (e) => handleSelectAll(e),
|
|
9698
|
+
type: "button",
|
|
9685
9699
|
children: [
|
|
9686
9700
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: allOptionsSelected ? "checked" : "" }),
|
|
9687
9701
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { typography: "labelSmall", children: selectedAllText ? selectedAllText : "Selecionar Todos" })
|
|
@@ -9722,13 +9736,13 @@ var MultiSelect = import_react16.default.forwardRef(
|
|
|
9722
9736
|
css: { flexWrap: "wrap" },
|
|
9723
9737
|
children: [
|
|
9724
9738
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
9725
|
-
|
|
9739
|
+
CloseBtnStyled,
|
|
9726
9740
|
{
|
|
9727
9741
|
onClick: (e) => {
|
|
9728
9742
|
e.stopPropagation();
|
|
9729
9743
|
handleRemove(value);
|
|
9730
9744
|
},
|
|
9731
|
-
|
|
9745
|
+
type: "button",
|
|
9732
9746
|
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons3.faSquareXmark, size: "sm" })
|
|
9733
9747
|
}
|
|
9734
9748
|
),
|
|
@@ -11296,7 +11310,8 @@ var QuillEditor = styled("div", {
|
|
|
11296
11310
|
marginBottom: 0
|
|
11297
11311
|
},
|
|
11298
11312
|
"& h1": {
|
|
11299
|
-
fontSize: "2em"
|
|
11313
|
+
fontSize: "2em",
|
|
11314
|
+
lineHeight: "2em!important"
|
|
11300
11315
|
},
|
|
11301
11316
|
"& h2": {
|
|
11302
11317
|
fontSize: "1.5em"
|
|
@@ -12155,6 +12170,17 @@ var QuillComponent = ({
|
|
|
12155
12170
|
const videoModalRef = (0, import_react20.useRef)(null);
|
|
12156
12171
|
const linkModalRef = (0, import_react20.useRef)(null);
|
|
12157
12172
|
const { addToast, removeToast } = useToast();
|
|
12173
|
+
const formatHTML = (html) => {
|
|
12174
|
+
const parser = new DOMParser();
|
|
12175
|
+
const doc = parser.parseFromString(html, "text/html");
|
|
12176
|
+
doc.querySelectorAll("h1").forEach((h1) => {
|
|
12177
|
+
h1.setAttribute("style", `${h1.getAttribute("style") || ""}line-height: 2em;`);
|
|
12178
|
+
});
|
|
12179
|
+
doc.querySelectorAll("img").forEach((img) => {
|
|
12180
|
+
img.setAttribute("style", `${img.getAttribute("style") || ""}max-width: 100%; height: auto; width: auto;`);
|
|
12181
|
+
});
|
|
12182
|
+
return doc.body.innerHTML;
|
|
12183
|
+
};
|
|
12158
12184
|
const modules = simpleVersion ? {
|
|
12159
12185
|
toolbar: [
|
|
12160
12186
|
["bold", "italic", "underline"],
|
|
@@ -12217,7 +12243,7 @@ var QuillComponent = ({
|
|
|
12217
12243
|
const index = selection ? selection.index : quill.getLength();
|
|
12218
12244
|
quill.insertEmbed(index, "image", uploadedFile.url);
|
|
12219
12245
|
quill.setSelection(index + 1, 0);
|
|
12220
|
-
onChange == null ? void 0 : onChange(quill.root.innerHTML);
|
|
12246
|
+
onChange == null ? void 0 : onChange(formatHTML(quill.root.innerHTML));
|
|
12221
12247
|
} catch (error) {
|
|
12222
12248
|
console.error("Erro no upload:", error);
|
|
12223
12249
|
addToast({
|
|
@@ -12252,7 +12278,7 @@ var QuillComponent = ({
|
|
|
12252
12278
|
quill.deleteText(maxLength, count - maxLength);
|
|
12253
12279
|
return;
|
|
12254
12280
|
}
|
|
12255
|
-
onChange == null ? void 0 : onChange(quill.root.innerHTML);
|
|
12281
|
+
onChange == null ? void 0 : onChange(formatHTML(quill.root.innerHTML));
|
|
12256
12282
|
onCharacterCountChange == null ? void 0 : onCharacterCountChange(count);
|
|
12257
12283
|
}
|
|
12258
12284
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -8001,6 +8001,12 @@ var DrawerHeaderCloseButton = styled("button", {
|
|
|
8001
8001
|
border: "none",
|
|
8002
8002
|
cursor: "pointer"
|
|
8003
8003
|
});
|
|
8004
|
+
var GoBackButtonStyled = styled("button", {
|
|
8005
|
+
background: "none",
|
|
8006
|
+
padding: "0",
|
|
8007
|
+
border: "none",
|
|
8008
|
+
cursor: "pointer"
|
|
8009
|
+
});
|
|
8004
8010
|
|
|
8005
8011
|
// src/components/Drawer/index.tsx
|
|
8006
8012
|
import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
@@ -8010,7 +8016,9 @@ function Drawer({
|
|
|
8010
8016
|
width,
|
|
8011
8017
|
backgroundColor,
|
|
8012
8018
|
title,
|
|
8013
|
-
children
|
|
8019
|
+
children,
|
|
8020
|
+
goBackIcon,
|
|
8021
|
+
goBackAction
|
|
8014
8022
|
}) {
|
|
8015
8023
|
if (!isOpen) return null;
|
|
8016
8024
|
const drawerContainerRef = useRef4(null);
|
|
@@ -8064,7 +8072,10 @@ function Drawer({
|
|
|
8064
8072
|
},
|
|
8065
8073
|
children: [
|
|
8066
8074
|
/* @__PURE__ */ jsxs7(DrawerHeaderDiv, { children: [
|
|
8067
|
-
/* @__PURE__ */
|
|
8075
|
+
/* @__PURE__ */ jsxs7(Flex2, { gap: 8, align: "center", children: [
|
|
8076
|
+
goBackIcon && goBackIcon && /* @__PURE__ */ jsx16(GoBackButtonStyled, { type: "button", onClick: goBackAction, children: goBackIcon }),
|
|
8077
|
+
/* @__PURE__ */ jsx16(DrawerHeaderTitle, { children: title })
|
|
8078
|
+
] }),
|
|
8068
8079
|
/* @__PURE__ */ jsx16(DrawerHeaderCloseButton, { onClick: onClose, children: /* @__PURE__ */ jsx16(Icon_default, { size: "xl", color: "$dark600", name: "xmark" }) })
|
|
8069
8080
|
] }),
|
|
8070
8081
|
children
|
|
@@ -9348,8 +9359,10 @@ var itemStyle = {
|
|
|
9348
9359
|
}
|
|
9349
9360
|
};
|
|
9350
9361
|
var StyledItem2 = styled("div", __spreadValues({}, itemStyle));
|
|
9351
|
-
var
|
|
9352
|
-
cursor: "pointer"
|
|
9362
|
+
var CloseBtnStyled = styled("button", {
|
|
9363
|
+
cursor: "pointer",
|
|
9364
|
+
background: "none",
|
|
9365
|
+
border: "none"
|
|
9353
9366
|
});
|
|
9354
9367
|
var StyledFlexWithMaxHeight = styled(Flex2, {
|
|
9355
9368
|
variants: {
|
|
@@ -9575,6 +9588,7 @@ var MultiSelect = React9.forwardRef(
|
|
|
9575
9588
|
{
|
|
9576
9589
|
css: itemStyle,
|
|
9577
9590
|
onClick: (e) => handleSelectAll(e),
|
|
9591
|
+
type: "button",
|
|
9578
9592
|
children: [
|
|
9579
9593
|
/* @__PURE__ */ jsx26("div", { className: allOptionsSelected ? "checked" : "" }),
|
|
9580
9594
|
/* @__PURE__ */ jsx26(Text, { typography: "labelSmall", children: selectedAllText ? selectedAllText : "Selecionar Todos" })
|
|
@@ -9615,13 +9629,13 @@ var MultiSelect = React9.forwardRef(
|
|
|
9615
9629
|
css: { flexWrap: "wrap" },
|
|
9616
9630
|
children: [
|
|
9617
9631
|
/* @__PURE__ */ jsx26(
|
|
9618
|
-
|
|
9632
|
+
CloseBtnStyled,
|
|
9619
9633
|
{
|
|
9620
9634
|
onClick: (e) => {
|
|
9621
9635
|
e.stopPropagation();
|
|
9622
9636
|
handleRemove(value);
|
|
9623
9637
|
},
|
|
9624
|
-
|
|
9638
|
+
type: "button",
|
|
9625
9639
|
children: /* @__PURE__ */ jsx26(FontAwesomeIcon3, { icon: faSquareXmark, size: "sm" })
|
|
9626
9640
|
}
|
|
9627
9641
|
),
|
|
@@ -11194,7 +11208,8 @@ var QuillEditor = styled("div", {
|
|
|
11194
11208
|
marginBottom: 0
|
|
11195
11209
|
},
|
|
11196
11210
|
"& h1": {
|
|
11197
|
-
fontSize: "2em"
|
|
11211
|
+
fontSize: "2em",
|
|
11212
|
+
lineHeight: "2em!important"
|
|
11198
11213
|
},
|
|
11199
11214
|
"& h2": {
|
|
11200
11215
|
fontSize: "1.5em"
|
|
@@ -12053,6 +12068,17 @@ var QuillComponent = ({
|
|
|
12053
12068
|
const videoModalRef = useRef8(null);
|
|
12054
12069
|
const linkModalRef = useRef8(null);
|
|
12055
12070
|
const { addToast, removeToast } = useToast();
|
|
12071
|
+
const formatHTML = (html) => {
|
|
12072
|
+
const parser = new DOMParser();
|
|
12073
|
+
const doc = parser.parseFromString(html, "text/html");
|
|
12074
|
+
doc.querySelectorAll("h1").forEach((h1) => {
|
|
12075
|
+
h1.setAttribute("style", `${h1.getAttribute("style") || ""}line-height: 2em;`);
|
|
12076
|
+
});
|
|
12077
|
+
doc.querySelectorAll("img").forEach((img) => {
|
|
12078
|
+
img.setAttribute("style", `${img.getAttribute("style") || ""}max-width: 100%; height: auto; width: auto;`);
|
|
12079
|
+
});
|
|
12080
|
+
return doc.body.innerHTML;
|
|
12081
|
+
};
|
|
12056
12082
|
const modules = simpleVersion ? {
|
|
12057
12083
|
toolbar: [
|
|
12058
12084
|
["bold", "italic", "underline"],
|
|
@@ -12115,7 +12141,7 @@ var QuillComponent = ({
|
|
|
12115
12141
|
const index = selection ? selection.index : quill.getLength();
|
|
12116
12142
|
quill.insertEmbed(index, "image", uploadedFile.url);
|
|
12117
12143
|
quill.setSelection(index + 1, 0);
|
|
12118
|
-
onChange == null ? void 0 : onChange(quill.root.innerHTML);
|
|
12144
|
+
onChange == null ? void 0 : onChange(formatHTML(quill.root.innerHTML));
|
|
12119
12145
|
} catch (error) {
|
|
12120
12146
|
console.error("Erro no upload:", error);
|
|
12121
12147
|
addToast({
|
|
@@ -12150,7 +12176,7 @@ var QuillComponent = ({
|
|
|
12150
12176
|
quill.deleteText(maxLength, count - maxLength);
|
|
12151
12177
|
return;
|
|
12152
12178
|
}
|
|
12153
|
-
onChange == null ? void 0 : onChange(quill.root.innerHTML);
|
|
12179
|
+
onChange == null ? void 0 : onChange(formatHTML(quill.root.innerHTML));
|
|
12154
12180
|
onCharacterCountChange == null ? void 0 : onCharacterCountChange(count);
|
|
12155
12181
|
}
|
|
12156
12182
|
});
|
package/package.json
CHANGED
|
@@ -7,8 +7,10 @@ import {
|
|
|
7
7
|
DrawerHeaderDiv,
|
|
8
8
|
DrawerHeaderTitle,
|
|
9
9
|
DrawerHeaderCloseButton,
|
|
10
|
+
GoBackButtonStyled,
|
|
10
11
|
} from "./styledComponents";
|
|
11
12
|
import { useOnClickOutside } from "../../hooks/useOnClickOutside";
|
|
13
|
+
import { Flex } from "../Flex";
|
|
12
14
|
|
|
13
15
|
export type DrawerProps = ComponentProps<typeof DrawerOverlayStyled> & {
|
|
14
16
|
isOpen: boolean;
|
|
@@ -17,6 +19,8 @@ export type DrawerProps = ComponentProps<typeof DrawerOverlayStyled> & {
|
|
|
17
19
|
backgroundColor?: keyof Colors;
|
|
18
20
|
title: string;
|
|
19
21
|
children?: ReactNode;
|
|
22
|
+
goBackIcon?: ReactNode;
|
|
23
|
+
goBackAction: () => void;
|
|
20
24
|
};
|
|
21
25
|
|
|
22
26
|
export function Drawer({
|
|
@@ -26,6 +30,8 @@ export function Drawer({
|
|
|
26
30
|
backgroundColor,
|
|
27
31
|
title,
|
|
28
32
|
children,
|
|
33
|
+
goBackIcon,
|
|
34
|
+
goBackAction
|
|
29
35
|
}: DrawerProps) {
|
|
30
36
|
if (!isOpen) return null;
|
|
31
37
|
const drawerContainerRef = useRef<HTMLDivElement>(null);
|
|
@@ -117,7 +123,10 @@ export function Drawer({
|
|
|
117
123
|
}}
|
|
118
124
|
>
|
|
119
125
|
<DrawerHeaderDiv>
|
|
120
|
-
<
|
|
126
|
+
<Flex gap={8} align="center">
|
|
127
|
+
{(goBackIcon && goBackIcon) && <GoBackButtonStyled type="button" onClick={goBackAction}>{goBackIcon}</GoBackButtonStyled>}
|
|
128
|
+
<DrawerHeaderTitle>{title}</DrawerHeaderTitle>
|
|
129
|
+
</Flex>
|
|
121
130
|
<DrawerHeaderCloseButton onClick={onClose}>
|
|
122
131
|
<Icon size={"xl"} color="$dark600" name="xmark" />
|
|
123
132
|
</DrawerHeaderCloseButton>
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { colors } from "@lets-events/tokens";
|
|
12
12
|
import { ComponentProps, useMemo } from "react";
|
|
13
13
|
import { Flex } from "../Flex";
|
|
14
|
-
import {
|
|
14
|
+
import { CloseBtnStyled, ButtonSelectAllStyled, itemStyle, StyledContent, StyledFlexSelectedItems, StyledFlexWithMaxHeight, StyledItem, StyledText, StyledTrigger } from "./styledComponents";
|
|
15
15
|
|
|
16
16
|
export type MultiSelectProps = ComponentProps<typeof StyledTrigger> & {
|
|
17
17
|
placeholder?: string;
|
|
@@ -170,6 +170,7 @@ export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
|
|
|
170
170
|
<ButtonSelectAllStyled
|
|
171
171
|
css={itemStyle}
|
|
172
172
|
onClick={(e) => handleSelectAll(e)}
|
|
173
|
+
type="button"
|
|
173
174
|
>
|
|
174
175
|
<div className={allOptionsSelected ? "checked" : ""}></div>
|
|
175
176
|
<Text typography="labelSmall">
|
|
@@ -216,15 +217,15 @@ export const MultiSelect = React.forwardRef<HTMLDivElement, MultiSelectProps>(
|
|
|
216
217
|
align={"center"}
|
|
217
218
|
css={{ flexWrap: "wrap" }}
|
|
218
219
|
>
|
|
219
|
-
<
|
|
220
|
+
<CloseBtnStyled
|
|
220
221
|
onClick={(e) => {
|
|
221
222
|
e.stopPropagation();
|
|
222
223
|
handleRemove(value);
|
|
223
224
|
}}
|
|
224
|
-
|
|
225
|
+
type="button"
|
|
225
226
|
>
|
|
226
227
|
<FontAwesomeIcon icon={faSquareXmark} size="sm" />
|
|
227
|
-
</
|
|
228
|
+
</CloseBtnStyled>
|
|
228
229
|
<Text
|
|
229
230
|
typography={"captionMedium"}
|
|
230
231
|
fontWeight={"regular"}
|
|
@@ -67,8 +67,10 @@ export const StyledItem = styled("div", {
|
|
|
67
67
|
...itemStyle,
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
-
export const
|
|
70
|
+
export const CloseBtnStyled = styled("button", {
|
|
71
71
|
cursor: "pointer",
|
|
72
|
+
background: "none",
|
|
73
|
+
border: "none",
|
|
72
74
|
});
|
|
73
75
|
|
|
74
76
|
export const StyledFlexWithMaxHeight = styled(Flex, {
|
|
@@ -26,7 +26,20 @@ const QuillComponent: React.FC<RichEditorProps> = ({
|
|
|
26
26
|
const videoModalRef = useRef<HTMLDivElement>(null);
|
|
27
27
|
const linkModalRef = useRef<HTMLDivElement>(null);
|
|
28
28
|
const { addToast, removeToast } = useToast();
|
|
29
|
+
const formatHTML = (html: string) => {
|
|
30
|
+
const parser = new DOMParser();
|
|
31
|
+
const doc = parser.parseFromString(html, "text/html");
|
|
29
32
|
|
|
33
|
+
doc.querySelectorAll("h1").forEach((h1) => {
|
|
34
|
+
h1.setAttribute("style", `${h1.getAttribute("style") || ""}line-height: 2em;`);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
doc.querySelectorAll("img").forEach((img) => {
|
|
38
|
+
img.setAttribute("style", `${img.getAttribute("style") || ""}max-width: 100%; height: auto; width: auto;`);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return doc.body.innerHTML;
|
|
42
|
+
};
|
|
30
43
|
const modules = simpleVersion
|
|
31
44
|
? {
|
|
32
45
|
toolbar: [
|
|
@@ -99,7 +112,7 @@ const QuillComponent: React.FC<RichEditorProps> = ({
|
|
|
99
112
|
const index = selection ? selection.index : quill.getLength();
|
|
100
113
|
quill.insertEmbed(index, "image", uploadedFile.url);
|
|
101
114
|
quill.setSelection(index + 1, 0);
|
|
102
|
-
onChange?.(quill.root.innerHTML);
|
|
115
|
+
onChange?.(formatHTML(quill.root.innerHTML));
|
|
103
116
|
} catch (error) {
|
|
104
117
|
console.error("Erro no upload:", error);
|
|
105
118
|
addToast({
|
|
@@ -132,15 +145,15 @@ const QuillComponent: React.FC<RichEditorProps> = ({
|
|
|
132
145
|
if (quill) {
|
|
133
146
|
quill.on("text-change", (delta: any, oldDelta: any, source: string) => {
|
|
134
147
|
if (source === "user") {
|
|
135
|
-
const text = quill.getText().trim()
|
|
136
|
-
const count = text.length
|
|
148
|
+
const text = quill.getText().trim()
|
|
149
|
+
const count = text.length
|
|
137
150
|
|
|
138
151
|
if (maxLength !== undefined && count > maxLength) {
|
|
139
|
-
quill.deleteText(maxLength, count - maxLength)
|
|
140
|
-
return
|
|
152
|
+
quill.deleteText(maxLength, count - maxLength)
|
|
153
|
+
return
|
|
141
154
|
}
|
|
142
|
-
onChange?.(quill.root.innerHTML)
|
|
143
|
-
onCharacterCountChange?.(count)
|
|
155
|
+
onChange?.(formatHTML(quill.root.innerHTML))
|
|
156
|
+
onCharacterCountChange?.(count)
|
|
144
157
|
}
|
|
145
158
|
});
|
|
146
159
|
|