Skip to content

Commit 21d659f

Browse files
committed
fix: load raw slide content in slide editor
Fixes slidevjs#1579. Otherwise, the editor would load the preprocessed content and overwrite the unprocessed content.
1 parent cb0ac1b commit 21d659f

File tree

4 files changed

+150
-1
lines changed

4 files changed

+150
-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

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface SourceSlideInfo extends SlideInfoBase {
3131
contentStart: number
3232
end: number
3333
raw: string
34+
contentRaw: string
3435
/**
3536
* Slides import by this slide.
3637
*/

0 commit comments

Comments
 (0)