From e68d535fa267275bf92b8e81e8793b37734318b8 Mon Sep 17 00:00:00 2001 From: kostaldavid8 Date: Wed, 15 Feb 2017 22:18:20 +0100 Subject: [PATCH 01/44] Smart bullets When you hit enter on a line with a bullet, you get a new one on the new line. Also when you hit tab after a bullet, it automatically indents. It makes typing with bullets much more pleasant. --- browser/components/CodeEditor.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index 6f19c49f..beee8961 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -57,17 +57,35 @@ export default class CodeEditor extends React.Component { inputStyle: 'textarea', extraKeys: { Tab: function (cm) { + let cursor = cm.getCursor() + let line = cm.getLine(cursor.line) if (cm.somethingSelected()) cm.indentSelection('add') else { - if (cm.getOption('indentWithTabs')) { - cm.execCommand('insertTab') + let tabs = cm.getOption('indentWithTabs') + if (line.trimLeft() === '- ' || line.trimLeft() === '* ') { + cm.execCommand('goLineStart') + if (tabs) cm.execCommand('insertTab'); else cm.execCommand('insertSoftTab') + cm.execCommand('goLineEnd') } else { - cm.execCommand('insertSoftTab') + if (tabs) cm.execCommand('insertTab'); else cm.execCommand('insertSoftTab') } } }, 'Cmd-T': function (cm) { // Do nothing + }, + Enter: function (cm) { + let cursor = cm.getCursor() + let line = cm.getLine(cursor.line) + let dash = line.trim().startsWith('- ') + if ((line.trim().startsWith('- ') || line.trim().startsWith('* '))) { + cm.execCommand('newlineAndIndent') + let range = {line: cursor.line + 1, ch: cm.getLine(cursor.line + 1).length} + console.log(range) + if (dash) cm.replaceRange('- ', range); else cm.replaceRange('* ', range) + } else { + cm.execCommand('newlineAndIndent') + } } } }) From 77eb19af405f3f5078136f5a136ccc719a311907 Mon Sep 17 00:00:00 2001 From: kostaldavid8 Date: Wed, 15 Feb 2017 23:30:56 +0100 Subject: [PATCH 02/44] Code style fixes --- browser/components/CodeEditor.js | 37 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index beee8961..03270de2 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -57,32 +57,43 @@ export default class CodeEditor extends React.Component { inputStyle: 'textarea', extraKeys: { Tab: function (cm) { - let cursor = cm.getCursor() - let line = cm.getLine(cursor.line) + const cursor = cm.getCursor() + const line = cm.getLine(cursor.line) if (cm.somethingSelected()) cm.indentSelection('add') else { - let tabs = cm.getOption('indentWithTabs') + const tabs = cm.getOption('indentWithTabs') if (line.trimLeft() === '- ' || line.trimLeft() === '* ') { cm.execCommand('goLineStart') - if (tabs) cm.execCommand('insertTab'); else cm.execCommand('insertSoftTab') + if (tabs) { + cm.execCommand('insertTab') + } else { + cm.execCommand('insertSoftTab') + } cm.execCommand('goLineEnd') } else { - if (tabs) cm.execCommand('insertTab'); else cm.execCommand('insertSoftTab') + if (tabs) { + cm.execCommand('insertTab') + } else { + cm.execCommand('insertSoftTab') + } } } }, 'Cmd-T': function (cm) { // Do nothing }, - Enter: function (cm) { - let cursor = cm.getCursor() - let line = cm.getLine(cursor.line) - let dash = line.trim().startsWith('- ') - if ((line.trim().startsWith('- ') || line.trim().startsWith('* '))) { + Enter: (cm) => { + const cursor = cm.getCursor() + const line = cm.getLine(cursor.line) + const dash = line.trim().startsWith('- ') + if (line.trim().startsWith('- ') || line.trim().startsWith('* ')) { cm.execCommand('newlineAndIndent') - let range = {line: cursor.line + 1, ch: cm.getLine(cursor.line + 1).length} - console.log(range) - if (dash) cm.replaceRange('- ', range); else cm.replaceRange('* ', range) + const range = {line: cursor.line + 1, ch: cm.getLine(cursor.line + 1).length} + if (dash) { + cm.replaceRange('- ', range) + } else { + cm.replaceRange('* ', range) + } } else { cm.execCommand('newlineAndIndent') } From d6171dc5020984cc752bfb7fa8c6bfeaf16ef7b5 Mon Sep 17 00:00:00 2001 From: kostaldavid8 Date: Thu, 16 Feb 2017 13:18:17 +0100 Subject: [PATCH 03/44] Smart numbered lists, too Has auto increment, but no auto indent on tab, I don't know what to do --- browser/components/CodeEditor.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index 03270de2..ad650ccf 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -86,10 +86,14 @@ export default class CodeEditor extends React.Component { const cursor = cm.getCursor() const line = cm.getLine(cursor.line) const dash = line.trim().startsWith('- ') - if (line.trim().startsWith('- ') || line.trim().startsWith('* ')) { + const numberedListRegex = /(\d+)\. .+/ + const match = line.trim().match(numberedListRegex) + if (line.trim().startsWith('- ') || line.trim().startsWith('* ') || match) { cm.execCommand('newlineAndIndent') const range = {line: cursor.line + 1, ch: cm.getLine(cursor.line + 1).length} - if (dash) { + if (match) { + cm.replaceRange((parseInt(match[1]) + 1) + '. ', range) + } else if (dash) { cm.replaceRange('- ', range) } else { cm.replaceRange('* ', range) From c65db4e2b0b3028e921f6ded3b16450911c97b57 Mon Sep 17 00:00:00 2001 From: kostaldavid8 Date: Fri, 17 Feb 2017 10:03:53 +0100 Subject: [PATCH 04/44] Fixed image drag and drop Added escaping and changed function that wasn't working --- browser/components/CodeEditor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index ad650ccf..19a9b3a7 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -201,13 +201,13 @@ export default class CodeEditor extends React.Component { e.preventDefault() let imagePath = e.dataTransfer.files[0].path let filename = path.basename(imagePath) - let imageMd = `![${filename}](${imagePath})` + let imageMd = `![${encodeURI(filename)}](${encodeURI(imagePath)})` this.insertImage(imageMd) } insertImage (imageMd) { - const textarea = this.editor.getInputField() - textarea.value = textarea.value.substr(0, textarea.selectionStart) + imageMd + textarea.value.substr(textarea.selectionEnd) + const cm = this.editor + cm.setValue(cm.getValue() + imageMd) } render () { From 566fe9258950ed389e54e9bbbfa122d52d283932 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Fri, 3 Mar 2017 02:13:13 +0900 Subject: [PATCH 05/44] change the icon to delete snippet and markdown --- browser/SnippetTab.js | 131 ++++++++++++++++++++++ browser/main/Detail/MarkdownNoteDetail.js | 10 +- browser/main/Detail/NoteDetailInfo.styl | 3 +- browser/main/Detail/SnippetNoteDetail.js | 10 +- 4 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 browser/SnippetTab.js diff --git a/browser/SnippetTab.js b/browser/SnippetTab.js new file mode 100644 index 00000000..2b4f3ad6 --- /dev/null +++ b/browser/SnippetTab.js @@ -0,0 +1,131 @@ +import React from 'react' +import CSSModules from 'browser/lib/CSSModules' +import styles from './SnippetTab.styl' +import context from 'browser/lib/context' + +class SnippetTab extends React.Component { + constructor (props) { + super(props) + + this.state = { + isRenaming: false, + name: props.snippet.name + } + } + + componentWillUpdate (nextProps) { + if (nextProps.snippet.name !== this.props.snippet.name) { + this.setState({ + name: nextProps.snippet.name + }) + } + } + + handleClick (e) { + this.props.onClick(e) + } + + handleContextMenu (e) { + context.popup([ + { + label: 'Rename', + click: (e) => this.handleRenameClick(e) + } + ]) + } + + handleRenameClick (e) { + this.startRenaming() + } + + handleNameInputBlur (e) { + this.handleRename() + } + + handleNameInputChange (e) { + this.setState({ + name: e.target.value + }) + } + + handleNameInputKeyDown (e) { + switch (e.keyCode) { + case 13: + this.handleRename() + break + case 27: + this.setState({ + name: this.props.snippet.name, + isRenaming: false + }) + break + } + } + + handleRename () { + this.setState({ + isRenaming: false + }, () => { + if (this.props.snippet.name !== this.state.name) { + this.props.onRename(this.state.name) + } + }) + } + + handleDeleteButtonClick (e) { + this.props.onDelete(e) + } + + startRenaming () { + this.setState({ + isRenaming: true + }, () => { + this.refs.name.focus() + this.refs.name.select() + }) + } + + render () { + let { isActive, snippet, isDeletable } = this.props + return ( +
+ {!this.state.isRenaming + ? + : this.handleNameInputChange(e)} + onBlur={(e) => this.handleNameInputBlur(e)} + onKeyDown={(e) => this.handleNameInputKeyDown(e)} + /> + } + {isDeletable && + + } +
+ ) + } +} + +SnippetTab.propTypes = { +} + +export default CSSModules(SnippetTab, styles) diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index 65821962..0320b512 100644 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -238,7 +238,15 @@ class MarkdownNoteDetail extends React.Component { diff --git a/browser/main/Detail/NoteDetailInfo.styl b/browser/main/Detail/NoteDetailInfo.styl index 73062d8a..eeffd78a 100644 --- a/browser/main/Detail/NoteDetailInfo.styl +++ b/browser/main/Detail/NoteDetailInfo.styl @@ -60,9 +60,10 @@ $info-margin-under-border = 27px border-radius 17px font-size 14px margin 13px 7px - padding 0 + padding-top 7px border none color $ui-button-color + fill $ui-button-color background-color transparent &:hover opacity 1 diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index 30760589..e5d1908e 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -548,7 +548,15 @@ class SnippetNoteDetail extends React.Component { From a6bd239592c9224f8f81763c6dac33ae3c63de90 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Thu, 9 Mar 2017 13:04:14 -0800 Subject: [PATCH 06/44] Fix the design of li * fix the design of markdown-it-TOC --- browser/components/MarkdownPreview.js | 4 ++++ browser/components/markdown.styl | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/browser/components/MarkdownPreview.js b/browser/components/MarkdownPreview.js index c8e9374b..1802139e 100644 --- a/browser/components/MarkdownPreview.js +++ b/browser/components/MarkdownPreview.js @@ -243,6 +243,10 @@ export default class MarkdownPreview extends React.Component { this.refs.root.contentWindow.document.body.setAttribute('data-theme', theme) this.refs.root.contentWindow.document.body.innerHTML = markdown.render(value) + _.forEach(this.refs.root.contentWindow.document.querySelectorAll('.taskListItem'), (el) => { + el.parentNode.parentNode.style.listStyleType = 'none' + }) + _.forEach(this.refs.root.contentWindow.document.querySelectorAll('a'), (el) => { el.addEventListener('click', this.anchorClickHandler) }) diff --git a/browser/components/markdown.styl b/browser/components/markdown.styl index 9dd769d2..e94ebae8 100644 --- a/browser/components/markdown.styl +++ b/browser/components/markdown.styl @@ -182,8 +182,18 @@ ul list-style-type circle &>li>ul list-style-type square -ul.markdownIt-TOC, ul.markdownIt-TOC ul - list-style-type none +ul.markdownIt-TOC + list-style-type decimal + background-color #ffffff + padding-top 10px + padding-bottom 10px + ul + list-style-type none + a + text-decoration none + color #000000 + a:hover + color #2bac8f ol list-style-type decimal padding-left 2em From e78492983a134714416320cdb5dc82b3bce126ff Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Wed, 22 Feb 2017 01:51:02 +0900 Subject: [PATCH 07/44] Add a shortcut for supporting to input bold --- browser/components/MarkdownEditor.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js index a00a87bf..1014ff52 100644 --- a/browser/components/MarkdownEditor.js +++ b/browser/components/MarkdownEditor.js @@ -11,6 +11,8 @@ class MarkdownEditor extends React.Component { this.escapeFromEditor = ['Control', 'w'] + this.supportBold = ['Control', 'b'] + this.state = { status: 'PREVIEW', renderValue: props.value, @@ -166,6 +168,16 @@ class MarkdownEditor extends React.Component { if (!this.state.isLocked && this.state.status === 'CODE' && this.escapeFromEditor.every(isNoteHandlerKey)) { document.activeElement.blur() } + if (this.state.status === 'CODE' && this.supportBold.every(isNoteHandlerKey)) { + this.addMdAndMoveCaretToCenter('****') + } + } + + addMdAndMoveCaretToCenter (md) { + const currentCaret = this.refs.code.editor.getCursor() + const cmDoc = this.refs.code.editor.getDoc() + cmDoc.replaceRange(md, currentCaret) + this.refs.code.editor.setCursor({line: currentCaret.line, ch: currentCaret.ch + md.length/2}) } handleKeyUp (e) { From c3e92b3b81c7c17c412b5adc8e53612328a145bc Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Sun, 12 Mar 2017 16:04:00 -0700 Subject: [PATCH 08/44] Fix if clauses --- browser/components/MarkdownEditor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js index 1014ff52..2172db99 100644 --- a/browser/components/MarkdownEditor.js +++ b/browser/components/MarkdownEditor.js @@ -160,6 +160,7 @@ class MarkdownEditor extends React.Component { } handleKeyDown(e) { + if (this.state.status !== 'CODE') return false const keyPressed = Object.assign(this.state.keyPressed, { [e.key]: true }) @@ -168,7 +169,7 @@ class MarkdownEditor extends React.Component { if (!this.state.isLocked && this.state.status === 'CODE' && this.escapeFromEditor.every(isNoteHandlerKey)) { document.activeElement.blur() } - if (this.state.status === 'CODE' && this.supportBold.every(isNoteHandlerKey)) { + if (this.supportBold.every(isNoteHandlerKey)) { this.addMdAndMoveCaretToCenter('****') } } From 49a4ec5e167670820dd65793cadec0c5677b0de0 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Wed, 22 Feb 2017 03:33:42 +0900 Subject: [PATCH 09/44] Enable CTRL + B in a word to make it bold --- browser/components/MarkdownEditor.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js index 2172db99..aeed5e08 100644 --- a/browser/components/MarkdownEditor.js +++ b/browser/components/MarkdownEditor.js @@ -11,7 +11,9 @@ class MarkdownEditor extends React.Component { this.escapeFromEditor = ['Control', 'w'] - this.supportBold = ['Control', 'b'] + this.supportMdBold = ['Control', 'b'] + + this.supportMdWordBold = ['Control', ':'] this.state = { status: 'PREVIEW', @@ -169,9 +171,12 @@ class MarkdownEditor extends React.Component { if (!this.state.isLocked && this.state.status === 'CODE' && this.escapeFromEditor.every(isNoteHandlerKey)) { document.activeElement.blur() } - if (this.supportBold.every(isNoteHandlerKey)) { + if (this.supportMdBold.every(isNoteHandlerKey)) { this.addMdAndMoveCaretToCenter('****') } + if (this.supportMdWordBold.every(isNoteHandlerKey)) { + this.addMdBetweenWord('**') + } } addMdAndMoveCaretToCenter (md) { @@ -181,6 +186,14 @@ class MarkdownEditor extends React.Component { this.refs.code.editor.setCursor({line: currentCaret.line, ch: currentCaret.ch + md.length/2}) } + addMdBetweenWord (md) { + const currentCaret = this.refs.code.editor.getCursor() + const word = this.refs.code.editor.findWordAt(currentCaret) + const cmDoc = this.refs.code.editor.getDoc() + cmDoc.replaceRange(md, word.anchor) + cmDoc.replaceRange(md, { line: word.head.line, ch: word.head.ch + md.length }) + } + handleKeyUp (e) { const keyPressed = Object.assign(this.state.keyPressed, { [e.key]: false From 48514d102084ac17cef804e690532f3758ae5bd7 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Sun, 12 Mar 2017 16:07:40 -0700 Subject: [PATCH 10/44] Change an arg name md to mdElement --- browser/components/MarkdownEditor.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js index aeed5e08..b8e44939 100644 --- a/browser/components/MarkdownEditor.js +++ b/browser/components/MarkdownEditor.js @@ -179,19 +179,19 @@ class MarkdownEditor extends React.Component { } } - addMdAndMoveCaretToCenter (md) { + addMdAndMoveCaretToCenter (mdElement) { const currentCaret = this.refs.code.editor.getCursor() const cmDoc = this.refs.code.editor.getDoc() - cmDoc.replaceRange(md, currentCaret) - this.refs.code.editor.setCursor({line: currentCaret.line, ch: currentCaret.ch + md.length/2}) + cmDoc.replaceRange(mdElement, currentCaret) + this.refs.code.editor.setCursor({line: currentCaret.line, ch: currentCaret.ch + mdElement.length/2}) } - addMdBetweenWord (md) { + addMdBetweenWord (mdElement) { const currentCaret = this.refs.code.editor.getCursor() const word = this.refs.code.editor.findWordAt(currentCaret) const cmDoc = this.refs.code.editor.getDoc() - cmDoc.replaceRange(md, word.anchor) - cmDoc.replaceRange(md, { line: word.head.line, ch: word.head.ch + md.length }) + cmDoc.replaceRange(mdElement, word.anchor) + cmDoc.replaceRange(mdElement, { line: word.head.line, ch: word.head.ch + mdElement.length }) } handleKeyUp (e) { From 2f2c500e4ac4a2dce4404fd216c48b7b2e8e6694 Mon Sep 17 00:00:00 2001 From: Kazu Yokomizo Date: Tue, 14 Mar 2017 13:59:59 +0900 Subject: [PATCH 11/44] Change the tray icons. --- resources/tray-icon-default.png | Bin 802 -> 624 bytes resources/tray-icon-default@2x.png | Bin 1506 -> 1113 bytes 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 resources/tray-icon-default.png mode change 100755 => 100644 resources/tray-icon-default@2x.png diff --git a/resources/tray-icon-default.png b/resources/tray-icon-default.png old mode 100755 new mode 100644 index 2b76ee327caaf2bc1ff66bf6785f5aa1f45042ce..08725fb78ce65069618444d13951f048da5474dc GIT binary patch delta 562 zcmV-20?qxR2Ji%sNq-VaL_t(|+T4`iD}zxO$G=#OHsWS!6Ypf&YHEs7l9dZLioZa1 zp)6PO7r1umlKi^iMy8YznW9J-k+OsfuetD}tZ41RbB=fG?CgCv-0{@YdEfV(^Euz1 z=RIHGuSHS5$*$Jc0UCNK{gjp3=U2)I<;vFK;p~sV1Z1EYN`Iw*uv^Li9T1TxN(@vk z3kvfETQgAaaNOOfYSd6ML47ow{Iaagq&x#RNt4UpA-J2G;A?4t)oR7m#DuulnFH2J zpj*?@vN8_yc)d^>8cRTXL!g&)A;^!PY$gGI%! z@??8wCx^~YPU7P13?7e%*ZGl3aD8>9t4R+Wk)dPb<9{5|-P41L@^W5h7JF1CgNW#X zSHu<1PtNd#HRoQ0LWCl1Iz5uD*ylh07*qoM6N<$g1ZwN A82|tP delta 741 zcmV&C4xVW&7l{e(v*79gQkRds6`Vim9|=wsI?7-IN#Sz*d&`x zbzn35_T_!v%)FU-5}8P?R*SL<^W$%s%J8!yNm8oQTB!qYhJV#m{;;Gx+R0M7TxiTG z7AJ*0!xZTYkl*3S^QT$fAZZF_pu%dIfog1HkBh^Wm2q8SRUgIif!OJ zG`W*iR|w(*3Ph;+gC}LqV69PCFF}xd$lV zIPxT2Ha}>&UZzHZvITTzbCp)hpBa9V<1C2~WQ5B`8RLV>1Drwa8$lP&PBNq@(#S5$ z9A~R`K!58UEe*N7BGdq{0MaV=hAs(>UVv15yqjyxb&4-4P-CTJv_5nxSk+Wb)kBe& zs3^FO>cZG84AX-bMfjPSuUB4_7bZsDJTPrO+zaS78xa4vWH^U@!B(RYrS(l{fh~z> zHE-H*TIY35Xr7^Q!?wwAwHv(E(!|&`=p;j9W?qecj-k=n&6kwi&34=XRwAZTgBS4L zu(aFNG_Gx+qV@}XU?_X!J1j&>X{VpouBP;{?mXQFDsmp_sk=~d&#fV)aQdCr{uN*V X#GywB60b!r00000NkvXXu0mjfzteBb diff --git a/resources/tray-icon-default@2x.png b/resources/tray-icon-default@2x.png old mode 100755 new mode 100644 index fea7a99bf94cf396f99473dd1bb64108d954daff..c2a7e17e3ded8abc07aaa07c81719e002f717bc2 GIT binary patch delta 1056 zcmV+*1mFAO3)u*eNPh$SNklTbGQmLsMac2b=u8M-96~ttrf>!IR5X4fY7{A+9?dZpa5kMQodHxBn^+Jw2iBoh=M34GNa(?A_Q{ z2A7?a!?yI@X0t&?Mh5tNK1fSRfp0rITBm0b18;EAa`>4QNZCoH5)%^{tk>&>f`S5= zo1WIY9F3y-z)~-55QR)iPQKzKPnnsSkc`J|Z*N0-dVe~DU+{SJE?rA3>N3Z3xIq-M z%;A7kDUaN|VFbuc+7fJBTpV*baC!97MlHPB0}!&Ysfjr&B8mVxd3JWjU@tE(p$KzLPLmeIflG~)wcpdK z-Cb~XcYgy%H z)j`&xG1yvD4y)xqIf40^8P-Y>{9$D!#1|IA*Ue3^#l%41{G7qcjw@xwT`gd@kyXU{ z@-k~mIbE(`CzEq4Yh!KA=<3AqY%Qd6^70@)A%B6}@#Nep-K7j$QMAUqR9C5KY4C1n z2;Q`}b4!{swkf%NQ%uTPD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Mar 2017 01:36:58 +0900 Subject: [PATCH 12/44] The snippet subtab was successfully deleted. --- browser/main/Detail/SnippetNoteDetail.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index 30760589..73324078 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -259,6 +259,8 @@ class SnippetNoteDetail extends React.Component { this.setState({ note: this.state.note, snippetIndex + }, () => { + this.save() }) } From 4243afb03304f9ca6acb1ed3ed7506f0ddad89b3 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Thu, 16 Mar 2017 02:34:26 +0900 Subject: [PATCH 13/44] remove the extra file, and correct indents --- browser/SnippetTab.js | 131 ----------------------- browser/main/Detail/SnippetNoteDetail.js | 6 +- 2 files changed, 3 insertions(+), 134 deletions(-) delete mode 100644 browser/SnippetTab.js diff --git a/browser/SnippetTab.js b/browser/SnippetTab.js deleted file mode 100644 index 2b4f3ad6..00000000 --- a/browser/SnippetTab.js +++ /dev/null @@ -1,131 +0,0 @@ -import React from 'react' -import CSSModules from 'browser/lib/CSSModules' -import styles from './SnippetTab.styl' -import context from 'browser/lib/context' - -class SnippetTab extends React.Component { - constructor (props) { - super(props) - - this.state = { - isRenaming: false, - name: props.snippet.name - } - } - - componentWillUpdate (nextProps) { - if (nextProps.snippet.name !== this.props.snippet.name) { - this.setState({ - name: nextProps.snippet.name - }) - } - } - - handleClick (e) { - this.props.onClick(e) - } - - handleContextMenu (e) { - context.popup([ - { - label: 'Rename', - click: (e) => this.handleRenameClick(e) - } - ]) - } - - handleRenameClick (e) { - this.startRenaming() - } - - handleNameInputBlur (e) { - this.handleRename() - } - - handleNameInputChange (e) { - this.setState({ - name: e.target.value - }) - } - - handleNameInputKeyDown (e) { - switch (e.keyCode) { - case 13: - this.handleRename() - break - case 27: - this.setState({ - name: this.props.snippet.name, - isRenaming: false - }) - break - } - } - - handleRename () { - this.setState({ - isRenaming: false - }, () => { - if (this.props.snippet.name !== this.state.name) { - this.props.onRename(this.state.name) - } - }) - } - - handleDeleteButtonClick (e) { - this.props.onDelete(e) - } - - startRenaming () { - this.setState({ - isRenaming: true - }, () => { - this.refs.name.focus() - this.refs.name.select() - }) - } - - render () { - let { isActive, snippet, isDeletable } = this.props - return ( -
- {!this.state.isRenaming - ? - : this.handleNameInputChange(e)} - onBlur={(e) => this.handleNameInputBlur(e)} - onKeyDown={(e) => this.handleNameInputKeyDown(e)} - /> - } - {isDeletable && - - } -
- ) - } -} - -SnippetTab.propTypes = { -} - -export default CSSModules(SnippetTab, styles) diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index e5d1908e..7ef1c832 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -552,10 +552,10 @@ class SnippetNoteDetail extends React.Component { - - + + - + From 712301436d8f4db8658af61fb3c74c8f08ed833b Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Thu, 16 Mar 2017 02:54:57 +0900 Subject: [PATCH 14/44] I crrected indents --- browser/main/Detail/MarkdownNoteDetail.js | 18 +++++++++--------- browser/main/Detail/SnippetNoteDetail.js | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index 0320b512..cff43906 100644 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -238,15 +238,15 @@ class MarkdownNoteDetail extends React.Component { diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index 7ef1c832..ddc700a2 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -549,13 +549,13 @@ class SnippetNoteDetail extends React.Component { onClick={(e) => this.handleContextButtonClick(e)} > - - - - - + + + + + - + From 034f46792bbb9f88b46e49b6ff0b9e077a5f735b Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Fri, 17 Mar 2017 03:42:17 +0900 Subject: [PATCH 15/44] ignore # in the code block --- browser/main/Detail/MarkdownNoteDetail.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index 29504351..28a21423 100644 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -65,12 +65,23 @@ class MarkdownNoteDetail extends React.Component { findTitle (value) { let splitted = value.split('\n') let title = null + let markdownInCode = false for (let i = 0; i < splitted.length; i++) { let trimmedLine = splitted[i].trim() - if (trimmedLine.match(/^# .+/)) { - title = trimmedLine.substring(1, trimmedLine.length).trim() - break + if (trimmedLine.match('```')){ + if (markdownInCode) { + markdownInCode = false + } else { + markdownInCode = true + } + } else { + if(!markdownInCode) { + if (trimmedLine.match(/^# +/)){ + title = trimmedLine.substring(1, trimmedLine.length).trim() + break + } + } } } From 70a97a6a2ab132a53dd9060a5cd5fd28137d14f4 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Thu, 16 Mar 2017 13:30:24 -0700 Subject: [PATCH 16/44] Fix a typo --- browser/main/NoteList/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 82c0bbc3..579dbe0b 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -38,7 +38,7 @@ class NoteList extends React.Component { this.focusHandler = () => { this.refs.list.focus() } - this.alertIfSnippetHnalder = () => { + this.alertIfSnippetHandler = () => { this.alertIfSnippet() } @@ -51,7 +51,7 @@ class NoteList extends React.Component { ee.on('list:next', this.selectNextNoteHandler) ee.on('list:prior', this.selectPriorNoteHandler) ee.on('list:focus', this.focusHandler) - ee.on('list:isMarkdownNote', this.alertIfSnippetHnalder) + ee.on('list:isMarkdownNote', this.alertIfSnippetHandler) } componentWillReceiveProps (nextProps) { @@ -70,7 +70,7 @@ class NoteList extends React.Component { ee.off('list:next', this.selectNextNoteHandler) ee.off('list:prior', this.selectPriorNoteHandler) ee.off('list:focus', this.focusHandler) - ee.off('list:isMarkdownNote', this.alertIfSnippetHnalder) + ee.off('list:isMarkdownNote', this.alertIfSnippetHandler) } componentDidUpdate (prevProps) { From b577ca2bc25b5dfc82e1e502edec6475159544bb Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 18 Mar 2017 01:58:15 +0900 Subject: [PATCH 17/44] Refactor the dirty code --- browser/main/Detail/MarkdownNoteDetail.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index 28a21423..5ac00ebc 100644 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -65,22 +65,16 @@ class MarkdownNoteDetail extends React.Component { findTitle (value) { let splitted = value.split('\n') let title = null - let markdownInCode = false + let isMarkdownInCode = false for (let i = 0; i < splitted.length; i++) { let trimmedLine = splitted[i].trim() if (trimmedLine.match('```')){ - if (markdownInCode) { - markdownInCode = false - } else { - markdownInCode = true - } + isMarkdownInCode = !isMarkdownInCode } else { - if(!markdownInCode) { - if (trimmedLine.match(/^# +/)){ - title = trimmedLine.substring(1, trimmedLine.length).trim() - break - } + if(isMarkdownInCode === false && trimmedLine.match(/^# +/)) { + title = trimmedLine.substring(1, trimmedLine.length).trim() + break } } } From fe1c1971380c1b5466d542883dcb5e418e3a1dba Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 18 Mar 2017 03:02:04 +0900 Subject: [PATCH 18/44] reduce indent --- browser/main/Detail/MarkdownNoteDetail.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index 5ac00ebc..2eceef43 100644 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -71,8 +71,7 @@ class MarkdownNoteDetail extends React.Component { let trimmedLine = splitted[i].trim() if (trimmedLine.match('```')){ isMarkdownInCode = !isMarkdownInCode - } else { - if(isMarkdownInCode === false && trimmedLine.match(/^# +/)) { + } else if (isMarkdownInCode === false && trimmedLine.match(/^# +/)) { title = trimmedLine.substring(1, trimmedLine.length).trim() break } From 806c3bbaf97ec5c08c71147d56ab87600751ed5e Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 18 Mar 2017 12:27:43 +0900 Subject: [PATCH 19/44] delete unnecessary `}` and correct the indent --- browser/main/Detail/MarkdownNoteDetail.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index 2eceef43..90f26286 100644 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -69,12 +69,11 @@ class MarkdownNoteDetail extends React.Component { for (let i = 0; i < splitted.length; i++) { let trimmedLine = splitted[i].trim() - if (trimmedLine.match('```')){ + if (trimmedLine.match('```')) { isMarkdownInCode = !isMarkdownInCode } else if (isMarkdownInCode === false && trimmedLine.match(/^# +/)) { - title = trimmedLine.substring(1, trimmedLine.length).trim() - break - } + title = trimmedLine.substring(1, trimmedLine.length).trim() + break } } From c80a26fe0b07e6f247fcfa855d2cca47ab917765 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 18 Mar 2017 13:44:35 +0900 Subject: [PATCH 20/44] dragged svg file is turns not into xml text --- browser/components/CodeEditor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index d17987ce..56f6c93f 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -69,7 +69,8 @@ export default class CodeEditor extends React.Component { 'Cmd-T': function (cm) { // Do nothing } - } + }, + dragDrop: false }) this.setMode(this.props.mode) From af0fdb9277dffc9edaac537d5421d67a1bd608dc Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 18 Mar 2017 14:49:46 +0900 Subject: [PATCH 21/44] move the line under L57 --- browser/components/CodeEditor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/components/CodeEditor.js b/browser/components/CodeEditor.js index 56f6c93f..15a97877 100644 --- a/browser/components/CodeEditor.js +++ b/browser/components/CodeEditor.js @@ -55,6 +55,7 @@ export default class CodeEditor extends React.Component { indentWithTabs: this.props.indentType !== 'space', keyMap: this.props.keyMap, inputStyle: 'textarea', + dragDrop: false, extraKeys: { Tab: function (cm) { if (cm.somethingSelected()) cm.indentSelection('add') @@ -69,8 +70,7 @@ export default class CodeEditor extends React.Component { 'Cmd-T': function (cm) { // Do nothing } - }, - dragDrop: false + } }) this.setMode(this.props.mode) From 4767f15e9b7f81fa5bda0439f748bcdaf8a628e5 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Fri, 17 Mar 2017 23:16:53 -0700 Subject: [PATCH 22/44] Fix the behavior of a feature what locks the editor --- browser/main/Detail/MarkdownNoteDetail.js | 1 + 1 file changed, 1 insertion(+) diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index 90f26286..4a2be4d0 100644 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -219,6 +219,7 @@ class MarkdownNoteDetail extends React.Component { e.preventDefault() ee.emit('editor:lock') this.setState({ isLocked: !this.state.isLocked }) + if (this.state.isLocked) this.focus() } getToggleLockButton () { From 8a5558db550cdadc6b7c78109c674963ab038fb6 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Fri, 17 Mar 2017 23:32:44 -0700 Subject: [PATCH 23/44] Change a name showlockbutton to togglelockbutton --- browser/components/MarkdownEditor.js | 8 ++++---- browser/main/Detail/MarkdownNoteDetail.js | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js index b8e44939..3dd6d15c 100644 --- a/browser/components/MarkdownEditor.js +++ b/browser/components/MarkdownEditor.js @@ -82,7 +82,7 @@ class MarkdownEditor extends React.Component { this.refs.code.blur() this.refs.preview.focus() } - eventEmitter.emit('topbar:showlockbutton') + eventEmitter.emit('topbar:togglelockbutton') }) } } @@ -99,7 +99,7 @@ class MarkdownEditor extends React.Component { this.refs.preview.focus() this.refs.preview.scrollTo(cursorPosition.line) }) - eventEmitter.emit('topbar:showlockbutton') + eventEmitter.emit('topbar:togglelockbutton') } } @@ -115,7 +115,7 @@ class MarkdownEditor extends React.Component { }, () => { this.refs.code.focus() }) - eventEmitter.emit('topbar:showlockbutton') + eventEmitter.emit('topbar:togglelockbutton') } } @@ -152,7 +152,7 @@ class MarkdownEditor extends React.Component { } else { this.refs.code.focus() } - eventEmitter.emit('topbar:showlockbutton') + eventEmitter.emit('topbar:togglelockbutton') } reload () { diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index 4a2be4d0..5513953c 100644 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -31,7 +31,7 @@ class MarkdownNoteDetail extends React.Component { } this.dispatchTimer = null - this.showLockButton = this.handleShowLockButton.bind(this) + this.toggleLockButton = this.handleToggleLockButton.bind(this) } focus () { @@ -39,7 +39,7 @@ class MarkdownNoteDetail extends React.Component { } componentDidMount () { - ee.on('topbar:showlockbutton', this.showLockButton) + ee.on('topbar:togglelockbutton', this.toggleLockButton) } componentWillReceiveProps (nextProps) { @@ -59,7 +59,7 @@ class MarkdownNoteDetail extends React.Component { } componentDidUnmount () { - ee.off('topbar:lock', this.showLockButton) + ee.off('topbar:togglelockbutton', this.toggleLockButton) } findTitle (value) { @@ -230,7 +230,7 @@ class MarkdownNoteDetail extends React.Component { if (e.keyCode === 27) this.handleDeleteCancelButtonClick(e) } - handleShowLockButton () { + handleToggleLockButton () { this.setState({editorStatus: this.refs.content.state.status}) } From e7fd18967b9b4df9077ceee5fa3e8eee5feaf3ba Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Fri, 17 Mar 2017 23:37:22 -0700 Subject: [PATCH 24/44] Change a state name editorStatus to isLockButtonShown --- browser/main/Detail/MarkdownNoteDetail.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index 5513953c..d800be71 100644 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -26,7 +26,7 @@ class MarkdownNoteDetail extends React.Component { title: '', content: '' }, props.note), - editorStatus: false, + isLockButtonShown: false, isLocked: false } this.dispatchTimer = null @@ -231,7 +231,11 @@ class MarkdownNoteDetail extends React.Component { } handleToggleLockButton () { - this.setState({editorStatus: this.refs.content.state.status}) + if (this.refs.content.state.status === 'CODE') { + this.setState({isLockButtonShown: true}) + } else { + this.setState({isLockButtonShown: false}) + } } handleFocus (e) { @@ -279,7 +283,7 @@ class MarkdownNoteDetail extends React.Component { return ( - this.state.editorStatus === 'CODE' ? lockButtonComponent : '' + this.state.isLockButtonShown ? lockButtonComponent : '' ) })()} return ( this.state.isLockButtonShown ? lockButtonComponent : '' diff --git a/browser/main/Detail/MarkdownNoteDetail.styl b/browser/main/Detail/MarkdownNoteDetail.styl index e23296a4..b5ebc26a 100644 --- a/browser/main/Detail/MarkdownNoteDetail.styl +++ b/browser/main/Detail/MarkdownNoteDetail.styl @@ -9,6 +9,34 @@ background-color $ui-noteDetail-backgroundColor box-shadow $note-detail-box-shadow +.control-lockButton + width 34px + height 34px + border-radius 17px + font-size 14px + margin 13px 7px + padding-top 7px + border none + color $ui-button-color + fill $ui-button-color + background-color transparent + &:active + border-color $ui-button--active-backgroundColor + &:hover .control-lockButton-tooltip + opacity 1 + +.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 + .body absolute left right left $note-detail-left-margin @@ -24,3 +52,13 @@ body[data-theme="dark"] border-color $ui-dark-borderColor background-color $ui-dark-noteDetail-backgroundColor box-shadow none + + .control-lockButton + colorDarkDefaultButton() + border-color $ui-dark-borderColor + background-color $ui-dark-noteList-backgroundColor + &:active + border-color $ui-dark-button--active-backgroundColor + + .control-lockButton-tooltip + darkTooltip() diff --git a/browser/main/Detail/NoteDetailInfo.styl b/browser/main/Detail/NoteDetailInfo.styl index eeffd78a..a579d148 100644 --- a/browser/main/Detail/NoteDetailInfo.styl +++ b/browser/main/Detail/NoteDetailInfo.styl @@ -38,7 +38,7 @@ $info-margin-under-border = 27px margin 13px 2px padding 0 border-radius 17px - &:hover .info-right-button-tooltip + &:hover .info-left-button-tooltip opacity 1 &:focus border-color $ui-favorite-star-button-color From cec4b3132c0ee76db0b2d9186be3e00a46946e24 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Sat, 18 Mar 2017 23:45:23 -0700 Subject: [PATCH 27/44] Add a shortcut which jumps to top by Ctrl-G --- browser/main/NoteList/index.js | 25 +++++++++++++++++++++++++ lib/main-menu.js | 7 +++++++ 2 files changed, 32 insertions(+) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 579dbe0b..88f3a3e9 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -42,6 +42,10 @@ class NoteList extends React.Component { this.alertIfSnippet() } + this.jumpToTopHandler = () => { + this.jumpToTop() + } + this.state = { } } @@ -52,6 +56,8 @@ class NoteList extends React.Component { ee.on('list:prior', this.selectPriorNoteHandler) ee.on('list:focus', this.focusHandler) ee.on('list:isMarkdownNote', this.alertIfSnippetHandler) + ee.on('list:top', this.jumpToTopHandler) + ee.on('list:jumpToTop', this.jumpToTopHandler) } componentWillReceiveProps (nextProps) { @@ -71,6 +77,8 @@ class NoteList extends React.Component { ee.off('list:prior', this.selectPriorNoteHandler) ee.off('list:focus', this.focusHandler) ee.off('list:isMarkdownNote', this.alertIfSnippetHandler) + ee.off('list:top', this.jumpToTopHandler) + ee.off('list:jumpToTop', this.jumpToTopHandler) } componentDidUpdate (prevProps) { @@ -324,6 +332,23 @@ class NoteList extends React.Component { } } + jumpToTop() { + if (this.notes == null || this.notes.length === 0) { + return + } + let { router } = this.context + let { location } = this.props + + let targetIndex = 0 + + router.push({ + pathname: location.pathname, + query: { + key: this.notes[targetIndex].storage + '-' + this.notes[targetIndex].key + } + }) + } + render () { let { location, notes, config } = this.props let sortFunc = config.sortBy === 'CREATED_AT' diff --git a/lib/main-menu.js b/lib/main-menu.js index b3a7acc7..2b9a2a99 100644 --- a/lib/main-menu.js +++ b/lib/main-menu.js @@ -183,6 +183,13 @@ var view = { mainWindow.webContents.send('list:prior') } }, + { + label: 'Jump to Top', + accelerator: 'Control + G', + click () { + mainWindow.webContents.send('list:top') + } + }, { type: 'separator' }, From dea0c4287b13078fd85b214e26e71fdf4ff4824b Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Wed, 15 Mar 2017 14:06:43 -0700 Subject: [PATCH 28/44] Fix let to const --- browser/main/NoteList/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 88f3a3e9..7bb3d4e5 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -339,7 +339,7 @@ class NoteList extends React.Component { let { router } = this.context let { location } = this.props - let targetIndex = 0 + const targetIndex = 0 router.push({ pathname: location.pathname, From 31c04de7b6fa406075dd25f911951cf73fb0a8ff Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Sun, 19 Mar 2017 00:17:51 -0700 Subject: [PATCH 29/44] Change the name list:top to list:jumpToTop --- lib/main-menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/main-menu.js b/lib/main-menu.js index 2b9a2a99..2dfe92ea 100644 --- a/lib/main-menu.js +++ b/lib/main-menu.js @@ -187,7 +187,7 @@ var view = { label: 'Jump to Top', accelerator: 'Control + G', click () { - mainWindow.webContents.send('list:top') + mainWindow.webContents.send('list:jumpToTop') } }, { From 525ab900bd7d4ae91020428792555890e229edca Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Sat, 18 Mar 2017 23:44:43 -0700 Subject: [PATCH 30/44] Fix == to === --- browser/main/NoteList/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 7bb3d4e5..b3267d05 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -333,7 +333,7 @@ class NoteList extends React.Component { } jumpToTop() { - if (this.notes == null || this.notes.length === 0) { + if (this.notes === null || this.notes.length === 0) { return } let { router } = this.context From bb0b74e889766f191d3d7199af4a9d850c4c864e Mon Sep 17 00:00:00 2001 From: Kazu Yokomizo Date: Sun, 19 Mar 2017 16:20:55 +0900 Subject: [PATCH 31/44] Changed the tray icon when mouse on. --- resources/tray-icon-dark.png | Bin 802 -> 498 bytes resources/tray-icon-dark@2x.png | Bin 1506 -> 937 bytes resources/tray-icon.png | Bin 802 -> 624 bytes resources/tray-icon@2x.png | Bin 1506 -> 1113 bytes 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 resources/tray-icon-dark.png mode change 100755 => 100644 resources/tray-icon-dark@2x.png mode change 100755 => 100644 resources/tray-icon.png mode change 100755 => 100644 resources/tray-icon@2x.png diff --git a/resources/tray-icon-dark.png b/resources/tray-icon-dark.png old mode 100755 new mode 100644 index 2b76ee327caaf2bc1ff66bf6785f5aa1f45042ce..4aa26bfd39d141d73e9efc3951579473f8979246 GIT binary patch delta 436 zcmV;l0Zaa(2J!=tNPhv8NklZ)ErOe~i*^!RJaKce;0Lh9?Uwj|_^;+dau*LY@Z&Y<%Rk9`FKrb4QHw*I zwANc=lj8VpW?_mQvRi_R&nejC^T4-A>=9Kk4LHZd+T)YJ=V zGZ^vRHaG<@+<&z&a73+ghQc`32h6>I9duz=q^7|-=+bRslFc2bj->TqcCpYI>;u?q zcZRW{Loan!g)Pd=_erjQn(|an;kz7((SM}KJL@(vgfrI_cP?n(9$xLj6k-4M*SD50 zdsDs(D&$JfBAz&Mp+Y|@%8t1&rasY0A9{)HF}qK4(=GTc<7+?`z3`M>@UJPOkhIz- e_Al*IfB^u}+e`OSjX)p(0000;aNzXcSQ{;TNVDF)xfH(7&D!+lu#KLYP2 za!;Wn%!)KD=6}KWiQE&VTTJUReqxxeD5GqtgYJBI-W2o1*!4VHJz~WUIDIo{uf;B4 zVULf_yHAnd>7i<^M)O}@H~o)8iNo|WQ?>H=22#ol1`V-DG7UL;X{WMJK87#uZM3aR z?Y)QP5rF;rJO%LK=v4~z^ffJT$upSrd@!H&CBS7u4g~u*3@=}!K{`OI#7)@?fe$xG|SK^uMKSM#6mrgqs3b_X; z;5hOmT{b^xxn8D5g0cm4W^ zXfal^LBaJ3t})zZY+HRvQmV_#;CevYBh+0B=f+|72}09GQVQ-c@q z-mtXW)ikbcprZB*d|)Vh8ZO=anG$GrEvP4*8UY> Y0K}n32okSFE&u=k07*qoM6N<$g2_m4&j0`b diff --git a/resources/tray-icon-dark@2x.png b/resources/tray-icon-dark@2x.png old mode 100755 new mode 100644 index fea7a99bf94cf396f99473dd1bb64108d954daff..5e58d5ef08d410b2cf46dfd62aed2c5951204420 GIT binary patch delta 878 zcmV-!1CjjV3#kW?NPh!MNklflE(vFZHNX}D zcL*a8pA(L{An#0+kPudcln@L0#^|$xkFamDV?yCOnDV9B*SIgT9GOfKQOAh0&(yWg zCC6xF=YkJ{147;vVfMv7F;3QrM99fP5&_>C?7~Sp_)F$B9uh3;J(K?&H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XXu0mjfzteBb diff --git a/resources/tray-icon@2x.png b/resources/tray-icon@2x.png old mode 100755 new mode 100644 index fea7a99bf94cf396f99473dd1bb64108d954daff..c2a7e17e3ded8abc07aaa07c81719e002f717bc2 GIT binary patch delta 1056 zcmV+*1mFAO3)u*eNPh$SNklTbGQmLsMac2b=u8M-96~ttrf>!IR5X4fY7{A+9?dZpa5kMQodHxBn^+Jw2iBoh=M34GNa(?A_Q{ z2A7?a!?yI@X0t&?Mh5tNK1fSRfp0rITBm0b18;EAa`>4QNZCoH5)%^{tk>&>f`S5= zo1WIY9F3y-z)~-55QR)iPQKzKPnnsSkc`J|Z*N0-dVe~DU+{SJE?rA3>N3Z3xIq-M z%;A7kDUaN|VFbuc+7fJBTpV*baC!97MlHPB0}!&Ysfjr&B8mVxd3JWjU@tE(p$KzLPLmeIflG~)wcpdK z-Cb~XcYgy%H z)j`&xG1yvD4y)xqIf40^8P-Y>{9$D!#1|IA*Ue3^#l%41{G7qcjw@xwT`gd@kyXU{ z@-k~mIbE(`CzEq4Yh!KA=<3AqY%Qd6^70@)A%B6}@#Nep-K7j$QMAUqR9C5KY4C1n z2;Q`}b4!{swkf%NQ%uTPDFI{N^8d*tsUQezN7ng zdz5+*Ay6v*Klb;9?(C?lf`Q&%2m}J6uz&PYWz5v78BgpC)dBT1J2hoA4sPk5mflOW zhz=%dQN~}lwi+2E8qJJ!yfRm3)@i}oJ07-IRjTz~r{0SW6LRXsK&aDcbVN6H#0i>+ zf%Vs|RJIyJbuh~gbKVTmQoPyVskEpZG5TKEGO+5kK&`a?stGZPS(mDSA0mqAKN;3f a0R{kEB#inHhCn+20000p0i3S01H;3Kp!6=Pt4Qv#nim;8;t9&AtASlu1p{nj5fScDD@-FTC+dUC^3?W>@wStOMvQ z0Uof=301ic4rajn_Yy1&k{h`39b0<5#{H7Wo2Us`gnurx=wQFRkPQi-m1n1fJSzbU zDIm^rW_QcM+!z?1y!)H{IOW9fnAC01p{pVWQ|$fX)%R!<>2sVjQHu4Zx|M4R!|MQi z)6UXQ)-x335#`Z z0AK*vzwb~@kg5cF!%?t1i+#SRz?SDUgcmn-Ooj<|826b)~@m~ z6g|p5i1xDMtq0la(@pMJ&6>`^78#FLc>SIOR_&+t+kB|@`^gdEWQL_%b(I>iP-*Mz z@pS{_uA;oDa6BoOk{p(OB~^(?cNt(_t$+4Vnc}sqS$OjT?e!m44QbUPieEVxO)bU5 zhbrrkC`X8?c2BHcefu*WEo7~yW?ps~G~#erJyC)1u2D$TO*woSbICGT#f^}>AV#8q zoH}yGI{)p18&$yilLPt~QvRxj=Zh!%>fQh;pKOBQ2d?yg&aWF^xuj%Se*`9nvwtN_ z7gfNs_%nL=RDB0foKrem#?}EsifZ2+{1gQsM39&#CCpoZ=>zXBVuBgzu6>hmq^$k| zv(<{#>3=Sll{|j(?BVv4)}mF5!_$x_66SZVedBnOSz2x+N&r!7i_P-p;09;OPo9nI zMmyhCv6aVR(M4Q>K1KfNSOuWoa(|N#Os`&Me)DWNv5;I^?JL{+61*9QUYD&k>dR0q z_>lt~TWS|A*?OHHG%r$k5Ski|miu7I%RN98x<7*50ec(Psker{ni&*mpJ37Ko^aa? zG( Date: Sun, 19 Mar 2017 00:41:55 -0700 Subject: [PATCH 32/44] Fix a bug which cannot read a property when moves to other folder on locking --- browser/components/MarkdownEditor.js | 8 ++++---- browser/main/Detail/MarkdownNoteDetail.js | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js index 3dd6d15c..9bb50a87 100644 --- a/browser/components/MarkdownEditor.js +++ b/browser/components/MarkdownEditor.js @@ -82,7 +82,7 @@ class MarkdownEditor extends React.Component { this.refs.code.blur() this.refs.preview.focus() } - eventEmitter.emit('topbar:togglelockbutton') + eventEmitter.emit('topbar:togglelockbutton', this.state.status) }) } } @@ -99,7 +99,7 @@ class MarkdownEditor extends React.Component { this.refs.preview.focus() this.refs.preview.scrollTo(cursorPosition.line) }) - eventEmitter.emit('topbar:togglelockbutton') + eventEmitter.emit('topbar:togglelockbutton', this.state.status) } } @@ -115,7 +115,7 @@ class MarkdownEditor extends React.Component { }, () => { this.refs.code.focus() }) - eventEmitter.emit('topbar:togglelockbutton') + eventEmitter.emit('topbar:togglelockbutton', this.state.status) } } @@ -152,7 +152,7 @@ class MarkdownEditor extends React.Component { } else { this.refs.code.focus() } - eventEmitter.emit('topbar:togglelockbutton') + eventEmitter.emit('topbar:togglelockbutton', this.state.status) } reload () { diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index 520c0b90..b475d71e 100644 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -230,8 +230,9 @@ class MarkdownNoteDetail extends React.Component { if (e.keyCode === 27) this.handleDeleteCancelButtonClick(e) } - handleToggleLockButton () { - if (this.props.config.editor.switchPreview === 'BLUR' && this.refs.content.state.status === 'CODE') { + handleToggleLockButton (event, noteStatus) { + // first argument event is not used + if (this.props.config.editor.switchPreview === 'BLUR' && noteStatus === 'CODE') { this.setState({isLockButtonShown: true}) } else { this.setState({isLockButtonShown: false}) From 2af86dfa3ea7ddec4cb908bd52525b68a35b8992 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Sun, 19 Mar 2017 01:02:47 -0700 Subject: [PATCH 33/44] Fix the action of hover --- browser/main/Detail/MarkdownNoteDetail.styl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/browser/main/Detail/MarkdownNoteDetail.styl b/browser/main/Detail/MarkdownNoteDetail.styl index b5ebc26a..dc320c9b 100644 --- a/browser/main/Detail/MarkdownNoteDetail.styl +++ b/browser/main/Detail/MarkdownNoteDetail.styl @@ -22,8 +22,10 @@ background-color transparent &:active border-color $ui-button--active-backgroundColor - &:hover .control-lockButton-tooltip - opacity 1 + &:hover + background-color $ui-button--hover-backgroundColor + .control-lockButton-tooltip + opacity 1 .control-lockButton-tooltip tooltip() From 45111e161064e493536b22d788fbd2f2f2196be9 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Sun, 19 Mar 2017 01:20:04 -0700 Subject: [PATCH 34/44] Change the styleName info-right-button to control-trashButton because it's not good name * fix the position of lock button --- browser/main/Detail/MarkdownNoteDetail.js | 2 +- browser/main/Detail/MarkdownNoteDetail.styl | 24 +++++++++++++++++++++ browser/main/Detail/NoteDetailInfo.styl | 24 --------------------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/browser/main/Detail/MarkdownNoteDetail.js b/browser/main/Detail/MarkdownNoteDetail.js index b475d71e..d4aa6242 100644 --- a/browser/main/Detail/MarkdownNoteDetail.js +++ b/browser/main/Detail/MarkdownNoteDetail.js @@ -290,7 +290,7 @@ class MarkdownNoteDetail extends React.Component { this.state.isLockButtonShown ? lockButtonComponent : '' ) })()} -