mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-04 18:28:02 +00:00
feat: convert TypstDocument to enum (#1256)
* feat: convert `TypstDocument` to enum * fix: errors * build: update cargo.lock * fix: warnings * fix: error * html changes * Revert "html changes" This reverts commitf9fc0e4872
. * Revert "Revert "html changes"" This reverts commit7dc554a9e4
. * use std typst docs * span * paged * paged * html change * paged * html change * bytes * paged * paged * paged * html changes * paged * html changes * paged
This commit is contained in:
parent
30a08e79ab
commit
3bc5f19cf5
23 changed files with 237 additions and 123 deletions
|
@ -13,6 +13,7 @@ rust-version.workspace = true
|
|||
[dependencies]
|
||||
typst.workspace = true
|
||||
tinymist-assets.workspace = true
|
||||
tinymist-std.workspace = true
|
||||
typst-assets.workspace = true
|
||||
comemo.workspace = true
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ use std::sync::Arc;
|
|||
use reflexo_typst::debug_loc::{
|
||||
CharPosition, DocumentPosition, ElementPoint, SourceLocation, SourceSpanOffset,
|
||||
};
|
||||
use reflexo_typst::TypstDocument;
|
||||
use reflexo_vec2svg::IncrSvgDocServer;
|
||||
use tinymist_std::typst::TypstDocument;
|
||||
use tokio::sync::{broadcast, mpsc};
|
||||
|
||||
use super::{editor::EditorActorRequest, webview::WebviewActorRequest};
|
||||
|
@ -138,6 +138,9 @@ impl RenderActor {
|
|||
log::info!("RenderActor: document is not ready");
|
||||
continue;
|
||||
};
|
||||
|
||||
let TypstDocument::Paged(document) = document;
|
||||
|
||||
let data = if has_full_render {
|
||||
if let Some(data) = self.renderer.pack_current() {
|
||||
data
|
||||
|
|
|
@ -15,8 +15,8 @@ use futures::sink::SinkExt;
|
|||
use once_cell::sync::OnceCell;
|
||||
use reflexo_typst::debug_loc::SourceSpanOffset;
|
||||
use reflexo_typst::Error;
|
||||
use reflexo_typst::TypstDocument as Document;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tinymist_std::typst::TypstDocument;
|
||||
use tokio::sync::{broadcast, mpsc};
|
||||
use typst::{layout::Position, syntax::Span};
|
||||
|
||||
|
@ -355,7 +355,7 @@ pub struct MemoryFilesShort {
|
|||
|
||||
pub trait CompileView: Send + Sync {
|
||||
/// Get the compiled document.
|
||||
fn doc(&self) -> Option<Arc<Document>>;
|
||||
fn doc(&self) -> Option<TypstDocument>;
|
||||
/// Get the compile status.
|
||||
fn status(&self) -> CompileStatus;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use std::num::NonZeroUsize;
|
||||
|
||||
use reflexo_typst::debug_loc::DocumentPosition;
|
||||
use reflexo_typst::TypstDocument;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tinymist_std::typst::TypstDocument;
|
||||
use typst::foundations::{Content, NativeElement, Packed, StyleChain};
|
||||
use typst::introspection::Introspector;
|
||||
use typst::model::HeadingElem;
|
||||
|
@ -140,7 +140,7 @@ struct OutlineItem {
|
|||
}
|
||||
|
||||
pub fn outline(interner: &mut SpanInternerImpl, document: &TypstDocument) -> Outline {
|
||||
let outline = get_outline(&document.introspector);
|
||||
let outline = get_outline(document.introspector());
|
||||
let mut items = Vec::with_capacity(outline.as_ref().map_or(0, Vec::len));
|
||||
|
||||
for heading in outline.iter().flatten() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue