Skip to content

Commit

Permalink
Merge pull request CloudOrc#161 from 15100399015/dev
Browse files Browse the repository at this point in the history
fix: DocumentLoader fix
  • Loading branch information
15100399015 authored Sep 10, 2023
2 parents 225cc62 + 755e6ab commit 3443c86
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion solidui-web/src/components/DocumentLoader/DocumentLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ import Sandbox from "./Sandbox";
function patchElement(doc: ShadowRoot) {
const head = document.createElement("div");
const body = document.createElement("div");
head.setAttribute("data-element", "head");
body.setAttribute("data-element", "body");
doc.appendChild(head);
doc.appendChild(body);
Reflect.set(doc, "body", body);
Reflect.set(doc, "head", head);
Reflect.set(doc, "documentElement", doc);
// Reflect.set(doc, "documentElement", doc);
const docKeys = Object.keys(Document.prototype);
for (let index = 0; index < docKeys.length; index++) {
const key = docKeys[index];
Expand All @@ -38,6 +40,8 @@ function patchElement(doc: ShadowRoot) {
}
return value;
},
enumerable: true,
configurable: true,
});
}
}
Expand Down Expand Up @@ -121,6 +125,7 @@ export class DocumentLoaderClass extends HTMLElement {
load(tpl: string, callback: (finish?: boolean) => void) {
this.loadStatus = true;
importHTML(`/${this.cacheKey}`, {
// @ts-ignore
fetch: (url: string, ...args: any[]) => {
if (url === `/${this.cacheKey}`) {
return Promise.resolve(
Expand Down

0 comments on commit 3443c86

Please sign in to comment.