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