Skip to content

Commit

Permalink
chore: add React 18 example
Browse files Browse the repository at this point in the history
  • Loading branch information
kswenson committed Jan 10, 2024
1 parent ef82b5c commit 0bbe49a
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
74 changes: 74 additions & 0 deletions src/assets/examples/all-providers-react-18.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<html>
<head>
<script src="../js/globals.js"></script>
<!-- load React 18, replacing React 16 from globals -->
<script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script src="../js/app.js"></script>
<link rel="stylesheet" href="../css/app.css">
<title>Examples: All Providers (React 18)</title>
</head>
<body>
<div id="wrapper">
</div>
<script>
// Clients can use React 18-only createRoot API
let root
function renderRoot(content, container) {
if (!root) {
// call createRoot once only
root = ReactDOM.createRoot(container)
}
root.render(content)
}
var options = {
app: "example-app/index.html",
mimeType: "text/plain",
readableMimeTypes: ["application/json"],
extension: "txt",
readableExtensions: ["json", "txt"],
appName: "CFM_Demo",
appVersion: "0.1",
appBuildNum: "1",
iframeAllow: "geolocation; bluetooth",
providers: [
"localStorage",
"localFile",
{
"name": "readOnly",
"urlDisplayName": "examples",
"json": {
"first-example": "This is the first readonly example",
"second-example.txt": "This is the second readonly example"
}
},
{
"name": "googleDrive",
"apiKey": "AIzaSyDJsZTW51IRHPJBpVV2d3HpcOZ96H_e7nw",
"clientId": "107140815081-p1so3nbhgvbeio1imeigd8sf1ve7l6tj.apps.googleusercontent.com",
"appId": "107140815081"
},
{
"name": "documentStore",
"patch": true
},
"s3-share-provider"
],
renderRoot,
ui: {
menu: CloudFileManager.DefaultMenu,
menuBar: {
info: "Version 1.0.0",
help: "http://lmgtfy.com/"
}
}
};
CloudFileManager.createFrame(options, "wrapper", function (event) {
if (event.type == 'connected') {
var client = event.data.client;
client.insertMenuItemAfter('openFileDialog', {"name": "Import data...", action: client.importDataDialog.bind(client)});
}
});
</script>
</body>
</html>
1 change: 1 addition & 0 deletions src/assets/examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<h1>Cloud File Manager Examples</h1>
<ul>
<li><a href="all-providers.html">All Providers</a></li>
<li><a href="all-providers-react-18.html">All Providers (React 18)</a></li>
<li><a href="no-frame.html">No Frame</a></li>
<li><a href="view-no-frame.html">View Without Frame</a></li>
<li><a href="view-no-frame-nowrap.html">View Without Frame (unwrapped)</a></li>
Expand Down

0 comments on commit 0bbe49a

Please sign in to comment.