@@ -20,16 +20,22 @@ MathJax = {
2020 }
2121 } ,
2222 startup : {
23- ready ( ) {
24- MathJax . _ . output . chtml_ts . CHTML . commonStyles [ 'mjx-copytext' ] = {
25- display : 'inline-block' ,
26- position : 'absolute' ,
27- top : 0 , left : 0 , width : 0 , height : 0 ,
28- opacity : 0 ,
29- overflow : 'hidden'
30- } ;
31- MathJax . startup . defaultReady ( ) ;
32- }
23+ ready ( ) {
24+ const { newState, STATE } = MathJax . _ . core . MathItem ;
25+ const { AbstractMathDocument} = MathJax . _ . core . MathDocument ;
26+ const { CHTML } = MathJax . _ . output . chtml_ts ;
27+ newState ( 'ADDTEXT' , 156 ) ;
28+ AbstractMathDocument . ProcessBits . allocate ( 'addtext' ) ;
29+ CHTML . commonStyles [ 'mjx-copytext' ] = {
30+ display : 'inline-block' ,
31+ position : 'absolute' ,
32+ top : 0 , left : 0 , width : 0 , height : 0 ,
33+ opacity : 0 ,
34+ overflow : 'hidden'
35+ } ;
36+ MathJax . STATE = STATE ;
37+ MathJax . startup . defaultReady ( ) ;
38+ }
3339 } ,
3440 tex : {
3541 inlineMath : [ [ "\\(" , "\\)" ] ] ,
@@ -41,8 +47,13 @@ MathJax = {
4147 ignoreHtmlClass : ".*|" ,
4248 processHtmlClass : "arithmatex" ,
4349 renderActions : {
44- addCopyText : [ 155 ,
45- ( doc ) => { for ( const math of doc . math ) MathJax . config . addCopyText ( math , doc ) } ,
50+ addCopyText : [ 156 ,
51+ ( doc ) => {
52+ if ( ! doc . processed . isSet ( 'addtext' ) ) {
53+ for ( const math of doc . math ) MathJax . config . addCopyText ( math , doc ) ;
54+ doc . processed . set ( 'addtext' ) ;
55+ }
56+ } ,
4657 ( math , doc ) => MathJax . config . addCopyText ( math , doc )
4758 ]
4859 }
0 commit comments