tiptap-markdown-react 0.14.2 → 0.14.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.
package/dist/index.js CHANGED
@@ -1882,6 +1882,23 @@ function MarkdownPreview({
1882
1882
  },
1883
1883
  [extensions]
1884
1884
  );
1885
+ useEffect(() => {
1886
+ if (!editor) return;
1887
+ const strip = () => {
1888
+ const { doc, tr } = editor.state;
1889
+ const last = doc.lastChild;
1890
+ if (doc.childCount > 1 && (last == null ? void 0 : last.type.name) === "paragraph" && last.content.size === 0) {
1891
+ editor.view.dispatch(
1892
+ tr.delete(doc.content.size - last.nodeSize, doc.content.size)
1893
+ );
1894
+ }
1895
+ };
1896
+ strip();
1897
+ editor.on("update", strip);
1898
+ return () => {
1899
+ editor.off("update", strip);
1900
+ };
1901
+ }, [editor]);
1885
1902
  useEffect(() => {
1886
1903
  if (!editor) return;
1887
1904
  editor.commands.setContent(prepared, { contentType: "markdown" });