Skip to content

Commit

Permalink
Update fixture to include new JS
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 committed Aug 27, 2024
1 parent 2b206c7 commit fe10a0b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/baselines/generated-reference/assets-inline.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit fe10a0b

Please sign in to comment.