1+ @import ' ../../styles/global.less' ;
2+
3+ .mdxEditorCol {
4+ flex : 1 ;
5+ height : 100% ;
6+ overflow-y : auto ;
7+ padding : 40px ;
8+ background : var (--mdx-bg-surface );
9+ transition : background 0.3s ;
10+ }
11+
12+ .mdxEditorCol :global(.ProseMirror ) {
13+ outline : none ;
14+ min-height : 100% ;
15+ max-width : 840px ;
16+ margin : 0 auto ;
17+ color : var (--mdx-text-main );
18+ line-height : 1.75 ;
19+ font-size : 16px ;
20+ padding-bottom : 50vh ;
21+ cursor : text ;
22+
23+ p .is-editor-empty :first-child ::before {
24+ content : attr (data-placeholder );
25+ color : var (--mdx-text-muted );
26+ pointer-events : none ;
27+ float : left ;
28+ height : 0 ;
29+ font-style : italic ;
30+ }
31+
32+ h1 , h2 , h3 , h4 {
33+ font-weight : 700 ;
34+ line-height : 1.3 ;
35+ margin-top : 1.5em ;
36+ margin-bottom : 0.5em ;
37+ }
38+
39+ h1 {
40+ font-size : 2.25em ;
41+ border-bottom : 1px solid var (--mdx-border );
42+ padding-bottom : 0.3em ;
43+ }
44+
45+ h2 { font-size : 1.75em ; }
46+
47+ ul , ol {
48+ padding-left : 1.5em ;
49+ margin-bottom : 1em ;
50+ }
51+
52+ ul {
53+ list-style-type : disc ;
54+ }
55+
56+ ol {
57+ list-style-type : decimal ;
58+ }
59+
60+ li {
61+ margin : 0.25em 0 ;
62+ display : list-item ;
63+ }
64+
65+ ul ul { list-style-type : circle ; }
66+ ul ul ul { list-style-type : square ; }
67+ ol ol { list-style-type : lower-alpha ; }
68+ ol ol ol { list-style-type : lower-roman ; }
69+
70+ ul [data- type= " taskList" ] {
71+ list-style : none ;
72+ padding : 0 ;
73+ /* 支持多种 Tiptap 输出结构:
74+ 1. li > label > input + div
75+ 2. li > input + div
76+ 3. li > label (仅包裹 input)
77+ */
78+ /* 支持多种 Tiptap 输出:有的版本会生成 li[data-type="taskItem"], 有的生成 li[data-checked] */
79+ li [data- type= " taskItem" ], li [data- checked] {
80+ display : flex ;
81+ align-items : center ;
82+ gap : 8px ;
83+ padding : 4px 0 ;
84+
85+ /* 情况 A: label 在左侧,label 内包含 input */
86+ > label {
87+ flex : 0 0 auto ;
88+ margin : 0 ;
89+ cursor : pointer ;
90+ display : inline-flex ;
91+ align-items : center ;
92+ justify-content : center ;
93+ width : 20px ;
94+ height : 20px ;
95+ }
96+
97+ /* 情况 B: input 与内容为直接子节点(input + div) */
98+ > input [type= " checkbox" ] {
99+ flex : 0 0 auto ;
100+ margin : 0 ;
101+ width : 18px ;
102+ height : 18px ;
103+ cursor : pointer ;
104+ }
105+
106+ /* 文本内容无论位于 div(常见)还是位于 label 内的子节点,都应占据剩余空间并垂直居中 */
107+ /* 文本内容:通常在 div > p,或者直接在 p,或作为 label 的子节点
108+ 需要同时清除内部 p 的默认 margin(如 margin-bottom)以保证垂直居中 */
109+ > div ,
110+ > label > div ,
111+ > label > p ,
112+ > p {
113+ flex : 1 1 auto ;
114+ display : flex ;
115+ align-items : center ;
116+ line-height : 1.5 ;
117+ margin : 0 ;
118+ }
119+
120+ /* 额外确保 div 内的 p 元素没有默认 margin */
121+ > div p ,
122+ > label > div p {
123+ margin : 0 ;
124+ }
125+
126+ /* 当 input 在 label 内时,确保 input 大小 */
127+ label > input [type= " checkbox" ] {
128+ width : 18px ;
129+ height : 18px ;
130+ margin : 0 ;
131+ cursor : pointer ;
132+ }
133+ }
134+ }
135+
136+ pre {
137+ background : var (--mdx-code-bg );
138+ color : var (--mdx-code-text );
139+ padding : 1rem ;
140+ border-radius : 8px ;
141+ overflow-x : auto ;
142+ margin : 1.5rem 0 ;
143+ font-family : monospace ;
144+ font-size : 0.9em ;
145+ }
146+
147+ code {
148+ background : rgba (0 ,0 ,0 ,0.05 );
149+ padding : 0.2em 0.4em ;
150+ border-radius : 4px ;
151+ font-family : monospace ;
152+ font-size : 0.85em ;
153+ color : #ef4444 ;
154+ }
155+
156+ pre code {
157+ background : transparent ;
158+ color : inherit ;
159+ padding : 0 ;
160+ }
161+
162+ blockquote {
163+ border-left : 4px solid var (--mdx-primary );
164+ padding-left : 1rem ;
165+ font-style : italic ;
166+ color : var (--mdx-text-muted );
167+ margin : 1.5em 0 ;
168+ }
169+
170+ img {
171+ max-width : 100% ;
172+ height : auto ;
173+ border-radius : 8px ;
174+ margin : 1.5rem 0 ;
175+ display : block ;
176+ box-shadow : var (--mdx-shadow-md );
177+
178+ & .ProseMirror-selectednode {
179+ outline : 3px solid var (--mdx-primary );
180+ }
181+ }
182+
183+ a {
184+ color : var (--mdx-primary );
185+ text-decoration : underline ;
186+ cursor : pointer ;
187+ }
188+
189+ table {
190+ border-collapse : collapse ;
191+ table-layout : fixed ;
192+ width : 100% ;
193+ margin : 1.5em 0 ;
194+ overflow : hidden ;
195+ }
196+
197+ td , th {
198+ min-width : 1em ;
199+ border : 1px solid var (--mdx-border );
200+ padding : 6px 10px ;
201+ vertical-align : top ;
202+ box-sizing : border-box ;
203+ background-color : var (--mdx-bg-surface );
204+ }
205+
206+ th {
207+ font-weight : 700 ;
208+ text-align : left ;
209+ background-color : var (--mdx-bg-body );
210+ }
211+
212+ .selectedCell :after {
213+ z-index : 2 ;
214+ position : absolute ;
215+ content : " " ;
216+ left : 0 ; right : 0 ; top : 0 ; bottom : 0 ;
217+ background : rgba (200 , 200 , 255 , 0.4 );
218+ pointer-events : none ;
219+ }
220+
221+ .column-resize-handle {
222+ position : absolute ;
223+ right : -2px ;
224+ top : 0 ;
225+ bottom : 0 ;
226+ width : 4px ;
227+ z-index : 20 ;
228+ background-color : #adf ;
229+ pointer-events : none ;
230+ }
231+ }
0 commit comments