diff --git a/test/baselines/generated-reference/assets-inline.html b/test/baselines/generated-reference/assets-inline.html index 47d493c1..0acd1231 100644 --- a/test/baselines/generated-reference/assets-inline.html +++ b/test/baselines/generated-reference/assets-inline.html @@ -1486,6 +1486,25 @@ }); }); +// Omit indendation when copying a single algorithm step. +document.addEventListener('copy', evt => { + const selection = getSelection(); + const singleRange = selection?.rangeCount === 1 && selection.getRangeAt(0); + const container = singleRange?.commonAncestorContainer; + if (!container?.querySelector("span[aria-hidden='true']")) { + return; + } + const clone = document.createElement('div'); + clone.append(singleRange.cloneContents()); + const lastHidden = [...clone.querySelectorAll("span[aria-hidden='true']")].at(-1); + if (lastHidden.previousSibling || lastHidden.parentNode !== clone) { + return; + } + evt.clipboardData.setData('text/plain', clone.textContent.trimStart()); + evt.clipboardData.setData('text/html', clone.innerHTML); + evt.preventDefault(); +}); + 'use strict'; // Update superscripts to not suffer misinterpretation when copied and pasted as plain text.