-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathevents.html
More file actions
60 lines (59 loc) · 1.62 KB
/
events.html
File metadata and controls
60 lines (59 loc) · 1.62 KB
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Textfield</title>
<link
rel="stylesheet"
href="/node_modules/@vscode/codicons/dist/codicon.css"
id="vscode-codicon-stylesheet"
>
<script
type="module"
src="/node_modules/@vscode-elements/webview-playground/dist/index.js"
></script>
<script type="module" src="/dist/main.js"></script>
<script>
const logEvents = (selector, eventType) => {
document.querySelector(selector).addEventListener(eventType, (ev) => {
console.log(ev);
});
};
</script>
</head>
<body>
<h1>Textfield</h1>
<h2>Change, Input</h2>
<vscode-demo>
<vscode-textfield id="textfield-1">
<span
slot="content-after"
style="
display: flex;
align-items: center;
margin-top: -1px;
margin-right: 1px;
"
>
<vscode-key-label>Ctrl</vscode-key-label>
<span>+</span><vscode-key-label>K</vscode-key-label></span
>
</vscode-textfield>
<script type="module">
logEvents('#textfield-1', 'change');
logEvents('#textfield-1', 'input');
</script>
</vscode-demo>
<h2>Invalid</h2>
<vscode-demo>
<form action="#">
<vscode-textfield id="textfield-2" required></vscode-textfield>
<button type="submit">Submit</button>
</form>
<script type="module">
logEvents('#textfield-2', 'invalid');
</script>
</vscode-demo>
</body>
</html>