From: Evan You Date: Sun, 28 Mar 2021 22:50:12 +0000 (-0400) Subject: chore: force refresh playground editor on startup X-Git-Tag: v3.0.10~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ac661b896dc760a067ede9fa26d3a6daadeeeed;p=thirdparty%2Fvuejs%2Fcore.git chore: force refresh playground editor on startup --- diff --git a/packages/sfc-playground/src/codemirror/CodeMirror.vue b/packages/sfc-playground/src/codemirror/CodeMirror.vue index 18e3b3dbca..2140922afa 100644 --- a/packages/sfc-playground/src/codemirror/CodeMirror.vue +++ b/packages/sfc-playground/src/codemirror/CodeMirror.vue @@ -55,9 +55,16 @@ onMounted(() => { editor.setOption('mode', props.mode) }) - window.addEventListener('resize', debounce(() => { + window.addEventListener( + 'resize', + debounce(() => { + editor.refresh() + }) + ) + + setTimeout(() => { editor.refresh() - })) + }, 50) }) @@ -70,7 +77,7 @@ onMounted(() => { } .CodeMirror { - font-family: "Source Code Pro", monospace; + font-family: 'Source Code Pro', monospace; height: 100%; }