diff --git a/README.md b/README.md
index 8ca1494..a6c9928 100644
--- a/README.md
+++ b/README.md
@@ -4,4 +4,8 @@ TODO:
3. **Select-all CTRL+A shortcut**
4. **Scrolling** in the website container
5. **Store** tab containers so switching tabs won't erase previous tab.
-6. **GIF** support
\ No newline at end of file
+6. **GIF** support
+7. **Video** support via [GDE GoZen](https://github.com/VoylinsGamedevJourney/gde_gozen)
+
+Issues:
+1. **< br />** counts as 1 element in **WebsiteContainer**, therefore despite being (0,0) in size, it counts as double in spacing.
\ No newline at end of file
diff --git a/Scenes/Tags/p.tscn b/Scenes/Tags/p.tscn
index b4c94d4..8e1f3b0 100644
--- a/Scenes/Tags/p.tscn
+++ b/Scenes/Tags/p.tscn
@@ -17,5 +17,6 @@ mouse_default_cursor_shape = 1
theme = ExtResource("2_1glvj")
theme_override_colors/default_color = Color(0, 0, 0, 1)
bbcode_enabled = true
+text = "Placeholder"
fit_content = true
selection_enabled = true
diff --git a/Scenes/main.tscn b/Scenes/main.tscn
index 3b6b536..58a0eb5 100644
--- a/Scenes/main.tscn
+++ b/Scenes/main.tscn
@@ -196,6 +196,9 @@ layout_mode = 2
size_flags_vertical = 3
theme_override_constants/separation = 22
+[node name="Control" type="Control" parent="VBoxContainer/WebsiteContainer"]
+layout_mode = 2
+
[node name="WebsiteBackground" type="Panel" parent="."]
z_index = -1
layout_mode = 1
diff --git a/Scripts/B9/HTMLParser.gd b/Scripts/B9/HTMLParser.gd
index 558abea..6b91fdf 100644
--- a/Scripts/B9/HTMLParser.gd
+++ b/Scripts/B9/HTMLParser.gd
@@ -59,6 +59,12 @@ class HTMLElement:
child_content = "[font_size=20][code]" + child.get_bbcode_formatted_text() + "[/code][/font_size]"
"span":
child_content = child.get_bbcode_formatted_text()
+ "a":
+ var href = child.get_attribute("href")
+ if href.length() > 0:
+ child_content = "[color=#1a0dab][url=%s]%s[/url][/color]" % [href, child.get_bbcode_formatted_text()]
+ else:
+ child_content = child.get_bbcode_formatted_text()
_:
child_content = child.get_bbcode_formatted_text()
@@ -73,7 +79,7 @@ class HTMLElement:
return result
func is_inline_element() -> bool:
- return tag_name in ["b", "i", "u", "small", "mark", "code", "span"]
+ return tag_name in ["b", "i", "u", "small", "mark", "code", "span", "a"]
class ParseResult:
var root: HTMLElement
diff --git a/Scripts/Tags/br.gd b/Scripts/Tags/br.gd
index 74b39c1..e372935 100644
--- a/Scripts/Tags/br.gd
+++ b/Scripts/Tags/br.gd
@@ -1,4 +1,4 @@
extends Control
func init(element: HTMLParser.HTMLElement) -> void:
- custom_minimum_size.y = 24
+ pass
diff --git a/Scripts/Tags/p.gd b/Scripts/Tags/p.gd
index 43261b2..c551fee 100644
--- a/Scripts/Tags/p.gd
+++ b/Scripts/Tags/p.gd
@@ -1,5 +1,7 @@
extends Control
+@onready var rich_text_label: RichTextLabel = $RichTextLabel
+
func init(element: HTMLParser.HTMLElement) -> void:
var label: RichTextLabel = $RichTextLabel
label.text = "[font_size=24]%s[/font_size]" % element.get_bbcode_formatted_text()
diff --git a/Scripts/main.gd b/Scripts/main.gd
index ba6162c..472ba83 100644
--- a/Scripts/main.gd
+++ b/Scripts/main.gd
@@ -39,6 +39,10 @@ func render():
this is marked
this is code THIS IS A SPAN AND SHOULDNT BE ANY DIFFERENT
+
+ Hello gang +
+
Text in a pre element
is displayed in a fixed-width
@@ -69,8 +73,7 @@ line breaks
var icon = parser.get_icon()
set_loading_icon(tab)
- tab.set_icon(await Network.fetch_image(icon))
- stop_loading_icon()
+ call_deferred("update_tab_icon", tab, icon)
var body = parser.find_first("body")
var i = 0
@@ -80,8 +83,11 @@ line breaks
if element.is_inline_element():
# Collect consecutive inline elements and flatten nested ones
var inline_elements: Array[HTMLParser.HTMLElement] = []
+ var has_hyperlink = false
while i < body.children.size() and body.children[i].is_inline_element():
inline_elements.append(body.children[i])
+ if contains_hyperlink(body.children[i]):
+ has_hyperlink = true
i += 1
var inline_container = P.instantiate()
@@ -90,7 +96,12 @@ line breaks
temp_parent.tag_name = "p"
temp_parent.children = inline_elements
inline_container.init(temp_parent)
+
website_container.add_child(inline_container)
+
+ if has_hyperlink:
+ inline_container.rich_text_label.meta_clicked.connect(func(meta): OS.shell_open(str(meta)))
+
continue
match element.tag_name:
@@ -98,6 +109,8 @@ line breaks
var p = P.instantiate()
p.init(element)
website_container.add_child(p)
+ if contains_hyperlink(element):
+ p.rich_text_label.meta_clicked.connect(func(meta): OS.shell_open(str(meta)))
"pre":
var pre = PRE.instantiate()
pre.init(element)
@@ -137,3 +150,17 @@ func stop_loading_icon() -> void:
if loading_tween:
loading_tween.kill()
loading_tween = null
+
+func update_tab_icon(tab: Tab, icon: String) -> void:
+ tab.set_icon(await Network.fetch_image(icon))
+ stop_loading_icon()
+
+func contains_hyperlink(element: HTMLParser.HTMLElement) -> bool:
+ if element.tag_name == "a":
+ return true
+
+ for child in element.children:
+ if contains_hyperlink(child):
+ return true
+
+ return false
diff --git a/godotgif/bin/~godotgif.windows.template_debug.x86_64.dll b/godotgif/bin/~godotgif.windows.template_debug.x86_64.dll
deleted file mode 100644
index cfcbc52..0000000
Binary files a/godotgif/bin/~godotgif.windows.template_debug.x86_64.dll and /dev/null differ