Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix embed-pdf short code not rendering pdf file #844

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions assets/scripts/features/embedpdf/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PDFViewer {
this.loadingWrapper = el.getElementsByClassName('loading-wrapper')[0]
this.next = el.getElementsByClassName('next')[0]
this.prev = el.getElementsByClassName('prev')[0]
this.pageNum = el.getElementsByClassName('page-num')[0]
this.curPage = el.getElementsByClassName('page-num')[0]
this.pageCount = el.getElementsByClassName('page-count')[0]

// context
Expand Down Expand Up @@ -121,7 +121,7 @@ class PDFViewer {
this.pageNumPending = null
}
// Update page counters
this.pageNum.textContent = num
this.curPage.textContent = num
}

/**
Expand Down
11 changes: 9 additions & 2 deletions assets/styles/sections/pdf-viewer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@
}

.paginator {
display: none;
display: flex!important;
width: 100% !important;
text-align: center;
margin-bottom: 10px;
margin-bottom: 0.2rem !important;
justify-content: space-between;

.page-number-indicator {
margin-left: auto;
margin-right: auto;
}
}

.loading-wrapper {
Expand Down
10 changes: 7 additions & 3 deletions layouts/shortcodes/embed-pdf.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
data-page-num="{{ $pageNum }}"
>
<div class="paginator">
<button class="prev">Previous</button>
<button class="next">Next</button>
<span>Page: <span class="page-num"></span> / <span class="page-count"></span></span>
<div class="page-number-indicator">
<span>Page: <span class="page-num"></span> / <span class="page-count"></span></span>
</div>
<div class="next-prev-btn">
<button class="prev btn btn-sm btn-info">Previous</button>
<button class="next btn btn-sm btn-info">Next</button>
</div>
</div>

<div class="embed-pdf-container">
Expand Down