mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-07-23 12:45:04 +00:00
feat: add svg and png export (#101)
This commit is contained in:
parent
e649ad308f
commit
413c2e8deb
9 changed files with 298 additions and 136 deletions
|
@ -109,12 +109,40 @@ pub trait StatefulRequest {
|
|||
|
||||
#[allow(missing_docs)]
|
||||
mod polymorphic {
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::prelude::*;
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
|
||||
pub enum PageSelection {
|
||||
#[serde(rename = "first")]
|
||||
First,
|
||||
#[serde(rename = "merged")]
|
||||
Merged,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum ExportKind {
|
||||
Pdf,
|
||||
Svg { page: PageSelection },
|
||||
Png { page: PageSelection },
|
||||
}
|
||||
|
||||
impl ExportKind {
|
||||
pub fn extension(&self) -> &str {
|
||||
match self {
|
||||
Self::Pdf => "pdf",
|
||||
Self::Svg { .. } => "svg",
|
||||
Self::Png { .. } => "png",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct OnExportRequest {
|
||||
pub path: PathBuf,
|
||||
pub kind: ExportKind,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue