-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
50 lines (47 loc) · 1.37 KB
/
demo.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@next/webcomponents-loader.js"></script>
<style id="demo-style">
code-flask {
max-width: 640px;
min-height: 450px;
margin: 0 auto;
background: #f5f5ff;
border-radius: 5px;
color: #222;
--codeflask-tag: blue;
--codeflask-property: red;
}
body { background: #fff; color: #444; text-align: center; }
a { color: #8500ff; }
a:hover { color: #6550ff; }
</style>
</head>
<body>
<h1>
<a href="https://github.com/kazzkiq/CodeFlask">
CodeFlask</a> in a
<a href="https://github.com/myfreeweb/codeflask-element">
Custom Element</a>
</h1>
<script type="module">
import './dist/code-flask.module.js'
// NOTE: you can add prism languages here like:
// import './node_modules/prismjs/components/prism-markdown.min.js'
</script>
<code-flask id="cfdemo" language="markup">x</code-flask>
<script>
document.addEventListener("DOMContentLoaded", _ => {
const cf = document.getElementById('cfdemo')
cf.addEventListener('value-changed', e =>
console.log('NEW VALUE: ', cf.value))
cf.value = document.getElementById('demo-style')
.outerHTML.replace(/(^|\n)\t\t/g, '$1') + '\n'
cf.value += document.body.innerHTML
.replace(/(^|\n)\t\t/g, '$1')
})
</script>
</body>
</html>