From bfac67b1bf404f38a3582c5a89cd31ef368ada68 Mon Sep 17 00:00:00 2001 From: Matthew Mikolay Date: Mon, 10 Jun 2024 10:39:04 -0400 Subject: [PATCH 1/2] Update add_text_node in from_dom.py --- prosemirror/model/from_dom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prosemirror/model/from_dom.py b/prosemirror/model/from_dom.py index 994a2e9..fa5696f 100644 --- a/prosemirror/model/from_dom.py +++ b/prosemirror/model/from_dom.py @@ -568,7 +568,7 @@ def add_text_node(self, dom_: DOMNode) -> None: re.search(r"^[ \t\r\n\u000c]", value) is not None and self.open == len(self.nodes) - 1 ): - node_before = top.content[-1] + node_before = top.content[-1] if top.content else None dom_node_before = dom_.getprevious() if ( node_before is None From 8d4bd0f6acdb7304a80759b140e0904f165da156 Mon Sep 17 00:00:00 2001 From: Matthew Mikolay Date: Tue, 11 Jun 2024 09:58:28 -0400 Subject: [PATCH 2/2] Add UT --- tests/prosemirror_model/tests/test_dom.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/prosemirror_model/tests/test_dom.py b/tests/prosemirror_model/tests/test_dom.py index c06b529..481ef6e 100644 --- a/tests/prosemirror_model/tests/test_dom.py +++ b/tests/prosemirror_model/tests/test_dom.py @@ -178,6 +178,25 @@ def test_html_is_escaped(): ], }, ), + ( + "Indented HTML", + """ +
+

+ test +

+
+ """, + { + "type": "doc", + "content": [ + { + "type": "paragraph", + "content": [{"type": "text", "text": "test"}], + }, + ], + }, + ), ( "Styled(marks) nodes pt1", """

test some bolded text

""",