Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
01891d4
Added the auto-updating numbered list to the middle of a list
richardtks Nov 10, 2018
2908884
drag and drop image from browser
daiyam Nov 25, 2018
629d4a8
fixed delete note not navigate to next note
ZeroX-DG Nov 27, 2018
c2e4bae
fix regex to correctly match the `src` attribute when there is a `dat…
daiyam Nov 28, 2018
900f20f
handle all dropped images
daiyam Nov 28, 2018
aa20bc7
Fixed lock button behaviour and display
miguelalexbt Nov 29, 2018
2943c5f
Sync with upstream
miguelalexbt Dec 12, 2018
c5de940
Fixed bug where icon was hidden
miguelalexbt Dec 12, 2018
3b110bc
WIP
miguelalexbt Dec 13, 2018
37340d0
Fixed issue with double and right click
miguelalexbt Dec 13, 2018
6631f98
Removed debug log
miguelalexbt Dec 13, 2018
7f6d4ac
Fixed lock button not appearing
miguelalexbt Dec 19, 2018
04fdb67
#2194 - fixes Hotkey not working
rahgurung Jan 2, 2019
406e230
Fix bullet position of LaTeX equation in list
Foo-x Jan 10, 2019
aac13dc
Updated build.md to include directions for checking out PRs
Jan 12, 2019
5e9bd2f
escaped angle brackets
Jan 12, 2019
7b8fb56
fixed error in url
Jan 12, 2019
6fb72bd
minor typo
Jan 12, 2019
e298739
fixed typo
Jan 12, 2019
47d7cef
Update copywrite year
Jan 12, 2019
a8e601e
Update InfoTab.js
Jan 13, 2019
a0bfd9e
Disables updates in development mode
Jan 13, 2019
fa77cda
whitespace
Jan 13, 2019
951a126
Update LICENSE
Jan 13, 2019
038154c
Removed uneeded "electron-is-dev" package
Jan 14, 2019
99b53f4
added filter.
Jan 14, 2019
8d81706
Added a few more checks in related methods to prevent simular errors
Jan 14, 2019
f566b56
add zoom-in and zoom-out action of images #1448
roottool Jan 15, 2019
72df418
DRY my code #1448
roottool Jan 16, 2019
ea5970a
change a magnification by image size #1448
roottool Jan 16, 2019
294bf74
change variable name #1448
roottool Jan 16, 2019
3fe45e9
Added cheatsheets to menu
Jan 17, 2019
a0da4f9
Merge pull request #2795 from MiloTodt/update-build.md
Rokt33r Jan 17, 2019
743a900
Merge pull request #2797 from MiloTodt/patch-1
Rokt33r Jan 17, 2019
3d9b85d
Merge pull request #2811 from MiloTodt/Add_cheatsheets_to_menu
Rokt33r Jan 17, 2019
eea01f1
Added catch for exceptions, removed uneeded duplicate test.
Jan 18, 2019
304b83b
Merge pull request #2801 from MiloTodt/issue-2799-add_storage
Rokt33r Jan 21, 2019
c3a9808
change to isDev
Jan 21, 2019
e43c7e9
Merge pull request #2598 from richardtks/fix-number-list
Rokt33r Jan 22, 2019
b328654
fixed app body background (#2791)
ZeroX-DG Jan 22, 2019
9270e59
Merge pull request #2786 from Foo-x/2232
Rokt33r Jan 22, 2019
667ece7
Update main-app.js
Jan 23, 2019
2b6c380
Merge pull request #2774 from gurungrahul2/2194
Rokt33r Jan 23, 2019
c0f68dc
Merge pull request #2798 from MiloTodt/disable-updates-in-dev
Rokt33r Jan 23, 2019
96ab8ec
Merge pull request #2661 from miguelalexbt/bugfix-2121
Rokt33r Jan 23, 2019
a1deb15
Merge pull request #2651 from ZeroX-DG/fix-delete-note
Rokt33r Jan 23, 2019
33fb030
Reduced the count of calculation
roottool Jan 25, 2019
4cce52f
changed default editor font #1995
roottool Jan 25, 2019
1683d63
Modified indent
roottool Jan 25, 2019
4b14697
v0.11.13
Rokt33r Jan 26, 2019
79254a5
Update contributors
Rokt33r Jan 26, 2019
74535c9
Update yarn.lock
Rokt33r Jan 26, 2019
a113b99
Strange url-handling reverted + tests modified so that they might fin…
ehhc Jan 26, 2019
127da40
possibly fix for the broken test...
ehhc Jan 26, 2019
472496d
possibly fix for the broken test...
ehhc Jan 26, 2019
7165c45
possibly fix for the broken test...
ehhc Jan 26, 2019
5e87ec2
Specified MarkdownPreview class
roottool Jan 27, 2019
543c31c
Merge pull request #2831 from roottool/change_default_editor_font#1995
Rokt33r Jan 28, 2019
950d31a
Merge pull request #2809 from roottool/zoom-in-and-out-image#1448
Rokt33r Jan 28, 2019
a85a27f
- fix bad regex
daiyam Jan 29, 2019
b1c6c04
fix guardrails errors
daiyam Jan 29, 2019
6960c8b
Merge pull request #2835 from ehhc/fix_broken_attachments
Rokt33r Jan 30, 2019
8061390
fix: GIFs don't animate
Aaron-Bird Jan 30, 2019
f1b929c
Merge pull request #2848 from daiyam/fix-gallery
Rokt33r Jan 31, 2019
62ab444
Fix grammer error
K-Sato1995 Jan 31, 2019
851d3ba
fix image path when the dropped image's url contains a query
daiyam Jan 31, 2019
885f656
Merge pull request #2856 from K-Sato1995/fix/grammer-error#2844
Rokt33r Feb 1, 2019
215484c
add tests
daiyam Feb 1, 2019
53ff693
Merge pull request #2852 from Aaron-Bird/bug-gif
Rokt33r Feb 4, 2019
0f232b3
FIX #2853 Allow "#" in title
zzdjk6 Feb 4, 2019
cd301d5
Merge branch 'master' into drop-browser-image
daiyam Feb 4, 2019
de76f55
fix gif
daiyam Feb 4, 2019
10ea5d0
avoid converting SVG
daiyam Feb 4, 2019
e0d9cf7
fix dropping image from Firefox on Linux
daiyam Feb 4, 2019
54de57e
Merge pull request #2863 from zzdjk6/master
Rokt33r Feb 5, 2019
8b8d915
Merge pull request #2642 from daiyam/drop-browser-image
Rokt33r Feb 5, 2019
e53717c
v0.11.14
Rokt33r Feb 8, 2019
2ff655d
Check update if the app is packaged
Rokt33r Feb 8, 2019
78c00b1
v0.11.15
Rokt33r Feb 8, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ GPL-3.0

Boostnote - an open source note-taking app made for programmers just like you.

Copyright (C) 2017 - 2018 BoostIO
Copyright (C) 2017 - 2019 BoostIO

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
9 changes: 3 additions & 6 deletions browser/components/CodeEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -888,10 +888,7 @@ export default class CodeEditor extends React.Component {
handlePaste (editor, forceSmartPaste) {
const { storageKey, noteKey, fetchUrlTitle, enableSmartPaste } = this.props

const isURL = str => {
const matcher = /^(?:\w+:)?\/\/([^\s\.]+\.\S{2}|localhost[\:?\d]*)\S*$/
return matcher.test(str)
}
const isURL = str => /(?:^\w+:|^)\/\/(?:[^\s\.]+\.\S{2}|localhost[\:?\d]*)/.test(str)

const isInLinkTag = editor => {
const startCursor = editor.getCursor('start')
Expand Down Expand Up @@ -964,7 +961,7 @@ export default class CodeEditor extends React.Component {
} else {
const image = clipboard.readImage()
if (!image.isEmpty()) {
attachmentManagement.handlePastNativeImage(
attachmentManagement.handlePasteNativeImage(
this,
storageKey,
noteKey,
Expand Down Expand Up @@ -1109,7 +1106,7 @@ export default class CodeEditor extends React.Component {
iconv.encodingExists(_charset)
? _charset
: 'utf-8'
resolve(iconv.decode(new Buffer(buff), charset).toString())
resolve(iconv.decode(Buffer.from(buff), charset).toString())
} catch (e) {
reject(e)
}
Expand Down
5 changes: 3 additions & 2 deletions browser/components/MarkdownEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class MarkdownEditor extends React.Component {
this.supportMdSelectionBold = [16, 17, 186]

this.state = {
status: props.config.editor.switchPreview === 'RIGHTCLICK' ? props.config.editor.delfaultStatus : 'PREVIEW',
status: props.config.editor.switchPreview === 'RIGHTCLICK' ? props.config.editor.delfaultStatus : 'CODE',
renderValue: props.value,
keyPressed: new Set(),
isLocked: false
isLocked: props.isLocked
}

this.lockEditorCode = () => this.handleLockEditor()
Expand Down Expand Up @@ -76,6 +76,7 @@ class MarkdownEditor extends React.Component {
}

handleContextMenu (e) {
if (this.state.isLocked) return
const { config } = this.props
if (config.editor.switchPreview === 'RIGHTCLICK') {
const newStatus = this.state.status === 'PREVIEW' ? 'CODE' : 'PREVIEW'
Expand Down
75 changes: 75 additions & 0 deletions browser/components/MarkdownPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,81 @@ export default class MarkdownPreview extends React.Component {
)
}
)

const markdownPreviewIframe = document.querySelector('.MarkdownPreview')
const rect = markdownPreviewIframe.getBoundingClientRect()
const imgList = markdownPreviewIframe.contentWindow.document.body.querySelectorAll('img')
for (const img of imgList) {
img.onclick = () => {
const widthMagnification = document.body.clientWidth / img.width
const heightMagnification = document.body.clientHeight / img.height
const baseOnWidth = widthMagnification < heightMagnification
const magnification = baseOnWidth ? widthMagnification : heightMagnification

const zoomImgWidth = img.width * magnification
const zoomImgHeight = img.height * magnification
const zoomImgTop = (document.body.clientHeight - zoomImgHeight) / 2
const zoomImgLeft = (document.body.clientWidth - zoomImgWidth) / 2
const originalImgTop = img.y + rect.top
const originalImgLeft = img.x + rect.left
const originalImgRect = {
top: `${originalImgTop}px`,
left: `${originalImgLeft}px`,
width: `${img.width}px`,
height: `${img.height}px`
}
const zoomInImgRect = {
top: `${baseOnWidth ? zoomImgTop : 0}px`,
left: `${baseOnWidth ? 0 : zoomImgLeft}px`,
width: `${zoomImgWidth}px`,
height: `${zoomImgHeight}px`
}
const animationSpeed = 300

const zoomImg = document.createElement('img')
zoomImg.src = img.src
zoomImg.style = `
position: absolute;
top: ${baseOnWidth ? zoomImgTop : 0}px;
left: ${baseOnWidth ? 0 : zoomImgLeft}px;
width: ${zoomImgWidth};
height: ${zoomImgHeight}px;
`
zoomImg.animate([
originalImgRect,
zoomInImgRect
], animationSpeed)

const overlay = document.createElement('div')
overlay.style = `
background-color: rgba(0,0,0,0.5);
cursor: zoom-out;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: ${document.body.clientHeight}px;
z-index: 100;
`
overlay.onclick = () => {
zoomImg.style = `
position: absolute;
top: ${originalImgTop}px;
left: ${originalImgLeft}px;
width: ${img.width}px;
height: ${img.height}px;
`
const zoomOutImgAnimation = zoomImg.animate([
zoomInImgRect,
originalImgRect
], animationSpeed)
zoomOutImgAnimation.onfinish = () => overlay.remove()
}

overlay.appendChild(zoomImg)
document.body.appendChild(overlay)
}
}
}

focus () {
Expand Down
3 changes: 3 additions & 0 deletions browser/components/markdown.styl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ body
// allow inline line breaks
.katex
white-space initial
.katex .katex-html
display inline-flex
.katex .mfrac>.vlist>span:nth-child(2)
top 0 !important
.katex-error
Expand Down Expand Up @@ -163,6 +165,7 @@ p
white-space pre-line
word-wrap break-word
img
cursor zoom-in
max-width 100%
strong, b
font-weight bold
Expand Down
2 changes: 1 addition & 1 deletion browser/lib/markdownTextHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function strip (input) {
.replace(/\[(.*?)\][\[\(].*?[\]\)]/g, '$1')
.replace(/>/g, '')
.replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, '')
.replace(/^#{1,6}\s*([^#]*)\s*(#{1,6})?/gm, '$1')
.replace(/^#{1,6}\s*/gm, '')
.replace(/(`{3,})(.*?)\1/gm, '$2')
.replace(/^-{3,}\s*$/g, '')
.replace(/`(.+?)`/g, '$1')
Expand Down
21 changes: 16 additions & 5 deletions browser/main/Detail/MarkdownNoteDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ class MarkdownNoteDetail extends React.Component {
content: '',
linesHighlighted: []
}, props.note),
isLockButtonShown: false,
isLockButtonShown: props.config.editor.type !== 'SPLIT',
isLocked: false,
editorType: props.config.editor.type
editorType: props.config.editor.type,
switchPreview: props.config.editor.switchPreview
}

this.dispatchTimer = null
Expand All @@ -65,6 +66,9 @@ class MarkdownNoteDetail extends React.Component {
})
ee.on('hotkey:deletenote', this.handleDeleteNote.bind(this))
ee.on('code:generate-toc', this.generateToc)

// Focus content if using blur or double click
if (this.state.switchPreview === 'BLUR' || this.state.switchPreview === 'DBL_CLICK') this.focus()
}

componentWillReceiveProps (nextProps) {
Expand Down Expand Up @@ -96,7 +100,12 @@ class MarkdownNoteDetail extends React.Component {
handleUpdateContent () {
const { note } = this.state
note.content = this.refs.content.value
note.title = markdown.strip(striptags(findNoteTitle(note.content, this.props.config.editor.enableFrontMatterTitle, this.props.config.editor.frontMatterTitleField)))

let title = findNoteTitle(note.content, this.props.config.editor.enableFrontMatterTitle, this.props.config.editor.frontMatterTitleField)
title = striptags(title)
title = markdown.strip(title)
note.title = title

this.updateNote(note)
}

Expand Down Expand Up @@ -294,7 +303,7 @@ class MarkdownNoteDetail extends React.Component {

handleToggleLockButton (event, noteStatus) {
// first argument event is not used
if (this.props.config.editor.switchPreview === 'BLUR' && noteStatus === 'CODE') {
if (noteStatus === 'CODE') {
this.setState({isLockButtonShown: true})
} else {
this.setState({isLockButtonShown: false})
Expand All @@ -320,7 +329,8 @@ class MarkdownNoteDetail extends React.Component {
}

handleSwitchMode (type) {
this.setState({ editorType: type }, () => {
// If in split mode, hide the lock button
this.setState({ editorType: type, isLockButtonShown: !(type === 'SPLIT') }, () => {
this.focus()
const newConfig = Object.assign({}, this.props.config)
newConfig.editor.type = type
Expand Down Expand Up @@ -365,6 +375,7 @@ class MarkdownNoteDetail extends React.Component {
noteKey={note.key}
linesHighlighted={note.linesHighlighted}
onChange={this.handleUpdateContent.bind(this)}
isLocked={this.state.isLocked}
ignorePreviewPointerEvents={ignorePreviewPointerEvents}
/>
} else {
Expand Down
17 changes: 11 additions & 6 deletions browser/main/NoteList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -656,14 +656,18 @@ class NoteList extends React.Component {
})
)
.then((data) => {
data.forEach((item) => {
dispatch({
type: 'DELETE_NOTE',
storageKey: item.storageKey,
noteKey: item.noteKey
const dispatchHandler = () => {
data.forEach((item) => {
dispatch({
type: 'DELETE_NOTE',
storageKey: item.storageKey,
noteKey: item.noteKey
})
})
})
}
ee.once('list:next', dispatchHandler)
})
.then(() => ee.emit('list:next'))
.catch((err) => {
console.error('Cannot Delete note: ' + err)
})
Expand All @@ -687,6 +691,7 @@ class NoteList extends React.Component {
})
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('EDIT_NOTE')
})
.then(() => ee.emit('list:next'))
.catch((err) => {
console.error('Notes could not go to trash: ' + err)
})
Expand Down
4 changes: 4 additions & 0 deletions browser/main/global.styl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ modalBackColor = white


body[data-theme="dark"]
background-color $ui-dark-backgroundColor
::-webkit-scrollbar-thumb
background-color rgba(0, 0, 0, 0.3)
.ModalBase
Expand Down Expand Up @@ -148,6 +149,7 @@ body[data-theme="dark"]
z-index modalZIndex + 5

body[data-theme="solarized-dark"]
background-color $ui-solarized-dark-backgroundColor
::-webkit-scrollbar-thumb
background-color rgba(0, 0, 0, 0.3)
.ModalBase
Expand All @@ -157,6 +159,7 @@ body[data-theme="solarized-dark"]
color: $ui-solarized-dark-text-color

body[data-theme="monokai"]
background-color $ui-monokai-backgroundColor
::-webkit-scrollbar-thumb
background-color rgba(0, 0, 0, 0.3)
.ModalBase
Expand All @@ -166,6 +169,7 @@ body[data-theme="monokai"]
color: $ui-monokai-text-color

body[data-theme="dracula"]
background-color $ui-dracula-backgroundColor
::-webkit-scrollbar-thumb
background-color rgba(0, 0, 0, 0.3)
.ModalBase
Expand Down
4 changes: 2 additions & 2 deletions browser/main/lib/ConfigManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const DEFAULT_CONFIG = {
theme: 'base16-light',
keyMap: 'sublime',
fontSize: '14',
fontFamily: win ? 'Segoe UI' : 'Monaco, Consolas',
fontFamily: win ? 'Consolas' : 'Monaco',
indentType: 'space',
indentSize: '2',
enableRulers: false,
Expand Down Expand Up @@ -211,7 +211,7 @@ function assignConfigValues (originalConfig, rcConfig) {
function rewriteHotkey (config) {
const keys = [...Object.keys(config.hotkey)]
keys.forEach(key => {
config.hotkey[key] = config.hotkey[key].replace(/Cmd/g, 'Command')
config.hotkey[key] = config.hotkey[key].replace(/Cmd\s/g, 'Command ')
config.hotkey[key] = config.hotkey[key].replace(/Opt\s/g, 'Option ')
})
return config
Expand Down
Loading