-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
58 lines (49 loc) · 2 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
<html>
<head>
<script type="module" src="./dist/index.js"></script>
</head>
<body>
<drag-pane heading="Draggable Pane">
<tab-pane>
<div data-tab="Some Text" style="width: 300px;">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<div data-tab="Disabled" disabled>Nothing to see here.</div>
<div data-tab="An Image">
<img src="http://lorempixel.com/400/200/" />
</div>
</tab-pane>
</drag-pane>
<drag-pane>
<syntax-highlight class="language-js">
<pre><code class="language-js">
import style from "./prism.css";
export default class SyntaxHighlight extends HTMLElement {
constructor() {
super();
const template = document.createElement('template');
template.innerHTML = `<style>${style}</style>`;
const shadowRoot = this.attachShadow({mode: 'open'});
shadowRoot.appendChild(template.content.cloneNode(true));
}
connectedCallback() {
Array.from(this.children).forEach( el => {
import("./prism").then( (Prism) => {
Prism.default.highlightElement(el, false, () => {
this.shadowRoot!.appendChild(el)
});
})
});
}
}
window.customElements.define('syntax-highlight', SyntaxHighlight);
</code></pre>
</syntax-highlight>
</drag-pane>
</body>
</html>