update
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
use gpui::prelude::*;
|
||||
use gpui::{AnyElement, Context, Entity, SharedString, WeakEntity, Window, div, px};
|
||||
use gpui_component::button::{Button, ButtonVariants};
|
||||
use gpui_component::input::{Input, InputState};
|
||||
use gpui_component::input::{Editor, EditorState};
|
||||
use gpui_component::list::ListItem;
|
||||
use gpui_component::spinner::Spinner;
|
||||
use gpui_component::text::{TextView, TextViewState};
|
||||
@@ -61,7 +61,7 @@ pub(super) struct MarkdownView {
|
||||
pub(super) struct CodeView {
|
||||
/// Source path, relative to the worktree root.
|
||||
pub(super) path: SharedString,
|
||||
pub(super) state: Entity<InputState>,
|
||||
pub(super) state: Entity<EditorState>,
|
||||
}
|
||||
|
||||
/// Spinner shown while a document is being loaded/parsed.
|
||||
@@ -319,11 +319,7 @@ impl RepoDetailView {
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let language = code_language(path.as_ref()).unwrap_or("text");
|
||||
let state = cx.new(|cx| {
|
||||
InputState::new(window, cx)
|
||||
.code_editor(language)
|
||||
.default_value(text)
|
||||
});
|
||||
let state = cx.new(|cx| EditorState::new(language, window, cx).default_value(text));
|
||||
self.code = Some(CodeView { path, state });
|
||||
}
|
||||
|
||||
@@ -340,7 +336,7 @@ impl RepoDetailView {
|
||||
// Disabled: the preview is read-only. Selection, copy and the
|
||||
// built-in search (Cmd/Ctrl+F) still work; editing is blocked by the
|
||||
// component's disabled state.
|
||||
Input::new(&code.state)
|
||||
Editor::new(&code.state)
|
||||
.disabled(true)
|
||||
.h_full()
|
||||
.into_any_element()
|
||||
|
||||
Reference in New Issue
Block a user