保熟的呆瓜 (@youwen)js 拷贝html富文本 中发帖

找了不少文章,筛选出几个精华分享给佬友。 
目标: js 精准拷贝长页面富文本内容, 避免手工选择不准确。 用以方便直接粘贴到富文本中。
问题背景
拷贝后粘贴不如所愿
https://www.stefanjudis.com/notes/a-clipboard-magic-trick-how-to-use-different-mime-types-with-the-clipboard/
解决办法
const richTextDiv = document.getElementById("richTextDiv");

const clipboardItem = new ClipboardItem({
"text/plain": new Blob(
[richTextDiv.innerText],
{ type: "text/plain" }
),
"text/html": ...