Spaces:
Running
Running
LennardZuendorf
commited on
Commit
•
e9f86ad
1
Parent(s):
890672e
Upload folder using huggingface_hub
Browse files- README.md +2 -2
- src/README.md +1 -1
- src/backend/gradio_iframe/templates/component/index.js +2 -2
- src/frontend/shared/HTML.svelte +2 -2
- src/pyproject.toml +2 -2
README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
---
|
3 |
tags: [gradio-custom-component,gradio-template-HTML,HTML,iFrame]
|
4 |
title: gradio_iframe V0.0.4
|
5 |
-
colorFrom:
|
6 |
-
colorTo:
|
7 |
sdk: docker
|
8 |
pinned: false
|
9 |
license: apache-2.0
|
|
|
2 |
---
|
3 |
tags: [gradio-custom-component,gradio-template-HTML,HTML,iFrame]
|
4 |
title: gradio_iframe V0.0.4
|
5 |
+
colorFrom: red
|
6 |
+
colorTo: green
|
7 |
sdk: docker
|
8 |
pinned: false
|
9 |
license: apache-2.0
|
src/README.md
CHANGED
@@ -8,7 +8,7 @@ The usage is similar to the HTML component. You can pass valid html and it will
|
|
8 |
Also, JavaScript should run normal. You can even pass an iframe inside an iframe (see below!), i.e. a youtube or spotify embed.
|
9 |
|
10 |
The size will adjust to the size of the iframe (onload), **this is gonna be a bit delayed**. The width is default at 100%.
|
11 |
-
You can also set the height and width manually.
|
12 |
|
13 |
### Example
|
14 |
|
|
|
8 |
Also, JavaScript should run normal. You can even pass an iframe inside an iframe (see below!), i.e. a youtube or spotify embed.
|
9 |
|
10 |
The size will adjust to the size of the iframe (onload), **this is gonna be a bit delayed**. The width is default at 100%.
|
11 |
+
You can also set the height and width manually.
|
12 |
|
13 |
### Example
|
14 |
|
src/backend/gradio_iframe/templates/component/index.js
CHANGED
@@ -87,13 +87,13 @@ function ut(n) {
|
|
87 |
};
|
88 |
}
|
89 |
function dt(n, t, e) {
|
90 |
-
let { elem_classes: l = [] } = t, { value: i } = t, { visible: s = !0 } = t, { min_height: o = !1 } = t, { height: a } = t, { width: r = "100%" } = t;
|
91 |
const f = ct();
|
92 |
let _;
|
93 |
const m = () => {
|
94 |
try {
|
95 |
const c = _.contentDocument || _.contentWindow.document;
|
96 |
-
if (a ===
|
97 |
const v = c.documentElement.scrollHeight;
|
98 |
e(6, _.style.height = `${v}px`, _);
|
99 |
}
|
|
|
87 |
};
|
88 |
}
|
89 |
function dt(n, t, e) {
|
90 |
+
let { elem_classes: l = [] } = t, { value: i } = t, { visible: s = !0 } = t, { min_height: o = !1 } = t, { height: a = "100%" } = t, { width: r = "100%" } = t;
|
91 |
const f = ct();
|
92 |
let _;
|
93 |
const m = () => {
|
94 |
try {
|
95 |
const c = _.contentDocument || _.contentWindow.document;
|
96 |
+
if (a === "100%") {
|
97 |
const v = c.documentElement.scrollHeight;
|
98 |
e(6, _.style.height = `${v}px`, _);
|
99 |
}
|
src/frontend/shared/HTML.svelte
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
export let visible = true;
|
6 |
export let min_height = false;
|
7 |
|
8 |
-
export let height;
|
9 |
export let width = "100%";
|
10 |
|
11 |
const dispatch = createEventDispatcher<{ change: undefined }>();
|
@@ -15,7 +15,7 @@
|
|
15 |
const onLoad = () => {
|
16 |
try {
|
17 |
const iframeDocument = iframeElement.contentDocument || iframeElement.contentWindow.document;
|
18 |
-
if (height ===
|
19 |
const height = iframeDocument.documentElement.scrollHeight;
|
20 |
iframeElement.style.height = `${height}px`;
|
21 |
}
|
|
|
5 |
export let visible = true;
|
6 |
export let min_height = false;
|
7 |
|
8 |
+
export let height = "100%";
|
9 |
export let width = "100%";
|
10 |
|
11 |
const dispatch = createEventDispatcher<{ change: undefined }>();
|
|
|
15 |
const onLoad = () => {
|
16 |
try {
|
17 |
const iframeDocument = iframeElement.contentDocument || iframeElement.contentWindow.document;
|
18 |
+
if (height === "100%") {
|
19 |
const height = iframeDocument.documentElement.scrollHeight;
|
20 |
iframeElement.style.height = `${height}px`;
|
21 |
}
|
src/pyproject.toml
CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
|
|
8 |
|
9 |
[project]
|
10 |
name = "gradio_iframe"
|
11 |
-
version = "0.0.
|
12 |
description = "Experimental empowered iFrame component based on existing HTML gradio component."
|
13 |
readme = "README.md"
|
14 |
license = "MIT"
|
@@ -36,7 +36,7 @@ classifiers = [
|
|
36 |
dev = ["build", "twine"]
|
37 |
|
38 |
[tool.hatch.build]
|
39 |
-
artifacts = ["/backend/gradio_iframe/templates", "*.pyi", "backend/gradio_iframe/templates", "home/lennard/.virtualenvs/thesis/lib/python3.11/site-packages/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates"]
|
40 |
|
41 |
[tool.hatch.build.targets.wheel]
|
42 |
packages = ["/backend/gradio_iframe"]
|
|
|
8 |
|
9 |
[project]
|
10 |
name = "gradio_iframe"
|
11 |
+
version = "0.0.7"
|
12 |
description = "Experimental empowered iFrame component based on existing HTML gradio component."
|
13 |
readme = "README.md"
|
14 |
license = "MIT"
|
|
|
36 |
dev = ["build", "twine"]
|
37 |
|
38 |
[tool.hatch.build]
|
39 |
+
artifacts = ["/backend/gradio_iframe/templates", "*.pyi", "backend/gradio_iframe/templates", "home/lennard/.virtualenvs/thesis/lib/python3.11/site-packages/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates"]
|
40 |
|
41 |
[tool.hatch.build.targets.wheel]
|
42 |
packages = ["/backend/gradio_iframe"]
|