Skip to content

Commit

Permalink
feat: support custom display placeholder content (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
hehehai authored Sep 24, 2023
1 parent 2addd25 commit 9ca27a1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Repl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface Props {
previewOptions?: {
headHTML?: string
bodyHTML?: string
placeholderHTML?: string
customCode?: {
importCode?: string
useCode?: string
Expand All @@ -40,6 +41,7 @@ const props = withDefaults(defineProps<Props>(), {
previewOptions: () => ({
headHTML: '',
bodyHTML: '',
placeholderHTML: '',
customCode: {
importCode: '',
useCode: '',
Expand Down
4 changes: 4 additions & 0 deletions src/output/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ function createSandbox() {
/<!-- PREVIEW-OPTIONS-HEAD-HTML -->/,
previewOptions?.headHTML || ''
)
.replace(
/<!--PREVIEW-OPTIONS-PLACEHOLDER-HTML-->/,
previewOptions?.placeholderHTML || ''
)
sandbox.srcdoc = sandboxSrc
container.value.appendChild(sandbox)
Expand Down
4 changes: 3 additions & 1 deletion src/output/srcdoc.html
Original file line number Diff line number Diff line change
Expand Up @@ -365,5 +365,7 @@
<!--IMPORT_MAP-->
</script>
</head>
<body></body>
<body>
<!--PREVIEW-OPTIONS-PLACEHOLDER-HTML-->
</body>
</html>

0 comments on commit 9ca27a1

Please sign in to comment.