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 rodrigok committed Dec 10, 2018
1 parent 248c04c commit f952a52
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/rocketchat-message-attachments/client/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
import './stylesheets/messageAttachments.css';
import './messageAttachment.html';
import './messageAttachment';
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
1 change: 1 addition & 0 deletions packages/rocketchat-message-attachments/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ Package.onUse(function(api) {
'rocketchat:e2e',
'rocketchat:ui-message',
]);
api.addFiles('client/stylesheets/messageAttachments.css', 'client');
api.mainModule('client/index.js', 'client');
});
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 f952a52

Please sign in to comment.