Skip to content

Commit 67c57ae

Browse files
committed
frontend/frame title: do not limit title width if not necessary
1 parent a578c14 commit 67c57ae

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/packages/frontend/frame-editors/frame-tree/title-bar.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Button, Input, InputNumber, Popover, Tooltip } from "antd";
1212
import { List } from "immutable";
1313
import { useMemo, useRef } from "react";
1414
import { useIntl } from "react-intl";
15+
1516
import { ButtonGroup } from "@cocalc/frontend/antd-bootstrap";
1617
import {
1718
CSS,
@@ -110,6 +111,7 @@ const title_bar_style: CSS = {
110111
display: "flex",
111112
} as const;
112113

114+
// This is characters
113115
const MAX_TITLE_WIDTH = 20;
114116
const MAX_TITLE_WIDTH_INACTIVE = 40;
115117

@@ -118,7 +120,7 @@ const TITLE_STYLE: CSS = {
118120
fontSize: "11pt",
119121
whiteSpace: "nowrap",
120122
display: "inline-block",
121-
maxWidth: `${MAX_TITLE_WIDTH + 2}ex`,
123+
maxWidth: "100%",
122124
overflow: "hidden",
123125
fontWeight: 500,
124126
} as const;
@@ -706,8 +708,8 @@ export function FrameTitleBar(props: FrameTitleBarProps) {
706708
label === APPLICATION_MENU
707709
? manageCommands.applicationMenuTitle()
708710
: isIntlMessage(label)
709-
? intl.formatMessage(label)
710-
: label
711+
? intl.formatMessage(label)
712+
: label
711713
}
712714
items={v}
713715
/>
@@ -968,13 +970,10 @@ export function FrameTitleBar(props: FrameTitleBarProps) {
968970
}
969971
}
970972
}
971-
const label = (
972-
<span>
973-
{trunc_middle(
974-
title,
975-
is_active ? MAX_TITLE_WIDTH : MAX_TITLE_WIDTH_INACTIVE,
976-
)}
977-
</span>
973+
974+
const label = trunc_middle(
975+
title,
976+
is_active ? MAX_TITLE_WIDTH : MAX_TITLE_WIDTH_INACTIVE,
978977
);
979978

980979
if (props.title == null && is_active) {
@@ -993,6 +992,7 @@ export function FrameTitleBar(props: FrameTitleBarProps) {
993992
{label}
994993
</div>
995994
);
995+
996996
if (title.length >= MAX_TITLE_WIDTH) {
997997
return (
998998
<Tooltip title={title} key="title">

0 commit comments

Comments
 (0)