Skip to content

Commit 333b058

Browse files
AWolf81Rokt33r
authored andcommitted
address review comments - add production/dev main.html & remove comments
1 parent f7a6489 commit 333b058

File tree

8 files changed

+163
-18
lines changed

8 files changed

+163
-18
lines changed

browser/components/MarkdownPreview.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,8 @@ export default class MarkdownPreview extends React.Component {
10201020

10211021
if (!href) return
10221022

1023-
const regexNoteInternalLink = /main.html#(.+)/
1023+
const regexNoteInternalLink = process.env.NODE_ENV === 'production' ? /main.production.html#(.+)/ : /main.development.html#(.+)/
1024+
10241025
if (regexNoteInternalLink.test(linkHash)) {
10251026
const targetId = mdurl.encode(linkHash.match(regexNoteInternalLink)[1])
10261027
const targetElement = this.refs.root.contentWindow.document.getElementById(

browser/main/Detail/SnippetNoteDetail.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import StarButton from './StarButton'
88
import TagSelect from './TagSelect'
99
import FolderSelect from './FolderSelect'
1010
import dataApi from 'browser/main/lib/dataApi'
11-
// import {hashHistory} from 'react-router'
1211
import { history } from 'browser/main/store'
1312
import ee from 'browser/main/lib/eventEmitter'
1413
import CodeMirror from 'codemirror'

browser/main/Main.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import _ from 'lodash'
1212
import ConfigManager from 'browser/main/lib/ConfigManager'
1313
import mobileAnalytics from 'browser/main/lib/AwsMobileAnalyticsConfig'
1414
import eventEmitter from 'browser/main/lib/eventEmitter'
15-
// import { hashHistory } from 'react-router'
1615
import { store, history } from 'browser/main/store'
1716
import i18n from 'browser/lib/i18n'
1817
import { getLocales } from 'browser/lib/Languages'

browser/main/NewNoteButton/index.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,14 @@ class NewNoteButton extends React.Component {
2222
}
2323

2424
this.handleNewNoteButtonClick = this.handleNewNoteButtonClick.bind(this)
25-
26-
// why is there a newNoteHandler?!
27-
this.newNoteHandler = () => {
28-
this.handleNewNoteButtonClick()
29-
}
3025
}
3126

3227
componentDidMount () {
33-
eventEmitter.on('top:new-note', this.newNoteHandler)
28+
eventEmitter.on('top:new-note', this.handleNewNoteButtonClick)
3429
}
3530

3631
componentWillUnmount () {
37-
eventEmitter.off('top:new-note', this.newNoteHandler)
32+
eventEmitter.off('top:new-note', this.handleNewNoteButtonClick)
3833
}
3934

4035
handleNewNoteButtonClick (e) {

browser/main/store.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -469,16 +469,11 @@ function getOrInitItem (target, key) {
469469

470470
const history = createHistory()
471471

472-
// Query not available in HashHistory with ReactRouter >= v4
473-
// Relevant Issue https://github.com/ReactTraining/react-router/issues/4410#issuecomment-293772446
474-
// --> moved from query to search - so we only need query-string parsing/stringify for noteKey.
475-
// (No need to add query to history with a listener)
476-
477472
const reducer = combineReducers({
478473
data,
479474
config,
480475
status,
481-
router: connectRouter(history) // I think we could also go with-out connected-router as we're using history with imports directly
476+
router: connectRouter(history)
482477
})
483478

484479
const store = createStore(reducer, undefined, compose(

lib/main-window.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ const mainWindow = new BrowserWindow({
5454
},
5555
icon: path.resolve(__dirname, '../resources/app.png')
5656
})
57-
58-
const url = path.resolve(__dirname, './main.html')
57+
const url = path.resolve(__dirname, process.env.NODE_ENV === 'production' ? './main.production.html' : './main.development.html')
5958

6059
mainWindow.loadURL('file://' + url)
6160
mainWindow.setMenuBarVisibility(false)
File renamed without changes.

lib/main.production.html

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
7+
8+
<link rel="stylesheet" href="../node_modules/font-awesome/css/font-awesome.min.css" media="screen" charset="utf-8">
9+
<link rel="shortcut icon" href="../resources/favicon.ico">
10+
<link rel="stylesheet" href="../node_modules/codemirror/lib/codemirror.css">
11+
<link rel="stylesheet" href="../node_modules/katex/dist/katex.min.css">
12+
<link rel="stylesheet" href="../node_modules/codemirror/addon/dialog/dialog.css">
13+
<link rel="stylesheet" href="../extra_scripts/codemirror/mode/bfm/bfm.css">
14+
15+
<title>Boostnote</title>
16+
17+
<style>
18+
@font-face {
19+
font-family: 'OpenSans';
20+
src: url('../resources/fonts/Lato-Regular.woff2') format('woff2'), /* Modern Browsers */
21+
url('../resources/fonts/Lato-Regular.woff') format('woff'), /* Modern Browsers */
22+
url('../resources/fonts/Lato-Regular.ttf') format('truetype');
23+
font-style: normal;
24+
font-weight: normal;
25+
text-rendering: optimizeLegibility;
26+
}
27+
28+
@font-face {
29+
font-family: 'Lato';
30+
src: url('../resources/fonts/Lato-Regular.woff2') format('woff2'), /* Modern Browsers */
31+
url('../resources/fonts/Lato-Regular.woff') format('woff'), /* Modern Browsers */
32+
url('../resources/fonts/Lato-Regular.ttf') format('truetype');
33+
font-style: normal;
34+
font-weight: normal;
35+
text-rendering: optimizeLegibility;
36+
}
37+
38+
#loadingCover {
39+
background-color: #f4f4f4;
40+
position: absolute;
41+
top: 0;
42+
bottom: 0;
43+
left: 0;
44+
right: 0;
45+
box-sizing: border-box;
46+
padding: 65px 0;
47+
font-family: sans-serif;
48+
}
49+
50+
#loadingCover img {
51+
display: block;
52+
margin: 75px auto 5px;
53+
width: 160px;
54+
height: 160px;
55+
}
56+
57+
#loadingCover .message {
58+
font-size: 30px;
59+
text-align: center;
60+
line-height: 1.6;
61+
font-weight: 100;
62+
color: #888;
63+
}
64+
65+
.CodeEditor {
66+
opacity: 1 !important;
67+
pointer-events: auto !important;
68+
}
69+
70+
.CodeMirror-ruler {
71+
border-left-color: rgba(142, 142, 142, 0.5);
72+
mix-blend-mode: difference;
73+
}
74+
</style>
75+
</head>
76+
77+
<body>
78+
<div id="loadingCover">
79+
<img src="../resources/app.png">
80+
<div class='message'>
81+
<i class="fa fa-spinner fa-spin" spin></i>
82+
</div>
83+
</div>
84+
85+
<div id="content"></div>
86+
87+
<script src="../node_modules/codemirror/lib/codemirror.js"></script>
88+
<script src="../node_modules/codemirror/mode/meta.js"></script>
89+
<script src="../node_modules/codemirror-mode-elixir/dist/elixir.js"></script>
90+
<script src="../node_modules/codemirror/addon/mode/overlay.js"></script>
91+
<script src="../node_modules/codemirror/addon/mode/loadmode.js"></script>
92+
<script src="../node_modules/codemirror/addon/mode/simple.js"></script>
93+
<script src="../node_modules/codemirror/addon/mode/multiplex.js"></script>
94+
<script src="../node_modules/codemirror/keymap/sublime.js"></script>
95+
<script src="../node_modules/codemirror/keymap/vim.js"></script>
96+
<script src="../node_modules/codemirror/keymap/emacs.js"></script>
97+
<script src="../node_modules/codemirror/addon/runmode/runmode.js"></script>
98+
<script src="../node_modules/codemirror/addon/display/panel.js"></script>
99+
<script src="../node_modules/codemirror/mode/xml/xml.js"></script>
100+
<script src="../node_modules/codemirror/mode/markdown/markdown.js"></script>
101+
<script src="../node_modules/codemirror/mode/gfm/gfm.js"></script>
102+
<script src="../node_modules/codemirror/mode/yaml/yaml.js"></script>
103+
<script src="../node_modules/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js"></script>
104+
105+
<script src="../extra_scripts/boost/boostNewLineIndentContinueMarkdownList.js"></script>
106+
<script src="../extra_scripts/codemirror/mode/bfm/bfm.js"></script>
107+
<script src="../extra_scripts/codemirror/addon/hyperlink/hyperlink.js"></script>
108+
<script src="../extra_scripts/codemirror/mode/bfm/bfm.js"></script>
109+
110+
<script src="../node_modules/codemirror/addon/edit/closebrackets.js"></script>
111+
<script src="../node_modules/codemirror/addon/edit/matchbrackets.js"></script>
112+
113+
<script src="../node_modules/codemirror/addon/search/search.js"></script>
114+
<script src="../node_modules/codemirror/addon/search/searchcursor.js"></script>
115+
<script src="../node_modules/codemirror/addon/scroll/annotatescrollbar.js"></script>
116+
<script src="../node_modules/codemirror/addon/scroll/scrollpastend.js"></script>
117+
<script src="../node_modules/codemirror/addon/search/matchesonscrollbar.js"></script>
118+
<script src="../node_modules/codemirror/addon/search/jump-to-line.js"></script>
119+
120+
<script src="../node_modules/codemirror/addon/fold/brace-fold.js"></script>
121+
<script src="../node_modules/codemirror/addon/fold/markdown-fold.js"></script>
122+
<script src="../node_modules/codemirror/addon/fold/foldgutter.js"></script>
123+
<script src="../node_modules/codemirror/addon/fold/foldcode.js"></script>
124+
125+
<script src="../node_modules/codemirror/addon/dialog/dialog.js"></script>
126+
<script src="../node_modules/codemirror/addon/display/rulers.js"></script>
127+
128+
<script src="../node_modules/raphael/raphael.min.js"></script>
129+
<script src="../node_modules/flowchart.js/release/flowchart.min.js"></script>
130+
<script>
131+
window._ = require('lodash')
132+
</script>
133+
134+
<script src="../node_modules/@rokt33r/js-sequence-diagrams/dist/sequence-diagram-min.js"></script>
135+
<script src="../node_modules/react/umd/react.production.min.js"></script>
136+
<script src="../node_modules/react-dom/umd/react-dom.production.min.js"></script>
137+
<script src="../node_modules/redux/dist/redux.min.js"></script>
138+
<script src="../node_modules/react-redux/dist/react-redux.min.js"></script>
139+
<script type='text/javascript'>
140+
const electron = require('electron')
141+
electron.webFrame.setVisualZoomLevelLimits(1, 1)
142+
var scriptUrl = window._.find(electron.remote.process.argv, (a) => a === '--hot')
143+
? 'http://localhost:8080/assets/main.js'
144+
: '../compiled/main.js'
145+
var scriptEl = document.createElement('script')
146+
scriptEl.setAttribute('type', 'text/javascript')
147+
scriptEl.setAttribute('src', scriptUrl)
148+
document.body.appendChild(scriptEl)
149+
</script>
150+
<style>
151+
.ace_search {
152+
background-color: #d9d9d9;
153+
}
154+
</style>
155+
</body>
156+
157+
</html>

0 commit comments

Comments
 (0)