diff options
| author | Clawd <ai@clawd.bot> | 2026-02-28 14:47:43 -0800 |
|---|---|---|
| committer | Clawd <ai@clawd.bot> | 2026-02-28 14:47:43 -0800 |
| commit | 4bd42f9c508345391806eb7c5c2ed39863764695 (patch) | |
| tree | c1409c8deb8bc09ce198c521290c6f53fc17b0f2 /renderer/src | |
| parent | 812702aa9afbfe8de7672520852a6066341a4dc0 (diff) | |
Fix CodeMirror line wrapping and container overflow
- Add EditorView.lineWrapping for soft word wrap
- Fix container CSS to prevent horizontal overflow
- Add min-width: 0 to document-pane for proper flex shrinking
- Add overflow: hidden to contain the editor
Diffstat (limited to 'renderer/src')
| -rw-r--r-- | renderer/src/components/DocumentPane.tsx | 4 | ||||
| -rw-r--r-- | renderer/src/styles/globals.css | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/renderer/src/components/DocumentPane.tsx b/renderer/src/components/DocumentPane.tsx index cf777b1..c5f456c 100644 --- a/renderer/src/components/DocumentPane.tsx +++ b/renderer/src/components/DocumentPane.tsx | |||
| @@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect } from "react"; | |||
| 2 | import ReactMarkdown from "react-markdown"; | 2 | import ReactMarkdown from "react-markdown"; |
| 3 | import remarkGfm from "remark-gfm"; | 3 | import remarkGfm from "remark-gfm"; |
| 4 | import { EditorState } from "@codemirror/state"; | 4 | import { EditorState } from "@codemirror/state"; |
| 5 | import { EditorView, keymap, lineNumbers, highlightActiveLine } from "@codemirror/view"; | 5 | import { EditorView, keymap, lineNumbers, highlightActiveLine, drawSelection } from "@codemirror/view"; |
| 6 | import { markdown } from "@codemirror/lang-markdown"; | 6 | import { markdown } from "@codemirror/lang-markdown"; |
| 7 | import { languages } from "@codemirror/language-data"; | 7 | import { languages } from "@codemirror/language-data"; |
| 8 | import { defaultKeymap, history, historyKeymap } from "@codemirror/commands"; | 8 | import { defaultKeymap, history, historyKeymap } from "@codemirror/commands"; |
| @@ -43,12 +43,14 @@ function MarkdownEditor({ | |||
| 43 | extensions: [ | 43 | extensions: [ |
| 44 | lineNumbers(), | 44 | lineNumbers(), |
| 45 | highlightActiveLine(), | 45 | highlightActiveLine(), |
| 46 | drawSelection(), | ||
| 46 | history(), | 47 | history(), |
| 47 | keymap.of([...defaultKeymap, ...historyKeymap]), | 48 | keymap.of([...defaultKeymap, ...historyKeymap]), |
| 48 | markdown({ codeLanguages: languages }), | 49 | markdown({ codeLanguages: languages }), |
| 49 | oneDark, | 50 | oneDark, |
| 50 | updateListener, | 51 | updateListener, |
| 51 | EditorView.editable.of(!disabled), | 52 | EditorView.editable.of(!disabled), |
| 53 | EditorView.lineWrapping, | ||
| 52 | EditorView.theme({ | 54 | EditorView.theme({ |
| 53 | "&": { | 55 | "&": { |
| 54 | height: "100%", | 56 | height: "100%", |
diff --git a/renderer/src/styles/globals.css b/renderer/src/styles/globals.css index f115734..7ad199e 100644 --- a/renderer/src/styles/globals.css +++ b/renderer/src/styles/globals.css | |||
| @@ -113,6 +113,8 @@ body { | |||
| 113 | display: flex; | 113 | display: flex; |
| 114 | flex-direction: column; | 114 | flex-direction: column; |
| 115 | border-right: 1px solid var(--border); | 115 | border-right: 1px solid var(--border); |
| 116 | min-width: 0; | ||
| 117 | overflow: hidden; | ||
| 116 | } | 118 | } |
| 117 | 119 | ||
| 118 | .document-header { | 120 | .document-header { |
| @@ -155,10 +157,16 @@ body { | |||
| 155 | .codemirror-editor { | 157 | .codemirror-editor { |
| 156 | flex: 1; | 158 | flex: 1; |
| 157 | overflow: hidden; | 159 | overflow: hidden; |
| 160 | min-height: 0; | ||
| 158 | } | 161 | } |
| 159 | 162 | ||
| 160 | .codemirror-editor .cm-editor { | 163 | .codemirror-editor .cm-editor { |
| 161 | height: 100%; | 164 | height: 100%; |
| 165 | max-width: 100%; | ||
| 166 | } | ||
| 167 | |||
| 168 | .codemirror-editor .cm-scroller { | ||
| 169 | overflow: auto !important; | ||
| 162 | } | 170 | } |
| 163 | 171 | ||
| 164 | .codemirror-editor .cm-gutters { | 172 | .codemirror-editor .cm-gutters { |
