Skip to content

Commit 31609f2

Browse files
committed
fix: editor
1 parent f8ed345 commit 31609f2

2 files changed

Lines changed: 38 additions & 26 deletions

File tree

src/components/MarkdownEditor.tsx

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -125,35 +125,36 @@ export function MarkdownEditor({
125125
return (
126126
<div className={`border border-gray-300 dark:border-gray-600 rounded-md ${isMobile ? 'markdown-editor-mobile' : ''} ${className}`}>
127127
{/* Toolbar */}
128-
<div className="flex items-center gap-1 p-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 rounded-t-md">
129-
{toolbarButtons.map((button, index) => (
130-
<button
131-
key={index}
132-
onClick={button.action}
133-
className="p-1.5 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors"
134-
title={`${button.label} (${button.shortcut})`}
135-
type="button"
136-
>
137-
<button.icon className="w-4 h-4" />
138-
</button>
139-
))}
128+
<div className={`border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 rounded-t-md ${isMobile ? 'p-1' : 'p-2'}`}>
129+
<div className={`flex items-center gap-1 ${isMobile ? 'flex-wrap' : ''}`}>
130+
{toolbarButtons.map((button, index) => (
131+
<button
132+
key={index}
133+
onClick={button.action}
134+
className={`p-1.5 text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 hover:bg-gray-200 dark:hover:bg-gray-700 rounded transition-colors ${isMobile ? 'flex-shrink-0' : ''}`}
135+
title={`${button.label} (${button.shortcut})`}
136+
type="button"
137+
>
138+
<button.icon className="w-4 h-4" />
139+
</button>
140+
))}
140141

141-
<div className="ml-auto flex items-center gap-1">
142-
<button
143-
onClick={() => setShowPreview(!showPreview)}
144-
className={`p-1.5 rounded transition-colors ${
145-
showPreview
146-
? 'text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20'
147-
: 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 hover:bg-gray-200 dark:hover:bg-gray-700'
148-
}`}
149-
title={showPreview ? t('hidePreview') : t('preview')}
150-
type="button"
151-
>
152-
{showPreview ? <EyeOff className="w-4 h-4" /> : <Eye className="w-4 h-4" />}
153-
</button>
142+
<div className={`ml-auto flex items-center gap-1 ${isMobile ? 'w-full justify-end mt-1' : ''}`}>
143+
<button
144+
onClick={() => setShowPreview(!showPreview)}
145+
className={`p-1.5 rounded transition-colors ${
146+
showPreview
147+
? 'text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20'
148+
: 'text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-100 hover:bg-gray-200 dark:hover:bg-gray-700'
149+
}`}
150+
title={showPreview ? t('hidePreview') : t('preview')}
151+
type="button"
152+
>
153+
{showPreview ? <EyeOff className="w-4 h-4" /> : <Eye className="w-4 h-4" />}
154+
</button>
155+
</div>
154156
</div>
155157
</div>
156-
157158
{/* Editor/Preview */}
158159
<div className="relative">
159160
{showPreview ? (

src/index.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@
8989
overflow-wrap: break-word;
9090
}
9191

92+
.markdown-editor-mobile button {
93+
min-width: 32px;
94+
min-height: 32px;
95+
}
96+
9297
@media screen and (max-width: 480px) {
9398
.modal-dialog {
9499
max-width: calc(100vw - 2rem); /* Account for padding */
@@ -111,6 +116,12 @@
111116
.markdown-editor-mobile .p-1\\.5 {
112117
padding: 0.375rem;
113118
}
119+
120+
.markdown-editor-mobile button {
121+
min-width: 28px;
122+
min-height: 28px;
123+
padding: 0.25rem;
124+
}
114125
}
115126

116127
@media screen and (min-width: 768px) {

0 commit comments

Comments
 (0)