Skip to content

Commit 9ca27a1

Browse files
authored
feat: support custom display placeholder content (#160)
1 parent 2addd25 commit 9ca27a1

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/Repl.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export interface Props {
2121
previewOptions?: {
2222
headHTML?: string
2323
bodyHTML?: string
24+
placeholderHTML?: string
2425
customCode?: {
2526
importCode?: string
2627
useCode?: string
@@ -40,6 +41,7 @@ const props = withDefaults(defineProps<Props>(), {
4041
previewOptions: () => ({
4142
headHTML: '',
4243
bodyHTML: '',
44+
placeholderHTML: '',
4345
customCode: {
4446
importCode: '',
4547
useCode: '',

src/output/Preview.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ function createSandbox() {
9090
/<!-- PREVIEW-OPTIONS-HEAD-HTML -->/,
9191
previewOptions?.headHTML || ''
9292
)
93+
.replace(
94+
/<!--PREVIEW-OPTIONS-PLACEHOLDER-HTML-->/,
95+
previewOptions?.placeholderHTML || ''
96+
)
9397
sandbox.srcdoc = sandboxSrc
9498
container.value.appendChild(sandbox)
9599

src/output/srcdoc.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,5 +365,7 @@
365365
<!--IMPORT_MAP-->
366366
</script>
367367
</head>
368-
<body></body>
368+
<body>
369+
<!--PREVIEW-OPTIONS-PLACEHOLDER-HTML-->
370+
</body>
369371
</html>

0 commit comments

Comments
 (0)