@lets-events/react 12.2.8 → 12.2.10

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
 
2
2
 
3
- > @lets-events/react@12.2.8 build
3
+ > @lets-events/react@12.2.10 build
4
4
  > tsup src/index.tsx --format esm,cjs --dts --external react
5
5
 
6
6
  CLI Building entry: src/index.tsx
@@ -10,12 +10,12 @@
10
10
  CLI Target: es6
11
11
  ESM Build start
12
12
  CJS Build start
13
- CJS dist/index.js 394.03 KB
14
- CJS ⚡️ Build success in 600ms
15
- ESM dist/index.mjs 380.08 KB
16
- ESM ⚡️ Build success in 602ms
13
+ ESM dist/index.mjs 379.95 KB
14
+ ESM ⚡️ Build success in 300ms
15
+ CJS dist/index.js 393.90 KB
16
+ CJS ⚡️ Build success in 301ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 9746ms
18
+ DTS ⚡️ Build success in 5682ms
19
19
  DTS dist/index.d.mts 389.25 KB
20
20
  DTS dist/index.d.ts 389.25 KB
21
21
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lets-events/react
2
2
 
3
+ ## 12.2.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Simple Version RichEditor
8
+
9
+ ## 12.2.9
10
+
11
+ ### Patch Changes
12
+
13
+ - RichEditor stylization
14
+
3
15
  ## 12.2.8
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -14747,7 +14747,7 @@ type RichEditorFormFieldProps = Omit<RichEditorProps, "value" | "onChange"> & {
14747
14747
  maxLength?: number;
14748
14748
  validationErrorMessage?: string;
14749
14749
  simpleVersion?: boolean;
14750
- uploadConfig: RichEditorProps["uploadConfig"];
14750
+ uploadConfig?: RichEditorProps["uploadConfig"];
14751
14751
  disableVideo?: boolean;
14752
14752
  };
14753
14753
  declare const RichEditorFormField: ({ name, label, required, validate, validationErrorMessage, maxLength, simpleVersion, disableVideo, ...props }: RichEditorFormFieldProps) => react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -14747,7 +14747,7 @@ type RichEditorFormFieldProps = Omit<RichEditorProps, "value" | "onChange"> & {
14747
14747
  maxLength?: number;
14748
14748
  validationErrorMessage?: string;
14749
14749
  simpleVersion?: boolean;
14750
- uploadConfig: RichEditorProps["uploadConfig"];
14750
+ uploadConfig?: RichEditorProps["uploadConfig"];
14751
14751
  disableVideo?: boolean;
14752
14752
  };
14753
14753
  declare const RichEditorFormField: ({ name, label, required, validate, validationErrorMessage, maxLength, simpleVersion, disableVideo, ...props }: RichEditorFormFieldProps) => react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -12189,19 +12189,15 @@ var QuillComponent = ({
12189
12189
  const formatHTML = (html) => {
12190
12190
  const parser = new DOMParser();
12191
12191
  const doc = parser.parseFromString(html, "text/html");
12192
- doc.querySelectorAll("h1").forEach((h1) => {
12193
- h1.setAttribute("style", `${h1.getAttribute("style") || ""}line-height: 2em;`);
12194
- });
12195
- doc.querySelectorAll("img").forEach((img) => {
12196
- img.setAttribute("style", `${img.getAttribute("style") || ""}max-width: 100%; height: auto; width: auto;`);
12197
- });
12198
12192
  return doc.body.innerHTML;
12199
12193
  };
12200
12194
  const modules = simpleVersion ? {
12201
12195
  toolbar: [
12196
+ [{ header: [1, 2, false] }],
12202
12197
  ["bold", "italic", "underline"],
12203
- [{ list: "ordered" }, { list: "bullet" }],
12204
- ["link"]
12198
+ [{ color: [] }, { background: [] }],
12199
+ [{ align: [] }],
12200
+ [{ list: "ordered" }, { list: "bullet" }]
12205
12201
  ],
12206
12202
  clipboard: {
12207
12203
  matchVisual: false
@@ -12270,7 +12266,9 @@ var QuillComponent = ({
12270
12266
  const selection = quill.getSelection();
12271
12267
  const index = selection ? selection.index : quill.getLength();
12272
12268
  quill.insertEmbed(index, "image", uploadedFile.url);
12273
- quill.setSelection(index + 1, 0);
12269
+ quill.insertText(index + 1, "\n");
12270
+ quill.setSelection(index + 2, 0);
12271
+ quill.focus();
12274
12272
  onChange == null ? void 0 : onChange(formatHTML(quill.root.innerHTML));
12275
12273
  } catch (error) {
12276
12274
  console.error("Erro no upload:", error);
@@ -12280,7 +12278,7 @@ var QuillComponent = ({
12280
12278
  });
12281
12279
  }
12282
12280
  }),
12283
- [disabled, quill, addToast, removeToast, uploadConfig]
12281
+ [disabled, quill, addToast, removeToast, uploadConfig, onChange]
12284
12282
  );
12285
12283
  (0, import_react20.useEffect)(() => {
12286
12284
  if (quill && value) {
@@ -12663,7 +12661,8 @@ var RichEditorFormField = (_a) => {
12663
12661
  "aria-labelledby": `${name}-label`,
12664
12662
  onCharacterCountChange: handleCharacterCountChange,
12665
12663
  maxLength,
12666
- disableVideo
12664
+ disableVideo,
12665
+ simpleVersion
12667
12666
  })
12668
12667
  ),
12669
12668
  /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ErrorFormMessage, { message: errorMsg })
package/dist/index.mjs CHANGED
@@ -12087,19 +12087,15 @@ var QuillComponent = ({
12087
12087
  const formatHTML = (html) => {
12088
12088
  const parser = new DOMParser();
12089
12089
  const doc = parser.parseFromString(html, "text/html");
12090
- doc.querySelectorAll("h1").forEach((h1) => {
12091
- h1.setAttribute("style", `${h1.getAttribute("style") || ""}line-height: 2em;`);
12092
- });
12093
- doc.querySelectorAll("img").forEach((img) => {
12094
- img.setAttribute("style", `${img.getAttribute("style") || ""}max-width: 100%; height: auto; width: auto;`);
12095
- });
12096
12090
  return doc.body.innerHTML;
12097
12091
  };
12098
12092
  const modules = simpleVersion ? {
12099
12093
  toolbar: [
12094
+ [{ header: [1, 2, false] }],
12100
12095
  ["bold", "italic", "underline"],
12101
- [{ list: "ordered" }, { list: "bullet" }],
12102
- ["link"]
12096
+ [{ color: [] }, { background: [] }],
12097
+ [{ align: [] }],
12098
+ [{ list: "ordered" }, { list: "bullet" }]
12103
12099
  ],
12104
12100
  clipboard: {
12105
12101
  matchVisual: false
@@ -12168,7 +12164,9 @@ var QuillComponent = ({
12168
12164
  const selection = quill.getSelection();
12169
12165
  const index = selection ? selection.index : quill.getLength();
12170
12166
  quill.insertEmbed(index, "image", uploadedFile.url);
12171
- quill.setSelection(index + 1, 0);
12167
+ quill.insertText(index + 1, "\n");
12168
+ quill.setSelection(index + 2, 0);
12169
+ quill.focus();
12172
12170
  onChange == null ? void 0 : onChange(formatHTML(quill.root.innerHTML));
12173
12171
  } catch (error) {
12174
12172
  console.error("Erro no upload:", error);
@@ -12178,7 +12176,7 @@ var QuillComponent = ({
12178
12176
  });
12179
12177
  }
12180
12178
  }),
12181
- [disabled, quill, addToast, removeToast, uploadConfig]
12179
+ [disabled, quill, addToast, removeToast, uploadConfig, onChange]
12182
12180
  );
12183
12181
  useEffect6(() => {
12184
12182
  if (quill && value) {
@@ -12561,7 +12559,8 @@ var RichEditorFormField = (_a) => {
12561
12559
  "aria-labelledby": `${name}-label`,
12562
12560
  onCharacterCountChange: handleCharacterCountChange,
12563
12561
  maxLength,
12564
- disableVideo
12562
+ disableVideo,
12563
+ simpleVersion
12565
12564
  })
12566
12565
  ),
12567
12566
  /* @__PURE__ */ jsx53(ErrorFormMessage, { message: errorMsg })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "12.2.8",
3
+ "version": "12.2.10",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -17,7 +17,7 @@ export type RichEditorFormFieldProps = Omit<
17
17
  maxLength?: number;
18
18
  validationErrorMessage?: string;
19
19
  simpleVersion?: boolean;
20
- uploadConfig: RichEditorProps["uploadConfig"];
20
+ uploadConfig?: RichEditorProps["uploadConfig"];
21
21
  disableVideo?: boolean
22
22
  };
23
23
 
@@ -95,6 +95,7 @@ export const RichEditorFormField = ({
95
95
  onCharacterCountChange={handleCharacterCountChange}
96
96
  maxLength={maxLength}
97
97
  disableVideo={disableVideo}
98
+ simpleVersion={simpleVersion}
98
99
  />
99
100
  <ErrorFormMessage message={errorMsg} />
100
101
  </Flex>
@@ -31,22 +31,16 @@ const QuillComponent: React.FC<RichEditorProps> = ({
31
31
  const parser = new DOMParser();
32
32
  const doc = parser.parseFromString(html, "text/html");
33
33
 
34
- doc.querySelectorAll("h1").forEach((h1) => {
35
- h1.setAttribute("style", `${h1.getAttribute("style") || ""}line-height: 2em;`);
36
- });
37
-
38
- doc.querySelectorAll("img").forEach((img) => {
39
- img.setAttribute("style", `${img.getAttribute("style") || ""}max-width: 100%; height: auto; width: auto;`);
40
- });
41
-
42
34
  return doc.body.innerHTML;
43
35
  };
44
36
  const modules = simpleVersion
45
37
  ? {
46
38
  toolbar: [
39
+ [{ header: [1, 2, false] }],
47
40
  ["bold", "italic", "underline"],
41
+ [{ color: [] }, { background: [] }],
42
+ [{ align: [] }],
48
43
  [{ list: "ordered" }, { list: "bullet" }],
49
- ["link"],
50
44
  ],
51
45
  clipboard: {
52
46
  matchVisual: false,
@@ -124,7 +118,12 @@ const QuillComponent: React.FC<RichEditorProps> = ({
124
118
  const selection = quill.getSelection();
125
119
  const index = selection ? selection.index : quill.getLength();
126
120
  quill.insertEmbed(index, "image", uploadedFile.url);
127
- quill.setSelection(index + 1, 0);
121
+
122
+ quill.insertText(index + 1, "\n");
123
+ quill.setSelection(index + 2, 0);
124
+
125
+ quill.focus();
126
+
128
127
  onChange?.(formatHTML(quill.root.innerHTML));
129
128
  } catch (error) {
130
129
  console.error("Erro no upload:", error);
@@ -135,7 +134,7 @@ const QuillComponent: React.FC<RichEditorProps> = ({
135
134
  });
136
135
  }
137
136
  },
138
- [disabled, quill, addToast, removeToast, uploadConfig]
137
+ [disabled, quill, addToast, removeToast, uploadConfig, onChange]
139
138
  );
140
139
 
141
140
  useEffect(() => {