Add htmlEmbed to the schema toYdoc/fromYdoc acceptance cases, asserting source + height survive, so removing the passthrough node (which prevents 'Unknown node type: htmlEmbed' on MCP/AI edits of an embed page) fails CI. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -53,6 +53,10 @@ const cases = {
|
||||
video: docOf({ type: "video", attrs: { src: "http://x/v.mp4" } }),
|
||||
youtube: docOf({ type: "youtube", attrs: { src: "http://y/watch" } }),
|
||||
embed: docOf({ type: "embed", attrs: { src: "http://e", provider: "iframe" } }),
|
||||
htmlEmbed: docOf({
|
||||
type: "htmlEmbed",
|
||||
attrs: { source: "<script>track()</script>", height: 320 },
|
||||
}),
|
||||
drawio: docOf({ type: "drawio", attrs: { src: "http://d" } }),
|
||||
excalidraw: docOf({ type: "excalidraw", attrs: { src: "http://e" } }),
|
||||
columns: docOf({
|
||||
@@ -75,3 +79,19 @@ for (const [name, doc] of Object.entries(cases)) {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// htmlEmbed is the sandboxed raw-HTML block. The MCP write path carries it
|
||||
// through Yjs (toYdoc -> fromYdoc) without rendering, so a full round-trip must
|
||||
// preserve both the `source` snippet and the numeric `height`.
|
||||
test("htmlEmbed round-trips source and height through Yjs", () => {
|
||||
const doc = docOf({
|
||||
type: "htmlEmbed",
|
||||
attrs: { source: "<iframe src='x'></iframe>", height: 480 },
|
||||
});
|
||||
const ydoc = TiptapTransformer.toYdoc(doc, "default", docmostExtensions);
|
||||
const back = TiptapTransformer.fromYdoc(ydoc, "default");
|
||||
const node = back.content.find((n) => n.type === "htmlEmbed");
|
||||
assert.ok(node, "htmlEmbed node survives the round-trip");
|
||||
assert.equal(node.attrs.source, "<iframe src='x'></iframe>");
|
||||
assert.equal(node.attrs.height, 480);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user