Add disabled style for prompt editor after confirming
This commit is contained in:
parent
658d616b96
commit
55bf45d265
4 changed files with 28 additions and 3 deletions
|
@ -2871,8 +2871,15 @@ impl InlineAssistant {
|
|||
cx.emit(InlineAssistantEvent::Dismissed);
|
||||
} else {
|
||||
let prompt = self.prompt_editor.read(cx).text(cx);
|
||||
self.prompt_editor
|
||||
.update(cx, |editor, _| editor.set_read_only(true));
|
||||
self.prompt_editor.update(cx, |editor, cx| {
|
||||
editor.set_read_only(true);
|
||||
editor.set_field_editor_style(
|
||||
Some(Arc::new(|theme| {
|
||||
theme.assistant.inline.disabled_editor.clone()
|
||||
})),
|
||||
cx,
|
||||
);
|
||||
});
|
||||
cx.emit(InlineAssistantEvent::Confirmed { prompt });
|
||||
self.confirmed = true;
|
||||
}
|
||||
|
|
|
@ -1606,6 +1606,15 @@ impl Editor {
|
|||
self.read_only = read_only;
|
||||
}
|
||||
|
||||
pub fn set_field_editor_style(
|
||||
&mut self,
|
||||
style: Option<Arc<GetFieldEditorTheme>>,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
self.get_field_editor_theme = style;
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
pub fn replica_id_map(&self) -> Option<&HashMap<ReplicaId, ReplicaId>> {
|
||||
self.replica_id_mapping.as_ref()
|
||||
}
|
||||
|
|
|
@ -1158,6 +1158,7 @@ pub struct InlineAssistantStyle {
|
|||
#[serde(flatten)]
|
||||
pub container: ContainerStyle,
|
||||
pub editor: FieldEditor,
|
||||
pub disabled_editor: FieldEditor,
|
||||
pub pending_edit_background: Color,
|
||||
}
|
||||
|
||||
|
|
|
@ -68,9 +68,17 @@ export default function assistant(): any {
|
|||
}),
|
||||
editor: {
|
||||
text: text(theme.highest, "mono", "default", { size: "sm" }),
|
||||
placeholder_text: text(theme.lowest, "sans", "on", "disabled"),
|
||||
placeholder_text: text(theme.highest, "sans", "on", "disabled"),
|
||||
selection: theme.players[0],
|
||||
},
|
||||
disabled_editor: {
|
||||
text: text(theme.highest, "mono", "disabled", { size: "sm" }),
|
||||
placeholder_text: text(theme.highest, "sans", "on", "disabled"),
|
||||
selection: {
|
||||
cursor: text(theme.highest, "mono", "disabled").color,
|
||||
selection: theme.players[0].selection,
|
||||
},
|
||||
},
|
||||
pending_edit_background: background(theme.highest, "positive"),
|
||||
},
|
||||
message_header: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue