Skip to content

Commit be2d0d8

Browse files
committed
fix presentation title
add print button that prints the page as presentation
1 parent 86dd576 commit be2d0d8

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

obsidian-page.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ function toggleTopdownMenu() {
166166
}
167167

168168
function openAsPresentation() {
169-
const url = new URL(window.location.href);
169+
let url = new URL(window.location.href);
170+
if (print) {
171+
url.searchParams.set("print-pdf", "true")
172+
}
170173
url.searchParams.set("reveal", "true");
171174
window.open(url, "_blank");
172175
}

obsidian.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,9 +1018,12 @@ async function getTopBar(startPage, req) {
10181018
</div>`
10191019
: ""
10201020
}
1021-
<button class="sl-button" style="height: 32px; margin: 6px;" onclick="openAsPresentation()">${lucideIcon(
1021+
<button class="sl-button" style="height: 32px; margin: 6px;" onclick="openAsPresentation(false)">${lucideIcon(
10221022
"Presentation"
10231023
)}</button>
1024+
<button class="sl-button" style="height: 32px; margin: 6px;" onclick="openAsPresentation(true)">${lucideIcon(
1025+
"Printer"
1026+
)}</button>
10241027
<button class="sl-button-accent topdown-menu-chevron" style="height: 32px; margin: 6px;" onclick="toggleTopdownMenu()">${lucideIcon(
10251028
"Settings"
10261029
)}</button>
@@ -1088,7 +1091,7 @@ export async function wrapInPage(html, startPage, req) {
10881091
return pre + html + post;
10891092
}
10901093

1091-
export async function wrapInReveal(reveal) {
1094+
export async function wrapInReveal(reveal, req) {
10921095
const pre = `
10931096
<!DOCTYPE html>
10941097
<html>
@@ -1097,7 +1100,7 @@ export async function wrapInReveal(reveal) {
10971100
<meta charset="utf-8">
10981101
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
10991102
1100-
<title>Sample RevealJS with CDN</title>
1103+
<title>${req.file.name}</title>
11011104
11021105
<link href='https://fonts.googleapis.com/css?family=Lato:300,700' rel='stylesheet' type='text/css'>
11031106
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/reveal.css">

0 commit comments

Comments
 (0)