mirror of https://github.com/logseq/logseq
style: run prettier
parent
c17dd5fa31
commit
249a9dc688
|
@ -42,9 +42,9 @@ interface Asset extends TLAsset {
|
|||
}
|
||||
|
||||
const assetExtensions = {
|
||||
'image': ['.png', '.svg', '.jpg', '.jpeg', '.gif'],
|
||||
'video': ['.mp4', '.webm', '.ogg'],
|
||||
'pdf': ['.pdf']
|
||||
image: ['.png', '.svg', '.jpg', '.jpeg', '.gif'],
|
||||
video: ['.mp4', '.webm', '.ogg'],
|
||||
pdf: ['.pdf'],
|
||||
}
|
||||
|
||||
function getFileType(filename: string) {
|
||||
|
@ -53,7 +53,9 @@ function getFileType(filename: string) {
|
|||
if (!extensionMatch) return 'unknown'
|
||||
const extension = extensionMatch[0].toLowerCase()
|
||||
|
||||
const [type, _extensions] = Object.entries(assetExtensions).find(([_type, extensions]) => extensions.includes(extension)) ?? ['unknown', null]
|
||||
const [type, _extensions] = Object.entries(assetExtensions).find(([_type, extensions]) =>
|
||||
extensions.includes(extension)
|
||||
) ?? ['unknown', null]
|
||||
|
||||
return type
|
||||
}
|
||||
|
|
|
@ -30,9 +30,7 @@ export class PdfShape extends TLBoxShape<PdfShapeProps> {
|
|||
|
||||
ReactComponent = observer(({ events, asset, isErasing, isEditing }: TLComponentProps) => {
|
||||
const ref = React.useRef<HTMLElement>(null)
|
||||
const {
|
||||
handlers,
|
||||
} = React.useContext(LogseqContext)
|
||||
const { handlers } = React.useContext(LogseqContext)
|
||||
const app = useApp<Shape>()
|
||||
|
||||
const isMoving = useCameraMovingRef()
|
||||
|
|
|
@ -101,7 +101,7 @@ export function getSizeFromSrc(dataURL: string, type: string): Promise<number[]>
|
|||
img.onload = () => resolve([img.width, img.height])
|
||||
img.src = dataURL
|
||||
img.onerror = err => reject(err)
|
||||
} else if(type === 'pdf'){
|
||||
} else if (type === 'pdf') {
|
||||
resolve([595, 842]) // A4 portrait dimensions at 72 ppi
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue