@hyperbook/markdown 0.23.2 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/directive-collapsible/style.css +7 -7
- package/dist/assets/directive-webide/client.js +144 -0
- package/dist/assets/directive-webide/style.css +125 -0
- package/dist/assets/store.js +1 -0
- package/dist/index.js +269 -5
- package/dist/index.js.map +4 -4
- package/dist/locales/de.json +9 -1
- package/dist/locales/en.json +9 -1
- package/dist/remarkDirectiveWebide.d.ts +5 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.directive-collapsible button {
|
|
1
|
+
.directive-collapsible > button {
|
|
2
2
|
width: 100%;
|
|
3
3
|
text-align: left;
|
|
4
4
|
border-style: solid;
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
margin-bottom: 10px;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
.directive-collapsible button.expanded {
|
|
14
|
+
.directive-collapsible > button.expanded {
|
|
15
15
|
border-bottom-left-radius: 0px;
|
|
16
16
|
border-bottom-right-radius: 0px;
|
|
17
17
|
margin-bottom: 0px;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.directive-collapsible button:after {
|
|
20
|
+
.directive-collapsible > button:after {
|
|
21
21
|
content: "\02795";
|
|
22
22
|
/* Unicode character for "plus" sign (+) */
|
|
23
23
|
font-size: 13px;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
margin-left: 5px;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.directive-collapsible button.expanded:after {
|
|
28
|
+
.directive-collapsible > button.expanded:after {
|
|
29
29
|
content: "\2796";
|
|
30
30
|
/* Unicode character for "minus" sign (-) */
|
|
31
31
|
}
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
display: none;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.directive-collapsible button.expanded+.collapsible-content {
|
|
42
|
+
.directive-collapsible > button.expanded+.collapsible-content {
|
|
43
43
|
display: block;
|
|
44
44
|
border-style: solid;
|
|
45
45
|
border-width: 1px;
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
border-bottom-right-radius: 4px;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
.directive-collapsible button {
|
|
54
|
+
.directive-collapsible > button {
|
|
55
55
|
color: var(--color-text);
|
|
56
56
|
border-color: var(--color-spacer);
|
|
57
57
|
background-color: var(--color-nav);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
.directive-collapsible button:after {
|
|
60
|
+
.directive-collapsible > button:after {
|
|
61
61
|
color: var(--color-text);
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
hyperbook.webide = (function () {
|
|
2
|
+
window.codeInput?.registerTemplate(
|
|
3
|
+
"webide-highlighted",
|
|
4
|
+
codeInput.templates.prism(window.Prism, [
|
|
5
|
+
new codeInput.plugins.AutoCloseBrackets(),
|
|
6
|
+
new codeInput.plugins.Indent(true, 2),
|
|
7
|
+
])
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
const elems = document.getElementsByClassName("directive-webide");
|
|
11
|
+
|
|
12
|
+
for (let elem of elems) {
|
|
13
|
+
const title = elem.getElementsByClassName("container-title")[0];
|
|
14
|
+
/** @type {HTMLTextAreaElement | null} */
|
|
15
|
+
const editorHTML = elem.querySelector(".editor.html");
|
|
16
|
+
/** @type {HTMLTextAreaElement | null} */
|
|
17
|
+
const editorCSS = elem.querySelector(".editor.css");
|
|
18
|
+
/** @type {HTMLTextAreaElement | null} */
|
|
19
|
+
const editorJS = elem.querySelector(".editor.js");
|
|
20
|
+
/** @type {HTMLButtonElement | null} */
|
|
21
|
+
const btnHTML = elem.querySelector("button.html");
|
|
22
|
+
/** @type {HTMLButtonElement | null} */
|
|
23
|
+
const btnCSS = elem.querySelector("button.css");
|
|
24
|
+
/** @type {HTMLButtonElement | null} */
|
|
25
|
+
const btnJS = elem.querySelector("button.js");
|
|
26
|
+
|
|
27
|
+
const frame = elem.getElementsByTagName("iframe")[0];
|
|
28
|
+
const template = elem.getAttribute("data-template");
|
|
29
|
+
const id = elem.getAttribute("data-id");
|
|
30
|
+
/** @type {HTMLButtonElement} */
|
|
31
|
+
const resetEl = elem.querySelector("button.reset");
|
|
32
|
+
/** @type {HTMLButtonElement} */
|
|
33
|
+
const downloadEl = elem.querySelector("button.download");
|
|
34
|
+
|
|
35
|
+
resetEl?.addEventListener("click", () => {
|
|
36
|
+
if (window.confirm(i18n.get("webide-reset-prompt"))) {
|
|
37
|
+
store.webide.delete(id);
|
|
38
|
+
window.location.reload();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
btnHTML?.addEventListener("click", () => {
|
|
43
|
+
btnHTML?.classList.add("active");
|
|
44
|
+
btnCSS?.classList.remove("active");
|
|
45
|
+
btnJS?.classList.remove("active");
|
|
46
|
+
|
|
47
|
+
editorHTML?.classList.add("active");
|
|
48
|
+
editorCSS?.classList.remove("active");
|
|
49
|
+
editorJS?.classList.remove("active");
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
btnCSS?.addEventListener("click", () => {
|
|
53
|
+
btnHTML?.classList.remove("active");
|
|
54
|
+
btnCSS?.classList.add("active");
|
|
55
|
+
btnJS?.classList.remove("active");
|
|
56
|
+
|
|
57
|
+
editorHTML?.classList.remove("active");
|
|
58
|
+
editorCSS?.classList.add("active");
|
|
59
|
+
editorJS?.classList.remove("active");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
btnJS?.addEventListener("click", () => {
|
|
63
|
+
btnHTML?.classList.remove("active");
|
|
64
|
+
btnCSS?.classList.remove("active");
|
|
65
|
+
btnJS?.classList.add("active");
|
|
66
|
+
|
|
67
|
+
editorHTML?.classList.remove("active");
|
|
68
|
+
editorCSS?.classList.remove("active");
|
|
69
|
+
editorJS?.classList.add("active");
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const load = async () => {
|
|
73
|
+
const result = await store.webide.get(id);
|
|
74
|
+
if (!result) return;
|
|
75
|
+
const website = template
|
|
76
|
+
.replace("###HTML###", result.html)
|
|
77
|
+
.replace("###CSS###", result.css)
|
|
78
|
+
.replace("###JS###", result.js);
|
|
79
|
+
frame.srcdoc = website;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
load();
|
|
83
|
+
|
|
84
|
+
const update = () => {
|
|
85
|
+
store.webide.put({
|
|
86
|
+
id,
|
|
87
|
+
html: editorHTML?.value,
|
|
88
|
+
css: editorCSS?.value,
|
|
89
|
+
js: editorJS?.value,
|
|
90
|
+
});
|
|
91
|
+
const website = template
|
|
92
|
+
.replace("###HTML###", editorHTML?.value)
|
|
93
|
+
.replace("###CSS###", editorCSS?.value)
|
|
94
|
+
.replace("###JS###", editorJS?.value);
|
|
95
|
+
frame.srcdoc = website;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
frame.addEventListener("load", () => {
|
|
99
|
+
title.textContent = frame.contentDocument.title;
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
editorHTML?.addEventListener("code-input_load", async () => {
|
|
103
|
+
const result = await store.webide.get(id);
|
|
104
|
+
if (result) {
|
|
105
|
+
editorHTML.value = result.html;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
editorHTML.addEventListener("input", () => {
|
|
109
|
+
update();
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
editorCSS?.addEventListener("code-input_load", async () => {
|
|
114
|
+
const result = await store.webide.get(id);
|
|
115
|
+
if (result) {
|
|
116
|
+
editorCSS.value = result.css;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
editorCSS.addEventListener("input", () => {
|
|
120
|
+
update();
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
editorJS?.addEventListener("code-input_load", async () => {
|
|
125
|
+
const result = await store.webide.get(id);
|
|
126
|
+
if (result) {
|
|
127
|
+
editorJS.value = result.js;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
editorJS.addEventListener("input", () => {
|
|
131
|
+
update();
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
downloadEl?.addEventListener("click", async () => {
|
|
136
|
+
const a = document.createElement("a");
|
|
137
|
+
const website = frame.srcdoc;
|
|
138
|
+
const blob = new Blob([website], { type: "text/html" });
|
|
139
|
+
a.href = URL.createObjectURL(blob);
|
|
140
|
+
a.download = `website-${id}.html`;
|
|
141
|
+
a.click();
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
})();
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
.directive-webide {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
align-items: center;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
margin-bottom: 16px;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
gap: 8px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
code-input {
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.directive-webide .container {
|
|
16
|
+
width: 100%;
|
|
17
|
+
border: 1px solid var(--color-spacer);
|
|
18
|
+
border-radius: 8px;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.directive-webide .container-title {
|
|
23
|
+
border-bottom: 1px solid var(--color-spacer);
|
|
24
|
+
padding: 8px 16px;
|
|
25
|
+
padding-left: 0px;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
white-space:nowrap;
|
|
28
|
+
text-overflow: ellipsis;
|
|
29
|
+
background-color: var(--color-background);
|
|
30
|
+
color: var(--color-text);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.directive-webide .container-title::before {
|
|
34
|
+
content: "";
|
|
35
|
+
margin-right: 4.4rem;
|
|
36
|
+
display: inline-block;
|
|
37
|
+
aspect-ratio: 1 / 1;
|
|
38
|
+
height: 0.75rem;
|
|
39
|
+
border-radius: 9999px;
|
|
40
|
+
opacity: 0.3;
|
|
41
|
+
box-shadow:
|
|
42
|
+
0.8em 0,
|
|
43
|
+
2.2em 0,
|
|
44
|
+
3.6em 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.directive-webide .editor-container {
|
|
48
|
+
width: 100%;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
height: 400px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.directive-webide .editor {
|
|
55
|
+
width: 100%;
|
|
56
|
+
border: 1px solid var(--color-spacer);
|
|
57
|
+
flex: 1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.directive-webide .editor:not(.active) {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.directive-webide .buttons {
|
|
65
|
+
display: flex;
|
|
66
|
+
border: 1px solid var(--color-spacer);
|
|
67
|
+
border-radius: 8px;
|
|
68
|
+
border-bottom: none;
|
|
69
|
+
border-bottom-left-radius: 0;
|
|
70
|
+
border-bottom-right-radius: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.directive-webide .buttons.bottom {
|
|
74
|
+
border: 1px solid var(--color-spacer);
|
|
75
|
+
border-radius: 8px;
|
|
76
|
+
border-top: none;
|
|
77
|
+
border-top-left-radius: 0;
|
|
78
|
+
border-top-right-radius: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.directive-webide button {
|
|
82
|
+
flex: 1;
|
|
83
|
+
padding: 8px 16px;
|
|
84
|
+
border: none;
|
|
85
|
+
border-right: 1px solid var(--color-spacer);
|
|
86
|
+
background-color: var(--color--background);
|
|
87
|
+
color: var(--color-text);
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.directive-webide button:not(.active) {
|
|
92
|
+
opacity: 0.6;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.directive-webide .buttons:last-child {
|
|
96
|
+
border-right: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.directive-webide button:hover {
|
|
100
|
+
background-color: var(--color-spacer);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.directive-webide iframe {
|
|
104
|
+
border: none;
|
|
105
|
+
width: 100%;
|
|
106
|
+
height: 100%;
|
|
107
|
+
background-color: white;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@media screen and (min-width: 1024px) {
|
|
111
|
+
.directive-webide:not(.standalone) {
|
|
112
|
+
flex-direction: row;
|
|
113
|
+
height: calc(100dvh - 128px);
|
|
114
|
+
.container {
|
|
115
|
+
flex: 1;
|
|
116
|
+
height: 100% !important;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.editor-container {
|
|
120
|
+
flex: 1;
|
|
121
|
+
height: 100%;
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
package/dist/assets/store.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -63922,7 +63922,15 @@ var en_default = {
|
|
|
63922
63922
|
"slideshow-previous": "Previous",
|
|
63923
63923
|
"slideshow-next": "Next",
|
|
63924
63924
|
"slideshow-jump-to": "Jump to {{index}}",
|
|
63925
|
-
"toggle-bookmark": "Toggle Bookmark"
|
|
63925
|
+
"toggle-bookmark": "Toggle Bookmark",
|
|
63926
|
+
"webide-code-preview": "Code Preview",
|
|
63927
|
+
"webide-html": "HTML",
|
|
63928
|
+
"webide-css": "CSS",
|
|
63929
|
+
"webide-js": "JS",
|
|
63930
|
+
"webide-reset": "Reset",
|
|
63931
|
+
"webide-reset-prompt": "Are you sure you want to reset the code?",
|
|
63932
|
+
"webide-copy": "Copy",
|
|
63933
|
+
"webide-download": "Download"
|
|
63926
63934
|
};
|
|
63927
63935
|
|
|
63928
63936
|
// locales/de.json
|
|
@@ -63964,7 +63972,15 @@ var de_default = {
|
|
|
63964
63972
|
"slideshow-previous": "Zur\xFCck",
|
|
63965
63973
|
"slideshow-next": "Weiter",
|
|
63966
63974
|
"slideshow-jump-to": "Springe zu {{index}}",
|
|
63967
|
-
"toggle-bookmark": "Lesezeichen umschalten"
|
|
63975
|
+
"toggle-bookmark": "Lesezeichen umschalten",
|
|
63976
|
+
"webide-code-preview": "Code-Vorschau",
|
|
63977
|
+
"webide-html": "HTML",
|
|
63978
|
+
"webide-css": "CSS",
|
|
63979
|
+
"webide-js": "JS",
|
|
63980
|
+
"webide-reset": "Zur\xFCcksetzen",
|
|
63981
|
+
"webide-reset-prompt": "Sind Sie sicher, dass Sie den Code zur\xFCcksetzen m\xF6chten?",
|
|
63982
|
+
"webide-copy": "Kopieren",
|
|
63983
|
+
"webide-download": "Herunterladen"
|
|
63968
63984
|
};
|
|
63969
63985
|
|
|
63970
63986
|
// src/i18n.ts
|
|
@@ -73259,9 +73275,6 @@ var rehypeDirectiveP5_default = (ctx) => () => {
|
|
|
73259
73275
|
path4.posix.join("directive-p5", "p5.min.js"),
|
|
73260
73276
|
"assets"
|
|
73261
73277
|
);
|
|
73262
|
-
const escape2 = (s3) => {
|
|
73263
|
-
return s3.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
73264
|
-
};
|
|
73265
73278
|
const wrapSketch = (sketchCode) => {
|
|
73266
73279
|
if (sketchCode !== "" && !sketchCode?.includes("setup")) {
|
|
73267
73280
|
return `
|
|
@@ -73888,6 +73901,256 @@ var remarkDirectivePyide_default = (ctx) => () => {
|
|
|
73888
73901
|
};
|
|
73889
73902
|
};
|
|
73890
73903
|
|
|
73904
|
+
// src/remarkDirectiveWebide.ts
|
|
73905
|
+
var remarkDirectiveWebide_default = (ctx) => () => {
|
|
73906
|
+
const name = "webide";
|
|
73907
|
+
const makeWrapInMarkupTemplate = () => `<!DOCTYPE html>
|
|
73908
|
+
<head>
|
|
73909
|
+
<title>WebIDE</title>
|
|
73910
|
+
<meta charset="utf8" />
|
|
73911
|
+
<style type='text/css'>
|
|
73912
|
+
html, body {
|
|
73913
|
+
margin: 0;
|
|
73914
|
+
padding: 0;
|
|
73915
|
+
background: white;
|
|
73916
|
+
}
|
|
73917
|
+
###CSS###
|
|
73918
|
+
</style>
|
|
73919
|
+
</head>
|
|
73920
|
+
<body>###HTML###</body>
|
|
73921
|
+
<script type="text/javascript">###JS###</script>
|
|
73922
|
+
`;
|
|
73923
|
+
return (tree, file) => {
|
|
73924
|
+
visit(tree, function(node3) {
|
|
73925
|
+
if (isDirective(node3) && node3.name === name) {
|
|
73926
|
+
const { height = 400, id = hash(node3) } = node3.attributes || {};
|
|
73927
|
+
const data = node3.data || (node3.data = {});
|
|
73928
|
+
expectContainerDirective(node3, file, name);
|
|
73929
|
+
registerDirective(file, name, ["client.js"], ["style.css"]);
|
|
73930
|
+
requestJS(file, ["code-input", "code-input.min.js"]);
|
|
73931
|
+
requestCSS(file, ["code-input", "code-input.min.css"]);
|
|
73932
|
+
requestJS(file, ["code-input", "auto-close-brackets.min.js"]);
|
|
73933
|
+
requestJS(file, ["code-input", "indent.min.js"]);
|
|
73934
|
+
let js = "";
|
|
73935
|
+
let css = "";
|
|
73936
|
+
let html11 = "";
|
|
73937
|
+
let template = makeWrapInMarkupTemplate();
|
|
73938
|
+
let jsNode = node3.children.find(
|
|
73939
|
+
(n) => n.type === "code" && n.lang === "js"
|
|
73940
|
+
);
|
|
73941
|
+
let cssNode = node3.children.find(
|
|
73942
|
+
(n) => n.type === "code" && n.lang === "css"
|
|
73943
|
+
);
|
|
73944
|
+
let htmlNode = node3.children.find(
|
|
73945
|
+
(n) => n.type === "code" && n.lang === "html" && n.meta === null
|
|
73946
|
+
);
|
|
73947
|
+
let templateNode = node3.children.find(
|
|
73948
|
+
(n) => n.type === "code" && n.lang === "html" && n.meta === "template"
|
|
73949
|
+
);
|
|
73950
|
+
const buttons = [];
|
|
73951
|
+
const editors = [];
|
|
73952
|
+
if (htmlNode) {
|
|
73953
|
+
html11 = htmlNode.value;
|
|
73954
|
+
buttons.push({
|
|
73955
|
+
type: "element",
|
|
73956
|
+
tagName: "button",
|
|
73957
|
+
properties: {
|
|
73958
|
+
class: "html"
|
|
73959
|
+
},
|
|
73960
|
+
children: [
|
|
73961
|
+
{
|
|
73962
|
+
type: "text",
|
|
73963
|
+
value: i18n.get("webide-html")
|
|
73964
|
+
}
|
|
73965
|
+
]
|
|
73966
|
+
});
|
|
73967
|
+
editors.push({
|
|
73968
|
+
type: "element",
|
|
73969
|
+
tagName: "code-input",
|
|
73970
|
+
properties: {
|
|
73971
|
+
class: "editor html line-numbers",
|
|
73972
|
+
language: "html",
|
|
73973
|
+
template: "webide-highlighted"
|
|
73974
|
+
},
|
|
73975
|
+
children: [
|
|
73976
|
+
{
|
|
73977
|
+
type: "raw",
|
|
73978
|
+
value: html11
|
|
73979
|
+
}
|
|
73980
|
+
]
|
|
73981
|
+
});
|
|
73982
|
+
}
|
|
73983
|
+
if (cssNode) {
|
|
73984
|
+
css = cssNode.value;
|
|
73985
|
+
buttons.push({
|
|
73986
|
+
type: "element",
|
|
73987
|
+
tagName: "button",
|
|
73988
|
+
properties: {
|
|
73989
|
+
class: "css"
|
|
73990
|
+
},
|
|
73991
|
+
children: [
|
|
73992
|
+
{
|
|
73993
|
+
type: "text",
|
|
73994
|
+
value: i18n.get("webide-css")
|
|
73995
|
+
}
|
|
73996
|
+
]
|
|
73997
|
+
});
|
|
73998
|
+
editors.push({
|
|
73999
|
+
type: "element",
|
|
74000
|
+
tagName: "code-input",
|
|
74001
|
+
properties: {
|
|
74002
|
+
class: "editor css line-numbers",
|
|
74003
|
+
language: "css",
|
|
74004
|
+
template: "webide-highlighted"
|
|
74005
|
+
},
|
|
74006
|
+
children: [
|
|
74007
|
+
{
|
|
74008
|
+
type: "raw",
|
|
74009
|
+
value: css
|
|
74010
|
+
}
|
|
74011
|
+
]
|
|
74012
|
+
});
|
|
74013
|
+
}
|
|
74014
|
+
if (jsNode) {
|
|
74015
|
+
js = jsNode.value;
|
|
74016
|
+
buttons.push({
|
|
74017
|
+
type: "element",
|
|
74018
|
+
tagName: "button",
|
|
74019
|
+
properties: {
|
|
74020
|
+
class: "js"
|
|
74021
|
+
},
|
|
74022
|
+
children: [
|
|
74023
|
+
{
|
|
74024
|
+
type: "text",
|
|
74025
|
+
value: i18n.get("webide-js")
|
|
74026
|
+
}
|
|
74027
|
+
]
|
|
74028
|
+
});
|
|
74029
|
+
editors.push({
|
|
74030
|
+
type: "element",
|
|
74031
|
+
tagName: "code-input",
|
|
74032
|
+
properties: {
|
|
74033
|
+
class: "editor js line-numbers",
|
|
74034
|
+
language: "javascript",
|
|
74035
|
+
template: "webide-highlighted"
|
|
74036
|
+
},
|
|
74037
|
+
children: [
|
|
74038
|
+
{
|
|
74039
|
+
type: "raw",
|
|
74040
|
+
value: js
|
|
74041
|
+
}
|
|
74042
|
+
]
|
|
74043
|
+
});
|
|
74044
|
+
}
|
|
74045
|
+
if (buttons.length > 0) {
|
|
74046
|
+
buttons[0].properties.class += " active";
|
|
74047
|
+
}
|
|
74048
|
+
if (editors.length > 0) {
|
|
74049
|
+
editors[0].properties.class += " active";
|
|
74050
|
+
}
|
|
74051
|
+
if (templateNode) template = templateNode.value;
|
|
74052
|
+
const srcdoc = template.replace("###JS###", js).replace("###HTML###", html11).replace("###CSS###", css).replace(/\u00A0/g, " ");
|
|
74053
|
+
data.hName = "div";
|
|
74054
|
+
data.hProperties = {
|
|
74055
|
+
class: "directive-webide",
|
|
74056
|
+
"data-template": template.replace(/\u00A0/g, " "),
|
|
74057
|
+
"data-id": id
|
|
74058
|
+
};
|
|
74059
|
+
data.hChildren = [
|
|
74060
|
+
{
|
|
74061
|
+
type: "element",
|
|
74062
|
+
tagName: "div",
|
|
74063
|
+
properties: {
|
|
74064
|
+
class: "container",
|
|
74065
|
+
style: `height: ${height}px;`
|
|
74066
|
+
},
|
|
74067
|
+
children: [
|
|
74068
|
+
{
|
|
74069
|
+
type: "element",
|
|
74070
|
+
tagName: "div",
|
|
74071
|
+
properties: {
|
|
74072
|
+
class: "container-title"
|
|
74073
|
+
},
|
|
74074
|
+
children: [
|
|
74075
|
+
{
|
|
74076
|
+
type: "text",
|
|
74077
|
+
value: ""
|
|
74078
|
+
}
|
|
74079
|
+
]
|
|
74080
|
+
},
|
|
74081
|
+
{
|
|
74082
|
+
type: "element",
|
|
74083
|
+
tagName: "iframe",
|
|
74084
|
+
properties: {
|
|
74085
|
+
srcdoc,
|
|
74086
|
+
loading: "eager",
|
|
74087
|
+
sandbox: "allow-scripts allow-popups allow-modals allow-forms allow-same-origin",
|
|
74088
|
+
"aria-label": i18n.get("webide-code-preview"),
|
|
74089
|
+
title: i18n.get("webide-code-preview")
|
|
74090
|
+
},
|
|
74091
|
+
children: []
|
|
74092
|
+
}
|
|
74093
|
+
]
|
|
74094
|
+
},
|
|
74095
|
+
{
|
|
74096
|
+
type: "element",
|
|
74097
|
+
tagName: "div",
|
|
74098
|
+
properties: {
|
|
74099
|
+
class: "editor-container"
|
|
74100
|
+
},
|
|
74101
|
+
children: [
|
|
74102
|
+
{
|
|
74103
|
+
type: "element",
|
|
74104
|
+
tagName: "div",
|
|
74105
|
+
properties: {
|
|
74106
|
+
class: "buttons"
|
|
74107
|
+
},
|
|
74108
|
+
children: buttons
|
|
74109
|
+
},
|
|
74110
|
+
...editors,
|
|
74111
|
+
{
|
|
74112
|
+
type: "element",
|
|
74113
|
+
tagName: "div",
|
|
74114
|
+
properties: {
|
|
74115
|
+
class: "buttons bottom"
|
|
74116
|
+
},
|
|
74117
|
+
children: [
|
|
74118
|
+
{
|
|
74119
|
+
type: "element",
|
|
74120
|
+
tagName: "button",
|
|
74121
|
+
properties: {
|
|
74122
|
+
class: "reset"
|
|
74123
|
+
},
|
|
74124
|
+
children: [
|
|
74125
|
+
{
|
|
74126
|
+
type: "text",
|
|
74127
|
+
value: i18n.get("webide-reset")
|
|
74128
|
+
}
|
|
74129
|
+
]
|
|
74130
|
+
},
|
|
74131
|
+
{
|
|
74132
|
+
type: "element",
|
|
74133
|
+
tagName: "button",
|
|
74134
|
+
properties: {
|
|
74135
|
+
class: "download"
|
|
74136
|
+
},
|
|
74137
|
+
children: [
|
|
74138
|
+
{
|
|
74139
|
+
type: "text",
|
|
74140
|
+
value: i18n.get("webide-download")
|
|
74141
|
+
}
|
|
74142
|
+
]
|
|
74143
|
+
}
|
|
74144
|
+
]
|
|
74145
|
+
}
|
|
74146
|
+
]
|
|
74147
|
+
}
|
|
74148
|
+
];
|
|
74149
|
+
}
|
|
74150
|
+
});
|
|
74151
|
+
};
|
|
74152
|
+
};
|
|
74153
|
+
|
|
73891
74154
|
// src/process.ts
|
|
73892
74155
|
var remark = (ctx) => {
|
|
73893
74156
|
const remarkPlugins = [
|
|
@@ -73924,6 +74187,7 @@ var remark = (ctx) => {
|
|
|
73924
74187
|
remarkDirectiveExcalidraw_default(ctx),
|
|
73925
74188
|
remarkDirectiveStruktog_default(ctx),
|
|
73926
74189
|
remarkDirectiveGeogebra_default(ctx),
|
|
74190
|
+
remarkDirectiveWebide_default(ctx),
|
|
73927
74191
|
remarkCode_default(ctx),
|
|
73928
74192
|
remarkMath,
|
|
73929
74193
|
remarkUnwrapImages,
|