1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 18:26:26 +00:00

Compare commits

..

240 Commits

Author SHA1 Message Date
Kohei TAKATA
a7a5b789fa Merge pull request #1230 from BoostIO/feature-v0-8-18
v0.8.18
2017-12-03 11:51:11 +09:00
Kohei TAKATA
10b7d58dc6 v0.8.18 2017-12-03 11:08:06 +09:00
Kazz Yokomizo
16f0e95e32 Merge pull request #1226 from BoostIO/add-newsletter
Add newsletter link to preference modal
2017-12-02 15:45:36 +09:00
Kazu Yokomizo
55395d3a2d Add newsletter link to preference modal 2017-12-02 15:41:43 +09:00
Kazz Yokomizo
4e0fa63fad Merge pull request #1225 from BoostIO/fix-finder-layout
Fix finder layout
2017-12-02 15:33:55 +09:00
Kazu Yokomizo
b9ea7696d8 Fix finder layout 2017-12-02 15:20:16 +09:00
Kazz Yokomizo
7de3308f52 Merge pull request #1223 from BoostIO/fixbug-cannot-open-finder
fix bug cannot open finder.
2017-12-02 15:07:19 +09:00
Kazz Yokomizo
b2b2373c7b Merge pull request #1218 from PaulRosset/fixbug-react-code-mirror
Fixbug react code mirror
2017-12-02 15:03:19 +09:00
Sosuke Suzuki
1c54f40a28 require ipcClient 2017-12-02 14:07:11 +09:00
Paul Rosset
4735992835 Fix 2017-12-01 17:24:28 +00:00
Paul Rosset
cba3519458 Fix 2017-12-01 17:19:21 +00:00
Paul Rosset
c64a5e1cca Correction eslint purpose 2017-12-01 17:10:04 +00:00
Paul Rosset
47ee8b8ce7 Fix bug on UI Tab in relation to React CodeMirror 2017-12-01 16:56:43 +00:00
Kazz Yokomizo
455b424429 Merge pull request #1211 from yosmoc/tagconfirm_onblur
confirm tag at onBlur event
2017-12-01 15:11:47 +09:00
Kazz Yokomizo
7d67ac3f12 Merge pull request #1212 from PaulRosset/correct-notification-area
Correction Notification top-left
2017-12-01 15:04:40 +09:00
Paul Rosset
34f377eb5c Correction Notification top-left 2017-11-30 21:32:28 +00:00
yosmoc
b7f4af8c78 confirm tag at onBlur event
When user inputs the tag and leave the tag input box without fixing(enter or tab key), tag string is still there, but it is not stored as a tag.

This changes solved this problem. When the cursol is out of the tag input, it registers the input as a tag.
2017-11-30 22:04:56 +01:00
Kazz Yokomizo
a6c7dde194 Merge pull request #1202 from BoostIO/fix-folded-layout
Fix folded layout
2017-11-29 16:51:28 +09:00
Kazu Yokomizo
43ebe4ecfd FIx folded layout 2017-11-29 16:43:26 +09:00
Kazz Yokomizo
1d38f1abb4 Merge pull request #1197 from BoostIO/fix-initialmodal-layout
Fix layout at initial modal
2017-11-28 16:44:07 +09:00
Kazu Yokomizo
061a0cd219 Fix layout at initial modal 2017-11-28 16:27:12 +09:00
Kazz Yokomizo
f0ed20ee2c Merge pull request #1184 from cormoran/fix/SideNavFoldEmoji
Fix surrogate pairs garbling on folded SideNav
2017-11-28 12:42:41 +09:00
Kazz Yokomizo
edfc8d95c8 Merge pull request #1070 from voidsatisfaction/feature/add_multiselect_notes_delete
Feature multiselect notes delete and move to another folder
2017-11-28 12:39:12 +09:00
voidSatisfaction
c33f9d8307 fix: from let to const 2017-11-27 14:31:11 +09:00
voidSatisfaction
eee212f5b8 Merge with master resolve conflict 2017-11-27 14:05:26 +09:00
Kazz Yokomizo
b690147b0b Merge pull request #1187 from BoostIO/fix-note-list
Fix note list layout
2017-11-27 11:26:27 +09:00
Kazu Yokomizo
10879d0f67 Fix note list layout 2017-11-27 11:22:21 +09:00
Kazz Yokomizo
b48b8f39fc Merge pull request #1144 from whizark/store-window-size-on-linux
store correct window size on Linux
2017-11-27 11:06:56 +09:00
cormoran
3d0b3e759b Fix surrogate pairs garbling on folded SideNav 2017-11-27 06:04:24 +09:00
Kazz Yokomizo
3e7f4a41e2 Merge pull request #1183 from BoostIO/update-backers
Update Backers
2017-11-27 03:03:57 +09:00
Kazz Yokomizo
b89b888129 Update Backers 2017-11-27 02:57:17 +09:00
Kazz Yokomizo
cba9afc9ba Merge pull request #1180 from romainwn/fix/SideNavFilter-Hover
SideNavItem: add background when hover
2017-11-26 19:33:16 +09:00
Unknown
a66a11b81e SideNavItem: add background when hover 2017-11-26 11:21:49 +01:00
Kazz Yokomizo
22cc2791b6 Merge pull request #1179 from BoostIO/fix-margin-notedetail
Fix Margin at Note Detail
2017-11-26 16:24:36 +09:00
Kazu Yokomizo
369cf16b68 Fix Margin at Note Detail 2017-11-26 16:14:52 +09:00
Kazz Yokomizo
0d38baf194 Merge pull request #1176 from yosmoc/initmodal_exit_fix
fix anykey can close the initmodal window issue
2017-11-26 16:05:38 +09:00
Kazz Yokomizo
5b63c95f40 Merge pull request #1178 from BoostIO/fix-typo
Fix typo
2017-11-26 15:57:36 +09:00
Kazu Yokomizo
52497999a0 Fix typo 2017-11-26 15:50:45 +09:00
Kohei TAKATA
6bab108a35 Merge pull request #1113 from yosmoc/react_proptypes_deprecated
React.PropTypes is deprecated from React 15.5
2017-11-26 09:22:38 +09:00
yosmoc
eec22e6b7d fix anykey can close the initmodal issue
this change makes only ESC key can close the initmodal window.
2017-11-25 23:39:59 +01:00
yosmoc
edaa0713e8 React.PropTypes is deprecated from React 15.5
Migrated by react-codemod + minor fix by hand.
2017-11-25 22:27:04 +01:00
Kohei TAKATA
6b6a415dd5 Merge pull request #1170 from mslourens/reduce-lint-errors
fixed eslint warnings
2017-11-25 17:43:13 +09:00
Kohei TAKATA
414e0dbc05 Merge pull request #1172 from BoostIO/feature-v0-8-17
v0.8.17
2017-11-25 14:41:20 +09:00
Kohei TAKATA
081a3da9e1 v0.8.17 2017-11-25 11:22:52 +09:00
Maurits Lourens
3fbc749395 fixed eslint warnings 2017-11-24 17:00:03 +01:00
Kazz Yokomizo
626175b2b8 Merge pull request #1165 from BoostIO/fix-infopanel-position
Fix infopanel in note detail position
2017-11-24 17:41:59 +09:00
Kazu Yokomizo
54db0c718a Fix infopanel in note detail position 2017-11-24 17:38:03 +09:00
Kazz Yokomizo
ae9175d1b1 Merge pull request #1164 from BoostIO/fix-ci-error
Fix ci error
2017-11-24 12:53:10 +09:00
Kazu Yokomizo
16e1f0f882 Fix zoom icon color 2017-11-24 12:43:04 +09:00
Kazu Yokomizo
179b830d14 Fix layout at statusbar in snippet note detail 2017-11-24 12:31:45 +09:00
Kazu Yokomizo
aeb27f7bff Fix font color in note detail 2017-11-24 12:26:39 +09:00
Kazu Yokomizo
0b2b89da0f Fix CI error 2017-11-24 12:26:28 +09:00
Kazz Yokomizo
804991b300 Merge pull request #1161 from ytk141/update-note-design
Update note design
2017-11-24 12:17:32 +09:00
Yutaka Ishii
529f271e07 style update 2017-11-24 12:04:11 +09:00
Yutaka Ishii
402d577ce0 update status bar style 2017-11-23 21:52:49 +09:00
Yutaka Ishii
4bb28a358e improve search folder 2017-11-23 21:52:49 +09:00
Yutaka Ishii
200a9275d2 add font Black 2017-11-23 21:52:49 +09:00
Yutaka Ishii
9cb086cbd9 update tag and folder 2017-11-23 21:52:49 +09:00
Kazz Yokomizo
3a836aaf34 Merge pull request #1160 from BoostIO/update-readme
Update readme
2017-11-23 19:10:20 +09:00
Kazz Yokomizo
e14a6f2374 Update readme 2017-11-23 19:01:13 +09:00
Kazz Yokomizo
28794bff79 Merge pull request #1159 from BoostIO/update-top-image
Update top image
2017-11-23 17:57:18 +09:00
Kazu Yokomizo
ecc9443c9a Update top image 2017-11-23 17:32:55 +09:00
Kazz Yokomizo
a1c499c026 Merge pull request #1156 from yamash723/update-markdown-it-kbd
Updated markdown-it-kbd to 1.1.1 from 1.1.0
2017-11-22 16:31:27 +09:00
yamash723
4e8321268c Updated markdown-it-kbd to 1.1.1 from 1.1.0 2017-11-22 16:13:09 +09:00
Kazz Yokomizo
8510325732 Merge pull request #1154 from romainwn/master
Add fr /docs translations
2017-11-21 21:39:56 +09:00
Unknown
49102be894 Add fr /docs translations 2017-11-21 12:43:51 +01:00
Kazz Yokomizo
1a97488dd7 Merge pull request #1153 from BoostIO/improve-intial-content
Improve the initial content
2017-11-21 20:15:46 +09:00
Kazu Yokomizo
b90c7e5318 Improve the initial content 2017-11-21 19:54:07 +09:00
Kazz Yokomizo
ece1e37c16 Merge pull request #1152 from BoostIO/fix-layout-at-noteitem
Fix layout at note item
2017-11-21 18:06:13 +09:00
Kazu Yokomizo
3a6e3f5cae Fix layout at note item 2017-11-21 17:55:43 +09:00
Kazz Yokomizo
8e502eec80 Merge pull request #1151 from BoostIO/fix-finder-ui
Fix finder UI
2017-11-21 15:04:16 +09:00
Kazu Yokomizo
042ebe8316 Fix finder UI 2017-11-21 13:37:25 +09:00
Kazz Yokomizo
eee47b1f76 Merge pull request #1150 from BoostIO/fix-statusbar-layout
Fix status bar layout
2017-11-21 13:26:54 +09:00
Kazu Yokomizo
7978704f1b Fix status bar layout 2017-11-21 13:22:16 +09:00
Kazz Yokomizo
9392ac438c Merge pull request #1149 from BoostIO/fix-windows-scrolling-bug
Fix windows scrolling bug
2017-11-21 12:40:10 +09:00
Kazu Yokomizo
cbcfb57e35 Fix windows scrolling bug 2017-11-21 12:20:53 +09:00
Whizark
460437397f store window size on Linux 2017-11-19 21:10:53 +09:00
Kazz Yokomizo
29fa512a90 Merge pull request #1143 from BoostIO/fix-star-position
Fix star position at note list
2017-11-18 18:11:13 +09:00
Kazu Yokomizo
059d1fb4f2 Fix star position at note list 2017-11-18 17:36:08 +09:00
Kazz Yokomizo
4d3a538213 Merge pull request #1142 from BoostIO/fix-button-ux-when-toggle
Fix button layout when hover and active
2017-11-18 16:52:33 +09:00
Kazu Yokomizo
108a0db799 Fix button layout when hover and active 2017-11-18 16:21:31 +09:00
Kazz Yokomizo
04f632570d Merge pull request #1141 from BoostIO/fix-button-toggle-ux
Fix toggle info button ux at note detail
2017-11-18 16:13:47 +09:00
Kazz Yokomizo
92b919da6c Merge pull request #1140 from BoostIO/six-button-in-trash
Fix button layout in Trash
2017-11-18 16:09:10 +09:00
Kazu Yokomizo
4f0f611e52 Fix toggle info button ux at note detail 2017-11-18 16:02:45 +09:00
Kazu Yokomizo
90f7cf0996 Fix button layout in Trash 2017-11-18 15:39:00 +09:00
Kazz Yokomizo
ce43e80bdf Merge pull request #1139 from BoostIO/fix-ci
Fix ci
2017-11-18 14:50:35 +09:00
Kazu Yokomizo
c397752b7a Fix at InfoButton 2017-11-18 14:47:39 +09:00
Kazu Yokomizo
2470364571 Fix at StatusBar 2017-11-18 14:44:06 +09:00
Kazu Yokomizo
cab122ba8b Fix at StorageItem 2017-11-18 14:43:38 +09:00
Kazu Yokomizo
56b01b5a85 Fix at SideNav 2017-11-18 14:42:57 +09:00
Kazu Yokomizo
cbcc9fb411 Fix at NoteList 2017-11-18 14:42:31 +09:00
Kazu Yokomizo
5bbc60d48a Fix at NewNoteButton 2017-11-18 14:41:51 +09:00
Kazu Yokomizo
8fb8aab7b8 Fix at TrashButton 2017-11-18 14:41:15 +09:00
Kazu Yokomizo
5b76216a64 Fix at SnippetNoteDetail 2017-11-18 14:40:41 +09:00
Kazu Yokomizo
7f5e372bdc Fix at markdown note detail 2017-11-18 14:40:11 +09:00
Kazu Yokomizo
01913a9a40 Fix at Infobutton 2017-11-18 14:39:08 +09:00
Kazu Yokomizo
62f9fcf171 Fix CI error at SideNavFilter 2017-11-18 14:35:37 +09:00
Kazz Yokomizo
34c667f6b2 Merge pull request #1138 from ytk141/design-icon
Icon Design Update
2017-11-18 14:24:38 +09:00
Yutaka Ishii
7a6de387e3 delete boostnote json 2017-11-18 13:55:24 +09:00
Yutaka Ishii
b6efbcedef design update 2 2017-11-18 13:46:46 +09:00
Kazz Yokomizo
3c70b2e5a0 Merge pull request #1136 from kazuhisya/doc-for-dist-pkgs
[doc] Add how to creating distribution packages(deb, rpm)
2017-11-17 18:45:09 +09:00
Kazuhisa Hara
62e108d460 [doc] Add how to creating distribution packages (jp)
Signed-off-by: Kazuhisa Hara <kazuhisya@gmail.com>
2017-11-17 17:28:11 +09:00
Kazuhisa Hara
b7f426b03f [doc] Add how to creating distribution packages
Signed-off-by: Kazuhisa Hara <kazuhisya@gmail.com>
2017-11-17 17:22:37 +09:00
Kazz Yokomizo
5ca13b70aa Merge pull request #1135 from BoostIO/add-information-tab
Add facebook group url to infotab
2017-11-17 13:30:37 +09:00
Kazu Yokomizo
4644d107c6 Add facebook group url to infotab 2017-11-17 13:25:41 +09:00
Kazz Yokomizo
06013b2a6a Merge pull request #1126 from yamash723/add-simple-addon
Add simple addon for CodeMirror
2017-11-17 01:25:22 +09:00
Kazz Yokomizo
7380fc8500 Merge pull request #1133 from BoostIO/add-Community-on-tab
Add community on tab in preferences
2017-11-16 22:41:52 +09:00
Kazu Yokomizo
81b550e66c Add community on tab in preferences 2017-11-16 21:14:07 +09:00
Kazz Yokomizo
f5972c273b Merge pull request #266 from kazuhisya/add-rpm-support
add rpm support
2017-11-16 11:23:53 +09:00
Kohei TAKATA
c259ec2bed Merge pull request #1119 from mslourens/paste-image
replace selection with pasted image
2017-11-15 23:57:38 +09:00
voidSatisfaction
a36e779980 refactor: add new function and fix problems from feedbacks 2017-11-15 23:19:47 +09:00
Kazz Yokomizo
86a04b0dcb Merge pull request #1127 from yamash723/modify-indent-adjustment
Add task item to indent adjustment target for list
2017-11-15 15:00:17 +09:00
Kazz Yokomizo
8b7c0c957c Merge pull request #1125 from BoostIO/fix-ci-error
Fix CI error
2017-11-15 14:18:56 +09:00
Kazu Yokomizo
0cfe971a48 Fix CI error 2017-11-15 13:48:04 +09:00
Kazz Yokomizo
8884db858c Merge pull request #1041 from machellerogden/master
make ZZ work in vim mode
2017-11-15 13:46:50 +09:00
yamash723
0fe9dd4fbb Add simple addon for CodeMirror 2017-11-15 13:10:55 +09:00
yamash723
ae57e99173 Add task item to indent adjustment target for list 2017-11-15 11:31:40 +09:00
Kazz Yokomizo
c238e1b5cb Merge pull request #1121 from BoostIO/fix-note-detail-layout
Fix note detail layout
2017-11-14 21:36:13 +09:00
Kazu Yokomizo
55ef998c55 Fix create sub snippet button color 2017-11-14 21:27:02 +09:00
Maurits Lourens
166815ccbf removed unused code 2017-11-14 13:18:36 +01:00
Kazu Yokomizo
34a16298d4 Change markdown lock icon 2017-11-14 21:15:00 +09:00
Kohei TAKATA
1613e72d47 Merge pull request #1105 from yosmoc/latest_electron
electron-prebuilt is obsolete. use latest electron instead
2017-11-14 21:02:48 +09:00
Kazu Yokomizo
e933ad89dc Fix star button at note detail 2017-11-14 21:00:10 +09:00
Kazu Yokomizo
148fb25a15 Fix note list layout 2017-11-14 20:54:31 +09:00
Kohei TAKATA
fe0544dbc9 Merge pull request #1114 from levrik/remove-mixpanel
Removed mixpanel
2017-11-14 20:46:10 +09:00
Kazu Yokomizo
0aaea28e74 Fix note detail layout 2017-11-14 20:46:07 +09:00
Kazu Yokomizo
f4764afbf4 Appear the todo percentage bar 2017-11-14 20:45:53 +09:00
Kazu Yokomizo
2a2b662a6f Fix right buttons layout in note detail 2017-11-14 20:28:51 +09:00
Kazu Yokomizo
deade1f9f8 Add trash button in trash 2017-11-14 20:26:36 +09:00
Kazu Yokomizo
2b73c17cca Fix CI 2017-11-14 18:51:50 +09:00
Kazu Yokomizo
369f8b6093 Fix CI 2017-11-14 18:40:38 +09:00
Kazu Yokomizo
5391ca161d Fix top part of note detail 2017-11-14 18:38:05 +09:00
Kazu Yokomizo
5b224d3b54 Fix note detail layout 2017-11-14 18:13:37 +09:00
Maurits Lourens
dad6a93944 replace selection with pasted image 2017-11-13 22:44:18 +01:00
Kazz Yokomizo
10ec5c1342 Merge pull request #1108 from BoostIO/change-default-color-and-add-white-theme
Change default theme and add white
2017-11-14 00:51:17 +09:00
Kazz Yokomizo
8edfc15f45 Merge pull request #1081 from yosmoc/solarized_bug_fix
solarized light/dark bug fix
2017-11-13 01:05:59 +09:00
Kazu Yokomizo
792e41f161 Fix tag list on note list 2017-11-12 12:11:47 +09:00
Levin Rickert
9fbdf895af Removed mixpanel 2017-11-12 03:44:51 +01:00
yosmoc
dbc0fedf43 improve readability 2017-11-11 23:17:00 +01:00
yosmoc
cb298b8cad check solarized theme or not beofre setting css
solarized dark/light shares the solarized.css
2017-11-11 22:55:17 +01:00
yosmoc
2459a80e15 solarized light/dark bug fix
fixup for 0bf7e8b705
ConfigManager is also needed to change.
2017-11-11 22:55:17 +01:00
Kazu Yokomizo
0a973c4db3 Fix at folded UI 2017-11-12 02:11:26 +09:00
Kazu Yokomizo
a84fddd5fa Fix CI error 2017-11-11 20:34:31 +09:00
Kazu Yokomizo
1cd26d2e71 Fix layout at note detail 2017-11-11 20:25:34 +09:00
Kazu Yokomizo
f88ac891ff Fix layout at note list 2017-11-11 20:10:16 +09:00
Kazu Yokomizo
17aa9ae85f Fix small layout bug 2017-11-11 19:10:00 +09:00
Kazu Yokomizo
bb46a9ba4c Change default color and add white theme 2017-11-11 19:06:27 +09:00
Kazu Yokomizo
4a6c16df8d Add base of white theme 2017-11-11 19:05:08 +09:00
Kazz Yokomizo
95787fafc6 Merge pull request #1106 from BoostIO/chage-initial-items
Chage initial items
2017-11-11 13:25:38 +09:00
Kazu Yokomizo
c51d79e4d7 Change the information at the Infotab 2017-11-11 12:26:57 +09:00
Kazu Yokomizo
d5232a1b0e Change default markdown content 2017-11-11 12:21:27 +09:00
Kazz Yokomizo
e093c7f982 Merge pull request #1104 from yosmoc/fix_grunt_pre-build_error
Fix grunt pre-build error
2017-11-11 10:44:12 +09:00
yosmoc
3f53bddf7e electron-prebuilt is obsolete. use latest electron instead 2017-11-11 00:54:44 +01:00
yosmoc
e03d8175e3 fix grunt pre-build error 2017-11-11 00:33:41 +01:00
Kazz Yokomizo
7ab2e9f6ca Merge pull request #1096 from BoostIO/fix-layout
Fix layout
2017-11-09 23:37:25 +09:00
Kazu Yokomizo
6316ddc6a6 Fix layout 2017-11-09 21:51:43 +09:00
Kazz Yokomizo
11c46ede5d Merge pull request #398 from asmsuechan/iss-397
Fix note title
2017-11-09 21:05:14 +09:00
Kazz Yokomizo
2ec5238d97 Merge pull request #1093 from clone1612/openPreferences
[Improvement] - Option for preferences in menus (916 & 1074)
2017-11-09 19:41:53 +09:00
Jannick Hemelhof
b7f359f6cf Option for preferences in menus 2017-11-09 09:40:59 +01:00
Kazz Yokomizo
8ef485221c Merge pull request #1052 from PaulRosset/trash-counter-notes
Add counter on deleted notes
2017-11-09 15:33:36 +09:00
Kazu Yokomizo
afddb6fc33 Merge pull request #1087 from BoostIO/udpate-readme
Update Readme
2017-11-08 19:25:05 +09:00
Kazu Yokomizo
f28ee1bc4b Merge pull request #1088 from BoostIO/update-backers
Update Backers.md
2017-11-08 19:24:48 +09:00
Kazu Yokomizo
b997f0a5a7 Update Backers.md 2017-11-08 19:20:28 +09:00
Kazu Yokomizo
48dc47ce57 Update Readme 2017-11-08 19:06:47 +09:00
voidSatisfaction
84f18ced47 fix: pintotop error 2017-11-07 23:07:39 +09:00
voidSatisfaction
037ff2e749 Merge branch 'master' into feature/add_multiselect_notes_delete 2017-11-07 22:53:14 +09:00
voidSatisfaction
f0f23ede3d Merge branch 'master' into feature/add_multiselect_notes_delete 2017-11-07 22:48:50 +09:00
voidSatisfaction
c8763063c0 resolve conflict with master 2017-11-07 22:47:08 +09:00
voidSatisfaction
e57fef2413 refactor: add utils 2017-11-07 22:38:28 +09:00
asmsuechan
f1a90f4a11 Remove an unused function 2017-11-07 14:48:32 +09:00
asmsuechan
990d7edba4 Fix some pointed by eslint 2017-11-07 14:44:50 +09:00
asmsuechan
13a1da91be [Lint] Remove an unexpected trailing comma 2017-11-07 14:44:20 +09:00
asmsuechan
930b58d2a8 [Lint] Remove semicolons 2017-11-07 14:44:20 +09:00
asmsuechan
b88b1065ee [Lint] Fix double quatations to single quatations 2017-11-07 14:44:20 +09:00
sota1235
5fbb802b32 modify: add test case 2017-11-07 14:44:20 +09:00
sota1235
a40f8d25ef modify: change to modern js 2017-11-07 14:44:20 +09:00
sota1235
0a28798d54 modify: add test case for underscore 2017-11-07 14:44:20 +09:00
asmsuechan
6047987c25 refactor: fix to use cut off file 2017-11-07 14:44:15 +09:00
sota1235
2ce96186f2 add: cut out trimming text logic for md note title and add unit test 2017-11-07 14:43:31 +09:00
asmsuechan
26357bd4bc Fix note title 2017-11-07 14:43:31 +09:00
SuenagaRyota
e94b45a7e4 Merge pull request #1064 from yosmoc/importfiletoemptyfolder
enable importing file to empty folder
2017-11-07 14:42:35 +09:00
Kazu Yokomizo
4be1eb7a28 Merge pull request #1084 from BoostIO/add-backer
Add backer
2017-11-07 12:54:43 +09:00
Kazu Yokomizo
f4bbbb640d Merge pull request #1083 from BoostIO/update-issue-template
Update issue template
2017-11-07 12:54:27 +09:00
Kazu Yokomizo
94b4e70b0f Add backer 2017-11-07 10:05:23 +09:00
Kazu Yokomizo
b31e3f7783 Update issue template 2017-11-07 10:03:07 +09:00
voidSatisfaction
9095fe934d add multi selection with arrow short cut 2017-11-07 00:01:50 +09:00
voidSatisfaction
9139495f02 feat: add multiple pin to top and rename activateNote to focusNote 2017-11-06 21:53:31 +09:00
Kazu Yokomizo
6375ac857a Merge pull request #1076 from BoostIO/update-backers
Update Backers.md
2017-11-06 19:06:34 +09:00
Kazu Yokomizo
5eac08430f Update Backers.md 2017-11-06 18:56:18 +09:00
Paul Rosset
ef0b109ad4 Add 0 by default 2017-11-06 09:19:12 +00:00
Kazu Yokomizo
7fbe6c0955 Merge pull request #1067 from BoostIO/fix-layout
Fix layout
2017-11-06 16:30:32 +09:00
Kazu Yokomizo
c86e43597c Fix CI error 2017-11-06 16:11:00 +09:00
Kazu Yokomizo
123a73a5e6 Fix at InfoPanel in trash 2017-11-06 15:57:00 +09:00
Kazu Yokomizo
706b5d253f Fix updated date at note list 2017-11-06 15:49:04 +09:00
yosmoc
8fb8c7a40b importing from file uses the same storage/folder resolve logic as creating new note
It makes less confusing for user.
2017-11-06 00:22:43 +01:00
yosmoc
21220f93b1 enable importing file to empty folder
Current implementation is fetching the import destination storageKey and folderkey from a file in the folder. If no files are in the folder, it cannot fetch these keys. Use prop.params.storageKey / folderKey instead.
2017-11-06 00:21:58 +01:00
Kazu Yokomizo
705e64377b Fix CI 2017-11-06 03:08:15 +09:00
Kazu Yokomizo
5c3f0cd060 Fix layout at InfoPanel 2017-11-06 02:40:59 +09:00
voidSatisfaction
bcb1fb4331 feat multi drag and drop for changing folder 2017-11-05 21:18:39 +09:00
Kazu Yokomizo
a238be5b7c Fix font size at tag list in side bar 2017-11-05 20:40:16 +09:00
Kazu Yokomizo
2351bb78da Change "Folders" and "Tags" strings to icons. 2017-11-05 20:31:32 +09:00
Kazu Yokomizo
6bbc5a91fe Increase font size and change folder icon at side bar 2017-11-05 20:05:44 +09:00
voidSatisfaction
70b69a3bc9 refactor: inner codes 2017-11-05 19:22:55 +09:00
Kazu Yokomizo
2f52233bd0 Fix UX when press a note in note list 2017-11-05 19:21:28 +09:00
voidSatisfaction
a7e458b784 feat change name and add deletion logic 2017-11-05 19:00:03 +09:00
voidSatisfaction
a504a45d99 fix up and down key rendering problems 2017-11-05 18:45:09 +09:00
voidSatisfaction
2d0e14c1cc feat: add shiftkey multiselect notes and delete 2017-11-05 18:11:08 +09:00
Kazu Yokomizo
92eccb635a Move the notification area from main window to preference modal 2017-11-05 17:56:32 +09:00
Kazu Yokomizo
1f8acc3afc Merge pull request #1065 from BoostIO/not-quit-mac
Not quit app using close button on Mac
2017-11-05 15:18:03 +09:00
Kazu Yokomizo
f8eaa9e796 Not quit app using close button on Mac 2017-11-05 12:34:19 +09:00
Kazu Yokomizo
7c9fecd943 Merge pull request #1043 from mslourens/close-in-windows
added shortcut ctrl+q for quit and quit the app when using the Windows Close button
2017-11-05 12:13:34 +09:00
Kazu Yokomizo
3df8cbb357 Merge pull request #1049 from mslourens/selected-tag-issue
only make the selected tag active
2017-11-05 11:39:42 +09:00
Kazu Yokomizo
993cb9cb0b Merge pull request #1061 from yosmoc/master
fix solarized dark/light code block thema bug
2017-11-04 19:27:36 +09:00
Kazu Yokomizo
5bd4a3f761 Merge pull request #1033 from nathanielw/fix/pinned-next
Include each note only once when sorting by pin
2017-11-04 19:24:59 +09:00
Kazu Yokomizo
fcad84ced3 Merge pull request #1062 from asmsuechan/add-plantuml
Add PlantUML support
2017-11-04 13:25:52 +09:00
asmsuechan
0bd48981ec Add markdown-it-plantuml 2017-11-04 12:54:41 +09:00
yosmoc
0bf7e8b705 fix solarized dark/light code block thema bug
solarized dark/light shares the same css in CodeMirror.
You can see more detail info in commit 5b17808569
We need to treat solarized as a special case in code block also.
2017-11-04 01:03:56 +01:00
Paul Rosset
875c451221 Add Counters on All notes && Starred notes 2017-11-02 17:03:59 +00:00
Paul Rosset
c8256bea3a Add counter on deleted notes 2017-11-01 17:54:35 +00:00
Maurits Lourens
7d10b951b7 only make the selected tag active 2017-11-01 15:42:55 +01:00
Maurits Lourens
34e9238cc4 added shortcut ctrl+q for quit and quit the app when using the Windows Close button 2017-10-31 09:10:04 +01:00
Kazu Yokomizo
7d97784a58 Merge pull request #1042 from mslourens/image-in-anchor
only decode the url when the content of the link is a string
2017-10-31 13:23:54 +09:00
Kazu Yokomizo
1265e7c4a1 Merge pull request #1038 from voidsatisfaction/fix/pinned_note_right_click
Fix enabling no focus right click pin to top and show adequate context menu
2017-10-31 12:59:56 +09:00
Maurits Lourens
44ece2bf34 only decode the url when the content of the link is a string 2017-10-30 22:54:00 +01:00
Mac Heller-Ogden
fde2a8055d make ZZ work in vim mode 2017-10-30 15:20:59 -05:00
Kazu Yokomizo
f9643c2503 Merge pull request #1039 from BoostIO/add-props
Add props on NoteItemSimple
2017-10-31 00:53:34 +09:00
Kazu Yokomizo
e6a97e5cb3 Add props on NoteItemSimple 2017-10-31 00:46:33 +09:00
Kazu Yokomizo
73b5546ae9 Merge pull request #1036 from mslourens/context-menu
added the context menu to the list view
2017-10-31 00:37:48 +09:00
Kazu Yokomizo
f98719ee73 Merge pull request #1037 from BoostIO/change-image
Change top image
2017-10-31 00:29:58 +09:00
voidSatisfaction
7666182ae3 Fix enable no focus right click pin to top and show right context menu 2017-10-31 00:24:17 +09:00
Kazu Yokomizo
05af30f336 Change top image 2017-10-31 00:22:48 +09:00
Maurits Lourens
20de08b625 added the context menu to the list view 2017-10-30 16:18:49 +01:00
Nathaniel Watson
e60f4f4a64 Include each note only once when sorting by pin
Fixes #983
2017-10-30 21:51:44 +13:00
Kazu Yokomizo
6af25d932c Merge pull request #1022 from BoostIO/add-notification-ui-tab
Add notification at UI tab
2017-10-30 15:34:45 +09:00
Kazu Yokomizo
3f49a8a15a Merge pull request #1030 from RedBug312/fix-font-quotation
Fix custom preview fonts
2017-10-29 13:33:00 +09:00
RedBug312
bfa8db7b55 Delete escaped quotation marks between fonts
Delete addtional single quotation marks between the font name Microsoft YaHei
2017-10-29 11:42:35 +08:00
Kazu Yokomizo
d6f2e7588c Merge pull request #1025 from PaulRosset/note-uiTab_data-policy
Adjust Note in Uitab && Add message notification for data policy save
2017-10-28 18:28:27 +09:00
Paul Rosset
b9038e254e Adjust Note in Uitab && Add message notification for policy save 2017-10-27 12:38:26 +01:00
Kazu Yokomizo
b351e42538 Add notification at UI tab 2017-10-26 15:27:22 +09:00
Kazuhisa Hara
b6304a04e6 add rpm support
Make it able to build rpm package using grunt-electron-installer-redhat.
https://www.npmjs.com/package/grunt-electron-installer-redhat

Signed-off-by: Kazuhisa Hara <kazuhisya@gmail.com>
2017-01-25 21:14:30 +09:00
178 changed files with 3016 additions and 1436 deletions

View File

@@ -12,5 +12,10 @@
"react/no-find-dom-node": "warn",
"react/no-render-return-value": "warn",
"react/no-deprecated": "warn"
},
"globals": {
"FileReader": true,
"localStorage": true,
"fetch": true
}
}

View File

@@ -1,39 +1,72 @@
Dear all,
<h1 align="center">Sponsors &amp; Backers</h1>
Thanks for your using!
Boostnote is used in about 200 countries and regions, it is a awesome developer community.
Boostnote is an open source project. It's an independent project with its ongoing development made possible entirely thanks to the support by these awesome backers. If you'd like to join them, please consider:
To continue supporting this growth, and to satisfy community expectations,
we would like to invest more time in this project.
If you like this project and see its potential, you can help!
Thanks,
Boostnote maintainers.
### >> [Support via OpenCollective](https://opencollective.com/boostnoteio)
- [Become a backer or sponsor on Open Collective.](https://opencollective.com/boostnoteio)
---
## Backers
[Kazz](https://twitter.com/kazup_bot) - $65
## Backers via OpenCollective
Intense Raiden - $45
### [Gold Sponsors / $1,000 per month](https://opencollective.com/boostnoteio/order/2259)
- Get your logo on our Readme.md on GitHub and the frontpage of https://boostnote.io/.
ravy22 - $25
### [Silver Sponsors / $250 per month](https://opencollective.com/boostnoteio/order/2257)
- Get your logo on our Readme.md on GitHub and the frontpage of https://boostnote.io/.
trentpolack - $20
### [Bronze Sponsors / $50 per month](https://opencollective.com/boostnoteio/order/2258)
- Get your name and Url (or E-mail) on Readme.md on GitHub.
hikariru - $10
### [Backers3 / $10 per month](https://opencollective.com/boostnoteio/order/2176)
- [Ralph03](https://opencollective.com/ralph03)
kolchan11 - $10
- [Nikolas Dan](https://opencollective.com/nikolas-dan)
RonWalker22 - $10
### [Backers2 / $5 per month](https://opencollective.com/boostnoteio/order/2175)
- [Yeojong Kim](https://twitter.com/yeojoy)
hocchuc - $5
- [Scotia Draven](https://opencollective.com/scotia-draven)
Adam - $5
- [A. J. Vargas](https://opencollective.com/aj-vargas)
Steve - $5
### [Backers1](https://opencollective.com/boostnoteio/order/2563) and One-time sponsors
- Ryosuke Tamura - $30
evmin - $5
- tatoosh11 - $10
- Alexander Borovkov - $10
- spoonhoop - $5
- Drew Williams - $2
- Andy Shaw - $2
- mysafesky -$2
---
## Backers via Bountysource
https://salt.bountysource.com/teams/boostnote
- Kuzz - $65
- Intense Raiden - $45
- ravy22 - $25
- trentpolack - $20
- hikariru - $10
- kolchan11 - $10
- RonWalker22 - $10
- hocchuc - $5
- Adam - $5
- Steve - $5
- evmin - $5

View File

@@ -1,3 +1,10 @@
<!--
Please paste some **screenshots** with the **developer tool** open (console tab) when you report a bug.
If your issue is regarding boostnote mobile, move to https://github.com/BoostIO/boostnote-mobile.
-->
<!--
Love Boostnote? Please consider supporting us via OpenCollective:
👉 https://opencollective.com/boostnoteio
-->

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import _ from 'lodash'
import CodeMirror from 'codemirror'
import path from 'path'
@@ -67,7 +68,7 @@ export default class CodeEditor extends React.Component {
if (cm.somethingSelected()) cm.indentSelection('add')
else {
const tabs = cm.getOption('indentWithTabs')
if (line.trimLeft() === '- ' || line.trimLeft() === '* ' || line.trimLeft() === '+ ') {
if (line.trimLeft().match(/^(-|\*|\+) (\[( |x)\] )?$/)) {
cm.execCommand('goLineStart')
if (tabs) {
cm.execCommand('insertTab')
@@ -103,13 +104,14 @@ export default class CodeEditor extends React.Component {
this.editor.on('change', this.changeHandler)
this.editor.on('paste', this.pasteHandler)
let editorTheme = document.getElementById('editorTheme')
const editorTheme = document.getElementById('editorTheme')
editorTheme.addEventListener('load', this.loadStyleHandler)
CodeMirror.Vim.defineEx('quit', 'q', this.quitEditor)
CodeMirror.Vim.defineEx('q!', 'q!', this.quitEditor)
CodeMirror.Vim.defineEx('wq', 'wq', this.quitEditor)
CodeMirror.Vim.defineEx('qw', 'qw', this.quitEditor)
CodeMirror.Vim.map('ZZ', ':q', 'normal')
}
quitEditor () {
@@ -120,7 +122,7 @@ export default class CodeEditor extends React.Component {
this.editor.off('blur', this.blurHandler)
this.editor.off('change', this.changeHandler)
this.editor.off('paste', this.pasteHandler)
let editorTheme = document.getElementById('editorTheme')
const editorTheme = document.getElementById('editorTheme')
editorTheme.removeEventListener('load', this.loadStyleHandler)
}
@@ -196,7 +198,7 @@ export default class CodeEditor extends React.Component {
}
setValue (value) {
let cursor = this.editor.getCursor()
const cursor = this.editor.getCursor()
this.editor.setValue(value)
this.editor.setCursor(cursor)
}
@@ -213,9 +215,7 @@ export default class CodeEditor extends React.Component {
}
insertImageMd (imageMd) {
const textarea = this.editor.getInputField()
const cm = this.editor
cm.replaceSelection(`${textarea.value.substr(0, textarea.selectionStart)}${imageMd}${textarea.value.substr(textarea.selectionEnd)}`)
this.editor.replaceSelection(imageMd)
}
handlePaste (editor, e) {
@@ -223,7 +223,7 @@ export default class CodeEditor extends React.Component {
if (!dataTransferItem.type.match('image')) return
const blob = dataTransferItem.getAsFile()
let reader = new FileReader()
const reader = new FileReader()
let base64data
reader.readAsDataURL(blob)
@@ -243,7 +243,8 @@ export default class CodeEditor extends React.Component {
}
render () {
let { className, fontFamily, fontSize } = this.props
const { className, fontSize } = this.props
let fontFamily = this.props.className
fontFamily = _.isString(fontFamily) && fontFamily.length > 0
? [fontFamily].concat(defaultEditorFontFamily)
: defaultEditorFontFamily

View File

@@ -1,11 +1,11 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './MarkdownEditor.styl'
import CodeEditor from 'browser/components/CodeEditor'
import MarkdownPreview from 'browser/components/MarkdownPreview'
import eventEmitter from 'browser/main/lib/eventEmitter'
import { findStorage } from 'browser/lib/findStorage'
const _ = require('lodash')
class MarkdownEditor extends React.Component {
constructor (props) {
@@ -70,9 +70,9 @@ class MarkdownEditor extends React.Component {
}
handleContextMenu (e) {
let { config } = this.props
const { config } = this.props
if (config.editor.switchPreview === 'RIGHTCLICK') {
let newStatus = this.state.status === 'PREVIEW'
const newStatus = this.state.status === 'PREVIEW'
? 'CODE'
: 'PREVIEW'
this.setState({
@@ -91,9 +91,9 @@ class MarkdownEditor extends React.Component {
handleBlur (e) {
if (this.state.isLocked) return
this.setState({ keyPressed: new Set() })
let { config } = this.props
const { config } = this.props
if (config.editor.switchPreview === 'BLUR') {
let cursorPosition = this.refs.code.editor.getCursor()
const cursorPosition = this.refs.code.editor.getCursor()
this.setState({
status: 'PREVIEW'
}, () => {
@@ -109,7 +109,7 @@ class MarkdownEditor extends React.Component {
}
handlePreviewMouseUp (e) {
let { config } = this.props
const { config } = this.props
if (config.editor.switchPreview === 'BLUR' && new Date() - this.previewMouseDownedAt < 200) {
this.setState({
status: 'CODE'
@@ -123,15 +123,15 @@ class MarkdownEditor extends React.Component {
handleCheckboxClick (e) {
e.preventDefault()
e.stopPropagation()
let idMatch = /checkbox-([0-9]+)/
let checkedMatch = /\[x\]/i
let uncheckedMatch = /\[ \]/
const idMatch = /checkbox-([0-9]+)/
const checkedMatch = /\[x\]/i
const uncheckedMatch = /\[ \]/
if (idMatch.test(e.target.getAttribute('id'))) {
let lineIndex = parseInt(e.target.getAttribute('id').match(idMatch)[1], 10) - 1
let lines = this.refs.code.value
const lineIndex = parseInt(e.target.getAttribute('id').match(idMatch)[1], 10) - 1
const lines = this.refs.code.value
.split('\n')
let targetLine = lines[lineIndex]
const targetLine = lines[lineIndex]
if (targetLine.match(checkedMatch)) {
lines[lineIndex] = targetLine.replace(checkedMatch, '[ ]')
@@ -163,12 +163,12 @@ class MarkdownEditor extends React.Component {
}
handleKeyDown (e) {
let { config } = this.props
const { config } = this.props
if (this.state.status !== 'CODE') return false
const keyPressed = this.state.keyPressed
keyPressed.add(e.keyCode)
this.setState({ keyPressed })
let isNoteHandlerKey = (el) => { return keyPressed.has(el) }
const isNoteHandlerKey = (el) => { return keyPressed.has(el) }
// These conditions are for ctrl-e and ctrl-w
if (keyPressed.size === this.escapeFromEditor.length &&
!this.state.isLocked && this.state.status === 'CODE' &&
@@ -207,14 +207,14 @@ class MarkdownEditor extends React.Component {
}
render () {
let { className, value, config, storageKey } = this.props
const { className, value, config, storageKey } = this.props
let editorFontSize = parseInt(config.editor.fontSize, 10)
if (!(editorFontSize > 0 && editorFontSize < 101)) editorFontSize = 14
let editorIndentSize = parseInt(config.editor.indentSize, 10)
if (!(editorFontSize > 0 && editorFontSize < 132)) editorIndentSize = 4
let previewStyle = {}
const previewStyle = {}
if (this.props.ignorePreviewPointerEvents) previewStyle.pointerEvents = 'none'
const storage = findStorage(storageKey)

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import markdown from 'browser/lib/markdown'
import _ from 'lodash'
import CodeMirror from 'codemirror'
@@ -33,6 +34,15 @@ function buildStyle (fontFamily, fontSize, codeBlockFontFamily, lineNumber) {
font-weight: normal;
text-rendering: optimizeLegibility;
}
@font-face {
font-family: 'Lato';
src: url('${appPath}/resources/fonts/Lato-Black.woff2') format('woff2'), /* Modern Browsers */
url('${appPath}/resources/fonts/Lato-Black.woff') format('woff'), /* Modern Browsers */
url('${appPath}/resources/fonts/Lato-Black.ttf') format('truetype');
font-style: normal;
font-weight: 700;
text-rendering: optimizeLegibility;
}
${markdownStyle}
body {
font-family: '${fontFamily.join("','")}';
@@ -92,7 +102,7 @@ const OSX = global.process.platform === 'darwin'
const defaultFontFamily = ['helvetica', 'arial', 'sans-serif']
if (!OSX) {
defaultFontFamily.unshift('\'Microsoft YaHei\'')
defaultFontFamily.unshift('Microsoft YaHei')
defaultFontFamily.unshift('meiryo')
}
const defaultCodeBlockFontFamily = ['Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'monospace']
@@ -117,10 +127,10 @@ export default class MarkdownPreview extends React.Component {
e.preventDefault()
e.stopPropagation()
let anchor = e.target.closest('a')
let href = anchor.getAttribute('href')
const anchor = e.target.closest('a')
const href = anchor.getAttribute('href')
if (_.isString(href) && href.match(/^#/)) {
let targetElement = this.refs.root.contentWindow.document.getElementById(href.substring(1, href.length))
const targetElement = this.refs.root.contentWindow.document.getElementById(href.substring(1, href.length))
if (targetElement != null) {
this.getWindow().scrollTo(0, targetElement.offsetTop)
}
@@ -185,12 +195,14 @@ export default class MarkdownPreview extends React.Component {
}
fixDecodedURI (node) {
if (node && node.children.length === 1 && typeof node.children[0] === 'string') {
const { innerText, href } = node
node.innerText = mdurl.decode(href) === innerText
? href
: innerText
}
}
componentDidMount () {
this.refs.root.setAttribute('sandbox', 'allow-scripts')
@@ -240,7 +252,8 @@ export default class MarkdownPreview extends React.Component {
}
applyStyle () {
let { fontFamily, fontSize, codeBlockFontFamily, lineNumber, codeBlockTheme } = this.props
const { fontSize, lineNumber, codeBlockTheme } = this.props
let { fontFamily, codeBlockFontFamily } = this.props
fontFamily = _.isString(fontFamily) && fontFamily.trim().length > 0
? [fontFamily].concat(defaultFontFamily)
: defaultFontFamily
@@ -256,7 +269,9 @@ export default class MarkdownPreview extends React.Component {
theme = consts.THEMES.some((_theme) => _theme === theme) && theme !== 'default'
? theme
: 'elegant'
this.getWindow().document.getElementById('codeTheme').href = `${appPath}/node_modules/codemirror/theme/${theme}.css`
this.getWindow().document.getElementById('codeTheme').href = theme.startsWith('solarized')
? `${appPath}/node_modules/codemirror/theme/solarized.css`
: `${appPath}/node_modules/codemirror/theme/${theme}.css`
}
rewriteIframe () {
@@ -271,7 +286,8 @@ export default class MarkdownPreview extends React.Component {
el.removeEventListener('click', this.linkClickHandler)
})
let { value, theme, indentSize, codeBlockTheme, showCopyNotification, storagePath } = this.props
const { theme, indentSize, showCopyNotification, storagePath } = this.props
let { value, codeBlockTheme } = this.props
this.refs.root.contentWindow.document.body.setAttribute('data-theme', theme)
@@ -314,7 +330,7 @@ export default class MarkdownPreview extends React.Component {
let syntax = CodeMirror.findModeByName(el.className)
if (syntax == null) syntax = CodeMirror.findModeByName('Plain Text')
CodeMirror.requireMode(syntax.mode, () => {
let content = htmlTextHelper.decodeEntities(el.innerHTML)
const content = htmlTextHelper.decodeEntities(el.innerHTML)
const copyIcon = document.createElement('i')
copyIcon.innerHTML = '<button class="clipboardButton"><svg width="13" height="13" viewBox="0 0 1792 1792" ><path d="M768 1664h896v-640h-416q-40 0-68-28t-28-68v-416h-384v1152zm256-1440v-64q0-13-9.5-22.5t-22.5-9.5h-704q-13 0-22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h704q13 0 22.5-9.5t9.5-22.5zm256 672h299l-299-299v299zm512 128v672q0 40-28 68t-68 28h-960q-40 0-68-28t-28-68v-160h-544q-40 0-68-28t-28-68v-1344q0-40 28-68t68-28h1088q40 0 68 28t28 68v328q21 13 36 28l408 408q28 28 48 76t20 88z"/></svg></button>'
copyIcon.onclick = (e) => {
@@ -328,13 +344,18 @@ export default class MarkdownPreview extends React.Component {
}
el.parentNode.appendChild(copyIcon)
el.innerHTML = ''
if (codeBlockTheme.indexOf('solarized') === 0) {
const [refThema, color] = codeBlockTheme.split(' ')
el.parentNode.className += ` cm-s-${refThema} cm-s-${color} CodeMirror`
} else {
el.parentNode.className += ` cm-s-${codeBlockTheme} CodeMirror`
}
CodeMirror.runMode(content, syntax.mime, el, {
tabSize: indentSize
})
})
})
let opts = {}
const opts = {}
// if (this.props.theme === 'dark') {
// opts['font-color'] = '#DDD'
// opts['line-color'] = '#DDD'
@@ -344,7 +365,7 @@ export default class MarkdownPreview extends React.Component {
_.forEach(this.refs.root.contentWindow.document.querySelectorAll('.flowchart'), (el) => {
Raphael.setWindow(this.getWindow())
try {
let diagram = flowchart.parse(htmlTextHelper.decodeEntities(el.innerHTML))
const diagram = flowchart.parse(htmlTextHelper.decodeEntities(el.innerHTML))
el.innerHTML = ''
diagram.drawSVG(el, opts)
_.forEach(el.querySelectorAll('a'), (el) => {
@@ -360,7 +381,7 @@ export default class MarkdownPreview extends React.Component {
_.forEach(this.refs.root.contentWindow.document.querySelectorAll('.sequence'), (el) => {
Raphael.setWindow(this.getWindow())
try {
let diagram = SequenceDiagram.parse(htmlTextHelper.decodeEntities(el.innerHTML))
const diagram = SequenceDiagram.parse(htmlTextHelper.decodeEntities(el.innerHTML))
el.innerHTML = ''
diagram.drawSVG(el, {theme: 'simple'})
_.forEach(el.querySelectorAll('a'), (el) => {
@@ -383,11 +404,11 @@ export default class MarkdownPreview extends React.Component {
}
scrollTo (targetRow) {
let blocks = this.getWindow().document.querySelectorAll('body>[data-line]')
const blocks = this.getWindow().document.querySelectorAll('body>[data-line]')
for (let index = 0; index < blocks.length; index++) {
let block = blocks[index]
let row = parseInt(block.getAttribute('data-line'))
const row = parseInt(block.getAttribute('data-line'))
if (row > targetRow || index === blocks.length - 1) {
block = blocks[index - 1]
block != null && this.getWindow().scrollTo(0, block.offsetTop)
@@ -417,7 +438,7 @@ export default class MarkdownPreview extends React.Component {
}
render () {
let { className, style, tabIndex } = this.props
const { className, style, tabIndex } = this.props
return (
<iframe className={className != null
? 'MarkdownPreview ' + className

View File

@@ -1,4 +1,5 @@
import React, {PropTypes} from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './ModalEscButton.styl'

View File

@@ -1,7 +1,8 @@
/**
* @fileoverview Micro component for toggle SideNav
*/
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import styles from './NavToggleButton.styl'
import CSSModules from 'browser/lib/CSSModules'

View File

@@ -10,6 +10,9 @@
line-height 32px
padding 0
body[data-theme="white"]
navWhiteButtonColor()
body[data-theme="dark"]
.navToggle
&:hover

View File

@@ -1,7 +1,8 @@
/**
* @fileoverview Note item component.
*/
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import { isArray } from 'lodash'
import CSSModules from 'browser/lib/CSSModules'
import { getTodoStatus } from 'browser/lib/getTodoStatus'
@@ -70,7 +71,7 @@ const NoteItem = ({ isActive, note, dateDisplay, handleNoteClick, handleNoteCont
<div styleName='item-bottom-time'>{dateDisplay}</div>
{note.isStarred
? <i styleName='item-star' className='fa fa-star' /> : ''
? <img styleName='item-star' src='../resources/icon/icon-starred.svg' /> : ''
}
{note.isPinned && !pathname.match(/\/home|\/starred|\/trash/)
? <i styleName='item-pin' className='fa fa-thumb-tack' /> : ''

View File

@@ -11,9 +11,9 @@ $control-height = 30px
user-select none
cursor pointer
background-color $ui-noteList-backgroundColor
transition background-color 0.2s
transition 0.2s
&:hover
background-color alpha($ui-button--active-backgroundColor, 40%)
background-color alpha($ui-button--active-backgroundColor, 20%)
.item-title
.item-title-icon
.item-bottom-time
@@ -25,7 +25,7 @@ $control-height = 30px
.item-star
color $ui-favorite-star-button-color
&:active
background-color $ui-button--active-backgroundColor
background-color alpha($ui-button--active-backgroundColor, 40%)
color $ui-text-color
.item-title
.item-title-icon
@@ -43,7 +43,7 @@ $control-height = 30px
.item--active
@extend .item
background-color $ui-button--active-backgroundColor
background-color alpha($ui-button--active-backgroundColor, 60%)
color $ui-text-color
.item-title
.item-title-empty
@@ -59,20 +59,30 @@ $control-height = 30px
.item-star
color $ui-favorite-star-button-color
&:hover
background-color $ui-button--active-backgroundColor
background-color alpha($ui-button--active-backgroundColor, 40%)
color #e74c3c
.menu-button-label
color $ui-text-color
&:active, &:active:hover
background-color alpha($ui-button--active-backgroundColor, 40%)
color #e74c3c
.menu-button-label
color $ui-text-color
.item-title-icon
position relative
font-size 12px
color $ui-inactive-text-color
top 2px
.item-title
font-size 14px
font-size 15px
font-weight 700
position relative
top -12px
left 20px
padding-right 15px
padding-bottom 4px
padding 0px 15px 0px 0px
margin-bottom 4px
overflow ellipsis
color $ui-inactive-text-color
@@ -83,7 +93,7 @@ $control-height = 30px
.item-bottom
position relative
bottom 0px
margin-top 2px
margin-top 10px
font-size 12px
line-height 20px
overflow ellipsis
@@ -92,35 +102,33 @@ $control-height = 30px
.item-bottom-tagList
flex 1
overflow ellipsis
line-height 20px
padding-top 7px
line-height 25px
padding-left 2px
margin-right 27px
margin-right 40px
.item-bottom-tagList-item
font-size 11px
margin-right 8px
padding 0
height 20px
box-sizing border-box
border-radius 2px
padding 1px 2px
padding 4px
vertical-align middle
background-color white
color $ui-inactive-text-color
.item-bottom-time
color $ui-inactive-text-color
font-size 11px
font-size 13px
padding-left 2px
padding-bottom 2px
.item-star
position absolute
right -20px
bottom 2px
width 34px
height 34px
right -6px
bottom 23px
width 16px
height 16px
color alpha($ui-favorite-star-button-color, 60%)
font-size 12px
padding 0
@@ -128,8 +136,8 @@ $control-height = 30px
.item-pin
position absolute
right -21px
bottom 28px
right 0px
bottom 2px
width 34px
height 34px
color #E54D42
@@ -137,6 +145,20 @@ $control-height = 30px
padding 0
border-radius 17px
body[data-theme="white"]
.item
background-color $ui-white-noteList-backgroundColor
&:hover
background-color alpha($ui-button--active-backgroundColor, 60%)
&:active
background-color $ui-button--active-backgroundColor
.item--active
@extend .item
background-color $ui-button--active-backgroundColor
&:hover
background-color alpha($ui-button--active-backgroundColor, 60%)
body[data-theme="dark"]
.root
border-color $ui-dark-borderColor
@@ -148,6 +170,7 @@ body[data-theme="dark"]
&:hover
transition 0.15s
background-color alpha($ui-dark-button--active-backgroundColor, 20%)
color $ui-dark-text-color
.item-title
.item-title-icon
.item-bottom-time
@@ -155,11 +178,12 @@ body[data-theme="dark"]
color $ui-dark-text-color
.item-bottom-tagList-item
transition 0.15s
background-color alpha($ui-dark-button--active-backgroundColor, 40%)
background-color alpha(#fff, 20%)
color $ui-dark-text-color
&:active
transition 0.15s
background-color $ui-dark-button--active-backgroundColor
color $ui-dark-text-color
.item-title
.item-title-icon
.item-bottom-time
@@ -185,6 +209,11 @@ body[data-theme="dark"]
.item-bottom-tagList-item
background-color alpha(white, 10%)
color $ui-dark-text-color
&:hover
background-color alpha($ui-dark-button--active-backgroundColor, 60%)
color #c0392b
.item-bottom-tagList-item
background-color alpha(#fff, 20%)
.item-title
color $ui-inactive-text-color

View File

@@ -1,7 +1,8 @@
/**
* @fileoverview Note item component with simple display mode.
*/
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './NoteItemSimple.styl'
@@ -10,15 +11,17 @@ import styles from './NoteItemSimple.styl'
* @param {boolean} isActive
* @param {Object} note
* @param {Function} handleNoteClick
* @param {Function} handleNoteContextMenu
* @param {Function} handleDragStart
*/
const NoteItemSimple = ({ isActive, note, handleNoteClick, handleDragStart }) => (
const NoteItemSimple = ({ isActive, note, handleNoteClick, handleNoteContextMenu, handleDragStart }) => (
<div styleName={isActive
? 'item-simple--active'
: 'item-simple'
}
key={`${note.storage}-${note.key}`}
onClick={e => handleNoteClick(e, `${note.storage}-${note.key}`)}
onContextMenu={e => handleNoteContextMenu(e, `${note.storage}-${note.key}`)}
onDragStart={e => handleDragStart(e, note)}
draggable='true'
>
@@ -44,6 +47,7 @@ NoteItemSimple.propTypes = {
title: PropTypes.string.isrequired
}),
handleNoteClick: PropTypes.func.isRequired,
handleNoteContextMenu: PropTypes.func.isRequired,
handleDragStart: PropTypes.func.isRequired
}

View File

@@ -11,15 +11,15 @@ $control-height = 30px
user-select none
cursor pointer
background-color $ui-noteList-backgroundColor
transition background-color 0.15s
transition 0.2s
&:hover
background-color alpha($ui-button--active-backgroundColor, 40%)
background-color alpha($ui-button--active-backgroundColor, 20%)
.item-simple-title
.item-simple-title-empty
.item-simple-title-icon
color $ui-text-color
&:active
background-color $ui-button--active-backgroundColor
background-color alpha($ui-button--active-backgroundColor, 40%)
color $ui-text-color
.item-simple-title
.item-simple-title-empty
@@ -28,7 +28,7 @@ $control-height = 30px
.item-simple--active
@extend .item-simple
background-color $ui-button--active-backgroundColor
background-color alpha($ui-button--active-backgroundColor, 60%)
color $ui-text-color
.item-simple-title
.item-simple-title-empty
@@ -37,7 +37,15 @@ $control-height = 30px
.item-simple-title-icon
color $ui-text-color
&:hover
background-color $ui-button--active-backgroundColor
background-color alpha($ui-button--active-backgroundColor, 40%)
color #e74c3c
.menu-button-label
color $ui-text-color
&:active, &:active:hover
background-color alpha($ui-button--active-backgroundColor, 40%)
color #e74c3c
.menu-button-label
color $ui-text-color
.item-simple-title
font-size 13px
@@ -59,6 +67,20 @@ $control-height = 30px
font-weight normal
color $ui-inactive-text-color
body[data-theme="white"]
.item-simple
background-color $ui-white-noteList-backgroundColor
&:hover
background-color alpha($ui-button--active-backgroundColor, 60%)
&:active
background-color $ui-button--active-backgroundColor
.item-simple--active
@extend .item-simple
background-color $ui-button--active-backgroundColor
&:hover
background-color alpha($ui-button--active-backgroundColor, 60%)
body[data-theme="dark"]
.root
border-color $ui-dark-borderColor
@@ -67,33 +89,50 @@ body[data-theme="dark"]
.item-simple
border-color $ui-dark-borderColor
background-color $ui-dark-noteList-backgroundColor
&:active
background-color $ui-dark-button--active-backgroundColor
&:hover
transition 0.15s
background-color alpha($ui-dark-button--active-backgroundColor, 20%)
color $ui-dark-text-color
.item-simple-title
.item-simple-title-icon
.item-simple-bottom-time
.item-simple-bottom-tagList-item
transition 0.15s
color $ui-dark-text-color
&:hover
background-color alpha($ui-dark-button--active-backgroundColor, 20%)
.item-simple-bottom-tagList-item
transition 0.15s
background-color alpha(#fff, 20%)
color $ui-dark-text-color
&:active
transition 0.15s
background-color $ui-dark-button--active-backgroundColor
color $ui-dark-text-color
.item-simple-title
.item-simple-title-icon
.item-simple-bottom-time
transition 0.15s
color $ui-dark-text-color
.item-simple-bottom-tagList-item
transition 0.15s
background-color alpha(white, 10%)
color $ui-dark-text-color
.item-simple--active
border-color $ui-dark-borderColor
background-color $ui-dark-button--active-backgroundColor
.item-simple-wrapper
border-color transparent
.item-simple-title
.item-simple-title-icon
.item-simple-bottom-time
color $ui-dark-text-color
.item-simple-bottom-tagList-item
background-color transparent
background-color alpha(white, 10%)
color $ui-dark-text-color
&:hover
background-color alpha($ui-dark-button--active-backgroundColor, 60%)
color #c0392b
.item-simple-bottom-tagList-item
background-color alpha(#fff, 20%)
.item-simple-title
color $ui-inactive-text-color

View File

@@ -1,4 +1,4 @@
import React, { PropTypes } from 'react'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './RealtimeNotification.styl'
@@ -40,7 +40,7 @@ class RealtimeNotification extends React.Component {
? <a styleName='notification-link' href={notifications[0].linkUrl}
onClick={(e) => this.handleLinkClick(e)}
>
{notifications[0].text}
Info: {notifications[0].text}
</a>
: ''

View File

@@ -1,21 +1,18 @@
.notification-area
z-index 1000
font-size 12px
position absolute
bottom 0px
right 0px
background-color #EBEBEB
height 30px
position: relative
top: 12px
background-color none
.notification-link
position absolute
right 5px
top 5px
text-decoration none
color #282A36
font-size 14px
border 1px solid #6FA8E6
background-color alpha(#6FA8E6, 0.2)
padding 3px 9px
padding 5px 12px
border-radius 2px
transition 0.2s
&:hover
@@ -23,7 +20,7 @@
body[data-theme="dark"]
.notification-area
background-color #1E2124
background-color none
.notification-link
color #fff

View File

@@ -1,7 +1,8 @@
/**
* @fileoverview Filter for all notes.
*/
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './SideNavFilter.styl'
@@ -15,27 +16,53 @@ import styles from './SideNavFilter.styl'
*/
const SideNavFilter = ({
isFolded, isHomeActive, handleAllNotesButtonClick,
isStarredActive, handleStarredButtonClick, isTrashedActive, handleTrashedButtonClick
isStarredActive, handleStarredButtonClick, isTrashedActive, handleTrashedButtonClick, counterDelNote,
counterTotalNote, counterStarredNote
}) => (
<div styleName={isFolded ? 'menu--folded' : 'menu'}>
<button styleName={isHomeActive ? 'menu-button--active' : 'menu-button'}
onClick={handleAllNotesButtonClick}
>
<i className='fa fa-archive fa-fw' />
<div styleName='iconWrap'>
<img src={isHomeActive
? '../resources/icon/icon-all-active.svg'
: '../resources/icon/icon-all.svg'
}
/>
</div>
<span styleName='menu-button-label'>All Notes</span>
<span styleName='counters'>{counterTotalNote}</span>
</button>
<button styleName={isStarredActive ? 'menu-button-star--active' : 'menu-button'}
onClick={handleStarredButtonClick}
>
<i className='fa fa-star fa-fw' />
<div styleName='iconWrap'>
<img src={isStarredActive
? '../resources/icon/icon-star-active.svg'
: '../resources/icon/icon-star.svg'
}
/>
</div>
<span styleName='menu-button-label'>Starred</span>
<span styleName='counters'>{counterStarredNote}</span>
</button>
<button styleName={isTrashedActive ? 'menu-button--active' : 'menu-button'}
<button styleName={isTrashedActive ? 'menu-button-trash--active' : 'menu-button'}
onClick={handleTrashedButtonClick}
>
<i className='fa fa-trash fa-fw' />
<div styleName='iconWrap'>
<img src={isTrashedActive
? '../resources/icon/icon-trash-active.svg'
: '../resources/icon/icon-trash.svg'
}
/>
</div>
<span styleName='menu-button-label'>Trash</span>
<span styleName='counters'>{counterDelNote}</span>
</button>
</div>
)

View File

@@ -3,12 +3,93 @@
.menu-button
navButtonColor()
height 32px
padding 0 15px
font-size 12px
height 36px
padding 0 15px 0 20px
font-size 14px
width 100%
text-align left
overflow ellipsis
display flex
align-items center
&:hover, &:active, &:active:hover
color #1EC38B
background-color alpha($ui-button-default--active-backgroundColor, 20%)
.iconWrap
width 20px
text-align center
.counters
float right
color $ui-inactive-text-color
.menu-button--active
@extend .menu-button
SideNavFilter()
color #1EC38B
background-color alpha($ui-button-default--active-backgroundColor, 20%)
.menu-button-label, .counters
color #1EC38B
&:hover
color #1EC38B
.menu-button-star--active
@extend .menu-button
SideNavFilter()
color #1EC38B
background-color alpha($ui-button-default--active-backgroundColor, 20%)
.menu-button-label, .counters
color #1EC38B
.menu-button-trash--active
@extend .menu-button
SideNavFilter()
color #1EC38B
background-color alpha($ui-button-default--active-backgroundColor, 20%)
.menu-button-label, .counters
color #1EC38B
.menu-button-label
margin-left 10px
flex 1
.menu--folded
@extend .menu
.menu-button, .menu-button--active
text-align center
padding 0 12px
&:hover .menu-button-label
transition opacity 0.15s
opacity 1
color $ui-tooltip-text-color
background-color $ui-tooltip-backgroundColor
.menu-button-label
position fixed
display inline-block
height 32px
left 44px
padding 0 10px
margin-top -8px
margin-left 0
overflow ellipsis
z-index 10
line-height 32px
border-top-right-radius 2px
border-bottom-right-radius 2px
pointer-events none
opacity 0
font-size 13px
.counters
display none
body[data-theme="white"]
.menu-button
navWhiteButtonColor()
.counters
color $ui-inactive-text-color
.menu-button--active
@extend .menu-button
@@ -44,34 +125,22 @@
.menu-button-label
color $ui-text-color
.menu-button-trash--active
@extend .menu-button
color #5D9E36
background-color $ui-button--active-backgroundColor
.menu-button-label
margin-left 5px
.menu--folded
@extend .menu
.menu-button, .menu-button--active
text-align center
&:hover .menu-button-label
transition opacity 0.15s
opacity 1
color $ui-text-color
&:hover
background-color alpha($ui-button--active-backgroundColor, 50%)
color #5D9E36
.menu-button-label
position fixed
display inline-block
height 32px
left 44px
padding 0 10px
margin-top -8px
margin-left 0
overflow ellipsis
background-color $ui-tooltip-backgroundColor
z-index 10
color white
line-height 32px
border-top-right-radius 2px
border-bottom-right-radius 2px
pointer-events none
opacity 0
font-size 12px
color $ui-text-color
&:active, &:active:hover
background-color alpha($ui-button--active-backgroundColor, 50%)
color #5D9E36
.menu-button-label
color $ui-text-color
body[data-theme="dark"]
.menu-button
@@ -103,3 +172,14 @@ body[data-theme="dark"]
color $ui-favorite-star-button-color
.menu-button-label
color $ui-dark-text-color
.menu-button-trash--active
color #5D9E36
background-color $ui-dark-button--active-backgroundColor
.menu-button-label
color $ui-dark-text-color
&:hover
background-color alpha($ui-dark-button--active-backgroundColor, 50%)
color #5D9E36
.menu-button-label
color $ui-dark-text-color

View File

@@ -86,7 +86,7 @@ class SnippetTab extends React.Component {
}
render () {
let { isActive, snippet, isDeletable } = this.props
const { isActive, snippet, isDeletable } = this.props
return (
<div styleName={isActive
? 'root--active'

View File

@@ -1,10 +1,11 @@
/**
* @fileoverview Micro component for showing storage.
*/
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import styles from './StorageItem.styl'
import CSSModules from 'browser/lib/CSSModules'
import { isNumber } from 'lodash'
import _ from 'lodash'
/**
* @param {boolean} isActive
@@ -35,12 +36,10 @@ const StorageItem = ({
>
<span styleName={isFolded
? 'folderList-item-name--folded' : 'folderList-item-name'
}
style={{borderColor: folderColor}}
>
{isFolded ? folderName.substring(0, 1) : folderName}
}>
<text style={{color: folderColor, paddingRight: '10px'}}>{isActive ? <i className='fa fa-folder-open-o' /> : <i className='fa fa-folder-o' />}</text>{isFolded ? _.truncate(folderName, {length: 1, omission: ''}) : folderName}
</span>
{(!isFolded && isNumber(noteCount)) &&
{(!isFolded && _.isNumber(noteCount)) &&
<span styleName='folderList-item-noteCount'>{noteCount}</span>
}
{isFolded &&

View File

@@ -5,37 +5,36 @@
.folderList-item
display flex
width 100%
height 26px
height 34px
background-color transparent
color $ui-inactive-text-color
padding 0
margin-bottom 5px
text-align left
border none
overflow ellipsis
font-size 12px
font-size 14px
&:first-child
margin-top 0
&:hover
color $ui-text-color
background-color alpha($ui-button--active-backgroundColor, 20%)
color #1EC38B;
background-color alpha($ui-button-default--active-backgroundColor, 20%)
transition background-color 0.15s
&:active
color $ui-text-color
background-color $ui-button--active-backgroundColor
color $$ui-button-default-color
background-color alpha($ui-button-default--active-backgroundColor, 20%)
.folderList-item--active
@extend .folderList-item
color $ui-text-color
background-color $ui-button--active-backgroundColor
color #1EC38B
background-color alpha($ui-button-default--active-backgroundColor, 20%)
&:hover
color $ui-text-color
background-color alpha($ui-button--active-backgroundColor, 50%)
color #1EC38B;
background-color alpha($ui-button-default--active-backgroundColor, 50%)
.folderList-item-name
display block
flex 1
padding 0 25px
padding 0 12px
height 26px
line-height 26px
border-width 0 0 0 2px
@@ -48,7 +47,7 @@
float right
line-height 26px
padding-right 15px
font-size 12px
font-size 13px
.folderList-item-tooltip
tooltip()
@@ -69,8 +68,28 @@
.folderList-item-name--folded
@extend .folderList-item-name
padding-left 12px
padding-left 7px
text
font-size 9px
body[data-theme="white"]
.folderList-item
color $ui-inactive-text-color
&:hover
color $ui-text-color
background-color alpha($ui-button--active-backgroundColor, 20%)
transition background-color 0.15s
&:active
color $ui-text-color
background-color $ui-button--active-backgroundColor
.folderList-item--active
@extend .folderList-item
color $ui-text-color
background-color $ui-button--active-backgroundColor
&:hover
color $ui-text-color
background-color alpha($ui-button--active-backgroundColor, 50%)
body[data-theme="dark"]
.folderList-item

View File

@@ -1,8 +1,9 @@
/**
* @fileoverview Micro component for showing StorageList
*/
import React, { PropTypes } from 'react'
import styles from './StorgaeList.styl'
import PropTypes from 'prop-types'
import React from 'react'
import styles from './StorageList.styl'
import CSSModules from 'browser/lib/CSSModules'
/**

View File

@@ -1,7 +1,7 @@
.storageList
absolute left right
bottom 37px
top 160px
top 180px
overflow-y auto
.storageList-empty

View File

@@ -1,7 +1,8 @@
/**
* @fileoverview Micro component for showing TagList.
*/
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import styles from './TagListItem.styl'
import CSSModules from 'browser/lib/CSSModules'

View File

@@ -9,19 +9,19 @@
text-align left
border none
overflow ellipsis
font-size 12px
font-size 13px
&:first-child
margin-top 0
&:hover
color $ui-text-color
background-color alpha($ui-button--active-backgroundColor, 20%)
color $ui-button-default-color
background-color alpha($ui-button-default--active-backgroundColor, 20%)
transition background-color 0.15s
&:active
color $ui-text-color
background-color $ui-button--active-backgroundColor
&:active, &:active:hover
color $ui-button-default-color
background-color $ui-button-default--active-backgroundColor
.tagList-item-active
background-color $ui-button--active-backgroundColor
background-color $ui-button-default--active-backgroundColor
display flex
width 100%
height 26px
@@ -30,15 +30,16 @@
text-align left
border none
overflow ellipsis
font-size 12px
font-size 13px
color $ui-button-default-color
&:hover
background-color alpha($ui-button--active-backgroundColor, 60%)
background-color alpha($ui-button-default--active-backgroundColor, 60%)
transition 0.2s
.tagList-item-name
display block
flex 1
padding 0 25px
padding 0 15px
height 26px
line-height 26px
border-width 0 0 0 2px
@@ -47,6 +48,22 @@
overflow hidden
text-overflow ellipsis
body[data-theme="white"]
.tagList-item
color $ui-inactive-text-color
&:hover
color $ui-text-color
background-color alpha($ui-button--active-backgroundColor, 20%)
&:active
color $ui-text-color
background-color $ui-button--active-backgroundColor
.tagList-item-active
background-color $ui-button--active-backgroundColor
color $ui-text-color
&:hover
background-color alpha($ui-button--active-backgroundColor, 60%)
body[data-theme="dark"]
.tagList-item
color $ui-dark-inactive-text-color

View File

@@ -2,7 +2,8 @@
* @fileoverview Percentage of todo achievement.
*/
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './TodoListPercentage.styl'

View File

@@ -1,24 +1,25 @@
.percentageBar
position absolute
top 58px
right: 0px
top 50px
right 0px
left 0px
background-color #DADFE1
width 100%
height: 15px
height: 17px
font-size: 12px
z-index 100
border-radius 2px
.progressBar
background-color: #6C7A89
height 15px
background-color: #1EC38B
height 17px
border-radius 2px
transition 0.3s
transition 0.4s cubic-bezier(0.4, 0.4, 0, 1)
.percentageText
color #f4f4f4
padding: 2px 43%
font-weight 600
body[data-theme="dark"]
.percentageBar

View File

@@ -2,7 +2,8 @@
* @fileoverview Percentage of todo achievement.
*/
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './TodoProcess.styl'

View File

@@ -118,7 +118,7 @@ hr
h1, h2, h3, h4, h5, h6
font-weight bold
h1
font-size 2.25em
font-size 2.55em
padding-bottom 0.3em
line-height 1.2em
border-bottom solid 1px borderColor

View File

@@ -64,7 +64,7 @@ $list-width = 250px
.result-nav-storageList
absolute bottom left right
top 110px + 32px + 10px + 10px
top 110px + 32px + 10px + 10px + 20px
overflow-y auto
.result-list

View File

@@ -56,7 +56,7 @@ class NoteDetail extends React.Component {
}
selectPriorSnippet () {
let { note } = this.props
const { note } = this.props
if (note.type === 'SNIPPET_NOTE' && note.snippets.length > 1) {
this.setState({
snippetIndex: (this.state.snippetIndex + note.snippets.length - 1) % note.snippets.length
@@ -65,7 +65,7 @@ class NoteDetail extends React.Component {
}
selectNextSnippet () {
let { note } = this.props
const { note } = this.props
if (note.type === 'SNIPPET_NOTE' && note.snippets.length > 1) {
this.setState({
snippetIndex: (this.state.snippetIndex + 1) % note.snippets.length
@@ -74,7 +74,7 @@ class NoteDetail extends React.Component {
}
saveToClipboard () {
let { note } = this.props
const { note } = this.props
if (note.type === 'MARKDOWN_NOTE') {
clipboard.writeText(note.content)
@@ -95,7 +95,7 @@ class NoteDetail extends React.Component {
}
render () {
let { note, config } = this.props
const { note, config } = this.props
if (note == null) {
return (
<div styleName='root' />
@@ -110,8 +110,8 @@ class NoteDetail extends React.Component {
const storage = findStorage(note.storage)
if (note.type === 'SNIPPET_NOTE') {
let tabList = note.snippets.map((snippet, index) => {
let isActive = this.state.snippetIndex === index
const tabList = note.snippets.map((snippet, index) => {
const isActive = this.state.snippetIndex === index
return <div styleName={isActive
? 'tabList-item--active'
: 'tabList-item'
@@ -131,8 +131,8 @@ class NoteDetail extends React.Component {
</div>
})
let viewList = note.snippets.map((snippet, index) => {
let isActive = this.state.snippetIndex === index
const viewList = note.snippets.map((snippet, index) => {
const isActive = this.state.snippetIndex === index
let syntax = CodeMirror.findModeByName(pass(snippet.mode))
if (syntax == null) syntax = CodeMirror.findModeByName('Plain Text')

View File

@@ -3,8 +3,7 @@
.root
absolute top bottom left right
bottom 30px
left $note-detail-left-margin
right $note-detail-right-margin
margin 0 25px
height 100%
width 365px
background-color $ui-noteDetail-backgroundColor

View File

@@ -18,18 +18,18 @@ class NoteList extends React.Component {
}
componentDidUpdate () {
let { index } = this.props
const { index } = this.props
if (index > -1) {
let list = this.refs.root
let item = list.childNodes[index]
const list = this.refs.root
const item = list.childNodes[index]
if (item == null) return null
let overflowBelow = item.offsetTop + item.clientHeight - list.clientHeight - list.scrollTop > 0
const overflowBelow = item.offsetTop + item.clientHeight - list.clientHeight - list.scrollTop > 0
if (overflowBelow) {
list.scrollTop = item.offsetTop + item.clientHeight - list.clientHeight
}
let overflowAbove = list.scrollTop > item.offsetTop
const overflowAbove = list.scrollTop > item.offsetTop
if (overflowAbove) {
list.scrollTop = item.offsetTop
}
@@ -44,7 +44,7 @@ class NoteList extends React.Component {
}
handleScroll (e) {
let { notes } = this.props
const { notes } = this.props
if (e.target.offsetHeight + e.target.scrollTop > e.target.scrollHeight - 100 && notes.length > this.state.range * 10 + 10) {
this.setState({
@@ -54,9 +54,9 @@ class NoteList extends React.Component {
}
render () {
let { notes, index } = this.props
const { notes, index } = this.props
let notesList = notes
const notesList = notes
.slice(0, 10 + 10 * this.state.range)
.map((note, _index) => {
const isActive = (index === _index)

View File

@@ -19,18 +19,18 @@ class StorageSection extends React.Component {
}
handleHeaderClick (e) {
let { storage } = this.props
const { storage } = this.props
this.props.handleStorageButtonClick(e, storage.key)
}
handleFolderClick (e, folder) {
let { storage } = this.props
const { storage } = this.props
this.props.handleFolderButtonClick(e, storage.key, folder.key)
}
render () {
let { storage, filter } = this.props
let folderList = storage.folders
const { storage, filter } = this.props
const folderList = storage.folders
.map(folder => (
<StorageItem
key={folder.key}

View File

@@ -1,8 +1,8 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import ReactDOM from 'react-dom'
import { connect, Provider } from 'react-redux'
import _ from 'lodash'
import ipc from './ipcClient'
import store from './store'
import CSSModules from 'browser/lib/CSSModules'
import styles from './FinderMain.styl'
@@ -13,13 +13,14 @@ import SideNavFilter from 'browser/components/SideNavFilter'
import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig'
require('!!style!css!stylus?sourceMap!../main/global.styl')
require('../lib/customMeta')
require('./ipcClient.js')
const electron = require('electron')
const { remote } = electron
const { Menu } = remote
function hideFinder () {
let finderWindow = remote.getCurrentWindow()
const finderWindow = remote.getCurrentWindow()
if (global.process.platform === 'win32') {
finderWindow.blur()
finderWindow.hide()
@@ -136,7 +137,7 @@ class FinderMain extends React.Component {
}
handleOnlySnippetCheckboxChange (e) {
let { filter } = this.state
const { filter } = this.state
filter.includeSnippet = e.target.checked
this.setState({
filter: filter,
@@ -147,7 +148,7 @@ class FinderMain extends React.Component {
}
handleOnlyMarkdownCheckboxChange (e) {
let { filter } = this.state
const { filter } = this.state
filter.includeMarkdown = e.target.checked
this.refs.list.resetScroll()
this.setState({
@@ -159,7 +160,7 @@ class FinderMain extends React.Component {
}
handleAllNotesButtonClick (e) {
let { filter } = this.state
const { filter } = this.state
filter.type = 'ALL'
this.refs.list.resetScroll()
this.setState({
@@ -171,7 +172,7 @@ class FinderMain extends React.Component {
}
handleStarredButtonClick (e) {
let { filter } = this.state
const { filter } = this.state
filter.type = 'STARRED'
this.refs.list.resetScroll()
this.setState({
@@ -183,7 +184,7 @@ class FinderMain extends React.Component {
}
handleStorageButtonClick (e, storage) {
let { filter } = this.state
const { filter } = this.state
filter.type = 'STORAGE'
filter.storage = storage
this.refs.list.resetScroll()
@@ -196,7 +197,7 @@ class FinderMain extends React.Component {
}
handleFolderButtonClick (e, storage, folder) {
let { filter } = this.state
const { filter } = this.state
filter.type = 'FOLDER'
filter.storage = storage
filter.folder = folder
@@ -218,12 +219,12 @@ class FinderMain extends React.Component {
}
render () {
let { data, config } = this.props
let { filter, search } = this.state
let storageList = []
for (let key in data.storageMap) {
let storage = data.storageMap[key]
let item = (
const { data, config } = this.props
const { filter, search } = this.state
const storageList = []
for (const key in data.storageMap) {
const storage = data.storageMap[key]
const item = (
<StorageSection
filter={filter}
storage={storage}
@@ -252,7 +253,7 @@ class FinderMain extends React.Component {
notes.push(data.noteMap[id])
})
} else {
for (let key in data.noteMap) {
for (const key in data.noteMap) {
notes.push(data.noteMap[key])
}
}
@@ -264,13 +265,13 @@ class FinderMain extends React.Component {
}
if (search.trim().length > 0) {
let needle = new RegExp(_.escapeRegExp(search.trim()), 'i')
const needle = new RegExp(_.escapeRegExp(search.trim()), 'i')
notes = notes.filter((note) => note.title.match(needle))
}
notes = notes
.sort((a, b) => new Date(b.updatedAt) - new Date(a.updatedAt))
let activeNote = notes[this.state.index]
const activeNote = notes[this.state.index]
this.noteCount = notes.length
return (

View File

@@ -10,7 +10,7 @@ nodeIpc.config.retry = 1500
nodeIpc.config.silent = true
function killFinder () {
let finderWindow = remote.getCurrentWindow()
const finderWindow = remote.getCurrentWindow()
finderWindow.removeAllListeners()
if (global.process.platform === 'darwin') {
// Only OSX has another app process.
@@ -21,7 +21,7 @@ function killFinder () {
}
function toggleFinder () {
let finderWindow = remote.getCurrentWindow()
const finderWindow = remote.getCurrentWindow()
if (global.process.platform === 'darwin') {
if (finderWindow.isVisible()) {
finderWindow.hide()
@@ -84,6 +84,8 @@ nodeIpc.connectTo(
const { config } = payload
if (config.ui.theme === 'dark') {
document.body.setAttribute('data-theme', 'dark')
} else if (config.ui.theme === 'white') {
document.body.setAttribute('data-theme', 'white')
} else {
document.body.setAttribute('data-theme', 'default')
}

View File

@@ -2,7 +2,7 @@ import { combineReducers, createStore } from 'redux'
import { routerReducer } from 'react-router-redux'
import { DEFAULT_CONFIG } from 'browser/main/lib/ConfigManager'
let defaultData = {
const defaultData = {
storageMap: {},
noteMap: {},
starredSet: [],
@@ -40,12 +40,12 @@ function config (state = DEFAULT_CONFIG, action) {
return state
}
let reducer = combineReducers({
const reducer = combineReducers({
data,
config,
routing: routerReducer
})
let store = createStore(reducer)
const store = createStore(reducer)
export default store

View File

@@ -38,15 +38,15 @@ class MutableMap {
}
map (cb) {
let result = []
for (let [key, value] of this._map) {
const result = []
for (const [key, value] of this._map) {
result.push(cb(value, key))
}
return result
}
toJS () {
let result = {}
const result = {}
for (let [key, value] of this._map) {
if (value instanceof MutableSet || value instanceof MutableMap) {
value = value.toJS()
@@ -85,7 +85,7 @@ class MutableSet {
}
map (cb) {
let result = []
const result = []
this._set.forEach(function (value, key) {
result.push(cb(value, key))
})

View File

@@ -1,11 +1,11 @@
export function findNoteTitle (value) {
let splitted = value.split('\n')
const splitted = value.split('\n')
let title = null
let isInsideCodeBlock = false
splitted.some((line, index) => {
let trimmedLine = line.trim()
let trimmedNextLine = splitted[index + 1] === undefined ? '' : splitted[index + 1].trim()
const trimmedLine = line.trim()
const trimmedNextLine = splitted[index + 1] === undefined ? '' : splitted[index + 1].trim()
if (trimmedLine.match('```')) {
isInsideCodeBlock = !isInsideCodeBlock
}

View File

@@ -1,10 +1,10 @@
export function getTodoStatus (content) {
let splitted = content.split('\n')
const splitted = content.split('\n')
let numberOfTodo = 0
let numberOfCompletedTodo = 0
splitted.forEach((line) => {
let trimmedLine = line.trim()
const trimmedLine = line.trim()
if (trimmedLine.match(/^[\+\-\*] \[\s|x\] ./)) {
numberOfTodo++
}

View File

@@ -3,11 +3,12 @@ import emoji from 'markdown-it-emoji'
import math from '@rokt33r/markdown-it-math'
import _ from 'lodash'
// FIXME We should not depend on global variable.
const katex = window.katex
function createGutter (str) {
let lc = (str.match(/\n/g) || []).length
let lines = []
const lc = (str.match(/\n/g) || []).length
const lines = []
for (let i = 1; i <= lc; i++) {
lines.push('<span class="CodeMirror-linenumber">' + i + '</span>')
}
@@ -69,12 +70,14 @@ md.use(require('markdown-it-named-headers'), {
}
})
md.use(require('markdown-it-kbd'))
md.use(require('markdown-it-plantuml'))
// Override task item
md.block.ruler.at('paragraph', function (state, startLine/*, endLine */) {
let content, terminate, i, l, token
let nextLine = startLine + 1
let terminatorRules = state.md.block.ruler.getRules('paragraph')
let endLine = state.lineMax
const terminatorRules = state.md.block.ruler.getRules('paragraph')
const endLine = state.lineMax
// jump line-by-line until empty one or EOF
for (; nextLine < endLine && !state.isEmpty(nextLine); nextLine++) {
@@ -104,7 +107,7 @@ md.block.ruler.at('paragraph', function (state, startLine/*, endLine */) {
token.map = [ startLine, state.line ]
if (state.parentType === 'list') {
let match = content.match(/^\[( |x)\] ?(.+)/i)
const match = content.match(/^\[( |x)\] ?(.+)/i)
if (match) {
content = `<label class='taskListItem' for='checkbox-${startLine + 1}'><input type='checkbox'${match[1] !== ' ' ? ' checked' : ''} id='checkbox-${startLine + 1}'/> ${content.substring(4, content.length)}</label>`
}
@@ -121,7 +124,7 @@ md.block.ruler.at('paragraph', function (state, startLine/*, endLine */) {
})
// Add line number attribute for scrolling
let originalRender = md.renderer.render
const originalRender = md.renderer.render
md.renderer.render = function render (tokens, options, env) {
tokens.forEach((token) => {
switch (token.type) {
@@ -132,40 +135,12 @@ md.renderer.render = function render (tokens, options, env) {
token.attrPush(['data-line', token.map[0]])
}
})
let result = originalRender.call(md.renderer, tokens, options, env)
const result = originalRender.call(md.renderer, tokens, options, env)
return result
}
// FIXME We should not depend on global variable.
window.md = md
function strip (input) {
var output = input
try {
output = output
.replace(/^([\s\t]*)([\*\-\+]|\d\.)\s+/gm, '$1')
.replace(/\n={2,}/g, '\n')
.replace(/~~/g, '')
.replace(/`{3}.*\n/g, '')
.replace(/<(.*?)>/g, '$1')
.replace(/^[=\-]{2,}\s*$/g, '')
.replace(/\[\^.+?\](: .*?$)?/g, '')
.replace(/\s{0,2}\[.*?\]: .*?$/g, '')
.replace(/!\[.*?\][\[\(].*?[\]\)]/g, '')
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
.replace(/>/g, '')
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, '')
.replace(/^#{1,6}\s*([^#]*)\s*(#{1,6})?/gm, '$1')
.replace(/([\*_]{1,3})(\S.*?\S)\1/g, '$2')
.replace(/(`{3,})(.*?)\1/gm, '$2')
.replace(/^-{3,}\s*$/g, '')
.replace(/`(.+?)`/g, '$1')
.replace(/\n{2,}/g, '\n\n')
} catch (e) {
console.error(e)
return input
}
return output
}
function normalizeLinkText (linkText) {
return md.normalizeLinkText(linkText)
}
@@ -176,7 +151,7 @@ const markdown = {
const renderedContent = md.render(content)
return renderedContent
},
strip,
normalizeLinkText
}
export default markdown

View File

@@ -0,0 +1,39 @@
/**
* @fileoverview Text trimmer for markdown note.
*/
/**
* @param {string} input
* @return {string}
*/
export function strip (input) {
let output = input
try {
output = output
.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, '$1')
.replace(/\n={2,}/g, '\n')
.replace(/~~/g, '')
.replace(/`{3}.*\n/g, '')
.replace(/<(.*?)>/g, '$1')
.replace(/^[=\-]{2,}\s*$/g, '')
.replace(/\[\^.+?\](: .*?$)?/g, '')
.replace(/\s{0,2}\[.*?\]: .*?$/g, '')
.replace(/!\[.*?\][\[\(].*?[\]\)]/g, '')
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
.replace(/>/g, '')
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, '')
.replace(/^#{1,6}\s*([^#]*)\s*(#{1,6})?/gm, '$1')
.replace(/(`{3,})(.*?)\1/gm, '$2')
.replace(/^-{3,}\s*$/g, '')
.replace(/`(.+?)`/g, '$1')
.replace(/\n{2,}/g, '\n\n')
} catch (e) {
console.error(e)
return input
}
return output
}
export default {
strip
}

View File

@@ -16,7 +16,7 @@ export default function searchFromNotes (notes, search) {
function findByTag (notes, block) {
const tag = block.match(/#(.+)/)[1]
let regExp = new RegExp(_.escapeRegExp(tag), 'i')
const regExp = new RegExp(_.escapeRegExp(tag), 'i')
return notes.filter((note) => {
if (!_.isArray(note.tags)) return false
return note.tags.some((_tag) => {
@@ -26,7 +26,7 @@ function findByTag (notes, block) {
}
function findByWord (notes, block) {
let regExp = new RegExp(_.escapeRegExp(block), 'i')
const regExp = new RegExp(_.escapeRegExp(block), 'i')
return notes.filter((note) => {
if (_.isArray(note.tags) && note.tags.some((_tag) => {
return _tag.match(regExp)

View File

@@ -1,5 +1,8 @@
.root
absolute top bottom right
display flex
align-items center
justify-content center
.empty
height 320px
@@ -8,8 +11,9 @@
.empty-message
width 100%
font-size 42px
line-height 72px
font-size 36px
font-weight 600
line-height 56px
text-align center
color $ui-inactive-text-color

View File

@@ -3,7 +3,9 @@
*/
// Margin on the left side and the right side for NoteDetail component.
$note-detail-left-margin = 25px
$note-detail-right-margin = 25px
$note-detail-left-margin = 100px
$note-detail-right-margin = 120px
$snippet-note-detail-left-margin = 60px
$snippet-note-detail-right-margin = 80px
$note-detail-box-shadow = 2px 0 15px -8px #b1b1b1 inset

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './FolderSelect.styl'
import _ from 'lodash'
@@ -73,8 +74,8 @@ class FolderSelect extends React.Component {
case 9:
if (e.shiftKey) {
e.preventDefault()
let tabbable = document.querySelectorAll('a:not([disabled]), button:not([disabled]), input[type=text]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])')
let previousEl = tabbable[Array.prototype.indexOf.call(tabbable, this.refs.root) - 1]
const tabbable = document.querySelectorAll('a:not([disabled]), button:not([disabled]), input[type=text]:not([disabled]), [tabindex]:not([disabled]):not([tabindex="-1"])')
const previousEl = tabbable[Array.prototype.indexOf.call(tabbable, this.refs.root) - 1]
if (previousEl != null) previousEl.focus()
}
}
@@ -89,9 +90,9 @@ class FolderSelect extends React.Component {
}
handleSearchInputChange (e) {
let { folders } = this.props
let search = this.refs.search.value
let optionIndex = search.length > 0
const { folders } = this.props
const search = this.refs.search.value
const optionIndex = search.length > 0
? _.findIndex(folders, (folder) => {
return folder.name.match(new RegExp('^' + _.escapeRegExp(search), 'i'))
})
@@ -129,7 +130,7 @@ class FolderSelect extends React.Component {
nextOption () {
let { optionIndex } = this.state
let { folders } = this.props
const { folders } = this.props
optionIndex++
if (optionIndex >= folders.length) optionIndex = 0
@@ -140,7 +141,7 @@ class FolderSelect extends React.Component {
}
previousOption () {
let { folders } = this.props
const { folders } = this.props
let { optionIndex } = this.state
optionIndex--
@@ -152,10 +153,10 @@ class FolderSelect extends React.Component {
}
selectOption () {
let { folders } = this.props
let optionIndex = this.state.optionIndex
const { folders } = this.props
const optionIndex = this.state.optionIndex
let folder = folders[optionIndex]
const folder = folders[optionIndex]
if (folder != null) {
this.setState({
status: 'FOCUS'
@@ -184,10 +185,10 @@ class FolderSelect extends React.Component {
}
render () {
let { className, data, value } = this.props
let splitted = value.split('-')
let storageKey = splitted.shift()
let folderKey = splitted.shift()
const { className, data, value } = this.props
const splitted = value.split('-')
const storageKey = splitted.shift()
const folderKey = splitted.shift()
let options = []
data.storageMap.forEach((storage, index) => {
storage.folders.forEach((folder) => {
@@ -198,14 +199,14 @@ class FolderSelect extends React.Component {
})
})
let currentOption = options.filter((option) => option.storage.key === storageKey && option.folder.key === folderKey)[0]
const currentOption = options.filter((option) => option.storage.key === storageKey && option.folder.key === folderKey)[0]
if (this.state.search.trim().length > 0) {
let filter = new RegExp('^' + _.escapeRegExp(this.state.search), 'i')
const filter = new RegExp('^' + _.escapeRegExp(this.state.search), 'i')
options = options.filter((option) => filter.test(option.folder.name))
}
let optionList = options
const optionList = options
.map((option, index) => {
return (
<div styleName={index === this.state.optionIndex
@@ -259,12 +260,11 @@ class FolderSelect extends React.Component {
{optionList}
</div>
</div>
: <div styleName='idle'>
: <div styleName='idle' style={{color: currentOption.folder.color}}>
<div styleName='idle-label'>
<span styleName='idle-label-name'
style={{color: currentOption.folder.color}}
>
{currentOption.folder.name} /
<i className='fa fa-folder' />
<span styleName='idle-label-name'>
{currentOption.folder.name}
</span>
</div>
</div>

View File

@@ -1,21 +1,22 @@
.root
position relative
border solid 1px transparent
line-height 26px
vertical-align middle
border-radius 2px
transition 0.15s
user-select none
margin-right 10px
&:hover
background-color $ui-button--hover-backgroundColor
.root--search, .root--focus
@extend .root
background-color $ui-noteDetail-backgroundColor = #F4F4F4
background-color $ui-noteDetail-backgroundColor = #fff
border-color $ui-input--focus-borderColor
width 100px
width 154px
height 30px
&:hover
border-color $ui-input--focus-borderColor
border-color $ui-input--focus-borderColor = #fff
.idle
position relative
@@ -24,13 +25,16 @@
.idle-label
right 20px
overflow ellipsis
display flex
align-items center
.idle-label-name
font-size 14px
padding 2px
font-size 13px
font-weight 600
margin-left 4px
.idle-label-name-surfix
font-size 10px
font-size 15px
color $ui-inactive-text-color
margin-left 5px
.idle-caret
@@ -39,35 +43,37 @@
width 20px
line-height 34px
.search
absolute top left right bottom
line-height 34px
.search-input
vertical-align middle
position relative
top -2px
top 0
font-size 14px
outline none
border none
height 20px
line-height 20px
width 100%
background-color transparent
padding 0 10px
.search-optionList
position fixed
position absolute
top 30px
max-height 450px
min-width 150px
overflow auto
z-index 200
border $ui-border
background-color white
border-radius 2px
padding 10px 6px
.search-optionList-item
width 140px
height 34px
width 250px
display flex
align-items center
box-sizing border-box
padding 0 5px
padding 0
margin-bottom 10px
overflow ellipsis
cursor pointer
&:hover
@@ -81,13 +87,17 @@
background-color $ui-button--active-backgroundColor
color $ui-button--active-color
.search-optionList-item-name
border-left solid 2px transparent
padding 2px 5px
border-left solid 3px transparent
padding 6px
.search-optionList-item-name-surfix
font-size 10px
color $ui-inactive-text-color
margin-left 5px
body[data-theme="dark"]
.root
color $ui-dark-text-color

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './InfoButton.styl'
@@ -6,9 +7,9 @@ const InfoButton = ({
onClick
}) => (
<button styleName='control-infoButton'
onClick={onClick}
onClick={(e) => onClick(e)}
>
<i className='fa fa-info infoButton' styleName='info-button' />
<img className='infoButton' src='../resources/icon/icon-info.svg' />
</button>
)

View File

@@ -1,20 +1,10 @@
.control-infoButton
float right
top 10px
margin-bottom 10px
topBarButtonLight()
.control-infoPanel
position fixed
pointer-events none
top 50px
z-index 200
line-height normal
border-radius 2px
opacity 0
transition 0.1s
.infoButton
padding 0px
margin 15px 0
body[data-theme="dark"]
.control-infoButton

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './InfoPanel.styl'
@@ -6,68 +7,54 @@ const InfoPanel = ({
storageName, folderName, noteLink, updatedAt, createdAt, exportAsMd, exportAsTxt, wordCount, letterCount, type, print
}) => (
<div className='infoPanel' styleName='control-infoButton-panel' style={{display: 'none'}}>
<div styleName='group-section'>
<div styleName='group-section-label'>
Storage
</div>
<div styleName='group-section-control'>
{storageName}
</div>
</div>
<div styleName='group-section'>
<div styleName='group-section-label'>
Folder
</div>
<div styleName='group-section-control'>
{folderName}
</div>
</div>
<div styleName='group-section'>
<div styleName='group-section-label'>
Created
</div>
<div styleName='group-section-control'>
{createdAt}
</div>
</div>
<div styleName='group-section'>
<div styleName='group-section-label'>
Updated
</div>
<div styleName='group-section-control'>
{updatedAt}
</div>
</div>
<div styleName='group-section'>
<div styleName='group-section-label'>
Note Link
</div>
<div styleName='group-section-control'>
<input value={noteLink} onClick={(e) => { e.target.select() }} />
</div>
<div>
<p styleName='modification-date'>{updatedAt}</p>
<p styleName='modification-date-desc'>MODIFICATION DATE</p>
</div>
<hr />
{type === 'SNIPPET_NOTE'
? ''
: <div>
<div styleName='group-section'>
<div styleName='group-section-label'>
Words
</div>
<div styleName='group-section-control'>
{wordCount}
</div>
</div>
<div styleName='group-section'>
<div styleName='group-section-label'>
Letters
</div>
<div styleName='group-section-control'>
{letterCount}
: <div styleName='count-wrap'>
<div styleName='count-number'>
<p styleName='infoPanel-defaul-count'>{wordCount}</p>
<p styleName='infoPanel-sub-count'>Words</p>
</div>
<div styleName='count-number'>
<p styleName='infoPanel-defaul-count'>{letterCount}</p>
<p styleName='infoPanel-sub-count'>Letters</p>
</div>
</div>
}
{type === 'SNIPPET_NOTE'
? ''
: <hr />
}
<div>
<p styleName='infoPanel-default'>{storageName}</p>
<p styleName='infoPanel-sub'>STORAGE</p>
</div>
<div>
<p styleName='infoPanel-default'>{folderName}</p>
<p styleName='infoPanel-sub'>FOLDER</p>
</div>
<div>
<p styleName='infoPanel-default'>{createdAt}</p>
<p styleName='infoPanel-sub'>CREATION DATE</p>
</div>
<div>
<input styleName='infoPanel-noteLink' value={noteLink} onClick={(e) => { e.target.select() }} />
<p styleName='infoPanel-sub'>NOTE LINK</p>
</div>
<hr />
<div id='export-wrap'>
<button styleName='export--enable' onClick={(e) => exportAsMd(e)}>
<i className='fa fa-file-code-o fa-fw' />

View File

@@ -10,52 +10,81 @@
.control-infoButton-panel
z-index 200
margin-top 45px
margin-left -210px
margin-top 0px
right 0
position absolute
padding 20px 20px 0 20px
width 340px
padding 20px 25px 0 25px
width 300px
height 350px
overflow auto
background-color $ui-noteList-backgroundColor
border 1px solid $border-color
box-shadow 2px 12px 15px 2px rgba(0, 0, 0, 0.1), 2px 1px 50px 2px rgba(0, 0, 0, 0.1)
border-radius 2px
.modification-date
font-size 18px
line-height 30px
color $ui-text-color
.modification-date-desc
font-size 18px
color $ui-inactive-text-color
.control-infoButton-panel-trash
z-index 200
margin-top 45px
margin-left -230px
margin-top 0px
right 0px
position absolute
padding 20px 20px 0 20px
width 320px
padding 20px 25px 0 25px
width 300px
background-color $ui-noteList-backgroundColor
border 1px solid $border-color
box-shadow 2px 12px 15px 2px rgba(0, 0, 0, 0.1), 2px 1px 50px 2px rgba(0, 0, 0, 0.1)
border-radius 2px
.group-section
.count-wrap
display flex
position relative
width 100%
.count-number
position relative
display block
width 50%
overflow hidden
margin 0
padding 0
.infoPanel-defaul-count
font-size 16px
line-height 30px
font-size 13px
.group-section-label
width 70px
height 20px
text-align left
margin-right 50px
font-size 13px
color $ui-inactive-text-color
.group-section-control
flex 1
font-size 13px
color $ui-text-color
.group-section-control input
width 160px
height 25px
.infoPanel-sub-count
font-size 16px
color $ui-inactive-text-color
padding-bottom 8px
.group-section-control text
.infoPanel-default
font-size 14px
line-height 30px
color $ui-text-color
.infoPanel-sub
font-size 14px
color $ui-inactive-text-color
padding-bottom 8px
.infoPanel-noteLink
padding-right 5px
width 200px
height 25px
margin-bottom 6px
.infoPanel-trash
color #EA4447
font-weight 600
font-size 14px
width 70px
height 25px
background-color rgba(226,33,113,0.1)
border none
outline none
@@ -96,20 +125,30 @@
body[data-theme="dark"]
.control-infoButton-panel
background-color $ui-dark-noteList-backgroundColor
border 1px solid $ui-dark-borderColor
.control-infoButton-panel-trash
background-color $ui-dark-noteList-backgroundColor
border 1px solid $ui-dark-borderColor
.group-section-label
color $ui-inactive-text-color
.group-section-control
.modification-date
color $ui-dark-text-color
.group-section-control input
background-color alpha($ui-dark-borderColor, 80%)
.modification-date-desc
color $ui-inactive-text-color
.infoPanel-defaul-count
color $ui-dark-text-color
.infoPanel-sub-count
color $ui-inactive-text-color
.infoPanel-default
color $ui-dark-text-color
.infoPanel-sub
color $ui-inactive-text-color
.infoPanel-noteLink
background-color alpha($ui-dark-borderColor, 60%)
color $ui-dark-text-color
[id=export-wrap]

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './InfoPanel.styl'
@@ -6,37 +7,26 @@ const InfoPanelTrashed = ({
storageName, folderName, updatedAt, createdAt, exportAsMd, exportAsTxt
}) => (
<div className='infoPanel' styleName='control-infoButton-panel-trash' style={{display: 'none'}}>
<div styleName='group-section'>
<div styleName='group-section-label'>
Storage
<div>
<p styleName='modification-date'>{updatedAt}</p>
<p styleName='modification-date-desc'>MODIFICATION DATE</p>
</div>
<div styleName='group-section-control'>
{storageName}
<hr />
<div>
<p styleName='infoPanel-default'>{storageName}</p>
<p styleName='infoPanel-sub'>STORAGE</p>
</div>
<div>
<p styleName='infoPanel-default'><text styleName='infoPanel-trash'>Trash</text>{folderName}</p>
<p styleName='infoPanel-sub'>FOLDER</p>
</div>
<div styleName='group-section'>
<div styleName='group-section-label'>
Folder
</div>
<div styleName='group-section-control'>
<text>Trash</text>{folderName}
</div>
</div>
<div styleName='group-section'>
<div styleName='group-section-label'>
Created
</div>
<div styleName='group-section-control'>
{createdAt}
</div>
</div>
<div styleName='group-section'>
<div styleName='group-section-label'>
Updated
</div>
<div styleName='group-section-control'>
{updatedAt}
</div>
<div>
<p styleName='infoPanel-default'>{createdAt}</p>
<p styleName='infoPanel-sub'>CREATION DATE</p>
</div>
<div id='export-wrap'>

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './MarkdownNoteDetail.styl'
import MarkdownEditor from 'browser/components/MarkdownEditor'
@@ -9,12 +10,13 @@ import FolderSelect from './FolderSelect'
import dataApi from 'browser/main/lib/dataApi'
import { hashHistory } from 'react-router'
import ee from 'browser/main/lib/eventEmitter'
import markdown from 'browser/lib/markdown'
import markdown from 'browser/lib/markdownTextHelper'
import StatusBar from '../StatusBar'
import _ from 'lodash'
import { findNoteTitle } from 'browser/lib/findNoteTitle'
import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig'
import TrashButton from './TrashButton'
import PermanentDeleteButton from './PermanentDeleteButton'
import InfoButton from './InfoButton'
import InfoPanel from './InfoPanel'
import InfoPanelTrashed from './InfoPanelTrashed'
@@ -24,7 +26,7 @@ import striptags from 'striptags'
const electron = require('electron')
const { remote } = electron
const { Menu, MenuItem, dialog } = remote
const { dialog } = remote
class MarkdownNoteDetail extends React.Component {
constructor (props) {
@@ -73,7 +75,7 @@ class MarkdownNoteDetail extends React.Component {
}
handleChange (e) {
let { note } = this.state
const { note } = this.state
note.content = this.refs.content.value
if (this.refs.tags) note.tags = this.refs.tags.value
@@ -95,7 +97,7 @@ class MarkdownNoteDetail extends React.Component {
}
saveNow () {
let { note, dispatch } = this.props
const { note, dispatch } = this.props
clearTimeout(this.saveQueue)
this.saveQueue = null
@@ -111,11 +113,11 @@ class MarkdownNoteDetail extends React.Component {
}
handleFolderChange (e) {
let { note } = this.state
let value = this.refs.folder.value
let splitted = value.split('-')
let newStorageKey = splitted.shift()
let newFolderKey = splitted.shift()
const { note } = this.state
const value = this.refs.folder.value
const splitted = value.split('-')
const newStorageKey = splitted.shift()
const newFolderKey = splitted.shift()
dataApi
.moveNote(note.storage, note.key, newStorageKey, newFolderKey)
@@ -124,7 +126,7 @@ class MarkdownNoteDetail extends React.Component {
isMovingNote: true,
note: Object.assign({}, newNote)
}, () => {
let { dispatch, location } = this.props
const { dispatch, location } = this.props
dispatch({
type: 'MOVE_NOTE',
originNote: note,
@@ -144,7 +146,7 @@ class MarkdownNoteDetail extends React.Component {
}
handleStarButtonClick (e) {
let { note } = this.state
const { note } = this.state
if (!note.isStarred) AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_STAR')
note.isStarred = !note.isStarred
@@ -169,22 +171,22 @@ class MarkdownNoteDetail extends React.Component {
}
handleTrashButtonClick (e) {
let { note } = this.state
const { note } = this.state
const { isTrashed } = note
if (isTrashed) {
let dialogueButtonIndex = dialog.showMessageBox(remote.getCurrentWindow(), {
const dialogueButtonIndex = dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: 'Confirm note deletion',
detail: 'This will permanently remove this note.',
buttons: ['Confirm', 'Cancel']
})
if (dialogueButtonIndex === 1) return
let { note, dispatch } = this.props
const { note, dispatch } = this.props
dataApi
.deleteNote(note.storage, note.key)
.then((data) => {
let dispatchHandler = () => {
const dispatchHandler = () => {
dispatch({
type: 'DELETE_NOTE',
storageKey: data.storageKey,
@@ -206,7 +208,7 @@ class MarkdownNoteDetail extends React.Component {
}
handleUndoButtonClick (e) {
let { note } = this.state
const { note } = this.state
note.isTrashed = false
@@ -231,7 +233,7 @@ class MarkdownNoteDetail extends React.Component {
}
getToggleLockButton () {
return this.state.isLocked ? 'fa-lock' : 'fa-unlock'
return this.state.isLocked ? '../resources/icon/icon-lock.svg' : '../resources/icon/icon-unlock.svg'
}
handleDeleteKeyDown (e) {
@@ -261,12 +263,12 @@ class MarkdownNoteDetail extends React.Component {
}
render () {
let { data, config, location } = this.props
let { note } = this.state
let storageKey = note.storage
let folderKey = note.folder
const { data, config, location } = this.props
const { note } = this.state
const storageKey = note.storage
const folderKey = note.folder
let options = []
const options = []
data.storageMap.forEach((storage, index) => {
storage.folders.forEach((folder) => {
options.push({
@@ -275,7 +277,7 @@ class MarkdownNoteDetail extends React.Component {
})
})
})
let currentOption = options.filter((option) => option.storage.key === storageKey && option.folder.key === folderKey)[0]
const currentOption = options.filter((option) => option.storage.key === storageKey && option.folder.key === folderKey)[0]
const trashTopBar = <div styleName='info'>
<div styleName='info-left'>
@@ -285,7 +287,7 @@ class MarkdownNoteDetail extends React.Component {
/>
</div>
<div styleName='info-right'>
<TrashButton onClick={(e) => this.handleTrashButtonClick(e)} />
<PermanentDeleteButton onClick={(e) => this.handleTrashButtonClick(e)} />
<InfoButton
onClick={(e) => this.handleInfoButtonClick(e)}
/>
@@ -302,10 +304,6 @@ class MarkdownNoteDetail extends React.Component {
const detailTopBar = <div styleName='info'>
<div styleName='info-left'>
<StarButton styleName='info-left-button'
onClick={(e) => this.handleStarButtonClick(e)}
isActive={note.isStarred}
/>
<div styleName='info-left-top'>
<FolderSelect styleName='info-left-top-folderSelect'
value={this.state.note.storage + '-' + this.state.note.folder}
@@ -325,31 +323,38 @@ class MarkdownNoteDetail extends React.Component {
/>
</div>
<div styleName='info-right'>
<InfoButton
onClick={(e) => this.handleInfoButtonClick(e)}
/>
<StarButton
onClick={(e) => this.handleStarButtonClick(e)}
isActive={note.isStarred}
/>
{(() => {
const faClassName = `fa ${this.getToggleLockButton()}`
const imgSrc = `${this.getToggleLockButton()}`
const lockButtonComponent =
<button styleName='control-lockButton'
onFocus={(e) => this.handleFocus(e)}
onMouseDown={(e) => this.handleLockButtonMouseDown(e)}
>
<i className={faClassName} styleName='lock-button' />
<span styleName='control-lockButton-tooltip'>
{this.state.isLocked ? 'Unlock Editor' : 'Keep Editor Locked'}
</span>
<img styleName='iconInfo' src={imgSrc} />
</button>
return (
this.state.isLockButtonShown ? lockButtonComponent : ''
)
})()}
<TrashButton onClick={(e) => this.handleTrashButtonClick(e)} />
<button styleName='control-fullScreenButton'
onMouseDown={(e) => this.handleFullScreenButton(e)}
>
<i className='fa fa-window-maximize' styleName='fullScreen-button' />
<img styleName='iconInfo' src='../resources/icon/icon-sidebar.svg' />
</button>
<InfoButton
onClick={(e) => this.handleInfoButtonClick(e)}
/>
<TrashButton onClick={(e) => this.handleTrashButtonClick(e)} />
<InfoPanel
storageName={currentOption.storage.name}
folderName={currentOption.folder.name}

View File

@@ -3,50 +3,47 @@
.root
absolute top right bottom
border-width 0 0 1px
border-style solid
border-color $ui-borderColor
border-left 1px solid alpha(#DEDEDE, 60%)
background-color $ui-noteDetail-backgroundColor
box-shadow $note-detail-box-shadow
box-shadow none
padding 20px 40px
.lock-button
padding-bottom 3px
.control-lockButton
top 160px
margin-bottom 10px
topBarButtonLight()
.control-lockButton-tooltip
tooltip()
position fixed
pointer-events none
top 50px
z-index 200
padding 5px
line-height normal
border-radius 2px
opacity 0
transition 0.1s
.trashed-infopanel
top 40px
position relative
.control-fullScreenButton
float right
padding 0 0 2px 0
top 80px
topBarButtonLight()
.body
absolute left right
left $note-detail-left-margin
right $note-detail-right-margin
left 0
right 0
top $info-height + $info-margin-under-border
bottom $statusBar-height
margin 0 45px
.body-noteEditor
absolute top bottom left right
body[data-theme="white"]
.root
box-shadow $note-detail-box-shadow
border none
body[data-theme="dark"]
.root
border-color $ui-dark-borderColor
background-color $ui-dark-noteDetail-backgroundColor
box-shadow none
border none
.control-lockButton
topBarButtonDark()

View File

@@ -1,33 +1,31 @@
@import('DetailVars')
$info-height = 60px
$info-margin-under-border = 27px
$info-height = 50px
$info-margin-under-border = 30px
.info
absolute top left right
left $note-detail-left-margin
right $note-detail-right-margin
left 0
right 0
height $info-height
border-bottom $ui-border
border-bottom 1px solid #eee
background-color $ui-noteDetail-backgroundColor
width 100%
display flex
align-items center
.info-left
float left
padding 0 5px
margin 0px 2px
.info-left-top
display inline-block
height $info-height
line-height $info-height
padding 0 10px
width 100%
display flex
align-items center
.info-left-top-folderSelect
padding 0 3px
height 34px
line-height 26px
display flex
align-items center
justify-content center
border-radius 3px
.info-left-button
width 34px
height 34px
@@ -48,18 +46,18 @@ $info-margin-under-border = 27px
.info-right
position absolute
right 0
top 0
background $ui-noteDetail-backgroundColor
right 40px
top 60px
bottom 1px
padding-left 30px
z-index 101
.undo-button
width 34px
height 34px
border-radius 17px
font-size 14px
margin 15px 7px
margin 5px 0px
border none
color $ui-button-color
display flex
@@ -72,6 +70,7 @@ $info-margin-under-border = 27px
border-color $ui-button--active-backgroundColor
&:hover
background-color alpha($ui-button--hover-backgroundColor, 60%)
transition 0.2s
.control-lockButton-tooltip
opacity 1

View File

@@ -0,0 +1,20 @@
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './TrashButton.styl'
const PermanentDeleteButton = ({
onClick
}) => (
<button styleName='control-trashButton--in-trash'
onClick={(e) => onClick(e)}
>
<img styleName='iconInfo' src='../resources/icon/icon-trash.svg' />
</button>
)
PermanentDeleteButton.propTypes = {
onClick: PropTypes.func.isRequired
}
export default CSSModules(PermanentDeleteButton, styles)

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './SnippetNoteDetail.styl'
import CodeEditor from 'browser/components/CodeEditor'
@@ -18,6 +19,7 @@ import _ from 'lodash'
import { findNoteTitle } from 'browser/lib/findNoteTitle'
import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig'
import TrashButton from './TrashButton'
import PermanentDeleteButton from './PermanentDeleteButton'
import InfoButton from './InfoButton'
import InfoPanel from './InfoPanel'
import InfoPanelTrashed from './InfoPanelTrashed'
@@ -60,7 +62,7 @@ class SnippetNoteDetail extends React.Component {
componentWillReceiveProps (nextProps) {
if (nextProps.note.key !== this.props.note.key && !this.isMovingNote) {
if (this.saveQueue != null) this.saveNow()
let nextNote = Object.assign({
const nextNote = Object.assign({
description: ''
}, nextProps.note, {
snippets: nextProps.note.snippets.map((snippet) => Object.assign({}, snippet))
@@ -69,7 +71,7 @@ class SnippetNoteDetail extends React.Component {
snippetIndex: 0,
note: nextNote
}, () => {
let { snippets } = this.state.note
const { snippets } = this.state.note
snippets.forEach((snippet, index) => {
this.refs['code-' + index].reload()
})
@@ -83,7 +85,7 @@ class SnippetNoteDetail extends React.Component {
}
handleChange (e) {
let { note } = this.state
const { note } = this.state
if (this.refs.tags) note.tags = this.refs.tags.value
note.description = this.refs.description.value
@@ -105,7 +107,7 @@ class SnippetNoteDetail extends React.Component {
}
saveNow () {
let { note, dispatch } = this.props
const { note, dispatch } = this.props
clearTimeout(this.saveQueue)
this.saveQueue = null
@@ -121,11 +123,11 @@ class SnippetNoteDetail extends React.Component {
}
handleFolderChange (e) {
let { note } = this.state
let value = this.refs.folder.value
let splitted = value.split('-')
let newStorageKey = splitted.shift()
let newFolderKey = splitted.shift()
const { note } = this.state
const value = this.refs.folder.value
const splitted = value.split('-')
const newStorageKey = splitted.shift()
const newFolderKey = splitted.shift()
dataApi
.moveNote(note.storage, note.key, newStorageKey, newFolderKey)
@@ -134,7 +136,7 @@ class SnippetNoteDetail extends React.Component {
isMovingNote: true,
note: Object.assign({}, newNote)
}, () => {
let { dispatch, location } = this.props
const { dispatch, location } = this.props
dispatch({
type: 'MOVE_NOTE',
originNote: note,
@@ -154,7 +156,7 @@ class SnippetNoteDetail extends React.Component {
}
handleStarButtonClick (e) {
let { note } = this.state
const { note } = this.state
if (!note.isStarred) AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_STAR')
note.isStarred = !note.isStarred
@@ -171,22 +173,22 @@ class SnippetNoteDetail extends React.Component {
}
handleTrashButtonClick (e) {
let { note } = this.state
const { note } = this.state
const { isTrashed } = note
if (isTrashed) {
let dialogueButtonIndex = dialog.showMessageBox(remote.getCurrentWindow(), {
const dialogueButtonIndex = dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: 'Confirm note deletion',
detail: 'This will permanently remove this note.',
buttons: ['Confirm', 'Cancel']
})
if (dialogueButtonIndex === 1) return
let { note, dispatch } = this.props
const { note, dispatch } = this.props
dataApi
.deleteNote(note.storage, note.key)
.then((data) => {
let dispatchHandler = () => {
const dispatchHandler = () => {
dispatch({
type: 'DELETE_NOTE',
storageKey: data.storageKey,
@@ -208,7 +210,7 @@ class SnippetNoteDetail extends React.Component {
}
handleUndoButtonClick (e) {
let { note } = this.state
const { note } = this.state
note.isTrashed = false
@@ -237,7 +239,7 @@ class SnippetNoteDetail extends React.Component {
handleTabDeleteButtonClick (e, index) {
if (this.state.note.snippets.length > 1) {
if (this.state.note.snippets[index].content.trim().length > 0) {
let dialogIndex = dialog.showMessageBox(remote.getCurrentWindow(), {
const dialogIndex = dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: 'Delete a snippet',
detail: 'This work cannot be undone.',
@@ -287,7 +289,7 @@ class SnippetNoteDetail extends React.Component {
handleModeOptionClick (index, name) {
return (e) => {
let snippets = this.state.note.snippets.slice()
const snippets = this.state.note.snippets.slice()
snippets[index].mode = name
this.setState({note: Object.assign(this.state.note, {snippets: snippets})})
@@ -305,7 +307,7 @@ class SnippetNoteDetail extends React.Component {
handleCodeChange (index) {
return (e) => {
let snippets = this.state.note.snippets.slice()
const snippets = this.state.note.snippets.slice()
snippets[index].content = this.refs['code-' + index].value
this.setState({note: Object.assign(this.state.note, {snippets: snippets})})
this.setState({
@@ -332,7 +334,7 @@ class SnippetNoteDetail extends React.Component {
break
case 76:
{
let isSuper = global.process.platform === 'darwin'
const isSuper = global.process.platform === 'darwin'
? e.metaKey
: e.ctrlKey
if (isSuper) {
@@ -343,7 +345,7 @@ class SnippetNoteDetail extends React.Component {
break
case 84:
{
let isSuper = global.process.platform === 'darwin'
const isSuper = global.process.platform === 'darwin'
? e.metaKey
: e.ctrlKey
if (isSuper) {
@@ -356,7 +358,7 @@ class SnippetNoteDetail extends React.Component {
}
handleModeButtonClick (e, index) {
let menu = new Menu()
const menu = new Menu()
CodeMirror.modeInfo.forEach((mode) => {
menu.append(new MenuItem({
label: mode.name,
@@ -397,8 +399,8 @@ class SnippetNoteDetail extends React.Component {
}
handleIndentSizeItemClick (e, indentSize) {
let { config, dispatch } = this.props
let editor = Object.assign({}, config.editor, {
const { config, dispatch } = this.props
const editor = Object.assign({}, config.editor, {
indentSize
})
ConfigManager.set({
@@ -413,8 +415,8 @@ class SnippetNoteDetail extends React.Component {
}
handleIndentTypeItemClick (e, indentType) {
let { config, dispatch } = this.props
let editor = Object.assign({}, config.editor, {
const { config, dispatch } = this.props
const editor = Object.assign({}, config.editor, {
indentType
})
ConfigManager.set({
@@ -433,14 +435,14 @@ class SnippetNoteDetail extends React.Component {
}
addSnippet () {
let { note } = this.state
const { note } = this.state
note.snippets = note.snippets.concat([{
name: '',
mode: 'Plain Text',
content: ''
}])
let snippetIndex = note.snippets.length - 1
const snippetIndex = note.snippets.length - 1
this.setState({
note,
@@ -486,19 +488,19 @@ class SnippetNoteDetail extends React.Component {
}
render () {
let { data, config, location } = this.props
let { note } = this.state
const { data, config, location } = this.props
const { note } = this.state
let storageKey = note.storage
let folderKey = note.folder
const storageKey = note.storage
const folderKey = note.folder
let editorFontSize = parseInt(config.editor.fontSize, 10)
if (!(editorFontSize > 0 && editorFontSize < 101)) editorFontSize = 14
let editorIndentSize = parseInt(config.editor.indentSize, 10)
if (!(editorFontSize > 0 && editorFontSize < 132)) editorIndentSize = 4
let tabList = note.snippets.map((snippet, index) => {
let isActive = this.state.snippetIndex === index
const tabList = note.snippets.map((snippet, index) => {
const isActive = this.state.snippetIndex === index
return <SnippetTab
key={index}
@@ -512,8 +514,8 @@ class SnippetNoteDetail extends React.Component {
/>
})
let viewList = note.snippets.map((snippet, index) => {
let isActive = this.state.snippetIndex === index
const viewList = note.snippets.map((snippet, index) => {
const isActive = this.state.snippetIndex === index
let syntax = CodeMirror.findModeByName(pass(snippet.mode))
if (syntax == null) syntax = CodeMirror.findModeByName('Plain Text')
@@ -547,7 +549,7 @@ class SnippetNoteDetail extends React.Component {
</div>
})
let options = []
const options = []
data.storageMap.forEach((storage, index) => {
storage.folders.forEach((folder) => {
options.push({
@@ -556,7 +558,7 @@ class SnippetNoteDetail extends React.Component {
})
})
})
let currentOption = options.filter((option) => option.storage.key === storageKey && option.folder.key === folderKey)[0]
const currentOption = options.filter((option) => option.storage.key === storageKey && option.folder.key === folderKey)[0]
const trashTopBar = <div styleName='info'>
<div styleName='info-left'>
@@ -566,7 +568,7 @@ class SnippetNoteDetail extends React.Component {
/>
</div>
<div styleName='info-right'>
<TrashButton onClick={(e) => this.handleTrashButtonClick(e)} />
<PermanentDeleteButton onClick={(e) => this.handleTrashButtonClick(e)} />
<InfoButton
onClick={(e) => this.handleInfoButtonClick(e)}
/>
@@ -583,10 +585,6 @@ class SnippetNoteDetail extends React.Component {
const detailTopBar = <div styleName='info'>
<div styleName='info-left'>
<StarButton styleName='info-left-button'
onClick={(e) => this.handleStarButtonClick(e)}
isActive={note.isStarred}
/>
<div styleName='info-left-top'>
<FolderSelect styleName='info-left-top-folderSelect'
value={this.state.note.storage + '-' + this.state.note.folder}
@@ -603,15 +601,21 @@ class SnippetNoteDetail extends React.Component {
/>
</div>
<div styleName='info-right'>
<TrashButton onClick={(e) => this.handleTrashButtonClick(e)} />
<button styleName='control-fullScreenButton'
onMouseDown={(e) => this.handleFullScreenButton(e)}
>
<i className='fa fa-window-maximize' styleName='fullScreen-button' />
</button>
<InfoButton
onClick={(e) => this.handleInfoButtonClick(e)}
/>
<StarButton
onClick={(e) => this.handleStarButtonClick(e)}
isActive={note.isStarred}
/>
<button styleName='control-fullScreenButton'
onMouseDown={(e) => this.handleFullScreenButton(e)}>
<img styleName='iconInfo' src='../resources/icon/icon-sidebar.svg' />
</button>
<TrashButton onClick={(e) => this.handleTrashButtonClick(e)} />
<InfoPanel
storageName={currentOption.storage.name}
folderName={currentOption.folder.name}

View File

@@ -3,16 +3,14 @@
.root
absolute top bottom right
border-width 0 0 1px
border-style solid
border-color $ui-borderColor
border-left 1px solid alpha(#DEDEDE, 60%)
background-color $ui-noteDetail-backgroundColor
box-shadow $note-detail-box-shadow
box-shadow none
.body
absolute left right
left $note-detail-left-margin
right $note-detail-right-margin
left $snippet-note-detail-left-margin
right $snippet-note-detail-right-margin
top $info-height + $info-margin-under-border
bottom $statusBar-height
background-color $ui-noteDetail-backgroundColor
@@ -45,7 +43,7 @@
overflow hidden
.tabList .plusButton
navButtonColor()
navWhiteButtonColor()
width 30px
.tabView
@@ -57,24 +55,30 @@
.override
absolute bottom left
bottom 30px
bottom 1px
left 60px
height 23px
z-index 101
button
navButtonColor()
height 24px
padding 0 6px
&:hover
color $ui-active-color
&:active .update-icon
color white
color $ui-active-color
.control-fullScreenButton
float right
padding 0 0 2px 0
top 80px
margin-bottom 10px
topBarButtonLight()
body[data-theme="white"]
.root
box-shadow $note-detail-box-shadow
border none
body[data-theme="dark"]
.root
border-color $ui-dark-borderColor
border none
background-color $ui-dark-noteDetail-backgroundColor
box-shadow none

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './StarButton.styl'
import _ from 'lodash'
@@ -31,7 +32,7 @@ class StarButton extends React.Component {
}
render () {
let { className } = this.props
const { className } = this.props
return (
<button className={_.isString(className)
@@ -47,10 +48,10 @@ class StarButton extends React.Component {
onMouseLeave={(e) => this.handleMouseLeave(e)}
onClick={this.props.onClick}
>
<i styleName='icon'
className={this.state.isActive || this.props.isActive
? 'fa fa-star'
: 'fa fa-star-o'
<img styleName='icon'
src={this.state.isActive || this.props.isActive
? '../resources/icon/icon-starred.svg'
: '../resources/icon/icon-star.svg'
}
/>
</button>

View File

@@ -1,47 +1,24 @@
.root
left 7px
top 0
padding 0
color alpha($ui-favorite-star-button-color, 60%)
top 45px
topBarButtonLight()
&:hover
transition 0.15s
background-color alpha($ui-button--active-backgroundColor, 40%)
color $ui-favorite-star-button-color
&:active
transition 0.15s
background-color alpha($ui-button--active-backgroundColor, 40%)
color $ui-favorite-star-button-color
transition 0.2s
color alpha($ui-favorite-star-button-color, 0.6)
.root--active
@extend .root
transition 0.15s
color $ui-favorite-star-button-color
&:hover
transition 0.15s
color $ui-favorite-star-button-color
background-color alpha($ui-button--active-backgroundColor, 40%)
&:active
transition 0.15s
color $ui-favorite-star-button-color
background-color alpha($ui-button--active-backgroundColor, 40%)
transition 0.2s
color alpha($ui-favorite-star-button-color, 0.6)
.icon
transition transform 0.15s
body[data-theme="dark"]
.root
topBarButtonDark()
&:hover
transition 0.15s
background-color alpha($ui-dark-button--active-backgroundColor, 20%)
color $ui-favorite-star-button-color
&:active
transition 0.15s
background-color alpha($ui-dark-button--active-backgroundColor, 20%)
color $ui-favorite-star-button-color
.root--active
@extend .root
color $ui-favorite-star-button-color
&:hover
transition 0.15s
color $ui-favorite-star-button-color
background-color alpha($ui-dark-button--active-backgroundColor, 20%)
transition 0.2s
color alpha($ui-favorite-star-button-color, 0.6)

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './TagSelect.styl'
import _ from 'lodash'
@@ -37,6 +38,10 @@ class TagSelect extends React.Component {
}
}
handleNewTagBlur (e) {
this.submitTag()
}
removeLastTag () {
let { value } = this.props
@@ -59,7 +64,7 @@ class TagSelect extends React.Component {
submitTag () {
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_TAG')
let { value } = this.props
let newTag = this.refs.newTag.value.trim().replace(/ +/g, '_')
const newTag = this.refs.newTag.value.trim().replace(/ +/g, '_')
if (newTag.length <= 0) {
this.setState({
@@ -101,9 +106,9 @@ class TagSelect extends React.Component {
}
render () {
let { value, className } = this.props
const { value, className } = this.props
let tagList = _.isArray(value)
const tagList = _.isArray(value)
? value.map((tag) => {
return (
<span styleName='tag'
@@ -113,7 +118,7 @@ class TagSelect extends React.Component {
<button styleName='tag-removeButton'
onClick={(e) => this.handleTagRemoveButtonClick(tag)(e)}
>
<i className='fa fa-times fa-fw tag-removeButton-icon' />
<img className='tag-removeButton-icon' src='../resources/icon/icon-x.svg' width='8px' />
</button>
</span>
)
@@ -134,6 +139,7 @@ class TagSelect extends React.Component {
placeholder='Add tag...'
onChange={(e) => this.handleNewTagInputChange(e)}
onKeyDown={(e) => this.handleNewTagInputKeyDown(e)}
onBlur={(e) => this.handleNewTagBlur(e)}
/>
</div>
)

View File

@@ -1,9 +1,9 @@
.root
display inline-block
display flex
align-items center
user-select none
height 23px
vertical-align middle
width 300px
width 100%
overflow-x scroll
white-space nowrap
@@ -11,51 +11,42 @@
display none
.tag
display inline-block
margin 1px 3px
padding 0
height 20px
background-color alpha($ui-tag-backgroundColor, 10%)
border-radius 3px
overflow hidden
display flex
align-items center
margin 0px 2px
padding 2px 4px
background-color alpha($ui-tag-backgroundColor, 3%)
border-radius 4px
position relative
clearfix()
.tag-removeButton
float right
height 20px
width 18px
margin 0
padding 0
border-style solid
border-width 0
border-radius 20px
line-height 18px
background-color transparent
color $ui-button-color
position absolute
right 6px
.tag-removeButton-icon
width 5px
padding-right 4px
.tag-label
font-size 11px
font-weight 600
color: alpha($ui-text-color, 80%)
float left
height 20px
line-height 20px
padding 0 6px
font-size 13px
color: $ui-text-color
padding 4px 16px 4px 8px
.newTag
display inline-block
margin 2px 0 15px 2px
vertical-align middle
height 18px
box-sizing border-box
border none
background-color transparent
outline none
padding 0 4px
font-size 13px
body[data-theme="dark"]
.tag

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './TrashButton.styl'
@@ -8,7 +9,7 @@ const TrashButton = ({
<button styleName='control-trashButton'
onClick={(e) => onClick(e)}
>
<i className='fa fa-trash trashButton' styleName='info-button' />
<img styleName='iconInfo' src='../resources/icon/icon-trash.svg' />
</button>
)

View File

@@ -1,10 +1,14 @@
.control-trashButton
float right
top 120px
margin-bottom 10px
topBarButtonLight()
.control-trashButton--in-trash
top 60px
topBarButtonLight()
.trashButton
padding 0px
margin 15px 0
body[data-theme="dark"]
.control-trashButton

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './Detail.styl'
import _ from 'lodash'
@@ -32,12 +33,12 @@ class Detail extends React.Component {
}
render () {
let { location, data, config } = this.props
const { location, data, config } = this.props
let note = null
if (location.query.key != null) {
let splitted = location.query.key.split('-')
let storageKey = splitted.shift()
let noteKey = splitted.shift()
const splitted = location.query.key.split('-')
const storageKey = splitted.shift()
const noteKey = splitted.shift()
note = data.noteMap.get(storageKey + '-' + noteKey)
}

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './Main.styl'
import { connect } from 'react-redux'
@@ -11,14 +12,8 @@ import _ from 'lodash'
import ConfigManager from 'browser/main/lib/ConfigManager'
import modal from 'browser/main/lib/modal'
import InitModal from 'browser/main/modals/InitModal'
import mixpanel from 'browser/main/lib/mixpanel'
import mobileAnalytics from 'browser/main/lib/AwsMobileAnalyticsConfig'
import eventEmitter from 'browser/main/lib/eventEmitter'
import RealtimeNotification from 'browser/components/RealtimeNotification'
function focused () {
mixpanel.track('MAIN_FOCUSED')
}
class Main extends React.Component {
@@ -29,7 +24,7 @@ class Main extends React.Component {
mobileAnalytics.initAwsMobileAnalytics()
}
let { config } = props
const { config } = props
this.state = {
isRightSliderFocused: false,
@@ -45,7 +40,7 @@ class Main extends React.Component {
}
getChildContext () {
let { status, config } = this.props
const { status, config } = this.props
return {
status,
@@ -54,10 +49,12 @@ class Main extends React.Component {
}
componentDidMount () {
let { dispatch, config } = this.props
const { dispatch, config } = this.props
if (config.ui.theme === 'dark') {
document.body.setAttribute('data-theme', 'dark')
} else if (config.ui.theme === 'white') {
document.body.setAttribute('data-theme', 'white')
} else {
document.body.setAttribute('data-theme', 'default')
}
@@ -77,11 +74,9 @@ class Main extends React.Component {
})
eventEmitter.on('editor:fullscreen', this.toggleFullScreen)
window.addEventListener('focus', focused)
}
componentWillUnmount () {
window.removeEventListener('focus', focused)
eventEmitter.off('editor:fullscreen', this.toggleFullScreen)
}
@@ -105,8 +100,8 @@ class Main extends React.Component {
this.setState({
isRightSliderFocused: false
}, () => {
let { dispatch } = this.props
let newListWidth = this.state.listWidth
const { dispatch } = this.props
const newListWidth = this.state.listWidth
// TODO: ConfigManager should dispatch itself.
ConfigManager.set({listWidth: newListWidth})
dispatch({
@@ -121,8 +116,8 @@ class Main extends React.Component {
this.setState({
isLeftSliderFocused: false
}, () => {
let { dispatch } = this.props
let navWidth = this.state.navWidth
const { dispatch } = this.props
const navWidth = this.state.navWidth
// TODO: ConfigManager should dispatch itself.
ConfigManager.set({ navWidth })
dispatch({
@@ -135,7 +130,7 @@ class Main extends React.Component {
handleMouseMove (e) {
if (this.state.isRightSliderFocused) {
let offset = this.refs.body.getBoundingClientRect().left
const offset = this.refs.body.getBoundingClientRect().left
let newListWidth = e.pageX - offset
if (newListWidth < 10) {
newListWidth = 10
@@ -188,18 +183,10 @@ class Main extends React.Component {
}
render () {
let { config } = this.props
const { config } = this.props
// the width of the navigation bar when it is folded/collapsed
const foldedNavigationWidth = 44
let notificationBarOffsetLeft
if (this.state.fullScreen) {
notificationBarOffsetLeft = 0
} else if (config.isSideNavFolded) {
notificationBarOffsetLeft = foldedNavigationWidth
} else {
notificationBarOffsetLeft = this.state.navWidth
}
return (
<div
@@ -268,9 +255,6 @@ class Main extends React.Component {
ignorePreviewPointerEvents={this.state.isRightSliderFocused}
/>
</div>
<RealtimeNotification
style={{left: notificationBarOffsetLeft}}
/>
</div>
)
}

View File

@@ -44,6 +44,13 @@ $control-height = 34px
opacity 0
transition 0.1s
body[data-theme="white"]
.root, .root--expanded
background-color $ui-white-noteList-backgroundColor
.control-newNoteButton
background-color $ui-white-noteList-backgroundColor
body[data-theme="dark"]
.root, .root--expanded
background-color $ui-dark-noteList-backgroundColor

View File

@@ -1,12 +1,11 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './NewNoteButton.styl'
import _ from 'lodash'
import modal from 'browser/main/lib/modal'
import NewNoteModal from 'browser/main/modals/NewNoteModal'
import { hashHistory } from 'react-router'
import eventEmitter from 'browser/main/lib/eventEmitter'
import dataApi from 'browser/main/lib/dataApi'
const { remote } = require('electron')
const { dialog } = remote
@@ -34,7 +33,7 @@ class NewNoteButton extends React.Component {
}
handleNewNoteButtonClick (e) {
const { config, location, dispatch } = this.props
const { location, dispatch } = this.props
const { storage, folder } = this.resolveTargetFolder()
modal.open(NewNoteModal, {
@@ -51,7 +50,7 @@ class NewNoteButton extends React.Component {
// Find first storage
if (storage == null) {
for (let kv of data.storageMap) {
for (const kv of data.storageMap) {
storage = kv[1]
break
}
@@ -85,7 +84,7 @@ class NewNoteButton extends React.Component {
<div styleName='control'>
<button styleName='control-newNoteButton'
onClick={(e) => this.handleNewNoteButtonClick(e)}>
<i className='fa fa-pencil-square-o' />
<img styleName='iconTag' src='../resources/icon/icon-newnote.svg' />
<span styleName='control-newNoteButton-tooltip'>
Make a Note {OSX ? '⌘' : '^'} + n
</span>

View File

@@ -2,7 +2,6 @@ $control-height = 30px
.root
absolute left bottom
bottom 30px
top $topBar-height - 1
background-color $ui-noteList-backgroundColor
@@ -22,14 +21,14 @@ $control-height = 30px
.control-sortBy-select
appearance: none;
margin-left 3px
margin-left 5px
color $ui-inactive-text-color
padding 0
border none
background-color transparent
outline none
cursor pointer
font-size 11px
font-size 12px
&:hover
transition 0.2s
color $ui-text-color
@@ -60,6 +59,13 @@ $control-height = 30px
top $control-height
overflow auto
body[data-theme="white"]
.root
background-color $ui-white-noteList-backgroundColor
.control
background-color $ui-white-noteList-backgroundColor
body[data-theme="dark"]
.root
border-color $ui-dark-borderColor

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './NoteList.styl'
import moment from 'moment'
@@ -13,8 +14,8 @@ import fs from 'fs'
import { hashHistory } from 'react-router'
import markdown from 'browser/lib/markdown'
import { findNoteTitle } from 'browser/lib/findNoteTitle'
import stripgtags from 'striptags'
import store from 'browser/main/store'
import AwsMobileAnalyticsConfig from 'browser/main/lib/AwsMobileAnalyticsConfig'
const { remote } = require('electron')
const { Menu, MenuItem, dialog } = remote
@@ -31,6 +32,18 @@ function sortByUpdatedAt (a, b) {
return new Date(b.updatedAt) - new Date(a.updatedAt)
}
function findNoteByKey (notes, noteKey) {
return notes.find((note) => `${note.storage}-${note.key}` === noteKey)
}
function findNotesByKeys (notes, noteKeys) {
return notes.filter((note) => noteKeys.includes(getNoteKey(note)))
}
function getNoteKey (note) {
return `${note.storage}-${note.key}`
}
class NoteList extends React.Component {
constructor (props) {
super(props)
@@ -50,8 +63,16 @@ class NoteList extends React.Component {
}
this.importFromFileHandler = this.importFromFile.bind(this)
this.jumpNoteByHash = this.jumpNoteByHashHandler.bind(this)
this.handleNoteListKeyUp = this.handleNoteListKeyUp.bind(this)
this.getNoteKeyFromTargetIndex = this.getNoteKeyFromTargetIndex.bind(this)
this.deleteNote = this.deleteNote.bind(this)
this.focusNote = this.focusNote.bind(this)
this.pinToTop = this.pinToTop.bind(this)
// TODO: not Selected noteKeys but SelectedNote(for reusing)
this.state = {
shiftKeyDown: false,
selectedNoteKeys: []
}
this.contextNotes = []
@@ -89,10 +110,10 @@ class NoteList extends React.Component {
}
componentDidUpdate (prevProps) {
let { location } = this.props
const { location } = this.props
if (this.notes.length > 0 && location.query.key == null) {
let { router } = this.context
const { router } = this.context
if (!location.pathname.match(/\/searched/)) this.contextNotes = this.getContextNotes()
router.replace({
pathname: location.pathname,
@@ -107,16 +128,16 @@ class NoteList extends React.Component {
if (_.isString(location.query.key) && prevProps.location.query.key === location.query.key) {
const targetIndex = this.getTargetIndex()
if (targetIndex > -1) {
let list = this.refs.list
let item = list.childNodes[targetIndex]
const list = this.refs.list
const item = list.childNodes[targetIndex]
if (item == null) return false
let overflowBelow = item.offsetTop + item.clientHeight - list.clientHeight - list.scrollTop > 0
const overflowBelow = item.offsetTop + item.clientHeight - list.clientHeight - list.scrollTop > 0
if (overflowBelow) {
list.scrollTop = item.offsetTop + item.clientHeight - list.clientHeight
}
let overflowAbove = list.scrollTop > item.offsetTop
const overflowAbove = list.scrollTop > item.offsetTop
if (overflowAbove) {
list.scrollTop = item.offsetTop
}
@@ -124,12 +145,35 @@ class NoteList extends React.Component {
}
}
focusNote (selectedNoteKeys, noteKey) {
const { router } = this.context
const { location } = this.props
this.setState({
selectedNoteKeys
})
router.push({
pathname: location.pathname,
query: {
key: noteKey
}
})
}
getNoteKeyFromTargetIndex (targetIndex) {
const note = Object.assign({}, this.notes[targetIndex])
const noteKey = getNoteKey(note)
return noteKey
}
selectPriorNote () {
if (this.notes == null || this.notes.length === 0) {
return
}
let { router } = this.context
let { location } = this.props
let { selectedNoteKeys, shiftKeyDown } = this.state
let targetIndex = this.getTargetIndex()
@@ -137,14 +181,18 @@ class NoteList extends React.Component {
return
}
targetIndex--
if (targetIndex < 0) targetIndex = 0
router.push({
pathname: location.pathname,
query: {
key: this.notes[targetIndex].storage + '-' + this.notes[targetIndex].key
if (!shiftKeyDown) { selectedNoteKeys = [] }
const priorNoteKey = this.getNoteKeyFromTargetIndex(targetIndex)
if (selectedNoteKeys.includes(priorNoteKey)) {
selectedNoteKeys.pop()
} else {
selectedNoteKeys.push(priorNoteKey)
}
})
this.focusNote(selectedNoteKeys, priorNoteKey)
ee.emit('list:moved')
}
selectNextNote () {
@@ -153,23 +201,31 @@ class NoteList extends React.Component {
}
let { router } = this.context
let { location } = this.props
let { selectedNoteKeys, shiftKeyDown } = this.state
let targetIndex = this.getTargetIndex()
const isTargetLastNote = targetIndex === this.notes.length - 1
if (targetIndex === this.notes.length - 1) {
if (isTargetLastNote && shiftKeyDown) {
return
} else if (isTargetLastNote) {
targetIndex = 0
} else {
targetIndex++
if (targetIndex < 0) targetIndex = 0
else if (targetIndex > this.notes.length - 1) targetIndex === this.notes.length - 1
else if (targetIndex > this.notes.length - 1) targetIndex = this.notes.length - 1
}
router.push({
pathname: location.pathname,
query: {
key: this.notes[targetIndex].storage + '-' + this.notes[targetIndex].key
if (!shiftKeyDown) { selectedNoteKeys = [] }
const nextNoteKey = this.getNoteKeyFromTargetIndex(targetIndex)
if (selectedNoteKeys.includes(nextNoteKey)) {
selectedNoteKeys.pop()
} else {
selectedNoteKeys.push(nextNoteKey)
}
})
this.focusNote(selectedNoteKeys, nextNoteKey)
ee.emit('list:moved')
}
@@ -186,17 +242,17 @@ class NoteList extends React.Component {
if (targetIndex < 0) targetIndex = 0
router.push({
pathname: location.pathname,
query: {
key: this.notes[targetIndex].storage + '-' + this.notes[targetIndex].key
}
})
const selectedNoteKeys = []
const nextNoteKey = this.getNoteKeyFromTargetIndex(targetIndex)
selectedNoteKeys.push(nextNoteKey)
this.focusNote(selectedNoteKeys, nextNoteKey)
ee.emit('list:moved')
}
handleNoteListKeyDown (e) {
const { shiftKeyDown } = this.state
if (e.metaKey || e.ctrlKey) return true
if (e.keyCode === 65 && !e.shiftKey) {
@@ -206,7 +262,7 @@ class NoteList extends React.Component {
if (e.keyCode === 68) {
e.preventDefault()
ee.emit('detail:delete')
this.deleteNote()
}
if (e.keyCode === 69) {
@@ -223,11 +279,20 @@ class NoteList extends React.Component {
e.preventDefault()
this.selectNextNote()
}
if (e.shiftKey) {
this.setState({ shiftKeyDown: true })
}
}
handleNoteListKeyUp (e) {
if (!e.shiftKey) {
this.setState({ shiftKeyDown: false })
}
}
getNotes () {
let { data, params, location } = this.props
let { router } = this.context
const { data, params, location } = this.props
if (location.pathname.match(/\/home/) || location.pathname.match(/\alltags/)) {
const allNotes = data.noteMap.map((note) => note)
@@ -285,16 +350,39 @@ class NoteList extends React.Component {
}
sortByPin (unorderedNotes) {
const pinnedNotes = unorderedNotes.filter((note) => {
return note.isPinned
const pinnedNotes = []
const unpinnedNotes = []
unorderedNotes.forEach((note) => {
if (note.isPinned) {
pinnedNotes.push(note)
} else {
unpinnedNotes.push(note)
}
})
return pinnedNotes.concat(unorderedNotes)
return pinnedNotes.concat(unpinnedNotes)
}
handleNoteClick (e, uniqueKey) {
let { router } = this.context
let { location } = this.props
let { shiftKeyDown, selectedNoteKeys } = this.state
if (shiftKeyDown && selectedNoteKeys.includes(uniqueKey)) {
const newSelectedNoteKeys = selectedNoteKeys.filter((noteKey) => noteKey !== uniqueKey)
this.setState({
selectedNoteKeys: newSelectedNoteKeys
})
return
}
if (!shiftKeyDown) {
selectedNoteKeys = []
}
selectedNoteKeys.push(uniqueKey)
this.setState({
selectedNoteKeys
})
router.push({
pathname: location.pathname,
@@ -305,9 +393,9 @@ class NoteList extends React.Component {
}
handleSortByChange (e) {
let { dispatch } = this.props
const { dispatch } = this.props
let config = {
const config = {
sortBy: e.target.value
}
@@ -319,9 +407,9 @@ class NoteList extends React.Component {
}
handleListStyleButtonClick (e, style) {
let { dispatch } = this.props
const { dispatch } = this.props
let config = {
const config = {
listStyle: style
}
@@ -345,60 +433,129 @@ class NoteList extends React.Component {
}
handleDragStart (e, note) {
const noteData = JSON.stringify(note)
const { selectedNoteKeys } = this.state
const notes = this.notes.map((note) => Object.assign({}, note))
const selectedNotes = findNotesByKeys(notes, selectedNoteKeys)
const noteData = JSON.stringify(selectedNotes)
e.dataTransfer.setData('note', noteData)
this.setState({ selectedNoteKeys: [] })
}
handleNoteContextMenu (e, uniqueKey) {
const { location } = this.props
const targetIndex = this.getTargetIndex()
let note = this.notes[targetIndex]
const label = note.isPinned ? 'Remove pin' : 'Pin to Top'
const { selectedNoteKeys } = this.state
const note = findNoteByKey(this.notes, uniqueKey)
const noteKey = getNoteKey(note)
let menu = new Menu()
if (selectedNoteKeys.length === 0 || !selectedNoteKeys.includes(noteKey)) {
this.handleNoteClick(e, uniqueKey)
}
const pinLabel = note.isPinned ? 'Remove pin' : 'Pin to Top'
const deleteLabel = 'Delete Note'
const menu = new Menu()
if (!location.pathname.match(/\/home|\/starred|\/trash/)) {
menu.append(new MenuItem({
label: label,
click: (e) => this.pinToTop(e, uniqueKey)
label: pinLabel,
click: this.pinToTop
}))
}
menu.append(new MenuItem({
label: 'Delete Note',
click: (e) => this.deleteNote(e, uniqueKey)
label: deleteLabel,
click: this.deleteNote
}))
menu.popup()
}
pinToTop (e, uniqueKey) {
const { data, params } = this.props
const storageKey = params.storageKey
const folderKey = params.folderKey
pinToTop () {
const { selectedNoteKeys } = this.state
const { dispatch } = this.props
const notes = this.notes.map((note) => Object.assign({}, note))
const selectedNotes = findNotesByKeys(notes, selectedNoteKeys)
const currentStorage = data.storageMap.get(storageKey)
const currentFolder = _.find(currentStorage.folders, {key: folderKey})
const targetIndex = this.getTargetIndex()
let note = this.notes[targetIndex]
Promise.all(
selectedNotes.map((note) => {
note.isPinned = !note.isPinned
dataApi
return dataApi
.updateNote(note.storage, note.key, note)
.then((note) => {
store.dispatch({
})
)
.then((updatedNotes) => {
updatedNotes.forEach((note) => {
dispatch({
type: 'UPDATE_NOTE',
note: note
note
})
})
})
this.setState({ selectedNoteKeys: [] })
}
deleteNote (e, uniqueKey) {
this.handleNoteClick(e, uniqueKey)
ee.emit('detail:delete')
deleteNote () {
const { dispatch } = this.props
const { selectedNoteKeys } = this.state
const notes = this.notes.map((note) => Object.assign({}, note))
const selectedNotes = findNotesByKeys(notes, selectedNoteKeys)
const firstNote = selectedNotes[0]
if (firstNote.isTrashed) {
const noteExp = selectedNotes.length > 1 ? 'notes' : 'note'
const dialogueButtonIndex = dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: 'Confirm note deletion',
detail: `This will permanently remove ${selectedNotes.length} ${noteExp}.`,
buttons: ['Confirm', 'Cancel']
})
if (dialogueButtonIndex === 1) return
Promise.all(
selectedNoteKeys.map((uniqueKey) => {
const storageKey = uniqueKey.split('-')[0]
const noteKey = uniqueKey.split('-')[1]
return dataApi
.deleteNote(storageKey, noteKey)
})
)
.then((data) => {
data.forEach((item) => {
dispatch({
type: 'DELETE_NOTE',
storageKey: item.storageKey,
noteKey: item.noteKey
})
})
})
.catch((err) => {
console.error('Cannot Delete note: ' + err)
})
console.log('Notes were all deleted')
} else {
Promise.all(
selectedNotes.map((note) => {
note.isTrashed = true
return dataApi
.updateNote(note.storage, note.key, note)
})
)
.then((newNotes) => {
newNotes.forEach((newNote) => {
dispatch({
type: 'UPDATE_NOTE',
note: newNote
})
})
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('EDIT_NOTE')
console.log('Notes went to trash')
})
.catch((err) => {
console.error('Notes could not go to trash: ' + err)
})
}
this.setState({ selectedNoteKeys: [] })
}
importFromFile () {
const { dispatch, location } = this.props
const options = {
filters: [
{ name: 'Documents', extensions: ['md', 'txt'] }
@@ -421,11 +578,7 @@ class NoteList extends React.Component {
// Add notes to the current folder
addNotesFromFiles (filepaths) {
const { dispatch, location } = this.props
const targetIndex = this.getTargetIndex()
const storageKey = this.notes[targetIndex].storage
const folderKey = this.notes[targetIndex].folder
const { storage, folder } = this.resolveTargetFolder()
if (filepaths === undefined) return
filepaths.forEach((filepath) => {
@@ -434,11 +587,11 @@ class NoteList extends React.Component {
const content = data.toString()
const newNote = {
content: content,
folder: folderKey,
folder: folder.key,
title: markdown.strip(findNoteTitle(content)),
type: 'MARKDOWN_NOTE'
}
dataApi.createNote(storageKey, newNote)
dataApi.createNote(storage.key, newNote)
.then((note) => {
dispatch({
type: 'UPDATE_NOTE',
@@ -446,7 +599,7 @@ class NoteList extends React.Component {
})
hashHistory.push({
pathname: location.pathname,
query: {key: `${note.storage}-${note.key}`}
query: {key: getNoteKey(note)}
})
})
})
@@ -456,13 +609,44 @@ class NoteList extends React.Component {
getTargetIndex () {
const { location } = this.props
const targetIndex = _.findIndex(this.notes, (note) => {
return `${note.storage}-${note.key}` === location.query.key
return getNoteKey(note) === location.query.key
})
return targetIndex
}
resolveTargetFolder () {
const { data, params } = this.props
let storage = data.storageMap.get(params.storageKey)
// Find first storage
if (storage == null) {
for (const kv of data.storageMap) {
storage = kv[1]
break
}
}
if (storage == null) this.showMessageBox('No storage for importing note(s)')
const folder = _.find(storage.folders, {key: params.folderKey}) || storage.folders[0]
if (folder == null) this.showMessageBox('No folder for importing note(s)')
return {
storage,
folder
}
}
showMessageBox (message) {
dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: message,
buttons: ['OK']
})
}
render () {
let { location, notes, config, dispatch } = this.props
let { selectedNoteKeys } = this.state
let sortFunc = config.sortBy === 'CREATED_AT'
? sortByCreatedAt
: config.sortBy === 'ALPHABETICAL'
@@ -476,18 +660,38 @@ class NoteList extends React.Component {
if (note.isTrashed !== true || location.pathname === '/trashed') return true
})
let noteList = notes
moment.locale('en', {
relativeTime: {
future: 'in %s',
past: '%s ago',
s: '%ds',
ss: '%ss',
m: '1m',
mm: '%dm',
h: 'an hour',
hh: '%dh',
d: '1d',
dd: '%dd',
M: '1M',
MM: '%dM',
y: '1Y',
yy: '%dY'
}
})
const noteList = notes
.map(note => {
if (note == null) {
return null
}
const isDefault = config.listStyle === 'DEFAULT'
const isActive = location.query.key === note.storage + '-' + note.key
const uniqueKey = getNoteKey(note)
const isActive = selectedNoteKeys.includes(uniqueKey)
const dateDisplay = moment(
config.sortBy === 'CREATED_AT'
? note.createdAt : note.updatedAt
).fromNow()
).fromNow('D')
const key = `${note.storage}-${note.key}`
if (isDefault) {
@@ -496,7 +700,7 @@ class NoteList extends React.Component {
isActive={isActive}
note={note}
dateDisplay={dateDisplay}
key={key}
key={uniqueKey}
handleNoteContextMenu={this.handleNoteContextMenu.bind(this)}
handleNoteClick={this.handleNoteClick.bind(this)}
handleDragStart={this.handleDragStart.bind(this)}
@@ -509,7 +713,8 @@ class NoteList extends React.Component {
<NoteItemSimple
isActive={isActive}
note={note}
key={key}
key={uniqueKey}
handleNoteContextMenu={this.handleNoteContextMenu.bind(this)}
handleNoteClick={this.handleNoteClick.bind(this)}
handleDragStart={this.handleDragStart.bind(this)}
/>
@@ -541,7 +746,7 @@ class NoteList extends React.Component {
}
onClick={(e) => this.handleListStyleButtonClick(e, 'DEFAULT')}
>
<i className='fa fa-th-large' />
<img styleName='iconTag' src='../resources/icon/icon-column.svg' />
</button>
<button styleName={config.listStyle === 'SMALL'
? 'control-button--active'
@@ -549,7 +754,7 @@ class NoteList extends React.Component {
}
onClick={(e) => this.handleListStyleButtonClick(e, 'SMALL')}
>
<i className='fa fa-list-ul' />
<img styleName='iconTag' src='../resources/icon/icon-column-list.svg' />
</button>
</div>
</div>
@@ -557,6 +762,7 @@ class NoteList extends React.Component {
ref='list'
tabIndex='-1'
onKeyDown={(e) => this.handleNoteListKeyDown(e)}
onKeyUp={this.handleNoteListKeyUp}
>
{noteList}
</div>

View File

@@ -1,7 +1,7 @@
.root
absolute top left bottom
width $sideNav-width
background-color #f9f9f9
background-color #2E3235
user-select none
color $ui-text-color
height: 100vh
@@ -11,42 +11,41 @@
.top
padding-bottom 15px
.top-menu
.top-menu-preference
navButtonColor()
position absolute
top 22px
right 5px
height 23px
right 10px
width 2em
background-color transparent
&:hover
color $ui-text-color
color $ui-button-default--active-backgroundColor
background-color transparent
&:active, &:active:hover
color $ui-text-color
background-color alpha($ui-button--active-backgroundColor, 20%)
color $ui-button-default--active-backgroundColor
.switch-buttons
background-color transparent
border 1px solid $ui-borderColor
width 110px
height 25px
margin 20px auto 0px auto
border-radius 1px
border 0
margin 24px auto 4px 14px
display flex
text-align center
.non-active-button
navButtonColor()
font-weight 600
width 54px
height 23px
color $ui-inactive-text-color
font-size 16px
border 0
background-color transparent
transition 0.2s
display flex
text-align center
margin-right 4px;
&:hover
color alpha(#239F86, 60%)
.active-button
@extend .non-active-button
background-color $ui-button--active-backgroundColor
color $ui-text-color
&:hover
background-color alpha($ui-button--active-backgroundColor, 70%)
color alpha($ui-text-color, 70%)
&:active, &:active:hover
background-color $ui-button--active-backgroundColor
color $ui-button-default--active-backgroundColor
.top-menu-label
margin-left 5px
@@ -62,7 +61,7 @@
padding-left 15px
padding-bottom 13px
p
color $ui-text-color
color $ui-button-default-color
.tagList
overflow-y auto
@@ -71,6 +70,7 @@
.root--folded
height 100vh
width $sideNav--folded-width
background-color #2E3235
.switch-buttons
display none
.top
@@ -93,14 +93,48 @@
opacity 0
margin-left 0
overflow hidden
background-color $ui-tooltip-backgroundColor
z-index 10
color white
line-height 30px
border-top-right-radius 2px
border-bottom-right-radius 2px
pointer-events none
font-size 12px
font-size 13px
.top-menu-preference
position absolute
left 7px
body[data-theme="white"]
.root, .root--folded
background-color #f9f9f9
color $ui-text-color
.top-menu-preference
navWhiteButtonColor()
background-color transparent
&:hover
color #0B99F1
background-color transparent
&:active, &:active:hover
color #0B99F1
background-color transparent
.non-active-button
color $ui-inactive-text-color
&:hover
color alpha(#0B99F1, 60%)
.tag-title
p
color $ui-text-color
.non-active-button
&:hover
color alpha(#0B99F1, 60%)
.active-button
@extend .non-active-button
color #0B99F1
body[data-theme="dark"]
.root, .root--folded
@@ -111,32 +145,20 @@ body[data-theme="dark"]
.top
border-color $ui-dark-borderColor
.top-menu
.top-menu-preference
navDarkButtonColor()
background-color transparent
&:active
background-color alpha($ui-dark-button--active-backgroundColor, 20%)
background-color transparent
&:hover
background-color alpha($ui-dark-button--active-backgroundColor, 20%)
.switch-buttons
border-color $ui-dark-borderColor
background-color transparent
.non-active-button
navDarkButtonColor()
.active-button
@extend .non-active-button
background-color $ui-dark-button--active-backgroundColor
color $ui-dark-text-color
color alpha($ui-dark-text-color, 60%)
&:hover
background-color alpha($ui-dark-button--active-backgroundColor, 70%)
color alpha($ui-dark-text-color, 70%)
&:active
color $ui-dark-text-color
background-color alpha($ui-dark-button--active-backgroundColor, 60%)
&:active, &:active:hover
color $ui-dark-text-color
background-color $ui-dark-button--active-backgroundColor
color alpha(#0B99F1, 60%)
.tag-title
p

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './StorageItem.styl'
import { hashHistory } from 'react-router'
@@ -8,6 +9,7 @@ import RenameFolderModal from 'browser/main/modals/RenameFolderModal'
import dataApi from 'browser/main/lib/dataApi'
import StorageItemChild from 'browser/components/StorageItem'
import eventEmitter from 'browser/main/lib/eventEmitter'
import _ from 'lodash'
const { remote } = require('electron')
const { Menu, MenuItem, dialog } = remote
@@ -22,7 +24,7 @@ class StorageItem extends React.Component {
}
handleHeaderContextMenu (e) {
let menu = new Menu()
const menu = new Menu()
menu.append(new MenuItem({
label: 'Add Folder',
click: (e) => this.handleAddFolderButtonClick(e)
@@ -38,7 +40,7 @@ class StorageItem extends React.Component {
}
handleUnlinkStorageClick (e) {
let index = dialog.showMessageBox(remote.getCurrentWindow(), {
const index = dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: 'Unlink Storage',
detail: 'This work will just detatches a storage from Boostnote. (Any data won\'t be deleted.)',
@@ -46,7 +48,7 @@ class StorageItem extends React.Component {
})
if (index === 0) {
let { storage, dispatch } = this.props
const { storage, dispatch } = this.props
dataApi.removeStorage(storage.key)
.then(() => {
dispatch({
@@ -67,7 +69,7 @@ class StorageItem extends React.Component {
}
handleAddFolderButtonClick (e) {
let { storage } = this.props
const { storage } = this.props
modal.open(CreateFolderModal, {
storage
@@ -75,19 +77,19 @@ class StorageItem extends React.Component {
}
handleHeaderInfoClick (e) {
let { storage } = this.props
const { storage } = this.props
hashHistory.push('/storages/' + storage.key)
}
handleFolderButtonClick (folderKey) {
return (e) => {
let { storage } = this.props
const { storage } = this.props
hashHistory.push('/storages/' + storage.key + '/folders/' + folderKey)
}
}
handleFolderButtonContextMenu (e, folder) {
let menu = new Menu()
const menu = new Menu()
menu.append(new MenuItem({
label: 'Rename Folder',
click: (e) => this.handleRenameFolderClick(e, folder)
@@ -103,7 +105,7 @@ class StorageItem extends React.Component {
}
handleRenameFolderClick (e, folder) {
let { storage } = this.props
const { storage } = this.props
modal.open(RenameFolderModal, {
storage,
folder
@@ -111,7 +113,7 @@ class StorageItem extends React.Component {
}
handleFolderDeleteClick (e, folder) {
let index = dialog.showMessageBox(remote.getCurrentWindow(), {
const index = dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: 'Delete Folder',
detail: 'This will delete all notes in the folder and can not be undone.',
@@ -119,7 +121,7 @@ class StorageItem extends React.Component {
})
if (index === 0) {
let { storage, dispatch } = this.props
const { storage, dispatch } = this.props
dataApi
.deleteFolder(storage.key, folder.key)
.then((data) => {
@@ -142,48 +144,57 @@ class StorageItem extends React.Component {
e.target.style.backgroundColor = e.dataTransfer.getData('defaultColor')
}
handleDrop (e, storage, folder, dispatch, location) {
e.target.style.opacity = '1'
e.target.style.backgroundColor = e.dataTransfer.getData('defaultColor')
const noteData = JSON.parse(e.dataTransfer.getData('note'))
const newNoteData = Object.assign({}, noteData, {storage: storage, folder: folder.key})
if (folder.key === noteData.folder) return
dataApi
.createNote(storage.key, newNoteData)
.then((note) => {
dataApi
.deleteNote(noteData.storage, noteData.key)
.then((data) => {
let dispatchHandler = () => {
dispatch({
type: 'DELETE_NOTE',
storageKey: data.storageKey,
noteKey: data.noteKey
})
}
eventEmitter.once('list:moved', dispatchHandler)
eventEmitter.emit('list:next')
})
.catch((err) => {
console.error(err)
})
dropNote (storage, folder, dispatch, location, noteData) {
noteData = noteData.filter((note) => folder.key !== note.folder)
if (noteData.length === 0) return
const newNoteData = noteData.map((note) => Object.assign({}, note, {storage: storage, folder: folder.key}))
Promise.all(
newNoteData.map((note) => dataApi.createNote(storage.key, note))
)
.then((createdNoteData) => {
createdNoteData.forEach((note) => {
dispatch({
type: 'UPDATE_NOTE',
note: note
})
hashHistory.push({
pathname: location.pathname,
query: {key: `${note.storage}-${note.key}`}
})
})
.catch((err) => {
console.error(`error on create notes: ${err}`)
})
.then(() => {
return Promise.all(
noteData.map((note) => dataApi.deleteNote(note.storage, note.key))
)
})
.then((deletedNoteData) => {
deletedNoteData.forEach((note) => {
dispatch({
type: 'DELETE_NOTE',
storageKey: note.storageKey,
noteKey: note.noteKey
})
})
})
.catch((err) => {
console.error(`error on delete notes: ${err}`)
})
}
handleDrop (e, storage, folder, dispatch, location) {
e.target.style.opacity = '1'
e.target.style.backgroundColor = e.dataTransfer.getData('defaultColor')
const noteData = JSON.parse(e.dataTransfer.getData('note'))
this.dropNote(storage, folder, dispatch, location, noteData)
}
render () {
let { storage, location, isFolded, data, dispatch } = this.props
let { folderNoteMap, trashedSet } = data
let folderList = storage.folders.map((folder) => {
let isActive = !!(location.pathname.match(new RegExp('\/storages\/' + storage.key + '\/folders\/' + folder.key)))
let noteSet = folderNoteMap.get(storage.key + '-' + folder.key)
const { storage, location, isFolded, data, dispatch } = this.props
const { folderNoteMap, trashedSet } = data
const folderList = storage.folders.map((folder) => {
const isActive = !!(location.pathname.match(new RegExp('\/storages\/' + storage.key + '\/folders\/' + folder.key)))
const noteSet = folderNoteMap.get(storage.key + '-' + folder.key)
let noteCount = 0
if (noteSet) {
@@ -211,7 +222,7 @@ class StorageItem extends React.Component {
)
})
let isActive = location.pathname.match(new RegExp('\/storages\/' + storage.key + '$'))
const isActive = location.pathname.match(new RegExp('\/storages\/' + storage.key + '$'))
return (
<div styleName={isFolded ? 'root--folded' : 'root'}
@@ -226,9 +237,9 @@ class StorageItem extends React.Component {
<button styleName='header-toggleButton'
onMouseDown={(e) => this.handleToggleButtonClick(e)}
>
<i className={this.state.isOpen
? 'fa fa-caret-down'
: 'fa fa-caret-right'
<img src={this.state.isOpen
? '../resources/icon/icon-down.svg'
: '../resources/icon/icon-right.svg'
}
/>
</button>
@@ -237,7 +248,7 @@ class StorageItem extends React.Component {
<button styleName='header-addFolderButton'
onClick={(e) => this.handleAddFolderButtonClick(e)}
>
<i className='fa fa-plus' />
<img styleName='iconTag' src='../resources/icon/icon-plus.svg' />
</button>
}
@@ -245,7 +256,7 @@ class StorageItem extends React.Component {
onClick={(e) => this.handleHeaderInfoClick(e)}
>
<span styleName='header-info-name'>
{isFolded ? storage.name.substring(0, 1) : storage.name}
{isFolded ? _.truncate(storage.name, {length: 1, omission: ''}) : storage.name}
</span>
{isFolded &&
<span styleName='header-info--folded-tooltip'>

View File

@@ -5,27 +5,23 @@
.header
position relative
height 25px
height 36px
width 100%
margin-bottom 5px
transition 0.15s
display flex
align-items center
.header--active
margin-bottom 5px
background-color $ui-button--active-backgroundColor
background-color alpha($ui-button-default--active-backgroundColor, 20%)
transition color background-color 0.15s
.header--active
display flex
align-items center
.header-toggleButton
color $ui-text-color
.header--active
.header-info
color $ui-text-color
.header--active
.header-addFolderButton
color $ui-text-color
color #1EC38B
.header-toggleButton
navButtonColor()
@@ -38,23 +34,31 @@
border-radius 50%
&:hover
transition 0.2s
background-color alpha($ui-button--active-backgroundColor, 40%)
background-color alpha($ui-button-default--hover-backgroundColor, 40%)
color $ui-text-color
.header-info
navButtonColor()
display block
width 100%
height 25px
padding-left 23px
padding-right 10px
height 36px
padding-left 25px
padding-right 15px
line-height 22px
cursor pointer
font-size 13px
font-size 14px
border none
overflow ellipsis
text-align left
background-color alpha($ui-button--active-backgroundColor, 20%)
font-weight 600;
background-color transparent
&:hover
color #1EC38B
background-color alpha($ui-button-default--active-backgroundColor, 20%)
transition background-color 0.15s
&:active, &:active:hover
color #1EC38B
background-color alpha($ui-button-default--active-backgroundColor, 20%)
.header-info-path
font-size 10px
@@ -63,22 +67,20 @@
.header-addFolderButton
navButtonColor()
position absolute
right 0
right 7px
width 25px
height 25px
padding 0
border none
margin-right 5px
border-radius 50%
&:hover
transition 0.2s
background-color alpha($ui-button--active-backgroundColor, 40%)
color $ui-text-color
.root--folded
@extend .root
.header
width 100%
padding-left 5px
.header-info
overflow ellipsis
padding 0 0 0 18px
@@ -88,6 +90,7 @@
display none
.header-toggleButton
width 15px
padding-left 9px
.header-info--folded-tooltip
tooltip()
position fixed
@@ -102,6 +105,33 @@
font-size 10px
margin 0 5px
body[data-theme="white"]
.header--active
background-color $ui-button--active-backgroundColor
transition color background-color 0.15s
.header-toggleButton
color $ui-text-color
.header-info
color $ui-text-color
.header-addFolderButton
color $ui-text-color
.header-toggleButton
navWhiteButtonColor()
&:hover
background-color alpha($ui-button--active-backgroundColor, 40%)
color $ui-text-color
.header-info
navWhiteButtonColor()
background-color alpha($ui-button--active-backgroundColor, 20%)
.header-addFolderButton
navWhiteButtonColor()
&:hover
background-color alpha($ui-button--active-backgroundColor, 40%)
color $ui-text-color
body[data-theme="dark"]
.header--active
background-color $ui-dark-button--active-backgroundColor

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './SideNav.styl'
import { openModal } from 'browser/main/lib/modal'
@@ -9,25 +10,35 @@ import TagListItem from 'browser/components/TagListItem'
import SideNavFilter from 'browser/components/SideNavFilter'
import StorageList from 'browser/components/StorageList'
import NavToggleButton from 'browser/components/NavToggleButton'
import EventEmitter from 'browser/main/lib/eventEmitter'
class SideNav extends React.Component {
// TODO: should not use electron stuff v0.7
componentDidMount () {
EventEmitter.on('side:preferences', this.handleMenuButtonClick)
}
componentWillUnmount () {
EventEmitter.off('side:preferences', this.handleMenuButtonClick)
}
handleMenuButtonClick (e) {
openModal(PreferencesModal)
}
handleHomeButtonClick (e) {
let { router } = this.context
const { router } = this.context
router.push('/home')
}
handleStarredButtonClick (e) {
let { router } = this.context
const { router } = this.context
router.push('/starred')
}
handleToggleButtonClick (e) {
let { dispatch, config } = this.props
const { dispatch, config } = this.props
ConfigManager.set({isSideNavFolded: !config.isSideNavFolded})
dispatch({
@@ -37,7 +48,7 @@ class SideNav extends React.Component {
}
handleTrashedButtonClick (e) {
let { router } = this.context
const { router } = this.context
router.push('/trashed')
}
@@ -52,7 +63,7 @@ class SideNav extends React.Component {
}
SideNavComponent (isFolded, storageList) {
let { location, data } = this.props
const { location, data } = this.props
const isHomeActive = !!location.pathname.match(/^\/home$/)
const isStarredActive = !!location.pathname.match(/^\/starred$/)
@@ -72,6 +83,9 @@ class SideNav extends React.Component {
isTrashedActive={isTrashedActive}
handleStarredButtonClick={(e) => this.handleStarredButtonClick(e)}
handleTrashedButtonClick={(e) => this.handleTrashedButtonClick(e)}
counterTotalNote={data.noteMap._map.size}
counterStarredNote={data.starredSet._set.size}
counterDelNote={data.trashedSet._set.size}
/>
<StorageList storageList={storageList} />
@@ -96,7 +110,7 @@ class SideNav extends React.Component {
tagListComponent () {
const { data, location } = this.props
let tagList = data.tagNoteMap.map((tag, key) => {
const tagList = data.tagNoteMap.map((tag, key) => {
return key
})
return (
@@ -104,24 +118,30 @@ class SideNav extends React.Component {
<TagListItem
name={tag}
handleClickTagListItem={this.handleClickTagListItem.bind(this)}
isActive={!!location.pathname.match(tag)}
isActive={this.getTagActive(location.pathname, tag)}
key={tag}
/>
))
)
}
getTagActive (path, tag) {
const pathSegments = path.split('/')
const pathTag = pathSegments[pathSegments.length - 1]
return pathTag === tag
}
handleClickTagListItem (name) {
const { router } = this.context
router.push(`/tags/${name}`)
}
render () {
let { data, location, config, dispatch } = this.props
const { data, location, config, dispatch } = this.props
let isFolded = config.isSideNavFolded
const isFolded = config.isSideNavFolded
let storageList = data.storageMap.map((storage, key) => {
const storageList = data.storageMap.map((storage, key) => {
return <StorageItem
key={storage.key}
storage={storage}
@@ -131,7 +151,7 @@ class SideNav extends React.Component {
dispatch={dispatch}
/>
})
let style = {}
const style = {}
if (!isFolded) style.width = this.props.width
const isTagActive = location.pathname.match(/tag/)
return (
@@ -142,15 +162,26 @@ class SideNav extends React.Component {
>
<div styleName='top'>
<div styleName='switch-buttons'>
<button styleName={isTagActive ? 'non-active-button' : 'active-button'} onClick={this.handleSwitchFoldersButtonClick.bind(this)}>Folders</button>
<button styleName={isTagActive ? 'active-button' : 'non-active-button'} onClick={this.handleSwitchTagsButtonClick.bind(this)}>Tags</button>
<button styleName={isTagActive ? 'non-active-button' : 'active-button'} onClick={this.handleSwitchFoldersButtonClick.bind(this)}>
<img src={isTagActive
? '../resources/icon/icon-list.svg'
: '../resources/icon/icon-list-active.svg'
}
/>
</button>
<button styleName={isTagActive ? 'active-button' : 'non-active-button'} onClick={this.handleSwitchTagsButtonClick.bind(this)}>
<img src={isTagActive
? '../resources/icon/icon-tag-active.svg'
: '../resources/icon/icon-tag.svg'
}
/>
</button>
</div>
<div>
<button styleName='top-menu'
<button styleName='top-menu-preference'
onClick={(e) => this.handleMenuButtonClick(e)}
>
<i className='fa fa-wrench fa-fw' />
<span styleName='top-menu-label'>Preferences</span>
<img styleName='iconTag' src='../resources/icon/icon-setting.svg' />
</button>
</div>
</div>

View File

@@ -1,11 +1,10 @@
@import('../Detail/DetailVars')
.root
absolute bottom left right
height $statusBar-height
bottom 16px
position absolute
bottom 10px
right 10px
z-index 100
background-color $ui-noteDetail-backgroundColor
display flex
.blank
@@ -23,7 +22,18 @@
.zoom
navButtonColor()
height 24px
color rgba(0,0,0,.54)
height 20px
display flex
padding 0
align-items center
background-color transparent
&:hover
color $ui-active-color
&:active
color $ui-active-color
span
margin-left 5px
.update
navButtonColor()
@@ -39,14 +49,14 @@
body[data-theme="dark"]
.root
background-color $ui-dark-noteDetail-backgroundColor
border-color $ui-dark-borderColor
box-shadow none
.zoom
border-color $ui-dark-borderColor
background-color transparent
color #f9f9f9
&:hover
background-color alpha($ui-dark-button--active-backgroundColor, 20%)
transition 0.15s
color $ui-dark-text-color

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './StatusBar.styl'
import ZoomManager from 'browser/main/lib/ZoomManager'
@@ -11,7 +12,7 @@ const zoomOptions = [0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2
class StatusBar extends React.Component {
updateApp () {
let index = dialog.showMessageBox(remote.getCurrentWindow(), {
const index = dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: 'Update Boostnote',
detail: 'New Boostnote is ready to be installed.',
@@ -24,7 +25,7 @@ class StatusBar extends React.Component {
}
handleZoomButtonClick (e) {
let menu = new Menu()
const menu = new Menu()
zoomOptions.forEach((zoom) => {
menu.append(new MenuItem({
@@ -37,7 +38,7 @@ class StatusBar extends React.Component {
}
handleZoomMenuItemClick (zoomFactor) {
let { dispatch } = this.props
const { dispatch } = this.props
ZoomManager.setZoom(zoomFactor)
dispatch({
type: 'SET_ZOOM',
@@ -46,7 +47,7 @@ class StatusBar extends React.Component {
}
render () {
let { config, status } = this.context
const { config, status } = this.context
return (
<div className='StatusBar'
@@ -55,8 +56,8 @@ class StatusBar extends React.Component {
<button styleName='zoom'
onClick={(e) => this.handleZoomButtonClick(e)}
>
<i className='fa fa-search-plus' />&nbsp;
{Math.floor(config.zoom * 100)}%
<img src='../resources/icon/icon-zoom.svg' />
<span>{Math.floor(config.zoom * 100)}%</span>
</button>
{status.updateReady

View File

@@ -36,7 +36,7 @@ $control-height = 34px
outline none
border none
color $ui-text-color
font-size 16px
font-size 18px
padding-bottom 2px
background-color $ui-noteList-backgroundColor
@@ -112,6 +112,21 @@ $control-height = 34px
opacity 0
transition 0.1s
body[data-theme="white"]
.root, .root--expanded
background-color $ui-white-noteList-backgroundColor
.control
border-color $ui-dark-borderColor
.control-search
background-color $ui-white-noteList-backgroundColor
.control-search-input
background-color $ui-white-noteList-backgroundColor
input
background-color $ui-white-noteList-backgroundColor
body[data-theme="dark"]
.root, .root--expanded
background-color $ui-dark-noteList-backgroundColor

View File

@@ -1,16 +1,11 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './TopBar.styl'
import _ from 'lodash'
import NewNoteModal from 'browser/main/modals/NewNoteModal'
import ee from 'browser/main/lib/eventEmitter'
import NewNoteButton from 'browser/main/NewNoteButton'
const { remote } = require('electron')
const { dialog } = remote
const OSX = window.process.platform === 'darwin'
class TopBar extends React.Component {
constructor (props) {
super(props)
@@ -121,7 +116,7 @@ class TopBar extends React.Component {
}
render () {
let { config, style, data, location } = this.props
const { config, style, location } = this.props
return (
<div className='TopBar'
styleName={config.isSideNavFolded ? 'root--expanded' : 'root'}

View File

@@ -12,6 +12,7 @@ body
color textColor
font-size fontSize
font-weight 200
-webkit-font-smoothing antialiased
button, input, select, textarea
font-family DEFAULT_FONTS

View File

@@ -36,7 +36,7 @@ document.addEventListener('click', function (e) {
if (infoPanel) infoPanel.style.display = 'none'
})
let el = document.getElementById('content')
const el = document.getElementById('content')
const history = syncHistoryWithStore(hashHistory, store)
function notify (...args) {
@@ -44,7 +44,7 @@ function notify (...args) {
}
function updateApp () {
let index = dialog.showMessageBox(remote.getCurrentWindow(), {
const index = dialog.showMessageBox(remote.getCurrentWindow(), {
type: 'warning',
message: 'Update Boostnote',
detail: 'New Boostnote is ready to be installed.',
@@ -81,7 +81,7 @@ ReactDOM.render((
</Router>
</Provider>
), el, function () {
let loadingCover = document.getElementById('loadingCover')
const loadingCover = document.getElementById('loadingCover')
loadingCover.parentNode.removeChild(loadingCover)
ipcRenderer.on('update-ready', function () {

View File

@@ -4,6 +4,7 @@ const ConfigManager = require('browser/main/lib/ConfigManager')
const remote = require('electron').remote
const os = require('os')
let mobileAnalyticsClient
AWS.config.region = 'us-east-1'
if (process.env.NODE_ENV === 'production' && ConfigManager.default.get().amaEnabled) {
@@ -13,7 +14,7 @@ if (process.env.NODE_ENV === 'production' && ConfigManager.default.get().amaEnab
const validPlatformName = convertPlatformName(os.platform())
const mobileAnalyticsClient = new AMA.Manager({
mobileAnalyticsClient = new AMA.Manager({
appId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
appTitle: 'xxxxxxxxxx',
appVersionName: remote.app.getVersion().toString(),

View File

@@ -13,10 +13,10 @@ function release (el) {
function fire (command) {
console.info('COMMAND >>', command)
let splitted = command.split(':')
let target = splitted[0]
let targetCommand = splitted[1]
let targetCallees = callees
const splitted = command.split(':')
const target = splitted[0]
const targetCommand = splitted[1]
const targetCallees = callees
.filter((callee) => callee.name === target)
targetCallees.forEach((callee) => {

View File

@@ -6,8 +6,6 @@ const win = global.process.platform === 'win32'
const electron = require('electron')
const { ipcRenderer } = electron
const consts = require('browser/lib/consts')
const path = require('path')
const fs = require('fs')
let isInitialized = false
@@ -91,21 +89,27 @@ function get () {
: 'default'
if (config.editor.theme !== 'default') {
if (config.editor.theme.startsWith('solarized')) {
editorTheme.setAttribute('href', '../node_modules/codemirror/theme/solarized.css')
} else {
editorTheme.setAttribute('href', '../node_modules/codemirror/theme/' + config.editor.theme + '.css')
}
}
}
return config
}
function set (updates) {
let currentConfig = get()
let newConfig = Object.assign({}, DEFAULT_CONFIG, currentConfig, updates)
const currentConfig = get()
const newConfig = Object.assign({}, DEFAULT_CONFIG, currentConfig, updates)
if (!validate(newConfig)) throw new Error('INVALID CONFIG')
_save(newConfig)
if (newConfig.ui.theme === 'dark') {
document.body.setAttribute('data-theme', 'dark')
} else if (newConfig.ui.theme === 'white') {
document.body.setAttribute('data-theme', 'white')
} else {
document.body.setAttribute('data-theme', 'default')
}
@@ -117,13 +121,17 @@ function set (updates) {
editorTheme.setAttribute('rel', 'stylesheet')
document.head.appendChild(editorTheme)
}
let newTheme = consts.THEMES.some((theme) => theme === newConfig.editor.theme)
const newTheme = consts.THEMES.some((theme) => theme === newConfig.editor.theme)
? newConfig.editor.theme
: 'default'
if (newTheme !== 'default') {
if (newTheme.startsWith('solarized')) {
editorTheme.setAttribute('href', '../node_modules/codemirror/theme/solarized.css')
} else {
editorTheme.setAttribute('href', '../node_modules/codemirror/theme/' + newTheme + '.css')
}
}
ipcRenderer.send('config-renew', {
config: get()
@@ -131,7 +139,7 @@ function set (updates) {
}
function assignConfigValues (originalConfig, rcConfig) {
let config = Object.assign({}, DEFAULT_CONFIG, originalConfig, rcConfig)
const config = Object.assign({}, DEFAULT_CONFIG, originalConfig, rcConfig)
config.hotkey = Object.assign({}, DEFAULT_CONFIG.hotkey, originalConfig.hotkey, rcConfig.hotkey)
config.ui = Object.assign({}, DEFAULT_CONFIG.ui, originalConfig.ui, rcConfig.ui)
config.editor = Object.assign({}, DEFAULT_CONFIG.editor, originalConfig.editor, rcConfig.editor)

View File

@@ -19,7 +19,7 @@ function setZoom (zoomFactor, noSave = false) {
}
function getZoom () {
let config = ConfigManager.get()
const config = ConfigManager.get()
return config.zoom
}

View File

@@ -1,7 +1,5 @@
const fs = require('fs')
const path = require('path')
const _ = require('lodash')
const sander = require('sander')
const { findStorage } = require('browser/lib/findStorage')
/**

View File

@@ -23,7 +23,6 @@ const { findStorage } = require('browser/lib/findStorage')
* ```
*/
function createFolder (storageKey, input) {
let rawStorages
let targetStorage
try {
if (input == null) throw new Error('No input found.')
@@ -41,7 +40,7 @@ function createFolder (storageKey, input) {
while (storage.folders.some((folder) => folder.key === key)) {
key = keygen()
}
let newFolder = {
const newFolder = {
key,
color: input.color,
name: input.name

View File

@@ -66,7 +66,7 @@ function createNote (storageKey, input) {
}
}
}
let noteData = Object.assign({}, input, {
const noteData = Object.assign({}, input, {
key,
createdAt: new Date(),
updatedAt: new Date(),

View File

@@ -19,7 +19,6 @@ const { findStorage } = require('browser/lib/findStorage')
* ```
*/
function deleteFolder (storageKey, folderKey) {
let rawStorages
let targetStorage
try {
targetStorage = findStorage(storageKey)
@@ -38,17 +37,17 @@ function deleteFolder (storageKey, folderKey) {
})
})
.then(function deleteFolderAndNotes (data) {
let { storage, notes } = data
const { storage, notes } = data
storage.folders = storage.folders
.filter(function excludeTargetFolder (folder) {
return folder.key !== folderKey
})
let targetNotes = notes.filter(function filterTargetNotes (note) {
const targetNotes = notes.filter(function filterTargetNotes (note) {
return note.folder === folderKey
})
let deleteAllNotes = targetNotes
const deleteAllNotes = targetNotes
.map(function deleteNote (note) {
const notePath = path.join(storage.path, 'notes', note.key + '.cson')
return sander.unlink(notePath)

View File

@@ -1,5 +1,4 @@
const resolveStorageData = require('./resolveStorageData')
const _ = require('lodash')
const path = require('path')
const sander = require('sander')
const { findStorage } = require('browser/lib/findStorage')
@@ -14,7 +13,7 @@ function deleteNote (storageKey, noteKey) {
return resolveStorageData(targetStorage)
.then(function deleteNoteFile (storage) {
let notePath = path.join(storage.path, 'notes', noteKey + '.cson')
const notePath = path.join(storage.path, 'notes', noteKey + '.cson')
try {
sander.unlinkSync(notePath)

View File

@@ -20,7 +20,7 @@ const CSON = require('@rokt33r/season')
* 3. empty directory
*/
function init () {
let fetchStorages = function () {
const fetchStorages = function () {
let rawStorages
try {
rawStorages = JSON.parse(window.localStorage.getItem('storages'))
@@ -34,8 +34,8 @@ function init () {
.map(resolveStorageData))
}
let fetchNotes = function (storages) {
let findNotesFromEachStorage = storages
const fetchNotes = function (storages) {
const findNotesFromEachStorage = storages
.map((storage) => {
return resolveStorageNotes(storage)
.then((notes) => {

View File

@@ -9,7 +9,7 @@ const sander = require('sander')
function migrateFromV5Storage (storageKey, data) {
let targetStorage
try {
let cachedStorageList = JSON.parse(localStorage.getItem('storages'))
const cachedStorageList = JSON.parse(localStorage.getItem('storages'))
if (!_.isArray(cachedStorageList)) throw new Error('Target storage doesn\'t exist.')
targetStorage = _.find(cachedStorageList, {key: storageKey})
@@ -24,15 +24,15 @@ function migrateFromV5Storage (storageKey, data) {
}
function importAll (storage, data) {
let oldArticles = data.articles
let notes = []
const oldArticles = data.articles
const notes = []
data.folders
.forEach(function (oldFolder) {
let folderKey = keygen()
while (storage.folders.some((folder) => folder.key === folderKey)) {
folderKey = keygen()
}
let newFolder = {
const newFolder = {
key: folderKey,
name: oldFolder.name,
color: consts.FOLDER_COLORS[Math.floor(Math.random() * 7) % 7]
@@ -40,7 +40,7 @@ function importAll (storage, data) {
storage.folders.push(newFolder)
let articles = oldArticles.filter((article) => article.FolderKey === oldFolder.key)
const articles = oldArticles.filter((article) => article.FolderKey === oldFolder.key)
articles.forEach((article) => {
let noteKey = keygen()
let isUnique = false
@@ -59,7 +59,7 @@ function importAll (storage, data) {
}
if (article.mode === 'markdown') {
let newNote = {
const newNote = {
tags: article.tags,
createdAt: article.createdAt,
updatedAt: article.updatedAt,
@@ -73,7 +73,7 @@ function importAll (storage, data) {
}
notes.push(newNote)
} else {
let newNote = {
const newNote = {
tags: article.tags,
createdAt: article.createdAt,
updatedAt: article.updatedAt,

View File

@@ -20,7 +20,7 @@ function moveNote (storageKey, noteKey, newStorageKey, newFolderKey) {
.then(function saveNote (_oldStorage) {
oldStorage = _oldStorage
let noteData
let notePath = path.join(oldStorage.path, 'notes', noteKey + '.cson')
const notePath = path.join(oldStorage.path, 'notes', noteKey + '.cson')
try {
noteData = CSON.readFileSync(notePath)
} catch (err) {

View File

@@ -1,6 +1,5 @@
const _ = require('lodash')
const resolveStorageData = require('./resolveStorageData')
const { findStorage } = require('browser/lib/findStorage')
/**
* @param {String} key
@@ -19,7 +18,7 @@ function renameStorage (key, name) {
console.error(err)
return Promise.reject(err)
}
let targetStorage = _.find(cachedStorageList, {key: key})
const targetStorage = _.find(cachedStorageList, {key: key})
if (targetStorage == null) return Promise.reject('Storage')
targetStorage.name = name

View File

@@ -18,7 +18,6 @@ const { findStorage } = require('browser/lib/findStorage')
* ```
*/
function reorderFolder (storageKey, oldIndex, newIndex) {
let rawStorages
let targetStorage
try {
if (!_.isNumber(oldIndex)) throw new Error('oldIndex must be a number.')

View File

@@ -4,7 +4,7 @@ const CSON = require('@rokt33r/season')
const migrateFromV6Storage = require('./migrateFromV6Storage')
function resolveStorageData (storageCache) {
let storage = {
const storage = {
key: storageCache.key,
name: storageCache.name,
type: storageCache.type,
@@ -13,7 +13,7 @@ function resolveStorageData (storageCache) {
const boostnoteJSONPath = path.join(storageCache.path, 'boostnote.json')
try {
let jsonData = CSON.readFileSync(boostnoteJSONPath)
const jsonData = CSON.readFileSync(boostnoteJSONPath)
if (!_.isArray(jsonData.folders)) throw new Error('folders should be an array.')
storage.folders = jsonData.folders
storage.version = jsonData.version
@@ -28,7 +28,7 @@ function resolveStorageData (storageCache) {
storage.version = '1.0'
}
let version = parseInt(storage.version, 10)
const version = parseInt(storage.version, 10)
if (version >= 1) {
if (version > 1) {
console.log('The repository version is newer than one of current app.')

View File

@@ -16,13 +16,13 @@ function resolveStorageNotes (storage) {
}
notePathList = []
}
let notes = notePathList
const notes = notePathList
.filter(function filterOnlyCSONFile (notePath) {
return /\.cson$/.test(notePath)
})
.map(function parseCSONFile (notePath) {
try {
let data = CSON.readFileSync(path.join(notesDirPath, notePath))
const data = CSON.readFileSync(path.join(notesDirPath, notePath))
data.key = path.basename(notePath, '.cson')
data.storage = storage.key
return data

View File

@@ -23,7 +23,6 @@ const { findStorage } = require('browser/lib/findStorage')
* ```
*/
function updateFolder (storageKey, folderKey, input) {
let rawStorages
let targetStorage
try {
if (input == null) throw new Error('No input found.')
@@ -37,7 +36,7 @@ function updateFolder (storageKey, folderKey, input) {
return resolveStorageData(targetStorage)
.then(function updateFolder (storage) {
let targetFolder = _.find(storage.folders, {key: folderKey})
const targetFolder = _.find(storage.folders, {key: folderKey})
if (targetFolder == null) throw new Error('Target folder doesn\'t exist.')
targetFolder.name = input.name
targetFolder.color = input.color

View File

@@ -5,7 +5,7 @@ const CSON = require('@rokt33r/season')
const { findStorage } = require('browser/lib/findStorage')
function validateInput (input) {
let validatedInput = {}
const validatedInput = {}
if (input.tags != null) {
if (!_.isArray(input.tags)) validatedInput.tags = []
@@ -81,7 +81,7 @@ function updateNote (storageKey, noteKey, input) {
return resolveStorageData(targetStorage)
.then(function saveNote (storage) {
let noteData
let notePath = path.join(storage.path, 'notes', noteKey + '.cson')
const notePath = path.join(storage.path, 'notes', noteKey + '.cson')
try {
noteData = CSON.readFileSync(notePath)
} catch (err) {

View File

@@ -1,121 +0,0 @@
import store from 'browser/main/store'
const _ = require('lodash')
const keygen = require('browser/lib/keygen')
const Mixpanel = require('mixpanel')
const mixpanel = Mixpanel.init('7a0aca437d72dfd07cbcbf58d3b61f27', {key: 'fde4fd23f4d550f1b646bcd7d4374b1f'})
const moment = require('moment')
const electron = require('electron')
function _getClientKey () {
let clientKey = localStorage.getItem('clientKey')
if (!_.isString(clientKey) || clientKey.length !== 40) {
clientKey = keygen(20)
_setClientKey(clientKey)
}
return clientKey
}
function _setClientKey (newKey) {
localStorage.setItem('clientKey', newKey)
}
function _fetch () {
let events
try {
events = JSON.parse(localStorage.getItem('events'))
if (!_.isArray(events)) throw new Error('events is not an array.')
} catch (err) {
console.warn(err)
events = []
localStorage.setItem('events', JSON.stringify(events))
console.info('Events cache initialzed')
}
return events
}
function _keep (name, properties) {
let events = _fetch()
properties.time = new Date()
events.push({
name,
properties
})
localStorage.setItem('events', JSON.stringify(events))
}
function _keepUnique (name, properties) {
let events = _fetch()
properties.time = new Date()
events = events.filter((event) => event.name !== name)
events.push({
name,
properties
})
localStorage.setItem('events', JSON.stringify(events))
}
function _flush () {
let events = _fetch()
let spliced = events.splice(0, 50)
localStorage.setItem('events', JSON.stringify(events))
if (spliced.length > 0) {
let parsedEvents = spliced
.filter((event) => {
if (!_.isObject(event)) return false
if (!_.isString(event.name)) return false
if (!_.isObject(event.properties)) return false
if (!moment(event.properties.time).isValid()) return false
if (new Date() - moment(event.properties.time).toDate() > 1000 * 3600 * 24 * 3) return false
return true
})
.map((event) => {
return {
event: event.name,
properties: event.properties
}
})
mixpanel.import_batch(parsedEvents, {}, (errs) => {
if (errs.length > 0) {
let events = _fetch()
events = events.concat(spliced)
localStorage.setItem('events', JSON.stringify(events))
} else {
_flush()
}
})
let state = store.getState()
mixpanel.people.set(_getClientKey(), {
storage_count: state.data.storageMap.size,
note_count: state.data.noteMap.size,
version: electron.remote.app.getVersion()
})
}
}
setInterval(_flush, 1000 * 60 * 60)
function track (name, properties) {
switch (name) {
case 'MAIN_FOCUSED':
properties = Object.assign({}, properties, {
distinct_id: _getClientKey()
})
_keepUnique(name, properties)
break
default:
properties = Object.assign({}, properties, {
distinct_id: _getClientKey()
})
_keep(name, properties)
}
}
module.exports = {
_mp: mixpanel,
track
}

View File

@@ -16,7 +16,7 @@ class ModalBase extends React.Component {
close () {
if (modalBase != null) modalBase.setState({component: null, componentProps: null, isHidden: true})
// Toggle overflow style on NoteList
let list = document.querySelector('.NoteList__list___browser-main-NoteList-')
const list = document.querySelector('.NoteList__list___browser-main-NoteList-')
list.style.overflow = 'auto'
}
@@ -34,14 +34,14 @@ class ModalBase extends React.Component {
}
}
let el = document.createElement('div')
const el = document.createElement('div')
document.body.appendChild(el)
let modalBase = ReactDOM.render(<ModalBase />, el)
const modalBase = ReactDOM.render(<ModalBase />, el)
export function openModal (component, props) {
if (modalBase == null) { return }
// Hide scrollbar by removing overflow when modal opens
let list = document.querySelector('.NoteList__list___browser-main-NoteList-')
const list = document.querySelector('.NoteList__list___browser-main-NoteList-')
list.style.overflow = 'hidden'
document.body.setAttribute('data-modal', 'open')
modalBase.setState({component: component, componentProps: props, isHidden: false})

View File

@@ -1,4 +1,5 @@
import React, { PropTypes } from 'react'
import PropTypes from 'prop-types'
import React from 'react'
import CSSModules from 'browser/lib/CSSModules'
import styles from './CreateFolderModal.styl'
import dataApi from 'browser/main/lib/dataApi'
@@ -51,8 +52,8 @@ class CreateFolderModal extends React.Component {
confirm () {
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('ADD_FOLDER')
if (this.state.name.trim().length > 0) {
let { storage } = this.props
let input = {
const { storage } = this.props
const input = {
name: this.state.name.trim(),
color: consts.FOLDER_COLORS[Math.floor(Math.random() * 7) % 7]
}

Some files were not shown because too many files have changed in this diff Show More