File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1515 "acorn" : " ^6.1.1" ,
1616 "buble" : " ^0.19.7" ,
1717 "core-js" : " ^2.6.5" ,
18+ "lodash.debounce" : " ^4.0.8" ,
1819 "prismjs" : " ^1.16.0" ,
1920 "rewrite-imports" : " ^2.0.3" ,
2021 "vue" : " ^2.6.10" ,
Original file line number Diff line number Diff line change 11<template >
22 <VueLiveLayout >
33 <template v-slot :editor >
4- <PrismEditor v-model =" model" :language =" prismLang" />
4+ <PrismEditor :code =" model" @change = " updatePreview " :language =" prismLang" :lineNumbers = " true " />
55 </template >
66 <template v-slot :preview >
77 <Preview
@@ -24,6 +24,7 @@ import "prismjs/components/prism-jsx.min";
2424
2525import PrismEditor from " vue-prism-editor" ;
2626import hash from " hash-sum" ;
27+ import debounce from " lodash.debounce" ;
2728
2829import Preview from " ./Preview.vue" ;
2930import VueLiveLayout from " ./VueLiveDefaultLayout.vue" ;
@@ -73,7 +74,10 @@ export default {
7374 methods: {
7475 switchLanguage (newLang ) {
7576 this .prismLang = LANG_TO_PRISM [newLang];
76- }
77+ },
78+ updatePreview: debounce (function (value ) {
79+ this .model = value;
80+ }, 300 )
7781 }
7882};
7983 </script >
Original file line number Diff line number Diff line change @@ -6615,6 +6615,11 @@ locate-path@^3.0.0:
66156615 p-locate "^3.0.0"
66166616 path-exists "^3.0.0"
66176617
6618+ lodash.debounce@^4.0.8 :
6619+ version "4.0.8"
6620+ resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
6621+ integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168=
6622+
66186623lodash.defaultsdeep@^4.6.0 :
66196624 version "4.6.0"
66206625 resolved "https://registry.yarnpkg.com/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.0.tgz#bec1024f85b1bd96cbea405b23c14ad6443a6f81"
You can’t perform that action at this time.
0 commit comments