MCPcopy Create free account
hub / github.com/cp-algorithms/cp-algorithms / addCopyText

Function addCopyText

src/javascript/config.js:3–21  ·  view source on GitHub ↗
(math, doc)

Source from the content-addressed store, hash-verified

1// Makes text selectable
2MathJax = {
3 addCopyText(math, doc) {
4 if (math.state() < MathJax.STATE.ADDTEXT) {
5 if (!math.isEscaped) {
6 const adaptor = doc.adaptor;
7 const text = adaptor.node('span', {'aria-hidden': true, 'class': 'mathjax_ignore mjx-copytext'}, [
8 adaptor.text(math.start.delim + math.math + math.end.delim)
9 ]);
10 adaptor.append(math.typesetRoot, text);
11 // Insert thin space(s) if math is at begin or end of text
12 if (math.start.n == 0) {
13 adaptor.insert(adaptor.text('\u200A'), adaptor.firstChild(math.typesetRoot));
14 }
15 if (math.end.n == math.end.node.length) {
16 adaptor.append(math.typesetRoot, adaptor.text('\u200A'));
17 }
18 }
19 math.state(MathJax.STATE.ADDTEXT);
20 }
21 },
22 startup: {
23 ready() {
24 const {newState, STATE} = MathJax._.core.MathItem;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected