Skip to content

Commit

Permalink
Fix PDF view loading indicator (#12882)
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan authored and sampaiodiego committed Dec 10, 2018
1 parent 490679a commit 70e6faa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,11 @@ html.rtl .attachment {
& .attachment-pdf-loading {
display: none;

animation: spin 1s linear infinite;

font-size: 1.5rem;

svg {
animation: spin 1s linear infinite;
}
}

& .actions-container {
Expand Down
7 changes: 4 additions & 3 deletions packages/rocketchat-ui-message/client/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ async function renderPdfToCanvas(canvasId, pdfLink) {
const pdfjsLib = await import('pdfjs-dist');
pdfjsLib.GlobalWorkerOptions.workerSrc = `${ Meteor.absoluteUrl() }node_modules/pdfjs-dist/build/pdf.worker.js`;

const loader = document.getElementById('js-loading-${canvasId}');
const loader = document.getElementById(`js-loading-${ canvasId }`);

if (loader) {
loader.style.display = 'block';
}
Expand All @@ -45,10 +46,10 @@ async function renderPdfToCanvas(canvasId, pdfLink) {
const context = canvas.getContext('2d');
canvas.height = viewport.height;
canvas.width = viewport.width;
page.render({
await page.render({
canvasContext: context,
viewport,
});
}).promise;

if (loader) {
loader.style.display = 'none';
Expand Down

0 comments on commit 70e6faa

Please sign in to comment.