From 7a4258bb208d43be80e575fe61c0a0a187811e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Pavli=CC=81k?= Date: Wed, 20 Sep 2017 22:33:51 +0200 Subject: [PATCH 01/26] Make line numbers in the editor optional --- browser/components/CodeEditor.js | 6 +++++- browser/components/MarkdownEditor.js | 3 +++ browser/main/Detail/SnippetNoteDetail.js | 1 + browser/main/lib/ConfigManager.js | 1 + browser/main/modals/PreferencesModal/UiTab.js | 12 ++++++++++++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index f00794bff..8378f4931 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -50,7 +50,7 @@ export default class CodeEditor extends React.Component { this.value = this.props.value this.editor = CodeMirror(this.refs.root, { value: this.props.value, - lineNumbers: true, + lineNumbers: this.props.lineNumber, lineWrapping: true, theme: this.props.theme, indentUnit: this.props.indentSize, @@ -141,6 +141,10 @@ export default class CodeEditor extends React.Component { this.editor.setOption('indentWithTabs', this.props.indentType !== 'space') } + if (prevProps.lineNumber !== this.props.lineNumber) { + this.editor.setOption('lineNumbers', this.props.lineNumber) + } + if (needRefresh) { this.editor.refresh() } diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js index f20ec087a..e5b7287c2 100644 --- a/browser/components/MarkdownEditor.js +++ b/browser/components/MarkdownEditor.js @@ -213,6 +213,8 @@ class MarkdownEditor extends React.Component { if (!(editorFontSize > 0 && editorFontSize < 101)) editorFontSize = 14 let editorIndentSize = parseInt(config.editor.indentSize, 10) if (!(editorFontSize > 0 && editorFontSize < 132)) editorIndentSize = 4 + let editorLineNumber = config.editor.lineNumber + if (editorLineNumber === undefined) editorLineNumber = true let previewStyle = {} if (this.props.ignorePreviewPointerEvents) previewStyle.pointerEvents = 'none' @@ -242,6 +244,7 @@ class MarkdownEditor extends React.Component { fontSize={editorFontSize} indentType={config.editor.indentType} indentSize={editorIndentSize} + lineNumber={editorLineNumber} storageKey={storageKey} onChange={(e) => this.handleChange(e)} onBlur={(e) => this.handleBlur(e)} diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index 5f767b701..a7b0a8b34 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -530,6 +530,7 @@ class SnippetNoteDetail extends React.Component { fontSize={editorFontSize} indentType={config.editor.indentType} indentSize={editorIndentSize} + lineNumber keyMap={config.editor.keyMap} onChange={(e) => this.handleCodeChange(index)(e)} ref={'code-' + index} diff --git a/browser/main/lib/ConfigManager.js b/browser/main/lib/ConfigManager.js index 543c7e5b4..f87c1dc09 100644 --- a/browser/main/lib/ConfigManager.js +++ b/browser/main/lib/ConfigManager.js @@ -35,6 +35,7 @@ export const DEFAULT_CONFIG = { fontFamily: win ? 'Segoe UI' : 'Monaco, Consolas', indentType: 'space', indentSize: '2', + lineNumber: true, switchPreview: 'BLUR' // Available value: RIGHTCLICK, BLUR }, preview: { diff --git a/browser/main/modals/PreferencesModal/UiTab.js b/browser/main/modals/PreferencesModal/UiTab.js index 96c04ddf6..bea6d28be 100644 --- a/browser/main/modals/PreferencesModal/UiTab.js +++ b/browser/main/modals/PreferencesModal/UiTab.js @@ -46,6 +46,7 @@ class UiTab extends React.Component { fontFamily: this.refs.editorFontFamily.value, indentType: this.refs.editorIndentType.value, indentSize: this.refs.editorIndentSize.value, + lineNumber: this.refs.editorLineNumber.checked, switchPreview: this.refs.editorSwitchPreview.value, keyMap: this.refs.editorKeyMap.value }, @@ -222,6 +223,17 @@ class UiTab extends React.Component { +
+ +
+
Preview
From 1f5f6c3b0ed912ced8bc6fa0e03d716db4bfa6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Pavli=CC=81k?= Date: Sat, 23 Dec 2017 22:51:38 +0100 Subject: [PATCH 02/26] Rename 'lineNumber' to 'displayLineNumbers' --- browser/components/CodeEditor.js | 6 +++--- browser/components/MarkdownEditor.js | 4 +--- browser/main/Detail/SnippetNoteDetail.js | 2 +- browser/main/lib/ConfigManager.js | 2 +- browser/main/modals/PreferencesModal/UiTab.js | 6 +++--- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index 8378f4931..66e647d61 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -50,7 +50,7 @@ export default class CodeEditor extends React.Component { this.value = this.props.value this.editor = CodeMirror(this.refs.root, { value: this.props.value, - lineNumbers: this.props.lineNumber, + lineNumbers: this.props.displayLineNumbers, lineWrapping: true, theme: this.props.theme, indentUnit: this.props.indentSize, @@ -141,8 +141,8 @@ export default class CodeEditor extends React.Component { this.editor.setOption('indentWithTabs', this.props.indentType !== 'space') } - if (prevProps.lineNumber !== this.props.lineNumber) { - this.editor.setOption('lineNumbers', this.props.lineNumber) + if (prevProps.displayLineNumbers !== this.props.displayLineNumbers) { + this.editor.setOption('lineNumbers', this.props.displayLineNumbers) } if (needRefresh) { diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js index e5b7287c2..884852072 100644 --- a/browser/components/MarkdownEditor.js +++ b/browser/components/MarkdownEditor.js @@ -213,8 +213,6 @@ class MarkdownEditor extends React.Component { if (!(editorFontSize > 0 && editorFontSize < 101)) editorFontSize = 14 let editorIndentSize = parseInt(config.editor.indentSize, 10) if (!(editorFontSize > 0 && editorFontSize < 132)) editorIndentSize = 4 - let editorLineNumber = config.editor.lineNumber - if (editorLineNumber === undefined) editorLineNumber = true let previewStyle = {} if (this.props.ignorePreviewPointerEvents) previewStyle.pointerEvents = 'none' @@ -244,7 +242,7 @@ class MarkdownEditor extends React.Component { fontSize={editorFontSize} indentType={config.editor.indentType} indentSize={editorIndentSize} - lineNumber={editorLineNumber} + displayLineNumbers={config.editor.displayLineNumbers} storageKey={storageKey} onChange={(e) => this.handleChange(e)} onBlur={(e) => this.handleBlur(e)} diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index a7b0a8b34..2f5ba34fe 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -530,7 +530,7 @@ class SnippetNoteDetail extends React.Component { fontSize={editorFontSize} indentType={config.editor.indentType} indentSize={editorIndentSize} - lineNumber + displayLineNumbers keyMap={config.editor.keyMap} onChange={(e) => this.handleCodeChange(index)(e)} ref={'code-' + index} diff --git a/browser/main/lib/ConfigManager.js b/browser/main/lib/ConfigManager.js index f87c1dc09..cdd7eb807 100644 --- a/browser/main/lib/ConfigManager.js +++ b/browser/main/lib/ConfigManager.js @@ -35,7 +35,7 @@ export const DEFAULT_CONFIG = { fontFamily: win ? 'Segoe UI' : 'Monaco, Consolas', indentType: 'space', indentSize: '2', - lineNumber: true, + displayLineNumbers: true, switchPreview: 'BLUR' // Available value: RIGHTCLICK, BLUR }, preview: { diff --git a/browser/main/modals/PreferencesModal/UiTab.js b/browser/main/modals/PreferencesModal/UiTab.js index bea6d28be..61aca0dc8 100644 --- a/browser/main/modals/PreferencesModal/UiTab.js +++ b/browser/main/modals/PreferencesModal/UiTab.js @@ -46,7 +46,7 @@ class UiTab extends React.Component { fontFamily: this.refs.editorFontFamily.value, indentType: this.refs.editorIndentType.value, indentSize: this.refs.editorIndentSize.value, - lineNumber: this.refs.editorLineNumber.checked, + displayLineNumbers: this.refs.editorDisplayLineNumbers.checked, switchPreview: this.refs.editorSwitchPreview.value, keyMap: this.refs.editorKeyMap.value }, @@ -226,8 +226,8 @@ class UiTab extends React.Component {
@@ -167,7 +167,7 @@ class StoragesTab extends React.Component {
- 3rd party cloud integration: + Setting up 3rd-party cloud storage integration: this.handleLinkClick(e)} >Cloud-Syncing-and-Backup From 9165f518a94eb7b0218326358dcabb15b6ec0667 Mon Sep 17 00:00:00 2001 From: cyalins Date: Thu, 25 Jan 2018 13:41:24 +1100 Subject: [PATCH 05/26] Improved wording of data collection --- browser/main/modals/PreferencesModal/InfoTab.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/browser/main/modals/PreferencesModal/InfoTab.js b/browser/main/modals/PreferencesModal/InfoTab.js index 2a1db8283..a4ff1579c 100644 --- a/browser/main/modals/PreferencesModal/InfoTab.js +++ b/browser/main/modals/PreferencesModal/InfoTab.js @@ -60,7 +60,8 @@ class InfoTab extends React.Component { }) } - infoMessage () { + + Message () { const { amaMessage } = this.state return amaMessage ?

{amaMessage}

: null } @@ -102,7 +103,7 @@ class InfoTab extends React.Component {
-
Info
+
About
@@ -137,17 +138,19 @@ class InfoTab extends React.Component {
-
Data collection policy
-
We collect only the number of DAU for Boostnote and **DO NOT collect** any detail information such as your note content.
+
Analytics
+
Boostnote collects anonymous data for the sole purpose of improving the application, and strictly does not collect any personal information such the contents of your notes.
You can see how it works on this.handleLinkClick(e)}>GitHub.
-
This data is only used for Boostnote improvements.
+
+
You can choose to enable or disable this option.
this.handleConfigChange(e)} checked={this.state.config.amaEnabled} ref='amaEnabled' type='checkbox' /> - Enable to send analytics to our servers
+ Enable analytics to help improve Boostnote
+
{this.infoMessage()}
) From f7bd52ac0c53f1b8213f10638c1890fccfe35b97 Mon Sep 17 00:00:00 2001 From: cyalins Date: Thu, 25 Jan 2018 13:46:08 +1100 Subject: [PATCH 06/26] Improved clarity of crowdfunding message --- browser/main/modals/PreferencesModal/Crowdfunding.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/browser/main/modals/PreferencesModal/Crowdfunding.js b/browser/main/modals/PreferencesModal/Crowdfunding.js index 3dccd27b7..048520b0b 100644 --- a/browser/main/modals/PreferencesModal/Crowdfunding.js +++ b/browser/main/modals/PreferencesModal/Crowdfunding.js @@ -22,18 +22,18 @@ class Crowdfunding extends React.Component { return (
Crowdfunding
-

Dear all,

+

Dear everyone,


-

Thanks for your using!

-

Boostnote is used in about 200 countries and regions, it is a awesome developer community.

+

Thank you for using Boostnote!

+

Boostnote is used in about 200 different countries and regions by an awesome community of developers.


To continue supporting this growth, and to satisfy community expectations,

-

we would like to invest more time in this project.

+

we would like to invest more time and resources in this project.


-

If you like this project and see its potential, you can help!

+

If you like this project and see its potential, you can help by supporting us on OpenCollective!


Thanks,

-

Boostnote maintainers.

+

Boostnote maintainers


-
+
{this.infoMessage()}
) diff --git a/browser/main/modals/PreferencesModal/StoragesTab.js b/browser/main/modals/PreferencesModal/StoragesTab.js index 76e69f870..f66a617ee 100644 --- a/browser/main/modals/PreferencesModal/StoragesTab.js +++ b/browser/main/modals/PreferencesModal/StoragesTab.js @@ -167,7 +167,7 @@ class StoragesTab extends React.Component {
- Setting up 3rd-party cloud storage integration: + Setting up 3rd-party cloud storage integration:{' '} this.handleLinkClick(e)} >Cloud-Syncing-and-Backup diff --git a/browser/main/modals/PreferencesModal/index.js b/browser/main/modals/PreferencesModal/index.js index 228a08f4f..574b51860 100644 --- a/browser/main/modals/PreferencesModal/index.js +++ b/browser/main/modals/PreferencesModal/index.js @@ -1,6 +1,5 @@ import PropTypes from 'prop-types' import React from 'react' -import ReactDOM from 'react-dom' import { connect } from 'react-redux' import HotkeyTab from './HotkeyTab' import UiTab from './UiTab' @@ -11,6 +10,7 @@ import ModalEscButton from 'browser/components/ModalEscButton' import CSSModules from 'browser/lib/CSSModules' import styles from './PreferencesModal.styl' import RealtimeNotification from 'browser/components/RealtimeNotification' +import _ from 'lodash' class Preferences extends React.Component { constructor (props) { @@ -94,8 +94,8 @@ class Preferences extends React.Component { } getContentBoundingBox () { - const node = ReactDOM.findDOMNode(this.refs.content) - return node.getBoundingClientRect() + console.log(this.refs.content.getBoundingClientRect()) + return this.refs.content.getBoundingClientRect() } haveToSaveNotif (type, message) { diff --git a/browser/main/store.js b/browser/main/store.js index 36e7850d0..abd348896 100644 --- a/browser/main/store.js +++ b/browser/main/store.js @@ -355,11 +355,9 @@ function data (state = defaultDataMap(), action) { state.storageMap.set(action.storage.key, action.storage) return state case 'EXPORT_FOLDER': - { - state = Object.assign({}, state) - state.storageMap = new Map(state.storageMap) - state.storageMap.set(action.storage.key, action.storage) - } + state = Object.assign({}, state) + state.storageMap = new Map(state.storageMap) + state.storageMap.set(action.storage.key, action.storage) return state case 'DELETE_FOLDER': { From 7cad3d403b92be315c4911e6efd1fb05b10caa44 Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Sat, 3 Feb 2018 15:00:06 +0900 Subject: [PATCH 15/26] Discard unnecessary logging --- browser/main/modals/PreferencesModal/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/browser/main/modals/PreferencesModal/index.js b/browser/main/modals/PreferencesModal/index.js index 574b51860..6cd5badc9 100644 --- a/browser/main/modals/PreferencesModal/index.js +++ b/browser/main/modals/PreferencesModal/index.js @@ -94,7 +94,6 @@ class Preferences extends React.Component { } getContentBoundingBox () { - console.log(this.refs.content.getBoundingClientRect()) return this.refs.content.getBoundingClientRect() } From 69601bf15a1ab2f81cfd3ca4d59c43788b8446ce Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Sat, 3 Feb 2018 15:02:26 +0900 Subject: [PATCH 16/26] Fix but: line numbers of editor isnt applied properly --- browser/components/CodeEditor.js | 5 +++-- browser/components/MarkdownSplitEditor.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index cda37836d..217a14b13 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -51,6 +51,7 @@ export default class CodeEditor extends React.Component { componentDidMount () { this.value = this.props.value + this.editor = CodeMirror(this.refs.root, { value: this.props.value, lineNumbers: this.props.displayLineNumbers, @@ -71,7 +72,7 @@ export default class CodeEditor extends React.Component { if (cm.somethingSelected()) cm.indentSelection('add') else { const tabs = cm.getOption('indentWithTabs') - if (line.trimLeft().match(/^(-|\*|\+) (\[( |x)\] )?$/)) { + if (line.trimLeft().match(/^(-|\*|\+) (\[( |x)] )?$/)) { cm.execCommand('goLineStart') if (tabs) { cm.execCommand('insertTab') @@ -234,7 +235,7 @@ export default class CodeEditor extends React.Component { if (!dataTransferItem.type.match('image')) return const blob = dataTransferItem.getAsFile() - const reader = new FileReader() + const reader = new window.FileReader() let base64data reader.readAsDataURL(blob) diff --git a/browser/components/MarkdownSplitEditor.js b/browser/components/MarkdownSplitEditor.js index d0a3eb277..2cf8e322e 100644 --- a/browser/components/MarkdownSplitEditor.js +++ b/browser/components/MarkdownSplitEditor.js @@ -62,6 +62,7 @@ class MarkdownSplitEditor extends React.Component { keyMap={config.editor.keyMap} fontFamily={config.editor.fontFamily} fontSize={editorFontSize} + displayLineNumbers={config.editor.displayLineNumbers} indentType={config.editor.indentType} indentSize={editorIndentSize} scrollPastEnd={config.editor.scrollPastEnd} From 03be809ba923840dfd026f466b881b4db31a6d54 Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Sat, 3 Feb 2018 15:03:33 +0900 Subject: [PATCH 17/26] Text stable version only The current version of boostnote doesn't support the latest stable version, v9.x --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 013169e81..9080f9609 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: node_js node_js: - - stable - lts/* script: - npm run lint && npm run test From eb698a7430338d6b6d36c1aad5222f38ce54a5a2 Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Sat, 3 Feb 2018 15:10:16 +0900 Subject: [PATCH 18/26] Fix lint error --- browser/main/modals/PreferencesModal/UiTab.js | 1 - 1 file changed, 1 deletion(-) diff --git a/browser/main/modals/PreferencesModal/UiTab.js b/browser/main/modals/PreferencesModal/UiTab.js index 6165480d3..df35e2608 100644 --- a/browser/main/modals/PreferencesModal/UiTab.js +++ b/browser/main/modals/PreferencesModal/UiTab.js @@ -327,7 +327,6 @@ class UiTab extends React.Component {
-
Preview
From 31da231c1c1105187a259d64b98475f5660347be Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Sat, 3 Feb 2018 15:28:19 +0900 Subject: [PATCH 19/26] Rollback .travis.yml --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 9080f9609..013169e81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ language: node_js node_js: + - stable - lts/* script: - npm run lint && npm run test From ff67043210ef7ef8a2cb676be79c8656bd6fa806 Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Sat, 3 Feb 2018 15:52:51 +0900 Subject: [PATCH 20/26] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d2340b654..57dc4ae7e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "boost", "productName": "Boostnote", - "version": "0.8.20", + "version": "0.8.21", "main": "index.js", "description": "Boostnote", "license": "GPL-3.0", From ca282d5635ff40dbfff38306c4379673b58feb16 Mon Sep 17 00:00:00 2001 From: Kazu Yokomizo Date: Sat, 3 Feb 2018 16:32:02 +0900 Subject: [PATCH 21/26] Fix percentage bar in markdown preview --- browser/components/TodoListPercentage.styl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/components/TodoListPercentage.styl b/browser/components/TodoListPercentage.styl index d4cb7485d..329663f9c 100644 --- a/browser/components/TodoListPercentage.styl +++ b/browser/components/TodoListPercentage.styl @@ -1,6 +1,6 @@ .percentageBar position absolute - top 50px + top 72px right 0px left 0px background-color #DADFE1 From 51a8c47afd2fc5f70f18e62a316868427f3a0c15 Mon Sep 17 00:00:00 2001 From: "Junyoung Choi (Sai)" Date: Sat, 3 Feb 2018 23:39:53 +0900 Subject: [PATCH 22/26] Discard finder (#1497) * Discard finder * Upgrade electron * Discard anything related with finder * Fix lint errors * Run test serial * Test on v6 * Test on v6 only --- .boostnoterc.sample | 1 - .travis.yml | 3 +- browser/finder/FinderMain.styl | 156 -------- browser/finder/NoteDetail.js | 211 ----------- browser/finder/NoteDetail.styl | 129 ------- browser/finder/NoteList.js | 90 ----- browser/finder/StorageSection.js | 77 ---- browser/finder/StorageSection.styl | 85 ----- browser/finder/index.js | 357 ------------------ browser/finder/ipcClient.js | 126 ------- browser/finder/store.js | 51 --- browser/main/lib/ConfigManager.js | 1 - browser/main/lib/ipcClient.js | 14 - .../main/modals/PreferencesModal/HotkeyTab.js | 12 - browser/styles/finder/index.styl | 129 ------- browser/styles/theme/dark.styl | 42 --- index.js | 11 +- lib/finder-app.js | 14 - lib/finder-window.js | 101 ----- lib/finder.html | 65 ---- lib/ipcServer.js | 23 -- lib/main-app.js | 18 - lib/main-window.js | 12 +- package.json | 6 +- tests/lib/boostnoterc/.boostnoterc.all | 1 - tests/lib/rc-parser-test.js | 2 +- webpack-skeleton.js | 3 +- yarn.lock | 6 +- 28 files changed, 14 insertions(+), 1732 deletions(-) delete mode 100644 browser/finder/FinderMain.styl delete mode 100644 browser/finder/NoteDetail.js delete mode 100644 browser/finder/NoteDetail.styl delete mode 100644 browser/finder/NoteList.js delete mode 100644 browser/finder/StorageSection.js delete mode 100644 browser/finder/StorageSection.styl delete mode 100644 browser/finder/index.js delete mode 100644 browser/finder/ipcClient.js delete mode 100644 browser/finder/store.js delete mode 100644 browser/styles/finder/index.styl delete mode 100755 lib/finder-app.js delete mode 100644 lib/finder-window.js delete mode 100644 lib/finder.html diff --git a/.boostnoterc.sample b/.boostnoterc.sample index 2caa2c1af..8419061df 100644 --- a/.boostnoterc.sample +++ b/.boostnoterc.sample @@ -10,7 +10,6 @@ "theme": "monokai" }, "hotkey": { - "toggleFinder": "Cmd + Alt + S", "toggleMain": "Cmd + Alt + L" }, "isSideNavFolded": false, diff --git a/.travis.yml b/.travis.yml index 013169e81..c68d10632 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: node_js node_js: - - stable - - lts/* + - 6 script: - npm run lint && npm run test - 'if [[ ${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} = "master" ]]; then npm install -g grunt npm@5.2 && grunt pre-build; fi' diff --git a/browser/finder/FinderMain.styl b/browser/finder/FinderMain.styl deleted file mode 100644 index 8ba7c3b92..000000000 --- a/browser/finder/FinderMain.styl +++ /dev/null @@ -1,156 +0,0 @@ -$search-height = 50px -$nav-width = 175px -$list-width = 250px - -.root - absolute top left right bottom - -.search - height $search-height - padding 10px - box-sizing border-box - border-bottom $ui-border - text-align center - -.search-input - height 30px - width 100% - margin 0 auto - font-size 18px - border none - outline none - text-align center - background-color transparent - -.result - absolute left right bottom - top $search-height - background-color $ui-noteDetail-backgroundColor - -.result-nav - user-select none - absolute left top bottom - width $nav-width - background-color $ui-backgroundColor - -.result-nav-filter - margin-bottom 10px - -.result-nav-filter-option - height 25px - line-height 25px - padding 0 10px - label - cursor pointer - -.result-nav-menu - navButtonColor() - height 32px - padding 0 10px - font-size 14px - width 100% - outline none - text-align left - line-height 32px - box-sizing border-box - cursor pointer - -.result-nav-menu--active - @extend .result-nav-menu - background-color $ui-button--active-backgroundColor - color $ui-button--active-color - &:hover - background-color $ui-button--active-backgroundColor - -.result-nav-storageList - absolute bottom left right - top 110px + 32px + 10px + 10px + 20px - overflow-y auto - -.result-list - user-select none - absolute top bottom - left $nav-width - width $list-width - box-sizing border-box - overflow-y auto - box-shadow 2px 0 15px -8px #b1b1b1 - z-index 1 - -.result-detail - absolute top bottom right - left $nav-width + $list-width - background-color $ui-noteDetail-backgroundColor - -body[data-theme="dark"] - .root - background-color $ui-dark-backgroundColor - .search - border-color $ui-dark-borderColor - .search-input - color $ui-dark-text-color - - .result - background-color $ui-dark-noteList-backgroundColor - - .result-nav - background-color $ui-dark-backgroundColor - label - color $ui-dark-text-color - - .result-nav-menu - navDarkButtonColor() - - .result-nav-menu--active - background-color $ui-dark-button--active-backgroundColor - color $ui-dark-button--active-color - &:hover - background-color $ui-dark-button--active-backgroundColor - - .result-list - border-color $ui-dark-borderColor - box-shadow none - top 0 - - .result-detail - absolute top bottom right - left $nav-width + $list-width - background-color $ui-dark-noteDetail-backgroundColor - - - -body[data-theme="solarized-dark"] - .root - background-color $ui-solarized-dark-backgroundColor - .search - border-color $ui-solarized-dark-borderColor - .search-input - color $ui-dark-text-color - - .result - background-color $ui-solarized-dark-backgroundColor - - .result-nav - background-color $ui-solarized-dark-backgroundColor - label - color $ui-dark-text-color - - .result-nav-menu - navDarkButtonColor() - - .result-nav-menu--active - background-color $ui-solarized-dark-button-backgroundColor - color $ui-dark-button--active-color - &:hover - background-color $ui-dark-button--active-backgroundColor - - .result-list - border-color $ui-solarized-dark-borderColor - box-shadow none - top 0 - - .result-detail - absolute top bottom right - left $nav-width + $list-width - background-color $ui-solarized-dark-backgroundColor - diff --git a/browser/finder/NoteDetail.js b/browser/finder/NoteDetail.js deleted file mode 100644 index 3b9121d7d..000000000 --- a/browser/finder/NoteDetail.js +++ /dev/null @@ -1,211 +0,0 @@ -import React from 'react' -import CSSModules from 'browser/lib/CSSModules' -import styles from './NoteDetail.styl' -import MarkdownPreview from 'browser/components/MarkdownPreview' -import MarkdownEditor from 'browser/components/MarkdownEditor' -import CodeEditor from 'browser/components/CodeEditor' -import CodeMirror from 'codemirror' -import 'codemirror-mode-elixir' -import { findStorage } from 'browser/lib/findStorage' - -const electron = require('electron') -const { clipboard } = electron -const path = require('path') - -function pass (name) { - switch (name) { - case 'ejs': - return 'Embedded Javascript' - case 'html_ruby': - return 'Embedded Ruby' - case 'objectivec': - return 'Objective C' - case 'text': - return 'Plain Text' - default: - return name - } -} -function notify (title, options) { - if (global.process.platform === 'win32') { - options.icon = path.join('file://', global.__dirname, '../../resources/app.png') - } - return new window.Notification(title, options) -} - -class NoteDetail extends React.Component { - constructor (props) { - super(props) - - this.state = { - snippetIndex: 0 - } - } - - componentWillReceiveProps (nextProps) { - if (nextProps.note !== this.props.note) { - this.setState({ - snippetIndex: 0 - }, () => { - if (nextProps.note.type === 'SNIPPET_NOTE') { - nextProps.note.snippets.forEach((snippet, index) => { - this.refs['code-' + index].reload() - }) - } - }) - } - } - - selectPriorSnippet () { - 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 - }) - } - } - - selectNextSnippet () { - const { note } = this.props - if (note.type === 'SNIPPET_NOTE' && note.snippets.length > 1) { - this.setState({ - snippetIndex: (this.state.snippetIndex + 1) % note.snippets.length - }) - } - } - - saveToClipboard () { - const { note } = this.props - - if (note.type === 'MARKDOWN_NOTE') { - clipboard.writeText(note.content) - } else { - clipboard.writeText(note.snippets[this.state.snippetIndex].content) - } - - notify('Saved to Clipboard!', { - body: 'Paste it wherever you want!', - silent: true - }) - } - - handleTabButtonClick (e, index) { - this.setState({ - snippetIndex: index - }) - } - - render () { - const { note, config } = this.props - if (note == null) { - return ( -
- ) - } - - 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 - - const storage = findStorage(note.storage) - - if (note.type === 'SNIPPET_NOTE') { - const tabList = note.snippets.map((snippet, index) => { - const isActive = this.state.snippetIndex === index - return
- -
- }) - - 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') - - return
- {snippet.mode === 'markdown' - ? - : - } -
- }) - - return ( -
-
-