markdown_preview: Fix release notes title being overridden (#31703)

Closes: #31701

Screenshot:

<img width="383" alt="image"
src="https://github.com/user-attachments/assets/7fd8ce70-2208-4aca-bc70-860d6c649765"
/>



Release Notes:

- Fixed in-app release notes having an incorrect title

---------

Co-authored-by: Gilles Peiffer <gilles.peiffer.yt@gmail.com>
This commit is contained in:
Simon PhamandGilles Peiffer authored and GitHub committed 2025-05-30 08:29:52 +00:00
1 parent fc40f7a76c
commit 50b745b5df
2 files changed
+10 -6

No files matched your search

+1 -1
View File
@@ -91,7 +91,7 @@ fn view_release_notes_locally(
let buffer = cx.new(|cx| MultiBuffer::singleton(buffer, cx));
let tab_content = SharedString::from(body.title.to_string());
let tab_content = Some(SharedString::from(body.title.to_string()));
let editor = cx.new(|cx| {
Editor::for_multibuffer(buffer, Some(project), window, cx)
});
@@ -36,7 +36,7 @@ pub struct MarkdownPreviewView {
contents: Option<ParsedMarkdown>,
selected_block: usize,
list_state: ListState,
tab_content_text: SharedString,
tab_content_text: Option<SharedString>,
language_registry: Arc<LanguageRegistry>,
parsing_markdown_task: Option<Task<Result<()>>>,
}
@@ -130,7 +130,7 @@ impl MarkdownPreviewView {
editor,
workspace_handle,
language_registry,
"Markdown Preview".into(),
None,
window,
cx,
)
@@ -141,7 +141,7 @@ impl MarkdownPreviewView {
active_editor: Entity<Editor>,
workspace: WeakEntity<Workspace>,
language_registry: Arc<LanguageRegistry>,
tab_content_text: SharedString,
tab_content_text: Option<SharedString>,
window: &mut Window,
cx: &mut Context<Workspace>,
) -> Entity<Self> {
@@ -343,7 +343,9 @@ impl MarkdownPreviewView {
);
let tab_content = editor.read(cx).tab_content_text(0, cx);
self.tab_content_text = format!("Preview {}", tab_content).into();
if self.tab_content_text.is_none() {
self.tab_content_text = Some(format!("Preview {}", tab_content).into());
}
self.active_editor = Some(EditorState {
editor,
@@ -494,7 +496,9 @@ impl Item for MarkdownPreviewView {
}
fn tab_content_text(&self, _detail: usize, _cx: &App) -> SharedString {
self.tab_content_text.clone()
self.tab_content_text
.clone()
.unwrap_or_else(|| SharedString::from("Markdown Preview"))
}
fn telemetry_event_text(&self) -> Option<&'static str> {