@@ -13,6 +13,8 @@ function renderKaTeXWithCursor(latex, el) {
1313 } ) ;
1414
1515 el . innerHTML = html . replaceAll ( "[CURSOR]" , `<span class="JLS_disp-cursor"> </span>` ) . replaceAll ( "[PH]" , `<span class="JLS_disp-item-placeholder">0</span>` ) ;
16+
17+ el . dataset . latex = latex . replace ( CURSOR_MARKER , "" ) . replace ( PLACEHOLDER_MARKER , "?" ) ;
1618}
1719
1820class NodeDict {
@@ -143,7 +145,6 @@ const nodeDataDict = {
143145 abs : node ( { label : "|x|" , key : "|" , disp : "abs" , argLength : 1 , type : "func" } ) ,
144146 reciprocal : node ( { label : "1/x" , disp : "reciprocal" , argLength : 1 , type : "func" } ) ,
145147 exp : node ( { label : "eˣ" , disp : "exp" , argLength : 1 , type : "func" } ) ,
146- exp2 : node ( { label : "2ˣ" , disp : "exp2" , argLength : 1 , type : "func" } ) ,
147148 "!" : node ( { label : "n!" , key : "!" , disp : "factorial" , argLength : 1 , type : "func" } ) ,
148149 log : node ( { label : "log" , disp : "log" , argLength : 2 , type : "func" } ) ,
149150 log2 : node ( { label : "log₂" , disp : "log2" , argLength : 1 , type : "func" } ) ,
@@ -170,7 +171,6 @@ const LaTeXTemplates = {
170171 pow2 : ( args ) => `{${ args [ 0 ] } }^{2}` ,
171172 pow10 : ( args ) => `{10}^{${ args [ 0 ] } }` ,
172173 exp : ( args ) => `e^{${ args [ 0 ] } }` ,
173- exp2 : ( args ) => `2^{${ args [ 0 ] } }` ,
174174 reciprocal : ( args ) => `\\frac{1}{${ args [ 0 ] } }` ,
175175 factorial : ( args ) => `${ args [ 0 ] } !` ,
176176 gamma : ( args ) => `\\Gamma(${ args [ 0 ] } )` ,
@@ -369,8 +369,8 @@ class Calculator {
369369 [
370370 // 2行目
371371 nodeDataDict . gamma . clone ( ) ,
372+ nodeDataDict [ "!" ] . clone ( ) ,
372373 nodeDataDict . exp . clone ( ) ,
373- nodeDataDict . exp2 . clone ( ) ,
374374 nodeDataDict . sin . clone ( ) ,
375375 nodeDataDict . cos . clone ( ) ,
376376 nodeDataDict . tan . clone ( ) ,
@@ -422,7 +422,7 @@ class Calculator {
422422 ] ,
423423 [
424424 // 8行目
425- nodeDataDict [ "!" ] . clone ( ) ,
425+ { label : "Copy" , key : "C" , type : "cursor" , func : ( ) => this . _key_C ( ) } ,
426426 nodeDataDict [ "." ] . clone ( ) ,
427427 nodeDataDict [ "0" ] . clone ( ) ,
428428 { label : "=" , key : [ "=" , "Enter" ] , type : "equal" , func : ( ) => this . _key_Enter ( ) } ,
@@ -806,6 +806,17 @@ class Calculator {
806806 this . _cursor . moveRight ( ) ;
807807 }
808808
809+ _key_C ( ) {
810+ const latex = this . _display . dataset . latex ;
811+ jasc . copy2Clipboard ( latex )
812+ . then ( ( ) => {
813+ log . log ( "LaTeXコピー成功" ) ;
814+ } )
815+ . catch ( ( error ) => {
816+ log . error ( "LaTeXコピー失敗:" , error ) ;
817+ } ) ;
818+ }
819+
809820 _key_Enter ( ) {
810821 try {
811822 this . BigFloat . config . extraPrecision = this . exPrecision ;
@@ -939,8 +950,6 @@ class Calculator {
939950 return args [ 0 ] . reciprocal ( ) ;
940951 case "exp" :
941952 return args [ 0 ] . exp ( ) ;
942- case "exp2" :
943- return args [ 0 ] . exp2 ( ) ;
944953 case "expm1" :
945954 return args [ 0 ] . expm1 ( ) ;
946955 case "ln" :
0 commit comments