Skip to content

Commit

Permalink
refactor: include ignorelist in polisher.add
Browse files Browse the repository at this point in the history
This tells pagedjs to ignore attempting to load and use these resources
  • Loading branch information
JimFung committed Jul 23, 2024
1 parent cdebab8 commit 520a656
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/polisher/polisher.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,19 @@ class Polisher {
let urls = [];

for (var i = 0; i < arguments.length; i++) {
// Ignore list, make sure these resources are loaded via other mechanisms
if (
["https://cdn.form.io/formiojs/formio.full.min.css"].includes(
arguments[i]
)
) {
continue;
}
let f;

if (typeof arguments[i] === "object") {
for (let url in arguments[i]) {
let obj = arguments[i];
f = new Promise(function(resolve, reject) {
f = new Promise(function (resolve, reject) {
urls.push(url);
resolve(obj[url]);
});
Expand All @@ -59,11 +66,13 @@ class Polisher {
});
}


fetched.push(f);
}

return await Promise.all(fetched)
.catch((e) => {
throw e;
})
.then(async (originals) => {
let text = "";
for (let index = 0; index < originals.length; index++) {
Expand Down Expand Up @@ -101,7 +110,7 @@ class Polisher {
return sheet.toString();
}

insert(text){
insert(text) {
let head = document.querySelector("head");
let style = document.createElement("style");
style.setAttribute("data-pagedjs-inserted-styles", "true");
Expand Down

0 comments on commit 520a656

Please sign in to comment.