mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-27 01:49:33 +02:00
fix: misc
This commit is contained in:
@@ -14,6 +14,7 @@ interface MultiPdfInputComponentProps {
|
||||
value: MultiPdfInput[];
|
||||
onChange: (file: MultiPdfInput[]) => void;
|
||||
}
|
||||
|
||||
export interface MultiPdfInput {
|
||||
file: File;
|
||||
order: number;
|
||||
@@ -43,20 +44,6 @@ export default function ToolMultiFileInput({
|
||||
fileInputRef.current?.click();
|
||||
};
|
||||
|
||||
const handleCopy = () => {
|
||||
if (isArray(value)) {
|
||||
const blob = new Blob([value[0].file], { type: value[0].file.type });
|
||||
const clipboardItem = new ClipboardItem({ [value[0].file.type]: blob });
|
||||
|
||||
navigator.clipboard
|
||||
.write([clipboardItem])
|
||||
.then(() => showSnackBar('File copied', 'success'))
|
||||
.catch((err) => {
|
||||
showSnackBar('Failed to copy: ' + err, 'error');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function handleClear() {
|
||||
onChange([]);
|
||||
}
|
||||
@@ -175,11 +162,7 @@ export default function ToolMultiFileInput({
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<InputFooter
|
||||
handleCopy={handleCopy}
|
||||
handleImport={handleImportClick}
|
||||
handleClear={handleClear}
|
||||
/>
|
||||
<InputFooter handleImport={handleImportClick} handleClear={handleClear} />
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
style={{ display: 'none' }}
|
||||
|
@@ -173,7 +173,9 @@ export default function ToolFileResult({
|
||||
disabled={!value}
|
||||
handleCopy={handleCopy}
|
||||
handleDownload={handleDownload}
|
||||
hideCopy={fileType === 'video' || fileType === 'audio'}
|
||||
hideCopy={
|
||||
fileType === 'video' || fileType === 'audio' || fileType === 'pdf'
|
||||
}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
|
@@ -2,15 +2,13 @@ import { tool as pdfRotatePdf } from './rotate-pdf/meta';
|
||||
import { meta as splitPdfMeta } from './split-pdf/meta';
|
||||
import { meta as mergePdf } from './merge-pdf/meta';
|
||||
import { DefinedTool } from '@tools/defineTool';
|
||||
|
||||
export const pdfTools: DefinedTool[] = [splitPdfMeta, pdfRotatePdf, mergePdf];
|
||||
import { tool as compressPdfTool } from './compress-pdf/meta';
|
||||
import { tool as protectPdfTool } from './protect-pdf/meta';
|
||||
import { DefinedTool } from '@tools/defineTool';
|
||||
|
||||
export const pdfTools: DefinedTool[] = [
|
||||
splitPdfMeta,
|
||||
pdfRotatePdf,
|
||||
compressPdfTool,
|
||||
protectPdfTool
|
||||
protectPdfTool,
|
||||
mergePdf
|
||||
];
|
||||
|
@@ -7,7 +7,7 @@ import ToolMultiPdfInput, {
|
||||
MultiPdfInput
|
||||
} from '@components/input/ToolMultiplePdfInput';
|
||||
|
||||
export default function SplitPdf({ title }: ToolComponentProps) {
|
||||
export default function MergePdf({ title }: ToolComponentProps) {
|
||||
const [input, setInput] = useState<MultiPdfInput[]>([]);
|
||||
const [result, setResult] = useState<File | null>(null);
|
||||
const [isProcessing, setIsProcessing] = useState<boolean>(false);
|
||||
@@ -35,19 +35,18 @@ export default function SplitPdf({ title }: ToolComponentProps) {
|
||||
setInput={setInput}
|
||||
initialValues={input.map((i) => i.file)}
|
||||
compute={compute}
|
||||
// exampleCards={exampleCards}
|
||||
inputComponent={
|
||||
<ToolMultiPdfInput
|
||||
value={input}
|
||||
onChange={(v) => {
|
||||
setInput(v);
|
||||
onChange={(pdfInputs) => {
|
||||
setInput(pdfInputs);
|
||||
}}
|
||||
accept={['application/pdf']}
|
||||
title={'Input PDF'}
|
||||
type="pdf"
|
||||
/>
|
||||
}
|
||||
getGroups={({ values, updateField }) => []}
|
||||
getGroups={null}
|
||||
resultComponent={
|
||||
<ToolFileResult
|
||||
title={'Output merged PDF'}
|
||||
|
Reference in New Issue
Block a user