Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev_tw' into dev_tw
Browse files Browse the repository at this point in the history
  • Loading branch information
dasistwas committed Oct 13, 2023
2 parents 5b47d40 + 2b5e6ad commit 9bf2bad
Show file tree
Hide file tree
Showing 23 changed files with 517 additions and 82 deletions.
3 changes: 0 additions & 3 deletions amd/build/pdf.min.js

This file was deleted.

1 change: 0 additions & 1 deletion amd/build/pdf.min.js.map

This file was deleted.

3 changes: 0 additions & 3 deletions amd/build/pdf.worker.entry.min.js

This file was deleted.

1 change: 0 additions & 1 deletion amd/build/pdf.worker.entry.min.js.map

This file was deleted.

3 changes: 0 additions & 3 deletions amd/build/pdf.worker.min.js

This file was deleted.

1 change: 0 additions & 1 deletion amd/build/pdf.worker.min.js.map

This file was deleted.

8 changes: 0 additions & 8 deletions amd/build/pdf_backup.min.js

This file was deleted.

1 change: 0 additions & 1 deletion amd/build/pdf_backup.min.js.map

This file was deleted.

5 changes: 3 additions & 2 deletions amd/build/pdfembed.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/pdfembed.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added amd/src/._pdfembed.js
Binary file not shown.
19 changes: 0 additions & 19 deletions amd/src/pdf.worker.entry.js

This file was deleted.

28 changes: 0 additions & 28 deletions amd/src/pdf_backup.js

This file was deleted.

13 changes: 10 additions & 3 deletions amd/src/pdfembed.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

import * as pdfjsLib from 'mod_datalynx/pdf';
import * as pdfjsWorker from 'mod_datalynx/pdf.worker';
// import * as pdfjsLib from 'mod_datalynx/pdf';
// import * as pdfjsWorker from 'mod_datalynx/pdf.worker';

// eslint-disable-next-line require-jsdoc
function renderPDFfunction(url, canvasContainer) {

function renderPage(page) {
Expand Down Expand Up @@ -73,9 +74,15 @@ function renderPDFfunction(url, canvasContainer) {

}

// eslint-disable-next-line require-jsdoc
/**
*
* @param {*} pdfUrl
* @param {*} canvasContainerId
*/
export function renderPDF(pdfUrl, canvasContainerId) {

console.log(pdfUrl, canvasContainerId);

// eslint-disable-next-line no-unused-vars
const pdf = M.cfg.wwwroot + '/mod/datalynx/tests/turnen.pdf';
const container = document.querySelector(`#${canvasContainerId}`);
Expand Down
11 changes: 7 additions & 4 deletions field/file/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,17 @@ protected function embed_pdf(string $fullurl, string $fieldname): string {
global $PAGE;
$PAGE->requires->js_call_amd('mod_datalynx/pdfembed', 'renderPDF',
[$fullurl, $fieldname]);

$a = html_writer::tag('script', '', [
'src' => 'pdfjs/pdf.js']);
$b = html_writer::tag('script', '', [
'src' => 'pdfjs/pdf.worker.js']);

return '<div><a href="' . $fullurl . '" target="_blank" class="btn btn-primary">' .
get_string('download', 'core_repository') . ' ' .
get_string('application/pdf', 'core_mimetypes') . '</a></div><br>
<div style="width: 800px; min-height: 400px;" id="' . $fieldname . '"></div>
';

// the size is hardcoded in the boject obove intentionally because it is adjusted by the following function on-the-fly
// $PAGE->requires->js_call_amd('mod_datalynx/maximiseembed', 'initMaximisedEmbed', ['resourceembed']);
' . $a . $b;
}

/**
Expand Down
Loading

0 comments on commit 9bf2bad

Please sign in to comment.