Skip to content

Commit 9c32388

Browse files
jgosmannkermanx
andauthored
fix: load raw slide content in slide editor (#2094)
* fix: load raw slide content in slide editor Fixes #1579. Otherwise, the editor would load the preprocessed content and overwrite the unprocessed content. * chore: add comment --------- Co-authored-by: _Kerman <[email protected]>
1 parent dc8b462 commit 9c32388

File tree

4 files changed

+153
-1
lines changed

4 files changed

+153
-1
lines changed

packages/client/internals/SideEditor.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ watch(
2626
if (!isInputting.value) {
2727
note.value = (v?.note || '').trim()
2828
const frontmatterPart = v?.frontmatterRaw?.trim() ? `---\n${v.frontmatterRaw.trim()}\n---\n\n` : ''
29-
content.value = frontmatterPart + (v?.content || '').trim()
29+
content.value = frontmatterPart + (v?.source.contentRaw || '').trim()
3030
dirty.value = false
3131
}
3232
},

packages/parser/src/core.ts

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export function parseSlide(raw: string, options: SlidevParserOptions = {}): Omit
110110
level,
111111
revision,
112112
content,
113+
contentRaw: content,
113114
frontmatter,
114115
frontmatterStyle: matterResult.type,
115116
frontmatterDoc: matterResult.doc,

packages/types/src/types.ts

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export interface SourceSlideInfo extends SlideInfoBase {
3131
contentStart: number
3232
end: number
3333
raw: string
34+
/**
35+
* Raw content before being processed by preparsers (if any)
36+
*/
37+
contentRaw: string
3438
/**
3539
* Slides import by this slide.
3640
*/

0 commit comments

Comments
 (0)