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