Skip to content

Commit cf2e525

Browse files
derfl007Keavon
andauthored
Fix the ellipses of a long document name causing the tab's unsaved asterisk to be hidden (#3146)
* Fix unsaved indicator * Change isSaved to isUnsaved to prevent showing star on tabs like Properties * Fix CSS --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
1 parent 3e50d17 commit cf2e525

2 files changed

Lines changed: 26 additions & 13 deletions

File tree

frontend/src/components/window/workspace/Panel.svelte

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
3737
export let tabMinWidths = false;
3838
export let tabCloseButtons = false;
39-
export let tabLabels: { name: string; tooltip?: string }[];
39+
export let tabLabels: { name: string; unsaved?: boolean; tooltip?: string }[];
4040
export let tabActiveIndex: number;
4141
export let panelType: PanelType | undefined = undefined;
4242
export let clickAction: ((index: number) => void) | undefined = undefined;
@@ -130,7 +130,12 @@
130130
}}
131131
bind:this={tabElements[tabIndex]}
132132
>
133-
<TextLabel>{tabLabel.name}</TextLabel>
133+
<LayoutRow class="name">
134+
<TextLabel class="text">{tabLabel.name}</TextLabel>
135+
{#if tabLabel.unsaved}
136+
<TextLabel>*</TextLabel>
137+
{/if}
138+
</LayoutRow>
134139
{#if tabCloseButtons}
135140
<IconButton
136141
action={(e) => {
@@ -260,14 +265,22 @@
260265
}
261266
}
262267
263-
.text-label {
268+
.name {
264269
flex: 1 1 100%;
265-
overflow-x: hidden;
266-
white-space: nowrap;
267-
text-overflow: ellipsis;
268-
// Height and line-height required because https://stackoverflow.com/a/21611191/775283
269-
height: 28px;
270-
line-height: 28px;
270+
271+
.text-label {
272+
// Height and line-height required because https://stackoverflow.com/a/21611191/775283
273+
height: 28px;
274+
line-height: 28px;
275+
flex: 0 0 auto;
276+
277+
&.text {
278+
overflow-x: hidden;
279+
white-space: nowrap;
280+
text-overflow: ellipsis;
281+
flex-shrink: 1;
282+
}
283+
}
271284
}
272285
273286
.icon-button {

frontend/src/components/window/workspace/Workspace.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
$: documentPanel?.scrollTabIntoView($portfolio.activeDocumentIndex);
3131
3232
$: documentTabLabels = $portfolio.documents.map((doc: OpenDocument) => {
33-
const name = doc.displayName;
34-
35-
if (!editor.handle.inDevelopmentMode()) return { name };
33+
const name = doc.details.name;
34+
const unsaved = !doc.details.isSaved;
35+
if (!editor.handle.inDevelopmentMode()) return { name, unsaved };
3636
3737
const tooltip = `Document ID: ${doc.id}`;
38-
return { name, tooltip };
38+
return { name, unsaved, tooltip };
3939
});
4040
4141
const editor = getContext<Editor>("editor");

0 commit comments

Comments
 (0)