ignore the coprus file
This commit is contained in:
+1
-3
@@ -1,8 +1,6 @@
|
||||
# Build output & generated directories
|
||||
# Build output
|
||||
/build/
|
||||
/out/
|
||||
/corpus/
|
||||
/docs/
|
||||
**/build/
|
||||
**/cmake-build-*/
|
||||
CMakeUserPresets.json
|
||||
|
||||
+5
-15
@@ -52,20 +52,14 @@ function App() {
|
||||
const canRedo = hist.index < hist.stack.length - 1;
|
||||
const preservePageRef = useRef(false);
|
||||
|
||||
const [isOcrDisabled, setIsOcrDisabled] = useState(false);
|
||||
const permissions = activeDoc?.permissions ?? null;
|
||||
const can = (flag: keyof PDFPermissions) => !permissions || permissions[flag] !== false;
|
||||
const denyToast = (_label: string) => { };
|
||||
const disabledTools = new Set<ToolId>();
|
||||
disabledTools.add('ocr'); // OCR & Edit button is permanently disabled
|
||||
if (!activeDoc) {
|
||||
(['highlight', 'underline', 'strikeout', 'squiggly', 'draw', 'comment', 'textbox', 'edit_text', 'stream_edit', 'signature', 'stamp', 'watermark', 'redact'] as ToolId[]).forEach((t) => disabledTools.add(t));
|
||||
} else {
|
||||
if (!can('canAnnotate'))
|
||||
(['highlight', 'underline', 'strikeout', 'squiggly', 'draw', 'comment', 'textbox', 'stamp', 'signature'] as ToolId[]).forEach((t) => disabledTools.add(t));
|
||||
if (!can('canModify'))
|
||||
(['edit_text', 'stream_edit', 'redact'] as ToolId[]).forEach((t) => disabledTools.add(t));
|
||||
}
|
||||
disabledTools.add('ocr');
|
||||
if (!can('canAnnotate'))
|
||||
(['highlight', 'underline', 'strikeout', 'squiggly', 'draw', 'comment', 'textbox', 'stamp', 'signature'] as ToolId[]).forEach((t) => disabledTools.add(t));
|
||||
if (!can('canModify')) (['edit_text', 'redact'] as ToolId[]).forEach((t) => disabledTools.add(t));
|
||||
const disabledToolsRef = useRef(disabledTools);
|
||||
disabledToolsRef.current = disabledTools;
|
||||
|
||||
@@ -160,11 +154,7 @@ function App() {
|
||||
await gatewayService.performPageOCR(activeDoc.id, currentPage);
|
||||
viewerRef.current?.refreshPageLayout(currentPage);
|
||||
} catch (err: any) {
|
||||
const errMsg = err.message || String(err);
|
||||
alert(`OCR processing failed: ${errMsg}`);
|
||||
if (errMsg.toLowerCase().includes('not installed') || errMsg.toLowerCase().includes('not available')) {
|
||||
setIsOcrDisabled(true);
|
||||
}
|
||||
alert(`OCR processing failed: ${err.message || err}`);
|
||||
} finally {
|
||||
setIsOCRLoading(false);
|
||||
}
|
||||
|
||||
@@ -727,9 +727,7 @@ class GatewayService {
|
||||
method: 'POST',
|
||||
});
|
||||
if (!response.ok) {
|
||||
const errJson = await response.json().catch(() => null);
|
||||
const detail = errJson?.detail || response.statusText;
|
||||
throw new Error(detail);
|
||||
throw new Error(`OCR failed: ${response.statusText}`);
|
||||
}
|
||||
return response.json();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user