Skip to content

Commit fb8b094

Browse files
committed
fix(web): omit code block controls from html table copy
1 parent ed4904c commit fb8b094

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

‎apps/web/src/markdown-clipboard.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ describe("copying a table as HTML", () => {
498498
expect(
499499
content(
500500
new FakeText("run:"),
501+
new FakeElement("DIV", ["select-none"]).append(new FakeText("madeup")),
501502
new FakeElement("PRE").append(
502503
new FakeElement("CODE").append(new FakeText("if x:\n\ty = 1\n\nend\n")),
503504
),

‎apps/web/src/markdown-clipboard.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ function collectHtmlCellText(node: Node, parts: string[], preformatted: boolean)
438438
}
439439
if (child.nodeType !== Node.ELEMENT_NODE) continue;
440440
const element = child as Element;
441+
if (isSkippedElement(element)) continue;
441442
if (element.hasAttribute("data-markdown-math")) {
442443
parts.push(element.getAttribute("data-markdown-copy")?.trim() ?? "");
443444
continue;

0 commit comments

Comments
 (0)