diff --git a/web/app/views/page-header.php b/web/app/views/page-header.php index c6d1af3..cd105f7 100644 --- a/web/app/views/page-header.php +++ b/web/app/views/page-header.php @@ -180,7 +180,50 @@ if (!isset($ShowPageHeader)) { skipHtmlTags: { '[-]': ['pre'] }, - } + renderActions: { + addCopyText: [ + 155, + (doc) => { + for (const math of doc.math) { + MathJax.config.addCopyText(math, doc); + } + }, + function(math, doc) { + MathJax.config.addCopyText(math, doc); + } + ] + }, + }, + addCopyText(math, doc) { + doc.adaptor.append( + math.typesetRoot, + doc.adaptor.node( + 'mjx-copytext', { + 'aria-hidden': true, + }, + [ + doc.adaptor.text( + math.start.delim + + math.math + + math.end.delim) + ] + ) + ); + }, + startup: { + ready() { + MathJax._.output.chtml_ts.CHTML.commonStyles['mjx-copytext'] = { + display: 'inline-block', + position: 'absolute', + top: 0, + left: 0, + width: 0, + height: 0, + opacity: 0, + }; + MathJax.startup.defaultReady(); + } + }, };