Skip to content

Commit d255d31

Browse files
LeBenLeBenelevatebart
authored andcommitted
fix: A bunch of fixes for the next branch (#55)
* refactor: abandon functional components * fix: avoid warning of VueLiveDefaultLayout made reactive * fix: prevent PrismEditor from inheriting Editor props Otherwise the event onChange is triggered twice, once by PrismEditor textarea (payload: Event) and once by the Editor (payload: code string) * fix: externalize Vue from library bundle
1 parent f90897e commit d255d31

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

demo/CustomLayout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<template functional>
1+
<template>
22
<div class="preview-code">
33
<div>
44
<slot name="editor"></slot>

rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const rootConfig = {
3636
"prismjs/components/prism-javascript",
3737
"prismjs/components/prism-jsx",
3838
"@vue/compiler-core/dist/compiler-core.cjs",
39+
"vue"
3940
],
4041
};
4142

src/Editor.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const highlight = (lang, jsxInExamples) => {
6161
6262
export default {
6363
name: "VueLiveEditor",
64+
inheritAttrs: false,
6465
components: { PrismEditor },
6566
props: {
6667
code: {

src/VueLive.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
/>
2121
</template>
2222
<template v-slot:preview>
23-
<!--
23+
<!--
2424
* Emitted every time the component rendered throws an error
2525
* Catches runtime and compilation errors
2626
* @event error
27-
* @property { Error } - the error thrown
27+
* @property { Error } - the error thrown
2828
-->
2929
<Preview
3030
:key="codeKey"
@@ -41,6 +41,7 @@
4141
</component>
4242
</template>
4343
<script>
44+
import { markRaw } from "vue";
4445
import hash from "hash-sum";
4546
4647
import Preview from "./Preview.vue";
@@ -145,7 +146,7 @@ export default {
145146
model: this.code,
146147
lang: "vue",
147148
prismLang: "html",
148-
VueLiveDefaultLayout,
149+
VueLiveDefaultLayout: markRaw(VueLiveDefaultLayout),
149150
/**
150151
* this data only gets changed when changing language.
151152
* it allows for copy and pasting without having the code

src/VueLiveDefaultLayout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<template functional>
1+
<template>
22
<div class="VueLive-container">
33
<div class="VueLive-editor">
44
<slot name="editor" />

0 commit comments

Comments
 (0)