-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
142 lines (117 loc) · 4.38 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<html>
<head>
<!--
FIx Monaco Editor displaying 'Â' on startup
https://spectrum.chat/parcel/general/weird-encoding-in-monaco-electron-with-parceljs~3de2f45f-207b-4945-b3f0-c21f7eedc6fb?m=MTU1MzAzMDc0OTQyMA==
-->
<meta charset='UTF-8'>
<title>Clipboard to HTML code converter</title>
<style>
body {
display: flex;
flex-direction: column;
margin: 0;
/* Prevent #paste from overflowing */
height: 100%;
}
#top-app-bar {
position: relative !important;
}
#container {
display: flex;
flex-grow: 1;
background-color: #fafafa;
/* Prevent #container from overflowing */
height: calc(100% - 64px);
}
#paste,
#code {
width: 50%;
margin: 1rem;
overflow: auto;
}
#paste:focus,
#code:focus-within {
outline: 0;
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, .2), 0 2px 2px 0 rgba(0, 0, 0, .14), 0 1px 5px 0 rgba(0, 0, 0, .12);
}
#paste {
padding: 1rem;
margin-right: 0;
font-family: Roboto, sans-serif;
/* Prevent #paste from overflowing */
max-height: 100%;
}
#paste:empty:before {
/* Material Design disabled text color
* https://material.io/design/color/text-legibility.html#text-backgrounds
*/
color: rgba(0, 0, 0, .38);
content: "Paste here";
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
/* CSS from: Material Components for the Web → Typography → headline2 */
font-size: 3.75rem;
line-height: 3.75rem;
letter-spacing: -.0083333333em;
font-family: Roboto, sans-serif;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
font-weight: 300;
text-decoration: inherit;
text-transform: inherit;
}
#code {
padding: 1rem 0;
}
#code>#editor {
height: 100%;
}
/* Prevent Editor from overflowing */
#code>#editor>.monaco-editor .rename-box {
display: none;
}
</style>
<script src="https://unpkg.com/monaco-editor@latest/min/vs/loader.js"></script>
<script>
addEventListener('DOMContentLoaded', () => {
require.config({ paths: { 'vs': 'https://unpkg.com/monaco-editor@latest/min/vs' } });
require(['vs/editor/editor.main'], function () {
var editor = monaco.editor.create(document.getElementById('editor'), {
value: 'HTML code goes here',
language: 'html',
wordWrap: 'on',
readOnly: true,
scrollBeyondLastLine: false,
fontFamily: '"Roboto Mono", monospace',
});
let paste = document.getElementById('paste');
new MutationObserver(() => {
editor.setValue(paste.innerHTML);
}).observe(paste, { childList: true, subtree: true, characterData: true });
paste.focus();
});
});
</script>
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono|Roboto:300,500&display=swap" rel="stylesheet">
<link href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css" rel="stylesheet">
</head>
<body>
<header class=" mdc-top-app-bar" id="top-app-bar">
<div class="mdc-top-app-bar__row">
<section class="mdc-top-app-bar__section mdc-top-app-bar__section--align-start">
<span class="mdc-top-app-bar__title">Clipboard to HTML code converter</span>
</section>
</div>
</header>
<div id="container">
<div id="paste" class="mdc-card mdc-card--outlined" contentEditable="true"></div>
<div id="code" class="mdc-card mdc-card--outlined">
<div id="editor"></div>
</div>
</div>
</body>
</html>