File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,7 @@ const existingVariableTooltipCompartment = new Compartment();
157157const placeholderCompartment = new Compartment ();
158158const themeCompartment = new Compartment ();
159159const readOnlyCompartment = new Compartment ();
160+ const lineWrappingCompartment = new Compartment ();
160161
161162const buildVariableMap = (
162163 names : string [] | undefined ,
@@ -560,6 +561,8 @@ onMounted(() => {
560561 themeCompartment .of (createThemeExtension (themeVars .value )),
561562 // 🆕 只读状态
562563 readOnlyCompartment .of (EditorState .readOnly .of (props .readonly )),
564+ // 🆕 自动换行功能
565+ lineWrappingCompartment .of (EditorView .lineWrapping ),
563566 // 监听文档变化
564567 EditorView .updateListener .of ((update ) => {
565568 if (update .docChanged ) {
@@ -826,6 +829,16 @@ defineExpose({
826829
827830.codemirror-container :deep(.cm-content ) {
828831 min-height : v-bind(" editorHeight.min" );
832+ /* 🆕 支持文本自动换行 */
833+ white-space : pre-wrap ;
834+ word-wrap : break-word ;
835+ overflow-wrap : break-word ;
836+ }
837+
838+ /* 🆕 确保长行文本正确换行 */
839+ .codemirror-container :deep(.cm-line ) {
840+ white-space : pre-wrap ;
841+ word-break : break-word ;
829842}
830843
831844/* 占位符样式 */
You can’t perform that action at this time.
0 commit comments