@@ -107,7 +107,7 @@ class Documentations {
107107 */
108108class KatexInputHelper {
109109
110- version = "1.0.6 " ;
110+ version = "1.0.7 " ;
111111 codeType = 'Latex' ;
112112 saveOptionInCookies = false ;
113113 isBuild = false ;
@@ -571,6 +571,13 @@ class KatexInputHelper {
571571 } ) ;
572572
573573 this . math . setEditorInstance ( this . codeMirrorEditor ) ;
574+
575+ $ ( '#divMathTextInput' ) . panel ( {
576+ onResize : function ( width , height ) {
577+ vme . codeMirrorEditor . setSize ( width , height ) ;
578+ vme . codeMirrorEditor . refresh ( ) ;
579+ }
580+ } ) ;
574581 }
575582
576583 /**
@@ -707,6 +714,17 @@ class KatexInputHelper {
707714 await vme . setUniCodesValues ( 0x25A0 , 0x25FF ) ;
708715 }
709716 } ) ;
717+
718+ $ ( 'body' ) . on ( 'click' , '#btCOPYRIGHT' , async function ( event ) {
719+ event . preventDefault ( ) ;
720+ await vme . openInformationTab ( 0 ) ;
721+ vme . setFocus ( ) ;
722+ } ) ;
723+
724+ $ ( 'body' ) . on ( 'click' , '#btTITLE_EDITION_SYNTAX,#btENCLOSE_TYPE' , async function ( event ) {
725+ event . preventDefault ( ) ;
726+ vme . setFocus ( ) ;
727+ } ) ;
710728
711729 // TEST: MAIL
712730 $ ( 'body' )
@@ -1092,7 +1110,6 @@ class KatexInputHelper {
10921110 * - setting document language
10931111 * - setting the RTL style
10941112 * - localize all entries of the UI (using *span[locate]*)
1095- * - additional statements could not be assigned to this task => TODO: separate?
10961113 */
10971114 async onLocaleChanged ( localizer ) {
10981115 this . localType = this . localizer . currentLocale ;
@@ -1112,38 +1129,20 @@ class KatexInputHelper {
11121129 }
11131130 } ) ;
11141131
1115- // PLACEMENT in Language resources, may be replaced!!
1116- $ ( "#btCOPYRIGHT" ) . click ( async function ( event ) {
1117- event . preventDefault ( ) ;
1118- await vme . openInformationTab ( 0 ) ;
1119- vme . setFocus ( ) ;
1120- } ) ;
1121-
1122- // TODO: Remove?
1123- $ ( "#btTITLE_EDITION_SYNTAX" ) . click ( function ( event ) {
1124- event . preventDefault ( ) ;
1125- vme . setFocus ( ) ;
1126- } ) ;
1127-
1128- // TODO: HTML mode deactivated, remove completely?
11291132 vme . switchHtmlMode ( vme . encloseAllFormula ) ;
1130- $ ( "#btENCLOSE_TYPE" ) . click ( function ( event ) {
1131- event . preventDefault ( ) ;
1132- vme . setFocus ( ) ;
1133- } ) ;
11341133
11351134 this . printCodeType ( ) ;
11361135 }
11371136
11381137 /**
11391138 * @abstract Handlers for the HTML toolbar buttons.
11401139 *
1141- * This is the only place, where the ColorPicker is used.
1140+ * This is the only place, where the ColorPicker is used. The click events
1141+ * are assigned to static Html content, no need to re-invoke this in
1142+ * *onLocaleChanged*.
11421143 */
11431144 htmlToolbarButtons ( ) {
11441145
1145- // TODO: it seems this code has nothing to do with language, but perhaps the visual appearance
1146- // depends on ltr - style. There seems to be no switch.
11471146 $ ( "#btHTML_STRONG" ) . click ( function ( event ) { event . preventDefault ( ) ; vme . tag ( "<strong>" , "</strong>" ) ; } ) ;
11481147 $ ( "#btHTML_EM" ) . click ( function ( event ) { event . preventDefault ( ) ; vme . tag ( "<em>" , "</em>" ) ; } ) ;
11491148 $ ( "#btHTML_U" ) . click ( function ( event ) { event . preventDefault ( ) ; vme . tag ( "<u>" , "</u>" ) ; } ) ;
@@ -1466,59 +1465,93 @@ class KatexInputHelper {
14661465 vme . symbolPanelsLoaded . push ( fPanelID ) ;
14671466 $ ( fPanel ) . html ( `<img src='js/jquery-easyui/themes/default/images/loading.gif' />` ) ;
14681467 $ ( fPanel ) . load (
1469- `formulas/` + fPanelID + " .html" ,
1468+ `formulas/${ fPanelID } .html` ,
14701469 async function ( ) {
14711470 await vme . initialiseSymbolContent ( fPanelID ) ;
1472- $ ( "#" + fPanelID + " a.more" ) . click (
1473- async function ( event ) {
1474- event . preventDefault ( ) ;
1475- await vme . initialiseUImoreDialogs ( fPanelID ) ;
1476- }
1477- ) ;
14781471 vme . themes . activateStyle ( vme . style )
14791472 }
14801473 ) ;
1474+ $ ( `#${ fPanelID } ` ) . on ( 'click' , 'a.more' ,
1475+ async function ( event ) {
1476+ event . preventDefault ( ) ;
1477+ await vme . initialiseUImoreDialogs ( fPanelID ) ;
1478+ }
1479+ ) ;
14811480 }
14821481 }
14831482 vme . setFocus ( ) ;
14841483 }
14851484 } ) ;
14861485 var p = $ ( accordionID ) . accordion ( 'getSelected' ) ;
14871486 if ( p ) { p . panel ( 'collapse' , false ) ; }
1488- this . math . updateHeaders ( ) ; // TODO: maybe this must be done only once, optimize!
1487+ this . math . updateHeaders ( ) ;
14891488 }
14901489
1490+ /**
1491+ * @abstract The routine equips the entries in the given panel with functionality.
1492+ *
1493+ * This is:
1494+ * - tool tip
1495+ * - info line
1496+ * - click event
1497+ */
14911498 async initialiseSymbolContent ( fPanelID ) {
14921499 var vme = this ;
1493- function getSymbol ( obj ) {
1494- if ( typeof ( $ ( obj ) . attr ( "lbegin" ) ) != "undefined" && typeof ( $ ( obj ) . attr ( "lend" ) ) != "undefined" ) {
1495- return $ ( obj ) . attr ( "lbegin" ) + $ ( obj ) . attr ( "lend" ) ;
1496- } else if ( typeof ( $ ( obj ) . attr ( "latex" ) ) != "undefined" ) {
1497- return $ ( obj ) . attr ( "latex" ) ;
1498- } else {
1499- return vme . getLocalText ( "NO_LATEX" ) ;
1500- }
1501- } ;
1502- $ ( "#" + fPanelID + " a.s" )
1503- . addClass ( "easyui-tooltip" )
1504- . attr ( "title" , function ( index , attr ) { return getSymbol ( this ) ; } )
1505- . mouseover ( function ( event ) { $ ( "#divInformation" ) . html ( getSymbol ( this ) ) ; } )
1506- . mouseout ( function ( event ) { $ ( "#divInformation" ) . html ( " " ) ; } )
1507- . click ( function ( event ) {
1508- console . debug ( `click event` ) ;
1509- event . preventDefault ( ) ;
1510- if ( typeof ( $ ( this ) . attr ( "lbegin" ) ) != "undefined" && typeof ( $ ( this ) . attr ( "lend" ) ) != "undefined" ) {
1511- vme . tag ( $ ( this ) . attr ( "lbegin" ) , $ ( this ) . attr ( "lend" ) ) ;
1512- } else if ( typeof ( $ ( this ) . attr ( "latex" ) ) != "undefined" ) {
1513- vme . insert ( $ ( this ) . attr ( "latex" ) ) ;
1514- } else {
1515- $ . messager . show ( {
1516- title : "<span class='rtl-title-withicon'>" + vme . getLocalText ( "INFORMATION" ) + "</span>" ,
1517- msg : vme . getLocalText ( "NO_LATEX" ) } ) ;
1518- }
1500+ /**
1501+ * @abstract Given an anchor object, determines and returns the included
1502+ * LATEX code used as info for tool tip and info line.
1503+ */
1504+ function getSymbol ( a ) {
1505+ var info = beginEndInfo ( a ) ;
1506+ if ( info !== null ) return info [ 0 ] + info [ 1 ] ;
1507+ info = latex ( a ) ;
1508+ if ( info !== null ) return info ;
1509+ return vme . getLocalText ( "NO_LATEX" ) ;
1510+ } ;
1511+
1512+ /**
1513+ * @abstract Returns the begin to end info of an anchor.
1514+ */
1515+ function beginEndInfo ( a ) {
1516+ if ( typeof ( $ ( a ) . attr ( "lbegin" ) ) != "undefined" && typeof ( $ ( a ) . attr ( "lend" ) ) != "undefined" )
1517+ return [ $ ( a ) . attr ( "lbegin" ) , $ ( a ) . attr ( "lend" ) ] ;
1518+ return null ;
1519+ }
1520+
1521+ /**
1522+ * @abstract Returns the latex info of an anchor.
1523+ */
1524+ function latex ( a ) {
1525+ if ( typeof ( $ ( a ) . attr ( "latex" ) ) != "undefined" )
1526+ return $ ( a ) . attr ( "latex" ) ;
1527+ }
1528+
1529+ $ ( `#${ fPanelID } a.s` )
1530+ . addClass ( "easyui-tooltip" )
1531+ . attr ( "title" , function ( index , attr ) { return getSymbol ( this ) ; } )
1532+ . mouseover ( function ( event ) { $ ( "#divInformation" ) . html ( getSymbol ( this ) ) ; } )
1533+ . mouseout ( function ( event ) { $ ( "#divInformation" ) . html ( " " ) ; } )
1534+ . click ( function ( event ) {
1535+ event . preventDefault ( ) ;
1536+ var info = beginEndInfo ( this ) ;
1537+ if ( info !== null ) {
1538+ vme . tag ( ...info ) ;
1539+ return ;
1540+ }
1541+ info = latex ( this ) ;
1542+ if ( info !== null ) {
1543+ vme . insert ( info ) ;
1544+ return ;
1545+ }
1546+ $ . messager . show ( {
1547+ title : "<span class='rtl-title-withicon'>" + vme . getLocalText ( "INFORMATION" ) + "</span>" ,
1548+ msg : vme . getLocalText ( "NO_LATEX" )
15191549 } ) ;
1520- // link with more class -> needs image handling
1521- $ ( "#" + fPanelID + " a.more" )
1550+ } ) ;
1551+
1552+ // this is solely for a single ...more button linking to a dialog
1553+ // containing more formulae.
1554+ $ ( `#${ fPanelID } a.more` )
15221555 . addClass ( "easyui-tooltip" )
15231556 . attr ( "title" , function ( index , attr ) { return "Loading more formulae" ; } ) ;
15241557
0 commit comments