-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
39 lines (37 loc) · 1.13 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
<!doctype html>
<html>
<head>
<title>Core Demo</title>
<link rel="stylesheet" href="./view/editor-style.css" />
<link rel="stylesheet" href="./sandblocks/style.css" />
</head>
<body>
<scm-editor
id="scm-editor"
text=" a
b
c
"
></scm-editor>
<script type="module">
import {} from "./sandblocks/editor/editor.js";
import {} from "./codemirror6/editor.js";
import {} from "./test.js";
import { Extension } from "./core/extension.js";
import { SBMatcher } from "./core/model.js";
import { languageFor } from "./core/languages.js";
import { h } from "./external/preact.js";
const ext = new Extension().registerReplacement({
name: "test-hiding-replacement",
query: new SBMatcher(languageFor("javascript"), [
(x) => x.type === "number",
]),
rerender: () => true,
component: ({ node }) =>
h("span", { style: { "background-color": "red" } }, node.text),
});
if (document.querySelector("#scm-editor"))
document.querySelector("#scm-editor").extensions = [ext];
</script>
</body>
</html>