mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-24 08:12:24 +02:00
Getting backend/frontend bridge to work
This commit is contained in:
parent
d35bd7906b
commit
243d6e9845
3
ElectronClient/.gitignore
vendored
3
ElectronClient/.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
build/
|
||||
app/locales/
|
||||
app/node_modules/
|
||||
app/lib/
|
||||
app/lib/
|
||||
*.min.js
|
27
ElectronClient/app/ReactRoot.jsx
Normal file
27
ElectronClient/app/ReactRoot.jsx
Normal file
@ -0,0 +1,27 @@
|
||||
const React = require('react');
|
||||
const { render } = require('react-dom');
|
||||
const { createStore } = require('redux');
|
||||
const { Provider } = require('react-redux');
|
||||
|
||||
const { app } = require('electron').remote.require('./app');
|
||||
|
||||
class ReactRoot extends React.Component {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
Aaaa
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const store = app().store();
|
||||
|
||||
render(
|
||||
<Provider store={store}>
|
||||
<ReactRoot />
|
||||
</Provider>,
|
||||
document.getElementById('react-root')
|
||||
)
|
@ -67,11 +67,13 @@ class Application extends BaseApplication {
|
||||
let application_ = null;
|
||||
|
||||
function app() {
|
||||
console.info('AAAAAAAAA');
|
||||
if (!application_) throw new Error('Application has not been initialized');
|
||||
return application_;
|
||||
}
|
||||
|
||||
function initApp(electronApp) {
|
||||
console.info('INIT');
|
||||
if (application_) throw new Error('Application has already been initialized');
|
||||
application_ = new Application(electronApp);
|
||||
return application_;
|
||||
|
@ -1,2 +0,0 @@
|
||||
require('app-module-path').addPath(__dirname);
|
||||
const app = require('./app.js').app;
|
@ -1,17 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
<script src="app.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
<script>
|
||||
//console.info(initApp);
|
||||
</script>
|
||||
</body>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Hello World!</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello World!</h1>
|
||||
We are using node <script>document.write(process.versions.node)</script>,
|
||||
Chrome <script>document.write(process.versions.chrome)</script>,
|
||||
and Electron <script>document.write(process.versions.electron)</script>.
|
||||
<div id="react-root"></div>
|
||||
<script src="ReactRoot.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
1034
ElectronClient/app/package-lock.json
generated
1034
ElectronClient/app/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -18,6 +18,8 @@
|
||||
},
|
||||
"homepage": "https://github.com/laurent22/joplin#readme",
|
||||
"devDependencies": {
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"electron": "^1.7.9",
|
||||
"electron-builder": "^19.43.4",
|
||||
"electron-rebuild": "^1.6.0"
|
||||
@ -30,6 +32,9 @@
|
||||
"node-fetch": "^1.7.3",
|
||||
"promise": "^8.0.1",
|
||||
"query-string": "^5.0.1",
|
||||
"react": "^16.0.0",
|
||||
"react-dom": "^16.0.0",
|
||||
"react-redux": "^5.0.6",
|
||||
"redux": "^3.7.2",
|
||||
"sprintf-js": "^1.1.1",
|
||||
"sqlite3": "^3.1.13",
|
||||
|
@ -5,6 +5,11 @@ BUILD_DIR="$ROOT_DIR/app"
|
||||
|
||||
rsync -a "$ROOT_DIR/../ReactNativeClient/lib/" "$BUILD_DIR/lib/"
|
||||
|
||||
for JSX_FILE in "$BUILD_DIR"/*.jsx; do
|
||||
JS_FILE="${JSX_FILE::-4}.min.js"
|
||||
"$ROOT_DIR/app/node_modules/.bin/babel" --presets react "$JSX_FILE" > "$JS_FILE"
|
||||
done
|
||||
|
||||
TRANSLATION_BUILD_SCRIPT="$ROOT_DIR/../CliClient/build/build-translation.js"
|
||||
if [[ ! -f $TRANSLATION_BUILD_SCRIPT ]]; then
|
||||
echo "Build the CLI app first ($TRANSLATION_BUILD_SCRIPT missing)"
|
||||
|
@ -15,6 +15,7 @@
|
||||
"package-lock.json",
|
||||
"ReactNativeClient/locales/*",
|
||||
"src/log.txt",
|
||||
"*.min.js",
|
||||
],
|
||||
"folder_exclude_patterns":
|
||||
[
|
||||
|
Loading…
Reference in New Issue
Block a user