Compare commits

...
Author SHA1 Message Date
Frooodle a48da724ee Merge branch 'main' into fix/viewer-pan-mode-text-selection-lock 2026-07-13 09:27:52 +01:00
Anthony StirlingandGitHub a84b375f5d Portal Pipelines: SVG pipeline icon (#7002)
# Description of Changes

Replaces the chain glyph in the pipelines table with a proper pipeline
icon.

Part of a portal (processor) UI-consistency pass, split into small
focused PRs.

## Before / after

<!-- paste before / after screenshots here -->

---

## Checklist

### General

- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### Translations (if applicable)

- [ ] I ran
[`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md)

### UI Changes (if applicable)

- [x] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have run `task check` to verify linters, typechecks, and tests
pass
- [x] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing)
for more details.
2026-07-12 23:56:07 +00:00
Anthony StirlingandGitHub 52358c5bf9 Portal Agent Builder: SVG upload icon (#7001)
# Description of Changes

Replaces the upload glyph in the agent bootstrap dialog with a proper
SVG icon.

Part of a portal (processor) UI-consistency pass, split into small
focused PRs.

## Before / after

<!-- paste before / after screenshots here -->

---

## Checklist

### General

- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### Translations (if applicable)

- [ ] I ran
[`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md)

### UI Changes (if applicable)

- [x] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have run `task check` to verify linters, typechecks, and tests
pass
- [x] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing)
for more details.
2026-07-12 23:55:54 +00:00
Anthony StirlingandGitHub c1e68c27c5 Portal Documents: SVG lock and timer icons (#7000)
# Description of Changes

Replaces the emoji lock and timer icons in the document queue and
extraction views with stroke SVG icons.

Part of a portal (processor) UI-consistency pass, split into small
focused PRs.

## Before / after

<!-- paste before / after screenshots here -->

---

## Checklist

### General

- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### Translations (if applicable)

- [ ] I ran
[`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md)

### UI Changes (if applicable)

- [x] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have run `task check` to verify linters, typechecks, and tests
pass
- [x] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing)
for more details.
2026-07-12 23:55:43 +00:00
LudyandGitHub d4edff9059 fix(temp-files): prevent cleanup of active registered directories (#7006) 2026-07-12 22:33:09 +01:00
Frooodle 0530b0d2f5 merge main 2026-07-10 10:39:59 +01:00
Frooodle e2d4ac2431 merge main 2026-07-06 18:45:18 +01:00
Frooodle 24f5d63cfa merge main 2026-07-02 09:36:30 +01:00
Frooodle 2df406eed3 merge main 2026-07-01 08:43:52 +01:00
Frooodle 5efef66a58 merge main 2026-06-30 08:25:42 +01:00
Frooodle 9ebbd08b4b merge main 2026-06-29 11:19:25 +01:00
Frooodle 934ba9d8f9 merge main 2026-06-27 08:18:33 +01:00
Frooodle 144344d1c8 merge main 2026-06-25 13:57:27 +01:00
Frooodle 65ed0a0326 merge main 2026-06-25 09:32:39 +01:00
Frooodle 288a68b831 merge main 2026-06-24 10:19:25 +01:00
Frooodle abfbac75ea Merge remote-tracking branch 'origin/main' into fix/viewer-pan-mode-text-selection-lock 2026-06-23 15:22:47 +01:00
Anthony StirlingandGitHub 2ec34b7968 Merge branch 'main' into fix/viewer-pan-mode-text-selection-lock 2026-06-19 17:02:02 +01:00
Anthony Stirling e104d47dc1 fix(viewer): always restore text selection when pan is toggled off 2026-06-19 15:01:22 +01:00
12 changed files with 94 additions and 26 deletions
@@ -144,8 +144,10 @@ public class TempFileCleanupService {
int directoriesDeletedCount = 0;
for (Path directory : registry.getTempDirectories()) {
try {
if (Files.exists(directory)) {
if (Files.exists(directory)
&& shouldDeleteRegisteredDirectory(directory, maxAgeMillis)) {
GeneralUtils.deleteDirectory(directory);
registry.unregisterDirectory(directory);
directoriesDeletedCount++;
log.debug("Cleaned up temporary directory: {}", directory);
}
@@ -275,6 +277,21 @@ public class TempFileCleanupService {
return totalDeletedCount.get();
}
private boolean shouldDeleteRegisteredDirectory(Path directory, long maxAgeMillis) {
if (maxAgeMillis <= 0) {
return true;
}
try {
long currentTime = System.currentTimeMillis();
long lastModified = Files.getLastModifiedTime(directory).toMillis();
return (currentTime - lastModified) > maxAgeMillis;
} catch (IOException e) {
log.debug("Could not check directory age, skipping cleanup: {}", directory, e);
return false;
}
}
/** Get the system temp directory path based on configuration or system property. */
private Path getSystemTempPath() {
String systemTempDir =
@@ -155,6 +155,7 @@ public class TempFileManager {
if (directory != null && Files.isDirectory(directory)) {
try {
GeneralUtils.deleteDirectory(directory);
registry.unregisterDirectory(directory);
log.debug("Deleted temp directory: {}", directory.toString());
} catch (IOException e) {
log.warn("Failed to delete temp directory: {}", directory.toString(), e);
@@ -85,6 +85,18 @@ public class TempFileRegistry {
return directory;
}
/**
* Unregister a temporary directory from the registry.
*
* @param directory The directory to unregister
*/
public void unregisterDirectory(Path directory) {
if (directory != null) {
tempDirectories.remove(directory);
log.debug("Unregistered temp directory: {}", directory.toString());
}
}
/**
* Register a third-party temporary file that requires special handling.
*
@@ -176,11 +176,13 @@ class TempFileCleanupServiceMoreTest {
class ScheduledCleanup {
@Test
@DisplayName("deletes registered temp directories and reports counts")
@DisplayName("deletes stale registered temp directories and reports counts")
void deletesRegisteredDirectories() throws IOException {
when(tempFileManager.cleanupOldTempFiles(anyLong())).thenReturn(2);
Path regDir = Files.createDirectories(tempDir.resolve("registeredDir"));
Files.createFile(regDir.resolve("inside.txt"));
Files.setLastModifiedTime(
regDir, FileTime.fromMillis(System.currentTimeMillis() - 2L * 60 * 60 * 1000));
Set<Path> dirs = new HashSet<>();
dirs.add(regDir);
when(registry.getTempDirectories()).thenReturn(dirs);
@@ -193,6 +195,22 @@ class TempFileCleanupServiceMoreTest {
verify(tempFileManager).cleanupOldTempFiles(anyLong());
}
@Test
@DisplayName("keeps a fresh registered temp directory")
void keepsFreshRegisteredDirectory() throws IOException {
when(tempFileManager.cleanupOldTempFiles(anyLong())).thenReturn(0);
Path regDir = Files.createDirectories(tempDir.resolve("freshRegisteredDir"));
Files.createFile(regDir.resolve("inside.txt"));
Set<Path> dirs = new HashSet<>();
dirs.add(regDir);
when(registry.getTempDirectories()).thenReturn(dirs);
lenient().when(registry.contains(any(File.class))).thenReturn(false);
withIsolatedUserHome(cleanupService::scheduledCleanup);
assertThat(Files.exists(regDir)).isTrue();
}
@Test
@DisplayName("skips a registered directory that no longer exists")
void skipsMissingRegisteredDirectory() {
@@ -1,5 +1,6 @@
import { useEffect, useRef } from "react";
import { usePan } from "@embedpdf/plugin-pan/react";
import { useInteractionManagerCapability } from "@embedpdf/plugin-interaction-manager/react";
import { useViewer } from "@app/contexts/ViewerContext";
import { useActiveDocumentId } from "@app/components/viewer/useActiveDocumentId";
import { useDocumentReady } from "@app/components/viewer/hooks/useDocumentReady";
@@ -21,13 +22,18 @@ export function PanAPIBridge() {
function PanAPIBridgeInner({ documentId }: { documentId: string }) {
const { provides: pan, isPanning } = usePan(documentId);
const { provides: imCapability } = useInteractionManagerCapability();
const { registerBridge, triggerImmediatePanUpdate } = useViewer();
// Keep pan ref updated to avoid re-running effect when object reference changes
// Keep refs updated to avoid re-running effect when object references change
const panRef = useRef(pan);
useEffect(() => {
panRef.current = pan;
}, [pan]);
const imRef = useRef(imCapability);
useEffect(() => {
imRef.current = imCapability;
}, [imCapability]);
// Track previous isPanning value to detect changes
const prevIsPanningRef = useRef<boolean>(isPanning);
@@ -39,6 +45,17 @@ function PanAPIBridgeInner({ documentId }: { documentId: string }) {
isPanning,
};
// Pan off must always land in selection (pointerMode), not the default mode -
// if pan ever became the default, disablePan/togglePan couldn't escape it (#5175).
const goToPointerMode = () => {
const im = imRef.current;
if (im) {
im.forDocument(documentId).activate("pointerMode");
} else {
currentPan.disablePan();
}
};
// Register this bridge with ViewerContext
registerBridge("pan", {
state: newState,
@@ -47,22 +64,20 @@ function PanAPIBridgeInner({ documentId }: { documentId: string }) {
currentPan.enablePan();
},
disable: () => {
currentPan.disablePan();
goToPointerMode();
},
toggle: () => {
currentPan.togglePan();
},
makePanDefault: () => {
// v2.5.0: makePanDefault may not exist, enable pan as fallback
if (
"makePanDefault" in currentPan &&
typeof (currentPan as any).makePanDefault === "function"
) {
(currentPan as any).makePanDefault();
if (isPanning) {
goToPointerMode();
} else {
currentPan.enablePan();
}
},
makePanDefault: () => {
// Never make pan the default mode (that is what locks the viewer in
// #5175). Just enable pan for the current interaction.
currentPan.enablePan();
},
},
});
@@ -75,7 +90,7 @@ function PanAPIBridgeInner({ documentId }: { documentId: string }) {
return () => {
registerBridge("pan", null);
};
}, [isPanning, registerBridge, triggerImmediatePanUpdate]);
}, [isPanning, registerBridge, triggerImmediatePanUpdate, documentId]);
return null;
}
@@ -209,12 +209,10 @@ export function useViewerWorkbenchBarButtons(
disabled:
!isPanning && pendingCount > 0 && redactionActiveType !== null,
onClick: () => {
// Don't optimistically flip isPanning - it must reflect the real EmbedPDF
// mode so the button can't show "off" while still stuck in pan (#5175).
viewer.panActions.togglePan();
setIsPanning((prev) => {
const next = !prev;
if (next && isRulerActive) setIsRulerActive?.(false);
return next;
});
if (!isPanning && isRulerActive) setIsRulerActive?.(false);
},
},
{
@@ -1,5 +1,6 @@
import { useState } from "react";
import { useTranslation } from "react-i18next";
import FileUploadRounded from "@mui/icons-material/FileUploadRounded";
import { Button, Modal } from "@app/ui";
import "@portal/views/AgentBuilder.css";
@@ -58,7 +59,7 @@ export function BootstrapDialog({ open, onClose }: BootstrapDialogProps) {
onChange={(e) => setFileName(e.target.files?.[0]?.name ?? null)}
/>
<span className="portal-agents__dropzone-icon" aria-hidden>
⇪
<FileUploadRounded style={{ fontSize: "1.5rem" }} />
</span>
<span className="portal-agents__dropzone-text">
{fileName ?? t("portal.agentBuilder.bootstrap.dropzoneText")}
@@ -1,4 +1,5 @@
import { useTranslation } from "react-i18next";
import LockRounded from "@mui/icons-material/LockRounded";
import { StatusBadge, Table, type TableColumn } from "@app/ui";
import { type Extraction, type ReviewDocument } from "@portal/api/documents";
import {
@@ -55,7 +56,7 @@ export function DocumentExtractions({
return (
<div className="portal-documents__masked">
<span className="portal-documents__masked-icon" aria-hidden>
🔒
<LockRounded style={{ fontSize: "1.5rem" }} />
</span>
<p className="portal-documents__masked-text">
{t("portal.documents.extractions.masked")}
@@ -1,4 +1,6 @@
import { useTranslation } from "react-i18next";
import ScheduleRounded from "@mui/icons-material/ScheduleRounded";
import LockRounded from "@mui/icons-material/LockRounded";
import { Banner, Button } from "@app/ui";
import { formatCountdown } from "@portal/components/documents/format";
@@ -26,7 +28,7 @@ export function ElevationBanner({
return (
<Banner
tone="success"
icon={<span aria-hidden>⏱</span>}
icon={<ScheduleRounded style={{ fontSize: "1.1rem" }} />}
title={t("portal.documents.elevation.active.title", {
time: formatCountdown(secondsLeft),
})}
@@ -42,7 +44,7 @@ export function ElevationBanner({
return (
<Banner
tone="warning"
icon={<span aria-hidden>🔒</span>}
icon={<LockRounded style={{ fontSize: "1.1rem" }} />}
title={t("portal.documents.elevation.gated.title")}
description={
fourEyes
@@ -1,5 +1,6 @@
import { useMemo } from "react";
import { useTranslation } from "react-i18next";
import LockRounded from "@mui/icons-material/LockRounded";
import { Button, Chip, StatusBadge, Table, type TableColumn } from "@app/ui";
import {
classificationTone,
@@ -75,7 +76,7 @@ export function ReviewQueueTable({
title={t("portal.documents.table.sensitiveTitle")}
aria-label={t("portal.documents.table.sensitiveLabel")}
>
🔒
<LockRounded style={{ fontSize: "0.95rem" }} />
</span>
)}
</div>
@@ -1,5 +1,6 @@
import { useMemo } from "react";
import { useTranslation } from "react-i18next";
import AccountTreeRounded from "@mui/icons-material/AccountTreeRounded";
import ChevronRightRoundedIcon from "@mui/icons-material/ChevronRightRounded";
import {
Chip,
@@ -31,7 +32,7 @@ export function PipelinesTable({ pipelines, onRowClick }: PipelinesTableProps) {
render: (p) => (
<div className="portal-pipelines__name-cell">
<span className="portal-pipelines__pipe-dot" aria-hidden>
⛓
<AccountTreeRounded style={{ fontSize: "1.2rem" }} />
</span>
<div className="portal-pipelines__name-text">
<strong>{p.name}</strong>
@@ -1,5 +1,6 @@
import { useState } from "react";
import { useTranslation } from "react-i18next";
import FileUploadRounded from "@mui/icons-material/FileUploadRounded";
import { Button, EmptyState, Skeleton } from "@app/ui";
import { useTier } from "@portal/contexts/TierContext";
import { useAsync, useSectionFlags } from "@portal/hooks/useAsync";
@@ -41,7 +42,7 @@ export function AgentBuilder() {
</div>
<Button
onClick={() => setBootstrapOpen(true)}
leftSection={<span aria-hidden>⇪</span>}
leftSection={<FileUploadRounded style={{ fontSize: "1.2rem" }} />}
>
{t("portal.agentBuilder.bootstrapFromDocument")}
</Button>