@caspingus/lt
Version:
A utility library of helpers and extensions useful when working with Learnosity APIs.
29 lines (28 loc) • 1.58 kB
JavaScript
import { r as e, t } from "../../extensionsFactory-hk5ijx1G.js";
import { t as n } from "../../renderPDF-ClNoFlxX.js";
import { t as r } from "../../styling-D2uWYs0R.js";
//#region src/authoring/extensions/ui/renderPDF/index.js
var i = { classNamePrefix: null };
function a() {
i.classNamePrefix = r(i.classNamePrefix), t.authorApp().on("render:item", () => {
o(document.querySelector(".lrn-author-item-content-wrapper"));
}), t.authorApp().on("widgetedit:preview:changed", () => {
o(document.querySelector(".lrn-question-preview"));
});
}
function o(e) {
if (!e) return;
let t = e.querySelectorAll(".lrn_widget .resource");
t.length && t.forEach((e) => {
let t = e.querySelector("a");
if (!t) return;
let r = t.getAttribute("href") || "";
r.toLowerCase().endsWith(".pdf") && e.dataset.ltRenderedPdf !== "1" && (e.dataset.ltRenderedPdf = "1", n.mountNativePdf(e, r));
});
}
function s() {
return "\n /* Learnosity language text direction styles */\n /* Used to style render PDF options added to the resource upload panel */\n .lrn .lrn-author-ui .lrn-form-control.lt__renderPDFOption {\n width: auto;\n }\n\n .lt__renderPDF_pdf {\n display: block;\n width: 100%;\n max-width: 100%;\n }\n .lt__renderPDF_pdf .pdf-viewer {\n display: block;\n width: 100%;\n height: 650px;\n border: 0;\n background: #fff;\n }\n ";
}
var c = e("renderPDF", a, { getStyles: s });
//#endregion
export { c as renderPDF };