mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
implement view-source feature
This commit is contained in:
parent
9784a8a1a1
commit
614aa1d71a
5 changed files with 86 additions and 25 deletions
25
src/app/browser/window/tab/item/page/content/text/source.rs
Normal file
25
src/app/browser/window/tab/item/page/content/text/source.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
use gtk::{TextBuffer, TextView};
|
||||
|
||||
const MARGIN: i32 = 8;
|
||||
|
||||
pub struct Source {
|
||||
pub text_view: TextView,
|
||||
}
|
||||
|
||||
impl Source {
|
||||
pub fn new(data: &str) -> Self {
|
||||
Self {
|
||||
text_view: TextView::builder()
|
||||
.bottom_margin(MARGIN)
|
||||
.buffer(&TextBuffer::builder().text(data).build())
|
||||
.cursor_visible(false)
|
||||
.editable(false)
|
||||
.left_margin(MARGIN)
|
||||
.monospace(true)
|
||||
.right_margin(MARGIN)
|
||||
.top_margin(MARGIN)
|
||||
.vexpand(true)
|
||||
.build(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue