Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion components/Excalidraw.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const props = withDefaults(defineProps<{
drawFilePath: string
darkMode?: true
background?: boolean
frameId?: string | null | undefined
frame?: string | null | undefined
}>(), {
darkMode: false,
background: false,
Expand All @@ -43,8 +45,14 @@ const loadJsonAndExport = async ({ drawFilePath: path, darkMode = false, backgro
const url = new URL(path, window.location.origin + import.meta.env.BASE_URL).href
const json = await (await fetch(url)).json()

const svgElement = await ExcalidrawLib.exportToSvg({
const filterId = frameId ? frameId : (json.elements.find(e => e.type === "frame" && e.name === frame)?.id ?? null)
const filtered = filterId ? {
...json,
elements: json.elements.filter(e => e.frameId === filterId)
} : json

const svgElement = await ExcalidrawLib.exportToSvg({
...filtered,
appState: {
...(json.appState as any),
exportWithDarkMode: darkMode,
Expand Down