From e83c49fd334f16ac26550b05e3e474f8c2f8e7f9 Mon Sep 17 00:00:00 2001 From: Zen Date: Sat, 9 Jul 2022 14:49:46 +0800 Subject: [PATCH 1/6] feat: wrap line in js block --- src/components/newtab/settings/jsBlockWrap.js | 5 +++++ .../newtab/shared/SharedCodemirror.vue | 4 ++++ .../workflow/edit/EditJavascriptCode.vue | 22 +++++++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/components/newtab/settings/jsBlockWrap.js diff --git a/src/components/newtab/settings/jsBlockWrap.js b/src/components/newtab/settings/jsBlockWrap.js new file mode 100644 index 000000000..0ffcd9ba0 --- /dev/null +++ b/src/components/newtab/settings/jsBlockWrap.js @@ -0,0 +1,5 @@ +import { reactive } from 'vue'; + +export const css = reactive({ + whiteSpace: 'pre', +}); diff --git a/src/components/newtab/shared/SharedCodemirror.vue b/src/components/newtab/shared/SharedCodemirror.vue index 89c0c0e0a..9397c8f05 100644 --- a/src/components/newtab/shared/SharedCodemirror.vue +++ b/src/components/newtab/shared/SharedCodemirror.vue @@ -20,6 +20,7 @@ import { keymap } from '@codemirror/view'; import { javascript } from '@codemirror/lang-javascript'; import { EditorState } from '@codemirror/state'; import { EditorView, basicSetup } from 'codemirror'; +import { css } from '../settings/jsBlockWrap'; const props = defineProps({ lang: { @@ -98,6 +99,9 @@ onBeforeUnmount(() => { });