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?.text) {
|
||||||
if (pending.mode === 'append') {
|
if (pending.mode === 'append') {
|
||||||
setMessage((prev) => {
|
setMessage((prev) => {
|
||||||
const next = pending.text.trim();
|
if (!pending.text) return prev;
|
||||||
if (!next) return prev;
|
if (!prev.trim()) return pending.text;
|
||||||
const base = prev.trimEnd();
|
return `${prev}\n\n${pending.text}`;
|
||||||
if (!base.trim()) return next;
|
|
||||||
return `${base} ${next}`;
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setMessage(pending.text);
|
setMessage(pending.text);
|
||||||
|
|||||||
@@ -249,7 +249,8 @@ export const TextSelectionMenu: React.FC<TextSelectionMenuProps> = ({ containerR
|
|||||||
const handleAddToChat = React.useCallback(() => {
|
const handleAddToChat = React.useCallback(() => {
|
||||||
if (!selectedText) return;
|
if (!selectedText) return;
|
||||||
|
|
||||||
setPendingInputText(selectedText, 'append');
|
const fenced = `\`\`\`md\n${selectedText}\n\`\`\``;
|
||||||
|
setPendingInputText(fenced, 'append');
|
||||||
|
|
||||||
hideMenu();
|
hideMenu();
|
||||||
|
|
||||||
|
|||||||
@@ -192,7 +192,8 @@ export const ProjectNotesTodoPanel: React.FC<ProjectNotesTodoPanelProps> = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
routeToChat();
|
routeToChat();
|
||||||
setPendingInputText(todoText, 'append');
|
const fenced = `\`\`\`md\n${todoText}\n\`\`\``;
|
||||||
|
setPendingInputText(fenced, 'append');
|
||||||
toast.success('Todo sent to current session');
|
toast.success('Todo sent to current session');
|
||||||
onActionComplete?.();
|
onActionComplete?.();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user