implement view-source feature

This commit is contained in:
yggverse 2024-12-08 13:59:57 +02:00
parent 9784a8a1a1
commit 614aa1d71a
5 changed files with 86 additions and 25 deletions

View file

@ -92,7 +92,7 @@ impl Content {
/// * could be useful to extract document title parsed from Gemtext
pub fn to_text_gemini(&self, base: &Uri, data: &str) -> Text {
self.clean();
let text = Text::gemini(
let text = Text::new_gemini(
data,
base,
(self.window_action.clone(), self.tab_action.clone()),
@ -101,6 +101,13 @@ impl Content {
text
}
pub fn to_text_source(&self, data: &str) -> Text {
self.clean();
let text = Text::new_source(data);
self.gobject.append(&text.scrolled_window);
text
}
/// Remove all children components from `Self`
pub fn clean(&self) {
while let Some(child) = self.gobject.last_child() {