@@ -1610,21 +1610,20 @@ async function runToolTest() {
1610
1610
. then ( ( response ) => response . json ( ) )
1611
1611
. then ( ( result ) => {
1612
1612
const resultStr = JSON . stringify ( result , null , 2 ) ;
1613
- // If the CodeMirror editor exists, update its value; otherwise, create one.
1614
- if ( toolTestResultEditor ) {
1615
- toolTestResultEditor . setValue ( resultStr ) ;
1616
- } else {
1617
- toolTestResultEditor = window . CodeMirror (
1618
- document . getElementById ( "tool-test-result" ) ,
1619
- {
1620
- value : resultStr ,
1621
- mode : "application/json" ,
1622
- theme : "monokai" ,
1623
- readOnly : true ,
1624
- lineNumbers : true ,
1625
- } ,
1626
- ) ;
1627
- }
1613
+
1614
+ const container = document . getElementById ( "tool-test-result" ) ;
1615
+ container . innerHTML = '' ; // clear any old editor
1616
+
1617
+ toolTestResultEditor = window . CodeMirror (
1618
+ document . getElementById ( "tool-test-result" ) ,
1619
+ {
1620
+ value : resultStr ,
1621
+ mode : "application/json" ,
1622
+ theme : "monokai" ,
1623
+ readOnly : true ,
1624
+ lineNumbers : true ,
1625
+ } ,
1626
+ ) ;
1628
1627
} )
1629
1628
. catch ( ( error ) => {
1630
1629
document . getElementById ( "tool-test-result" ) . innerText = "Error: " + error ;
@@ -1636,8 +1635,17 @@ function openModal(modalId) {
1636
1635
document . getElementById ( modalId ) . classList . remove ( "hidden" ) ;
1637
1636
}
1638
1637
1639
- function closeModal ( modalId ) {
1640
- document . getElementById ( modalId ) . classList . add ( "hidden" ) ;
1638
+ function closeModal ( modalId , clearId = null ) {
1639
+ // document.getElementById(modalId).classList.add('hidden');
1640
+ const modal = document . getElementById ( modalId ) ;
1641
+
1642
+ if ( clearId ) {
1643
+ // Look up by id string
1644
+ const resultEl = document . getElementById ( clearId ) ;
1645
+ if ( resultEl ) resultEl . innerHTML = '' ;
1646
+ }
1647
+
1648
+ modal . classList . add ( 'hidden' ) ;
1641
1649
}
1642
1650
1643
1651
const integrationRequestMap = {
0 commit comments