Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🐛 Dedupe prosemirror-model so typing in the description editor works (#3611)

Luke Vella8aceeefad359
diff --git a/packages/ui/src/rich-text-editor.test.tsx b/packages/ui/src/rich-text-editor.test.tsx
index 28610ae75..a8eed281f 100644
--- a/packages/ui/src/rich-text-editor.test.tsx
+++ b/packages/ui/src/rich-text-editor.test.tsx
@@ -96,3 +96,29 @@ describe("RichTextEditor link validation (isAllowedUri)", () => {
}
});
});
+
+describe("RichTextEditor DOM input", () => {
+ it("reads typed text back into the document", () => {
+ // Typing goes through prosemirror-view's DOM observer, which parses the
+ // edited DOM with its own prosemirror-model. A second copy of that package
+ // in the lockfile makes this throw "Can not convert ... to a Fragment".
+ // Markdown content matters: an HTML load warms the schema's cached parser
+ // from @tiptap/pm's copy and hides the mismatch.
+ const element = document.createElement("div");
+ document.body.append(element);
+ const editor = new Editor({
+ element,
+ extensions: [...baseExtensions],
+ content: "**Lab tour,** please confirm",
+ contentType: "markdown",
+ });
+ const text = editor.view.dom.querySelector("p")?.lastChild;
+ if (!text) throw new Error("missing text node");
+ text.textContent = " please confirm today";
+ // @ts-expect-error domObserver is internal to prosemirror-view
+ editor.view.domObserver.flush();
+ expect(editor.getText()).toBe("Lab tour, please confirm today");
+ editor.destroy();
+ element.remove();
+ });
+});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 728ad4e72..0e2e32149 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -10755,9 +10755,6 @@ packages:
resolution: {integrity: sha512-4HucRlpiLd1IPQQXNqeo81BGtkY8Ai5smHhKW9jjPKRc2wQIxksg7Hl1tTI2IfT2B/LgX6bfYvXxEpJl7aKYKw==}
- resolution: {integrity: sha512-QWg9RhnpLlogAmp3p96uEFrE5txQpFynd4vhBAELkwgOCWQs/X0yCzB3/hrHqiPwf91RG5KyWq6553zs9JqIOQ==}
-
resolution: {integrity: sha512-Ue2gTmXMa7EhpLNhC7J+h4+ykD8ha12K6rrZFFKKJHBForfIStw5gJ6Zrf1mqqAa9NmpmEB4wp9bKmA4eUVjWg==}
@@ -18329,7 +18326,7 @@ snapshots:
prosemirror-history: 1.5.0
prosemirror-inputrules: 1.5.1
prosemirror-keymap: 1.2.3
- prosemirror-model: 1.25.11
+ prosemirror-model: 1.25.12
prosemirror-schema-list: 1.5.1
prosemirror-state: 1.4.4
prosemirror-tables: 1.8.5
@@ -23542,7 +23539,7 @@ snapshots:
dependencies:
- prosemirror-model: 1.25.11
+ prosemirror-model: 1.25.12
prosemirror-state: 1.4.4
prosemirror-transform: 1.12.0
@@ -23555,7 +23552,7 @@ snapshots:
dependencies:
prosemirror-keymap: 1.2.3
- prosemirror-model: 1.25.11
+ prosemirror-model: 1.25.12
prosemirror-state: 1.4.4
prosemirror-view: 1.42.6
@@ -23576,10 +23573,6 @@ snapshots:
prosemirror-state: 1.4.4
w3c-keyname: 2.2.8
- dependencies:
- orderedmap: 2.1.1
-
dependencies:
orderedmap: 2.1.1
@@ -23590,27 +23583,27 @@ snapshots:
dependencies:
- prosemirror-model: 1.25.11
+ prosemirror-model: 1.25.12
prosemirror-state: 1.4.4
prosemirror-transform: 1.12.0
dependencies:
- prosemirror-model: 1.25.11
+ prosemirror-model: 1.25.12
prosemirror-transform: 1.12.0
prosemirror-view: 1.42.6
dependencies:
prosemirror-keymap: 1.2.3
- prosemirror-model: 1.25.11
+ prosemirror-model: 1.25.12
prosemirror-state: 1.4.4
prosemirror-transform: 1.12.0
prosemirror-view: 1.42.6
dependencies:
- prosemirror-model: 1.25.11
+ prosemirror-model: 1.25.12
dependencies: