initial commit - v0.1.0

This commit is contained in:
2025-07-11 01:49:19 +01:00
commit 1b0b53a2d2
15 changed files with 6587 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
use egui_commonmark::{CommonMarkCache, CommonMarkViewer};
pub struct MainEditor {
preview: bool,
text: String,
}
impl MainEditor {
pub fn new() -> Self {
Self {
preview: true,
text: String::new(),
}
}
pub fn ui(&mut self, ctx: &egui::Context) {
if self.preview {
egui::TopBottomPanel::bottom("bottom_panel")
.resizable(true)
.default_height(250.0)
.show(ctx, |ui| {
egui::ScrollArea::vertical()
.stick_to_bottom(true)
.auto_shrink(false)
.show(ui, |ui| {
let mut cache = CommonMarkCache::default();
CommonMarkViewer::new().show(ui, &mut cache, &self.text);
});
});
}
egui::CentralPanel::default().show(ctx, |ui| {
egui::ScrollArea::vertical()
.enable_scrolling(true)
.auto_shrink(false)
.show(ui, |ui| {
ui.add(
egui::TextEdit::multiline(&mut self.text)
.id_source("MainEditor_numlines")
.font(egui::TextStyle::Monospace)
.interactive(true)
.frame(false)
.lock_focus(true)
.hint_text("Type here...")
.desired_width(256.0),
);
});
});
}
}