]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore: force refresh playground editor on startup
authorEvan You <yyx990803@gmail.com>
Sun, 28 Mar 2021 22:50:12 +0000 (18:50 -0400)
committerEvan You <yyx990803@gmail.com>
Sun, 28 Mar 2021 22:50:12 +0000 (18:50 -0400)
packages/sfc-playground/src/codemirror/CodeMirror.vue

index 18e3b3dbca34ac9edd563ff6c8b16ed55d7662a3..2140922afa49571a4a726bae2f3c3a747cf11c6e 100644 (file)
@@ -55,9 +55,16 @@ onMounted(() => {
     editor.setOption('mode', props.mode)
   })
 
-  window.addEventListener('resize', debounce(() => {
+  window.addEventListener(
+    'resize',
+    debounce(() => {
+      editor.refresh()
+    })
+  )
+
+  setTimeout(() => {
     editor.refresh()
-  }))
+  }, 50)
 })
 </script>
 
@@ -70,7 +77,7 @@ onMounted(() => {
 }
 
 .CodeMirror {
-  font-family: "Source Code Pro", monospace;
+  font-family: 'Source Code Pro', monospace;
   height: 100%;
 }
 </style>