Repository URL to install this package:
|
Version:
3.12.20 ▾
|
import { Fragment } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { PLUGINS_IDS } from '@filerobot/utils/lib/constants';
import { usePlugin } from '@filerobot/core/lib/hooks';
import { SlideTransition } from '@filerobot/common';
import { pdfFilePreviewOpened, selectShowPdfFilePreviewFor } from '../../slices/panels.slice';
import { selectCurrentFileByIdOrUuid } from '../../slices/files.slice';
import { jsx as _jsx } from "react/jsx-runtime";
var PdftronPanel = function PdftronPanel(_ref) {
var zIndex = _ref.zIndex;
var dispatch = useDispatch();
var showPdfFilePreviewFor = useSelector(selectShowPdfFilePreviewFor);
var pdfFilePreview = useSelector(function (state) {
return selectCurrentFileByIdOrUuid(state, showPdfFilePreviewFor);
});
var pdftron = usePlugin(PLUGINS_IDS.PDFTRON);
if (!pdftron) return null;
var closePdftronPanel = function closePdftronPanel() {
dispatch(pdfFilePreviewOpened(null));
};
return /*#__PURE__*/_jsx(SlideTransition, {
zIndex: zIndex,
handleClose: closePdftronPanel,
children: showPdfFilePreviewFor && /*#__PURE__*/_jsx(Fragment, {
children: pdftron.render({
pdfFilePreview: pdfFilePreview
})
}, pdftron.id)
});
};
export default PdftronPanel;