packages/ui/src/components/chat/message/TextSelectionMenu.tsx - What: Wrap selectedText in ```md fenced block before appending to composer. - Why: Selections were appended as raw inline text with no visual distinction. packages/ui/src/components/chat/ChatInput.tsx - What: Replace trimEnd()/trim() + single-space join with raw prev + \n\n separator in append branch. - Why: Existing composer newlines were being destroyed and multiple appends ran together. packages/ui/src/components/session/ProjectNotesTodoPanel.tsx - What: Wrap todoText in ```md fenced block before appending to composer. - Why: Todo text sent to current session should have the same fenced formatting.
This commit is contained in:
@@ -589,11 +589,9 @@ export const ChatInput: React.FC<ChatInputProps> = ({ onOpenSettings, scrollToBo
|
||||
if (pending?.text) {
|
||||
if (pending.mode === 'append') {
|
||||
setMessage((prev) => {
|
||||
const next = pending.text.trim();
|
||||
if (!next) return prev;
|
||||
const base = prev.trimEnd();
|
||||
if (!base.trim()) return next;
|
||||
return `${base} ${next}`;
|
||||
if (!pending.text) return prev;
|
||||
if (!prev.trim()) return pending.text;
|
||||
return `${prev}\n\n${pending.text}`;
|
||||
});
|
||||
} else {
|
||||
setMessage(pending.text);
|
||||
|
||||
@@ -249,7 +249,8 @@ export const TextSelectionMenu: React.FC<TextSelectionMenuProps> = ({ containerR
|
||||
const handleAddToChat = React.useCallback(() => {
|
||||
if (!selectedText) return;
|
||||
|
||||
setPendingInputText(selectedText, 'append');
|
||||
const fenced = `\`\`\`md\n${selectedText}\n\`\`\``;
|
||||
setPendingInputText(fenced, 'append');
|
||||
|
||||
hideMenu();
|
||||
|
||||
|
||||
@@ -192,7 +192,8 @@ export const ProjectNotesTodoPanel: React.FC<ProjectNotesTodoPanelProps> = ({
|
||||
return;
|
||||
}
|
||||
routeToChat();
|
||||
setPendingInputText(todoText, 'append');
|
||||
const fenced = `\`\`\`md\n${todoText}\n\`\`\``;
|
||||
setPendingInputText(fenced, 'append');
|
||||
toast.success('Todo sent to current session');
|
||||
onActionComplete?.();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user