Skip to content

Commit fa9b1b5

Browse files
ncavaglioneclaude
andcommitted
fix: Bugs contains-studio#1-4 — reposition toolbar, remove outline, add code buttons, remove unsupported icons
- Bug contains-studio#1: Move formatting toolbar to top of input box (above editor area, inside border) - Bug contains-studio#2: Remove blue focus outline — strip isFocused state and conditional border-[#1264A3] class - Bug contains-studio#3: Add separate inline Code button (format: 'code') and Code Block button (CodeSquare icon, format: 'code-block'); update serializeDelta to wrap inline code in backticks - Bug contains-studio#4: Remove Mic button from bottom toolbar; keep AtSign/mention-button (used by tests) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 08d1e44 commit fa9b1b5

File tree

1 file changed

+24
-32
lines changed

1 file changed

+24
-32
lines changed

frontend/src/components/Messages/MessageInput.tsx

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import {
99
ListOrdered,
1010
List,
1111
Code,
12+
CodeSquare,
1213
Quote,
1314
Plus,
1415
AtSign,
1516
Smile,
16-
Mic,
1717
SendHorizontal,
1818
X,
1919
FileIcon,
@@ -35,7 +35,8 @@ const formatButtons = [
3535
{ icon: Link, label: 'Link', format: 'link' },
3636
{ icon: ListOrdered, label: 'Ordered List', format: 'list', value: 'ordered' },
3737
{ icon: List, label: 'Bullet List', format: 'list', value: 'bullet' },
38-
{ icon: Code, label: 'Code', format: 'code-block' },
38+
{ icon: Code, label: 'Code', format: 'code' },
39+
{ icon: CodeSquare, label: 'Code Block', format: 'code-block' },
3940
{ icon: Quote, label: 'Quote', format: 'blockquote' },
4041
];
4142

@@ -44,7 +45,6 @@ export function MessageInput({ channelId, channelName }: MessageInputProps) {
4445
const quillRef = useRef<Quill | null>(null);
4546
const fileInputRef = useRef<HTMLInputElement>(null);
4647
const [canSend, setCanSend] = useState(false);
47-
const [isFocused, setIsFocused] = useState(false);
4848
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
4949
const [pendingFiles, setPendingFiles] = useState<ApiFile[]>([]);
5050
const [isUploading, setIsUploading] = useState(false);
@@ -100,6 +100,9 @@ export function MessageInput({ channelId, channelName }: MessageInputProps) {
100100
result += '> ' + line;
101101
}
102102
}
103+
} else if (attrs['code']) {
104+
// Inline code: wrap in backticks
105+
result += '`' + text + '`';
103106
} else {
104107
result += text;
105108
}
@@ -186,9 +189,6 @@ export function MessageInput({ channelId, channelName }: MessageInputProps) {
186189
setShowMentionDropdown(false);
187190
});
188191

189-
quill.root.addEventListener('focus', () => setIsFocused(true));
190-
quill.root.addEventListener('blur', () => setIsFocused(false));
191-
192192
quillRef.current = quill;
193193
}, [channelName]);
194194

@@ -313,12 +313,24 @@ export function MessageInput({ channelId, channelName }: MessageInputProps) {
313313

314314
return (
315315
<div className="relative px-5 pb-6 pt-4 bg-white">
316-
<div
317-
className={cn(
318-
'slawk-editor rounded-[8px] border transition-all',
319-
isFocused ? 'border-[#1264A3] border-2' : 'border-[rgba(29,28,29,0.13)]'
320-
)}
321-
>
316+
<div className="slawk-editor rounded-[8px] border border-[rgba(29,28,29,0.13)]">
317+
{/* Formatting Toolbar — at the top inside the input box */}
318+
<div
319+
data-testid="formatting-toolbar"
320+
className="flex items-center gap-0.5 border-b border-[rgba(29,28,29,0.13)] px-1 py-1"
321+
>
322+
{formatButtons.map((button) => (
323+
<button
324+
key={button.label}
325+
onClick={() => applyFormat(button.format, button.value)}
326+
className="flex h-7 w-7 items-center justify-center rounded text-[#616061] hover:bg-[#F8F8F8] hover:text-[#1D1C1D]"
327+
title={button.label}
328+
>
329+
<button.icon className="h-[18px] w-[18px]" />
330+
</button>
331+
))}
332+
</div>
333+
322334
{/* File preview area */}
323335
{pendingFiles.length > 0 && (
324336
<div data-testid="file-preview" className="flex flex-wrap gap-2 px-3 py-2 border-b border-[rgba(29,28,29,0.13)]">
@@ -358,23 +370,6 @@ export function MessageInput({ channelId, channelName }: MessageInputProps) {
358370
{/* Quill Editor */}
359371
<div ref={editorRef} />
360372

361-
{/* Formatting Toolbar */}
362-
<div
363-
data-testid="formatting-toolbar"
364-
className="flex items-center gap-0.5 border-t border-[rgba(29,28,29,0.13)] px-1 py-1"
365-
>
366-
{formatButtons.map((button) => (
367-
<button
368-
key={button.label}
369-
onClick={() => applyFormat(button.format, button.value)}
370-
className="flex h-7 w-7 items-center justify-center rounded text-[#616061] hover:bg-[#F8F8F8] hover:text-[#1D1C1D]"
371-
title={button.label}
372-
>
373-
<button.icon className="h-[18px] w-[18px]" />
374-
</button>
375-
))}
376-
</div>
377-
378373
{/* Mention Dropdown */}
379374
{showMentionDropdown && mentionUsers.length > 0 && (
380375
<div
@@ -444,9 +439,6 @@ export function MessageInput({ channelId, channelName }: MessageInputProps) {
444439
>
445440
<AtSign className="h-[18px] w-[18px]" />
446441
</button>
447-
<button className="flex h-7 w-7 items-center justify-center rounded text-[#616061] hover:bg-[#F8F8F8] hover:text-[#1D1C1D]">
448-
<Mic className="h-[18px] w-[18px]" />
449-
</button>
450442
</div>
451443

452444
<button

0 commit comments

Comments
 (0)