There was an error while loading. Please reload this page.
1 parent f075a58 commit c4556abCopy full SHA for c4556ab
1 file changed
apps/web/src/markdown-clipboard.ts
@@ -301,6 +301,17 @@ export function chatMarkdownClipboardPayload(
301
if (range.collapsed) continue;
302
const container = document.createElement("div");
303
container.appendChild(range.cloneContents());
304
+ const ancestor = range.commonAncestorContainer;
305
+ const ancestorElement =
306
+ ancestor.nodeType === Node.ELEMENT_NODE ? (ancestor as Element) : ancestor.parentElement;
307
+ if (ancestorElement?.closest("pre")) {
308
+ const text = range.toString();
309
+ if (text) {
310
+ texts.push(text);
311
+ htmls.push(sanitizedHtmlFrom(container));
312
+ }
313
+ continue;
314
315
const text = serializeRenderedMarkdownFragment(container);
316
if (!text) continue;
317
texts.push(text);
0 commit comments