Skip to content

Commit 321ea25

Browse files
committed
update components in mock-editor
1 parent 42188fb commit 321ea25

File tree

8 files changed

+961
-523
lines changed

8 files changed

+961
-523
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Nwokoma Uchechukwu
3+
Copyright (c) 2020 xhd2015
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

src/README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Demos
22
Build demo.js:
33
```sh
4-
bun src/build/build.ts src/demo.ts
5-
bun src/build/build.ts --watch src/demo.ts
4+
bun src/build/build.ts --gen-html src/demo.ts
5+
bun src/build/build.ts --gen-html --watch src/demo.ts
66
```
77

8+
Open demo.html
9+
```sh
10+
open src/demo.html
11+
```
12+
13+
# Serve via http server
814
Serve demo.html
915
```sh
1016
bun install -g http-server

src/build/build.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,30 @@ interface HTMLOptions {
125125
}
126126

127127
function packHTML(opts?: HTMLOptions) {
128-
// type="module" is required
128+
// type="module" is required
129+
// comments in generated html like __CUSTOM_EXTENSION_HEAD_BEGIN__
130+
// are reserved for other tools to replace with custom content easily
129131
return `<!DOCTYPE html>
130132
<html lang="en" style="height: 100%;">
131133
<head>
132134
<meta charset="UTF-8">
133135
<meta name="viewport" content="width=device-width, initial-scale=1.0">
134136
<title>${opts?.title || "Demo"}</title>
137+
<!--__CUSTOM_EXTENSION_HEAD_BEGIN__-->
135138
<style>
136139
${opts?.style || ""}
137140
</style>
138141
<script type="module">
142+
<!--__CUSTOM_EXTENSION_IN_SCRIPT__-->
139143
${safeScript(opts?.script || "")}
140144
</script>
145+
<!--__CUSTOM_EXTENSION_HEAD_END__-->
141146
</head>
142147
<body style="height: 100%;">
143148
<div id="root" style="height: 100%;"></div>
149+
<!--__CUSTOM_EXTENSION_BODY__-->
144150
</body>
151+
<!--__CUSTOM_EXTENSION_TAIL__-->
145152
</html>
146153
`
147154
}

0 commit comments

Comments
 (0)