l-min-components 1.0.1066 → 1.0.1068

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.0.1066",
3
+ "version": "1.0.1068",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -1,20 +1,26 @@
1
1
  import React, { useEffect, useState } from "react";
2
2
  import { Editor } from "react-draft-wysiwyg";
3
- import { EditorState, convertToRaw, ContentState } from "draft-js";
3
+ import {
4
+ EditorState,
5
+ convertToRaw,
6
+ ContentState,
7
+ convertFromHTML,
8
+ } from "draft-js";
4
9
  import "react-draft-wysiwyg/dist/react-draft-wysiwyg.css";
5
10
  import toalbarOptions from "./toalbarOptions";
6
11
  import { Container } from "./styled";
7
12
  import draftToHtml from "draftjs-to-html";
8
- import htmlToDraft from "html-to-draftjs";
13
+ // import htmlToDraft from "html-to-draftjs";
9
14
 
10
15
  function TextEditor({ onChange, defaultValue }) {
11
16
  let defaultState;
12
17
 
13
18
  if (defaultValue) {
14
- const contentBlock = htmlToDraft(defaultValue);
19
+ const contentBlock = convertFromHTML(defaultValue);
15
20
  if (contentBlock) {
16
- const contentState = ContentState.createFromBlockArray(
17
- contentBlock.contentBlocks
21
+ const contentState = ContentState?.createFromBlockArray(
22
+ contentBlock?.contentBlocks,
23
+ contentBlock?.entityMap
18
24
  );
19
25
  defaultState = EditorState?.createWithContent(contentState);
20
26
  }