1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-24 12:58:34 +00:00
Files
seahub/frontend/src/shared-file-view-svg.js
杨顺强 3faa4acb8e Update dependency 3 (#5344)
* update react react-dom prop-types

* update seafile-editor version

* install deep-copy denpendency

* update router version

* repair focus bug

* optimize code

* optimize code
2022-12-24 10:41:34 +08:00

34 lines
889 B
JavaScript

import React from 'react';
import { createRoot } from 'react-dom/client';
import SharedFileView from './components/shared-file-view/shared-file-view';
import SharedFileViewTip from './components/shared-file-view/shared-file-view-tip';
import './css/svg-file-view.css';
const { fileName, rawPath, err } = window.shared.pageOptions;
class SharedFileViewSVG extends React.Component {
render() {
return <SharedFileView content={<FileContent />} />;
}
}
class FileContent extends React.Component {
render() {
if (err) {
return <SharedFileViewTip />;
}
return (
<div className="shared-file-view-body d-flex">
<div className="svg-file-view flex-1">
<img src={rawPath} alt={fileName} id="svg-view" />
</div>
</div>
);
}
}
const root = createRoot(document.getElementById('wrapper'));
root.render(<SharedFileViewSVG />);