mirror of
https://github.com/wassname/nvatom.git
synced 2026-09-11 12:30:45 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74735eec82 | ||
|
|
fa873af344 | ||
|
|
a31f490a70 | ||
|
|
27f2a5bb8d | ||
|
|
95093df286 | ||
|
|
5e4345f719 | ||
|
|
cee47a8fd7 | ||
|
|
15bf1e741b | ||
|
|
bd19c270b3 | ||
|
|
b5f7ba7b75 | ||
|
|
da888fa461 | ||
|
|
97830b31db |
+7
-1
@@ -1,5 +1,11 @@
|
|||||||
|
## 0.8.0
|
||||||
|
- Add a feature to delete an empty note automatically when closing its pane
|
||||||
|
|
||||||
|
## 0.7.0
|
||||||
|
- Add `extensions` setting
|
||||||
|
|
||||||
## 0.5.0
|
## 0.5.0
|
||||||
- Add `useLunrPipeline` feature
|
- Add `useLunrPipeline` setting
|
||||||
- Improve autoselect/autocomplete logic
|
- Improve autoselect/autocomplete logic
|
||||||
- Fix a bug that autocomplete feature does not work
|
- Fix a bug that autocomplete feature does not work
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ Since keymaps overlap with `notational-velocity`, follow the menu *Packages > nv
|
|||||||
|
|
||||||
[1]: http://notational.net/
|
[1]: http://notational.net/
|
||||||
[2]: http://daringfireball.net/projects/markdown/syntax
|
[2]: http://daringfireball.net/projects/markdown/syntax
|
||||||
[3]: https://travis-ci.org/seongjaelee/notational-velocity.svg?branch=master
|
[3]: https://travis-ci.org/seongjaelee/nvatom.svg?branch=master
|
||||||
[4]: https://travis-ci.org/seongjaelee/notational-velocity
|
[4]: https://travis-ci.org/seongjaelee/nvatom
|
||||||
[5]: https://cloud.githubusercontent.com/assets/948301/7246990/2e2b4c6e-e7b9-11e4-93b0-57954e011e81.gif
|
[5]: https://cloud.githubusercontent.com/assets/948301/7246990/2e2b4c6e-e7b9-11e4-93b0-57954e011e81.gif
|
||||||
[6]: https://github.com/seongjaelee/notational-velocity/issues/25
|
[6]: https://github.com/seongjaelee/nvatom/issues/25
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class NotationalVelocityView extends SelectListView
|
|||||||
@skipPopulateList = false
|
@skipPopulateList = false
|
||||||
@prevCursorPosition = 0
|
@prevCursorPosition = 0
|
||||||
@documentsLoaded = false
|
@documentsLoaded = false
|
||||||
@docQuery = new DocQuery(@rootDirectory, {recursive: true})
|
@docQuery = new DocQuery(@rootDirectory, {recursive: true, extensions: atom.config.get('nvatom.extensions')})
|
||||||
@docQuery.on "ready", () =>
|
@docQuery.on "ready", () =>
|
||||||
@documentsLoaded = true
|
@documentsLoaded = true
|
||||||
@setLoading()
|
@setLoading()
|
||||||
@@ -92,7 +92,8 @@ class NotationalVelocityView extends SelectListView
|
|||||||
item = @getSelectedItem()
|
item = @getSelectedItem()
|
||||||
filePath = null
|
filePath = null
|
||||||
sanitizedQuery = @getFilterQuery().replace(/\s+$/, '')
|
sanitizedQuery = @getFilterQuery().replace(/\s+$/, '')
|
||||||
calculatedPath = path.join(@rootDirectory, sanitizedQuery + '.md')
|
extension = if atom.config.get('nvatom.extensions').length then atom.config.get('nvatom.extensions')[0] else '.md'
|
||||||
|
calculatedPath = path.join(@rootDirectory, sanitizedQuery + extension)
|
||||||
if item?
|
if item?
|
||||||
filePath = item.filePath
|
filePath = item.filePath
|
||||||
else if fs.existsSync(calculatedPath)
|
else if fs.existsSync(calculatedPath)
|
||||||
|
|||||||
@@ -9,6 +9,13 @@ module.exports =
|
|||||||
description: 'The directory to archive notes'
|
description: 'The directory to archive notes'
|
||||||
type: 'string'
|
type: 'string'
|
||||||
default: path.join(process.env.ATOM_HOME, 'nvatom-notes')
|
default: path.join(process.env.ATOM_HOME, 'nvatom-notes')
|
||||||
|
extensions:
|
||||||
|
title: 'Extensions'
|
||||||
|
description: 'The first extension will be used for newly created notes.'
|
||||||
|
type: 'array'
|
||||||
|
default: ['.md', '.txt']
|
||||||
|
items:
|
||||||
|
type: 'string'
|
||||||
enableLunrPipeline:
|
enableLunrPipeline:
|
||||||
title: 'Enable Lunr Pipeline'
|
title: 'Enable Lunr Pipeline'
|
||||||
description: 'Lunr pipeline preprocesses query to make search faster. However, it will skip searching some of stop words such as "an" or "be".'
|
description: 'Lunr pipeline preprocesses query to make search faster. However, it will skip searching some of stop words such as "an" or "be".'
|
||||||
@@ -40,7 +47,7 @@ module.exports =
|
|||||||
window.addEventListener('blur', handleBlur, true)
|
window.addEventListener('blur', handleBlur, true)
|
||||||
@subscriptions.add new Disposable -> window.removeEventListener('blur', handleBlur, true)
|
@subscriptions.add new Disposable -> window.removeEventListener('blur', handleBlur, true)
|
||||||
|
|
||||||
@subscriptions.add atom.workspace.onWillDestroyPaneItem ({item}) => @autosave(item)
|
@subscriptions.add atom.workspace.onWillDestroyPaneItem ({item}) => @autosave(item) unless @autodelete(item)
|
||||||
|
|
||||||
deactivate: ->
|
deactivate: ->
|
||||||
@subscriptions.dispose()
|
@subscriptions.dispose()
|
||||||
@@ -60,9 +67,20 @@ module.exports =
|
|||||||
return unless paneItem?.isModified?()
|
return unless paneItem?.isModified?()
|
||||||
uri = paneItem.getURI()
|
uri = paneItem.getURI()
|
||||||
return unless uri.indexOf(@rootDirectory) == 0
|
return unless uri.indexOf(@rootDirectory) == 0
|
||||||
return unless fs.isMarkdownExtension(path.extname(uri))
|
return unless path.extname(uri) in atom.config.get('nvatom.extensions')
|
||||||
paneItem?.save?()
|
paneItem?.save?()
|
||||||
|
|
||||||
|
autodelete: (paneItem) ->
|
||||||
|
return false unless paneItem?.getURI?()?
|
||||||
|
uri = paneItem.getURI()
|
||||||
|
return false unless uri.indexOf(@rootDirectory) == 0
|
||||||
|
return false unless path.extname(uri) in atom.config.get('nvatom.extensions')
|
||||||
|
return false unless paneItem?.isEmpty()
|
||||||
|
fs.unlinkSync(uri)
|
||||||
|
noteName = uri.substring(@rootDirectory.length + 1)
|
||||||
|
atom.notifications.addInfo("Empty note #{noteName} is deleted.")
|
||||||
|
return true
|
||||||
|
|
||||||
autosaveAll: ->
|
autosaveAll: ->
|
||||||
@autosave(paneItem) for paneItem in atom.workspace.getPaneItems()
|
@autosave(paneItem) for paneItem in atom.workspace.getPaneItems()
|
||||||
|
|
||||||
@@ -72,7 +90,7 @@ module.exports =
|
|||||||
defaultNoteDirectory = path.join(packagesDirectory, 'nvatom', 'notebook')
|
defaultNoteDirectory = path.join(packagesDirectory, 'nvatom', 'notebook')
|
||||||
|
|
||||||
if noteDirectory.startsWith(packagesDirectory)
|
if noteDirectory.startsWith(packagesDirectory)
|
||||||
throw new Error('Note directory #{noteDirectory} cannot reside within atom packages directory. Please change its value from package settings.')
|
throw new Error("Note directory #{noteDirectory} cannot reside within atom packages directory. Please change its value from package settings.")
|
||||||
|
|
||||||
# Initialize note directory.
|
# Initialize note directory.
|
||||||
if !fs.existsSync(noteDirectory)
|
if !fs.existsSync(noteDirectory)
|
||||||
@@ -97,7 +115,7 @@ module.exports =
|
|||||||
atom.notifications.addInfo('Migrating from notational-velocity package...')
|
atom.notifications.addInfo('Migrating from notational-velocity package...')
|
||||||
|
|
||||||
if !fs.existsSync(prevNoteDirectory)
|
if !fs.existsSync(prevNoteDirectory)
|
||||||
atom.notifications.addError('notational-velocity.directory #{prevNoteDirectory} does not exists. Migration process is failed.')
|
atom.notifications.addError("notational-velocity.directory #{prevNoteDirectory} does not exists. Migration process is failed.")
|
||||||
return
|
return
|
||||||
|
|
||||||
if prevNoteDirectory.startsWith(packagesDirectory)
|
if prevNoteDirectory.startsWith(packagesDirectory)
|
||||||
|
|||||||
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "nvatom",
|
"name": "nvatom",
|
||||||
"main": "./lib/notational-velocity",
|
"main": "./lib/notational-velocity",
|
||||||
"version": "0.5.1",
|
"version": "0.8.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Seongjae Lee <seongjae@gmail.com>",
|
"Seongjae Lee <seongjae@gmail.com>",
|
||||||
@@ -12,15 +12,15 @@
|
|||||||
"activationCommands": {
|
"activationCommands": {
|
||||||
"atom-workspace": "nvatom:toggle"
|
"atom-workspace": "nvatom:toggle"
|
||||||
},
|
},
|
||||||
"repository": "https://github.com/seongjaelee/notational-velocity",
|
"repository": "https://github.com/seongjaelee/nvatom",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"atom": ">0.50.0"
|
"atom": ">0.50.0"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/seongjaelee/notational-velocity/issues"
|
"url": "https://github.com/seongjaelee/nvatom/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/seongjaelee/notational-velocity",
|
"homepage": "https://github.com/seongjaelee/nvatom",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"atom-space-pen-views": "^2.0.3",
|
"atom-space-pen-views": "^2.0.3",
|
||||||
"chokidar": "^1.0.5",
|
"chokidar": "^1.0.5",
|
||||||
|
|||||||
Reference in New Issue
Block a user