shithub: mycel

Download patch

ref: a4b877ac03af623e1a6721465cab6be654b8225f
parent: ef158113c2f6ecaf3c0f8cd2410024f8b9736c35
author: Philip Silva <philip.silva@protonmail.com>
date: Mon Dec 21 19:26:04 EST 2020

makeLink(href)

--- a/browser/browser.go
+++ b/browser/browser.go
@@ -363,8 +363,9 @@
 	return el.UI.Mouse(dui, self, m, origM, orig)
 }
 
-func (el *Element) onClickLeafes(f func() duit.Event) {
-	PrintTree(el) // todo: debug remove me
+// makeLink of el and its children
+func (el *Element) makeLink(href string) {
+	f := browser.SetAndLoadUrl(href)
 	TraverseTree(el, func(ui duit.UI) {
 		el, ok := ui.(*Element)
 		if ok && el != nil {
@@ -863,10 +864,9 @@
 				innerContent,
 				n.Map,
 			)
-			el.IsLink = true // TODO make this cascading
 			//      also a way to bubble up
 			// will be needed eventually
-			el.onClickLeafes(browser.SetAndLoadUrl(href))
+			el.makeLink(href)
 			return el
 		default:
 			// Internal node object