Skip to content

Commit c21f88e

Browse files
committed
Merge remote-tracking branch 'origin/master' into express-5-8529
2 parents dabf62d + d11440f commit c21f88e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+671
-273
lines changed

src/packages/frontend/account/dark-mode.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ import { AccountStore } from "./store";
1010

1111
export const DARK_MODE_KEYS = ["brightness", "contrast", "sepia"] as const;
1212

13-
// Icon unicode character for dark mode toggle (◑ - circle with right half black)
14-
export const DARK_MODE_ICON = 0x25d1;
15-
1613
type Config = Record<(typeof DARK_MODE_KEYS)[number], number>;
1714

1815
export const DARK_MODE_MINS: Config = {

src/packages/frontend/account/editor-settings/font-size.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { InputNumber } from "antd";
77
import { LabeledRow } from "@cocalc/frontend/components";
8+
import { DEFAULT_FONT_SIZE } from "@cocalc/util/consts/ui";
89
import { useIntl } from "react-intl";
910

1011
interface Props {
@@ -24,7 +25,7 @@ export function EditorSettingsFontSize(props: Props) {
2425
className="cc-account-prefs-font-size"
2526
>
2627
<InputNumber
27-
onChange={(n) => props.on_change("font_size", n ?? 14)}
28+
onChange={(n) => props.on_change("font_size", n ?? DEFAULT_FONT_SIZE)}
2829
min={5}
2930
max={32}
3031
value={props.font_size}

src/packages/frontend/account/other-settings.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
*/
55

66
import { Button, Card, Slider } from "antd";
7-
import { debounce } from "lodash";
87
import { Map } from "immutable";
8+
import { debounce } from "lodash";
99
import { useMemo } from "react";
10-
import { defineMessages, FormattedMessage, useIntl } from "react-intl";
10+
import { FormattedMessage, defineMessages, useIntl } from "react-intl";
1111

1212
import { Checkbox, Panel } from "@cocalc/frontend/antd-bootstrap";
1313
import { Rendered, redux, useTypedRedux } from "@cocalc/frontend/app-framework";
@@ -41,15 +41,15 @@ import {
4141
import { NewFilenameFamilies } from "@cocalc/frontend/project/utils";
4242
import track from "@cocalc/frontend/user-tracking";
4343
import { webapp_client } from "@cocalc/frontend/webapp-client";
44+
import { DARK_MODE_ICON } from "@cocalc/util/consts/ui";
4445
import { DEFAULT_NEW_FILENAMES, NEW_FILENAMES } from "@cocalc/util/db-schema";
46+
import { DARK_MODE_DEFAULTS } from "@cocalc/util/db-schema/accounts";
4547
import { OTHER_SETTINGS_REPLY_ENGLISH_KEY } from "@cocalc/util/i18n/const";
4648
import {
47-
DARK_MODE_ICON,
4849
DARK_MODE_KEYS,
4950
DARK_MODE_MINS,
5051
get_dark_mode_config,
5152
} from "./dark-mode";
52-
import { DARK_MODE_DEFAULTS } from "@cocalc/util/db-schema/accounts";
5353
import { I18NSelector, I18N_MESSAGE, I18N_TITLE } from "./i18n-selector";
5454
import Messages from "./messages";
5555
import Tours from "./tours";

src/packages/frontend/cspell.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@
8989
"immutablejs",
9090
"ipynb",
9191
"isabs",
92+
"isactive",
9293
"isdir",
94+
"isopen",
95+
"issymlink",
9396
"kernelspec",
9497
"LLM",
9598
"LLMs",

src/packages/frontend/editors/slate/editable-markdown.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { EditorFunctions } from "@cocalc/frontend/editors/markdown-input/multimo
2828
import { SAVE_DEBOUNCE_MS } from "@cocalc/frontend/frame-editors/code-editor/const";
2929
import { useFrameContext } from "@cocalc/frontend/frame-editors/frame-tree/frame-context";
3030
import { Path } from "@cocalc/frontend/frame-editors/frame-tree/path";
31+
import { DEFAULT_FONT_SIZE } from "@cocalc/util/consts/ui";
3132
import { EditorState } from "@cocalc/frontend/frame-editors/frame-tree/types";
3233
import { markdown_to_html } from "@cocalc/frontend/markdown";
3334
import Fragment, { FragmentId } from "@cocalc/frontend/misc/fragment-id";
@@ -171,7 +172,7 @@ export const EditableMarkdown: React.FC<Props> = React.memo((props: Props) => {
171172
const isMountedRef = useIsMountedRef();
172173
const id = id0 ?? "";
173174
const actions = actions0 ?? {};
174-
const font_size = font_size0 ?? desc?.get("font_size") ?? 14; // so possible to use without specifying this. TODO: should be from account settings
175+
const font_size = font_size0 ?? desc?.get("font_size") ?? DEFAULT_FONT_SIZE; // so possible to use without specifying this. TODO: should be from account settings
175176
const [change, setChange] = useState<number>(0);
176177

177178
const editor = useMemo(() => {

src/packages/frontend/frame-editors/frame-tree/commands/generic-commands.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { debounce } from "lodash";
1010
import { useEffect, useRef } from "react";
1111
import { defineMessage, IntlShape, useIntl } from "react-intl";
1212

13-
import { DARK_MODE_ICON } from "@cocalc/frontend/account/dark-mode";
1413
import { set_account_table } from "@cocalc/frontend/account/util";
1514
import { redux } from "@cocalc/frontend/app-framework";
1615
import { Icon } from "@cocalc/frontend/components";
@@ -30,6 +29,7 @@ import { isSupportedExtension } from "@cocalc/frontend/project/page/home-page/ai
3029
import { AI_GENERATE_DOC_TAG } from "@cocalc/frontend/project/page/home-page/ai-generate-utils";
3130
import openSupportTab from "@cocalc/frontend/support/open";
3231
import userTracking from "@cocalc/frontend/user-tracking";
32+
import { DARK_MODE_ICON } from "@cocalc/util/consts/ui";
3333
import { filename_extension } from "@cocalc/util/misc";
3434
import { addCommands } from "./commands";
3535
import { SEARCH_COMMANDS } from "./const";

src/packages/frontend/frame-editors/latex-editor/output-control-build.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ import type { MenuProps } from "antd";
1212
import { Dropdown } from "antd";
1313
import { useIntl } from "react-intl";
1414

15-
import { Button as BSButton } from "@cocalc/frontend/antd-bootstrap";
16-
import { DARK_MODE_ICON } from "@cocalc/frontend/account/dark-mode";
1715
import { set_account_table } from "@cocalc/frontend/account/util";
16+
import { Button as BSButton } from "@cocalc/frontend/antd-bootstrap";
1817
import { useRedux, useTypedRedux } from "@cocalc/frontend/app-framework";
1918
import { Icon } from "@cocalc/frontend/components";
2019
import { COMMANDS } from "@cocalc/frontend/frame-editors/frame-tree/commands";
@@ -24,6 +23,7 @@ import {
2423
BUILD_ON_SAVE_LABEL,
2524
} from "@cocalc/frontend/frame-editors/frame-tree/commands/generic-commands";
2625
import { editor, IntlMessage } from "@cocalc/frontend/i18n";
26+
import { DARK_MODE_ICON } from "@cocalc/util/consts/ui";
2727

2828
import { Actions } from "./actions";
2929

src/packages/frontend/frame-editors/latex-editor/output-files.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function OutputFiles({
6363
path: filePath,
6464
displayPath,
6565
isMain: false,
66-
summary: fileSummaries[filePath] ?? "Loading...",
66+
summary: fileSummaries[filePath] ?? "Summary not available...",
6767
};
6868
});
6969

src/packages/frontend/frame-editors/latex-editor/output.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
import { EditorState } from "@cocalc/frontend/frame-editors/frame-tree/types";
4141
import { project_api } from "@cocalc/frontend/frame-editors/generic/client";
4242
import { editor, labels } from "@cocalc/frontend/i18n";
43+
import { DEFAULT_FONT_SIZE } from "@cocalc/util/consts/ui";
4344

4445
import { TITLE_BAR_BORDER } from "../frame-tree/style";
4546
import { Actions } from "./actions";
@@ -253,8 +254,8 @@ export function Output(props: OutputProps) {
253254
// Handle zoom changes from pinch-to-zoom or wheel gestures
254255
const handleZoomChange = useCallback(
255256
(data: Data) => {
256-
// Convert fontSize to zoom scale (fontSize 14 = 1.0 zoom)
257-
const newZoom = data.fontSize / 14;
257+
// Convert fontSize to zoom scale (DEFAULT_FONT_SIZE = 1.0 zoom)
258+
const newZoom = data.fontSize / DEFAULT_FONT_SIZE;
258259
const local_view_state = actions.store.get("local_view_state");
259260
actions.setState({
260261
local_view_state: local_view_state.setIn([id, "pdf_zoom"], newZoom),
@@ -369,11 +370,8 @@ export function Output(props: OutputProps) {
369370
const autoSyncInProgress =
370371
actions.store.get("autoSyncInProgress");
371372
if (autoSyncInProgress) {
372-
// Debounce the flag clearing to avoid clearing too early during scrolling
373-
clearTimeout((window as any).__autoSyncClearTimeout);
374-
(window as any).__autoSyncClearTimeout = setTimeout(() => {
375-
actions.setState({ autoSyncInProgress: false });
376-
}, 500); // Wait longer to ensure scrolling has stabilized
373+
// Clear immediately to allow next forward sync without delay
374+
actions.setState({ autoSyncInProgress: false });
377375
}
378376
}}
379377
onPageDimensions={setPageDimensions}

src/packages/frontend/frame-editors/latex-editor/pdfjs.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import usePinchToZoom, {
3535
} from "@cocalc/frontend/frame-editors/frame-tree/pinch-to-zoom";
3636
import { EditorState } from "@cocalc/frontend/frame-editors/frame-tree/types";
3737
import { list_alternatives, seconds_ago } from "@cocalc/util/misc";
38+
import { DEFAULT_FONT_SIZE } from "@cocalc/util/consts/ui";
3839
import { COLORS } from "@cocalc/util/theme";
3940
import { Actions, Actions as LatexEditorActions } from "./actions";
4041
import { dblclick } from "./mouse-click";
@@ -248,7 +249,7 @@ export function PDFJS({
248249
if (evt.key == "0" && (evt.metaKey || evt.ctrlKey)) {
249250
actions.set_font_size(
250251
id,
251-
redux.getStore("account").get("font_size") ?? 14,
252+
redux.getStore("account").get("font_size") ?? DEFAULT_FONT_SIZE,
252253
);
253254
return;
254255
}
@@ -440,7 +441,8 @@ export function PDFJS({
440441

441442
// Use onZoom callback if available (new zoom system), otherwise fall back to font_size
442443
if (onZoom) {
443-
const fontSize = getFontSize(scale);
444+
// For zoom-to-fit, always use DEFAULT_FONT_SIZE as base to avoid account font size dependency
445+
const fontSize = scale * DEFAULT_FONT_SIZE;
444446
onZoom({ fontSize });
445447
} else {
446448
actions.set_font_size(id, getFontSize(scale));
@@ -464,7 +466,8 @@ export function PDFJS({
464466

465467
// Use onZoom callback if available (new zoom system), otherwise fall back to font_size
466468
if (onZoom) {
467-
const fontSize = getFontSize(scale);
469+
// For zoom-to-fit, always use DEFAULT_FONT_SIZE as base to avoid account font size dependency
470+
const fontSize = scale * DEFAULT_FONT_SIZE;
468471
onZoom({ fontSize });
469472
} else {
470473
actions.set_font_size(id, getFontSize(scale));
@@ -840,11 +843,16 @@ export function PDFJS({
840843
if (zoom !== undefined) {
841844
return zoom;
842845
}
843-
return font_size / (redux.getStore("account").get("font_size") ?? 14);
846+
return (
847+
font_size /
848+
(redux.getStore("account").get("font_size") ?? DEFAULT_FONT_SIZE)
849+
);
844850
}, [zoom, font_size]);
845851

846852
function getFontSize(scale: number): number {
847-
return (redux.getStore("account").get("font_size") ?? 14) * scale;
853+
return (
854+
(redux.getStore("account").get("font_size") ?? DEFAULT_FONT_SIZE) * scale
855+
);
848856
}
849857

850858
function renderOtherViewers() {

0 commit comments

Comments
 (0)