Skip to content

Commit d58406c

Browse files
authored
Merge pull request #360 from keta1/fix/web
Add viewport meta tag to `index.html`
2 parents d7c9c0d + bb868b3 commit d58406c

File tree

3 files changed

+66
-64
lines changed

3 files changed

+66
-64
lines changed

sample/web/src/commonMain/resources/index.html

Lines changed: 4 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,11 @@
44
<meta charset="UTF-8">
55

66
<title>Markdown Sample (Kotlin/Wasm)</title>
7-
<script type="application/javascript" src="skiko.js"></script>
87
<script type="application/javascript" src="composeApp.js"></script>
9-
<style>
10-
html, body {
11-
width: 100%;
12-
height: 100%;
13-
margin: 0;
14-
padding: 0;
15-
background-color: white;
16-
overflow: hidden;
17-
}
18-
19-
#warning {
20-
position: absolute;
21-
top: 100px;
22-
left: 100px;
23-
max-width: 830px;
24-
z-index: 100;
25-
background-color: white;
26-
font-size: initial;
27-
display: none;
28-
}
29-
#warning li {
30-
padding-bottom: 15px;
31-
}
32-
33-
#warning span.code {
34-
font-family: monospace;
35-
}
36-
37-
ul {
38-
margin-top: 0;
39-
margin-bottom: 15px;
40-
}
41-
42-
#footer {
43-
position: fixed;
44-
bottom: 0;
45-
width: 100%;
46-
z-index: 1000;
47-
background-color: white;
48-
font-size: initial;
49-
}
50-
51-
#close {
52-
position: absolute;
53-
top: 0;
54-
right: 10px;
55-
cursor: pointer;
56-
}
57-
</style>
8+
<script type="application/javascript" src="unsupported_browser.js"></script>
9+
<link rel="stylesheet" type="text/css" href="styles.css">
10+
<!--https://developer.mozilla.org/en-US/docs/Web/CSS/Viewport_concepts#mobile_viewports-->
11+
<meta name="viewport" content="width=device-width, initial-scale=1">
5812
</head>
5913
<body>
6014
<canvas id="markdownCanvas"></canvas>
@@ -77,18 +31,4 @@
7731
</ul>
7832
</div>
7933
</body>
80-
81-
<script type="application/javascript" >
82-
const unhandledError = (event, error) => {
83-
if (error instanceof WebAssembly.CompileError) {
84-
document.getElementById("warning").style.display="initial";
85-
86-
// Hide a Scary Webpack Overlay which is less informative in this case.
87-
const webpackOverlay = document.getElementById("webpack-dev-server-client-overlay");
88-
if (webpackOverlay != null) webpackOverlay.style.display="none";
89-
}
90-
}
91-
addEventListener("error", (event) => unhandledError(event, event.error));
92-
addEventListener("unhandledrejection", (event) => unhandledError(event, event.reason));
93-
</script>
9434
</html>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
html, body {
2+
width: 100%;
3+
height: 100%;
4+
margin: 0;
5+
padding: 0;
6+
background-color: white;
7+
overflow: hidden;
8+
}
9+
10+
#warning {
11+
position: absolute;
12+
top: 100px;
13+
left: 100px;
14+
max-width: 830px;
15+
z-index: 100;
16+
background-color: white;
17+
font-size: initial;
18+
display: none;
19+
}
20+
21+
#warning li {
22+
padding-bottom: 15px;
23+
}
24+
25+
#warning span.code {
26+
font-family: monospace;
27+
}
28+
29+
ul {
30+
margin-top: 0;
31+
margin-bottom: 15px;
32+
}
33+
34+
#footer {
35+
position: fixed;
36+
bottom: 0;
37+
width: 100%;
38+
z-index: 1000;
39+
background-color: white;
40+
font-size: initial;
41+
}
42+
43+
#close {
44+
position: absolute;
45+
top: 0;
46+
right: 10px;
47+
cursor: pointer;
48+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const unhandledError = (event, error) => {
2+
if (error instanceof WebAssembly.CompileError) {
3+
document.getElementById("warning").style.display = "initial";
4+
5+
// Hide a Scary Webpack Overlay which is less informative in this case.
6+
const webpackOverlay = document.getElementById("webpack-dev-server-client-overlay");
7+
if (webpackOverlay != null) {
8+
webpackOverlay.style.display = "none";
9+
}
10+
}
11+
};
12+
13+
addEventListener("error", (event) => unhandledError(event, event.error));
14+
addEventListener("unhandledrejection", (event) => unhandledError(event, event.reason));

0 commit comments

Comments
 (0)