mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 14:20:04 -04:00
Replace markdown editor with new 'EasyMark' markup language
This commit is contained in:
@@ -16,7 +16,6 @@ impl Default for Demos {
|
||||
Box::new(super::dancing_strings::DancingStrings::default()),
|
||||
Box::new(super::drag_and_drop::DragAndDropDemo::default()),
|
||||
Box::new(super::font_book::FontBook::default()),
|
||||
Box::new(super::markdown_editor::MarkdownEditor::default()),
|
||||
Box::new(super::painting::Painting::default()),
|
||||
Box::new(super::scrolling::Scrolling::default()),
|
||||
Box::new(super::sliders::Sliders::default()),
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
use egui::*;
|
||||
|
||||
#[cfg_attr(feature = "persistence", derive(serde::Deserialize, serde::Serialize))]
|
||||
#[derive(PartialEq)]
|
||||
pub struct MarkdownEditor {
|
||||
markdown: String,
|
||||
}
|
||||
|
||||
impl Default for MarkdownEditor {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
markdown: r#"
|
||||
# Markdown editor
|
||||
Markdown support in egui is experimental, and *very* limited. There are:
|
||||
|
||||
* bullet points
|
||||
* with sub-points
|
||||
* `inline code`
|
||||
* *emphasis*
|
||||
* [hyperlinks](https://github.com/emilk/egui)
|
||||
|
||||
---
|
||||
|
||||
Also the separator
|
||||
|
||||
"#
|
||||
.trim_start()
|
||||
.to_owned(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl super::Demo for MarkdownEditor {
|
||||
fn name(&self) -> &str {
|
||||
"🖹 Markdown Editor"
|
||||
}
|
||||
|
||||
fn show(&mut self, ctx: &egui::CtxRef, open: &mut bool) {
|
||||
egui::Window::new(self.name()).open(open).show(ctx, |ui| {
|
||||
use super::View;
|
||||
self.ui(ui);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl super::View for MarkdownEditor {
|
||||
fn ui(&mut self, ui: &mut egui::Ui) {
|
||||
ui.vertical_centered(|ui| {
|
||||
egui::reset_button(ui, self);
|
||||
ui.add(crate::__egui_github_link_file!());
|
||||
});
|
||||
ui.separator();
|
||||
ui.columns(2, |columns| {
|
||||
ScrollArea::auto_sized()
|
||||
.id_source("source")
|
||||
.show(&mut columns[0], |ui| {
|
||||
ui.text_edit_multiline(&mut self.markdown);
|
||||
});
|
||||
ScrollArea::auto_sized()
|
||||
.id_source("rendered")
|
||||
.show(&mut columns[1], |ui| {
|
||||
egui::experimental::markdown(ui, &self.markdown);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ pub mod font_contents_emoji;
|
||||
pub mod font_contents_ubuntu;
|
||||
pub mod input_test;
|
||||
pub mod layout_test;
|
||||
pub mod markdown_editor;
|
||||
pub mod painting;
|
||||
pub mod scrolling;
|
||||
pub mod sliders;
|
||||
|
||||
Reference in New Issue
Block a user