@flozy/editor 5.8.2 → 5.8.3
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,8 +1,7 @@
|
|
1
1
|
import { Transforms, Editor, Element, Node, Path } from "slate";
|
2
2
|
import deserialize from "../helper/deserialize";
|
3
3
|
import { decodeAndParseBase64 } from "../utils/helper";
|
4
|
-
|
5
|
-
|
4
|
+
import convertMDToHTML from "../helper/markdown";
|
6
5
|
const avoidDefaultInsert = ["table", "grid"];
|
7
6
|
const NON_TEXT_TAGS = ["ol", "ul", "img", "table", "video", "a", "button", "GOOGLE-SHEETS-HTML-ORIGIN"];
|
8
7
|
const ALLOWED_TEXT_NODES = ["paragraph", "title", "headingOne", "headingTwo", "headingThree"];
|
@@ -276,14 +275,15 @@ const withHtml = editor => {
|
|
276
275
|
Transforms.insertFragment(editor, formattedFragment);
|
277
276
|
return;
|
278
277
|
} else {
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
insertData(data);
|
278
|
+
const html = convertMDToHTML(data.getData("text/plain"));
|
279
|
+
let parsed = new DOMParser().parseFromString(html, "text/html");
|
280
|
+
parsed = parseCopiedHTML(html);
|
281
|
+
const fragment = deserialize(parsed.body);
|
282
|
+
Transforms.insertFragment(editor, fragment);
|
283
|
+
// insertData(data);
|
285
284
|
}
|
286
285
|
};
|
286
|
+
|
287
287
|
return editor;
|
288
288
|
};
|
289
289
|
export default withHtml;
|