复制某个svg图中隐含的latex公式,目前只在知乎上测试过,有效性待验证
document.querySelector("body").onclick = function(e){
let target = e.target
if(target.tagName==='svg' && target.parentNode.className.contains('MathJax_SVG') ){
let node = e.target
while(!node.dataset.tex && node){
node = node.parentNode
}
let formula = node?.dataset.tex
//console.log(formula)
navigator.clipboard.writeText(formula).then(text=>{console.log('复制', formula, '到剪切板')})
}
}