@@ -43,6 +43,7 @@ class ToM{
4343 openMap : ' ToM_openMap' ,
4444 openTutMap : ' ToM_openTutMap' ,
4545 showNode : ' ToM_showNode' ,
46+ openTutorialPage : ' ToM_openTutPage' ,
4647 ]
4748
4849 static final exeHowIcons = [' emoji-1F507' , ' emoji-2328' , ' emoji-1F5B1' ]
@@ -125,6 +126,9 @@ class ToM{
125126 case styles. goto:
126127 addGotoPane(myPanel, tutNode, nextTutNodes[0 ], options)
127128 break
129+ case styles. openTutorialPage:
130+ addOpenTutorialPage(myPanel, tutNode, options)
131+ break
128132 case styles. action:
129133 addActionPane(myPanel, tutNode, options)
130134 break
@@ -323,6 +327,20 @@ class ToM{
323327 def buttonPanel = tomui. createButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false )
324328 myP. add(buttonPanel, tomui. GBC )
325329 }
330+
331+ def static addOpenTutorialPage (myP , ApiNode tNode , options ){
332+ def nodos = tNode. children. findAll{ n -> isValidUri(n. link?. uri) || isValidUri(n[attributeNewPageLink]. uri)}
333+ nodos. each{nodo ->
334+ def msgHtml = nodo. note? tomui. getHtmlFromNote(nodo, options): null
335+ def bttnText = nodo. text
336+ def bttnToolTip = " Click to go to '${ bttnText} ' section"
337+ def bttnAction = { e ->
338+ openTutorialPage(nodo)
339+ }
340+ def buttonPanel = tomui. createButtonPanel(msgHtml, bttnText, bttnToolTip, bttnAction, false )
341+ myP. add(buttonPanel, tomui. GBC )
342+ }
343+ }
326344
327345 def static addGroovyPane (myP , ApiNode nodoT ){
328346 def parentEnabled = ! disableBttn(nodoT)
@@ -673,20 +691,27 @@ class ToM{
673691
674692 def static openTutorialPageUri (URI uri , ApiMindMap mapa ){
675693 // if(!uri) return null
676- def isMindmap = uri . scheme in [ ' file ' , ' tutorial ' ] && uri . path . endsWith( ' .mm ' )
677- def nodeId = (! uri. scheme || isMindmap ) && uri. fragment?. startsWith(' ID_' )?
694+ def isMM = isMindmap(uri )
695+ def nodeId = (! uri. scheme || isMM ) && uri. fragment?. startsWith(' ID_' )?
678696 uri. fragment
679697 : null
680698 // if (!nodeId) return 'No node ID defined in URI'
681- def tutMapPath = /* nodeId && */ isMindmap ?
699+ def tutMapPath = /* nodeId && */ isMM ?
682700 uri. path. drop(1 )
683701 :null
684702 def tutMap = tutMapPath ?
685703 getMapFromPath(tutMapPath, false ) // open mind map not visible
686704 : mapa
687705 openTutorialPageString(nodeId, tutMap)
688706 }
707+
708+ def static isMindmap (uri ){
709+ uri && uri. scheme in [' file' ,' tutorial' ] && uri. path. endsWith(' .mm' )
710+ }
689711
712+ def static isValidUri (uri ){
713+ return uri && (! uri. scheme && uri. fragment?. startsWith(' ID_' ) || isMindmap(uri))
714+ }
690715
691716 def static openTutorialPageString (String nodeId , ApiMindMap tutMap ){
692717 if (! tutMap) return ' No tutorial mindmap defined'
0 commit comments