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 |
@@ -1,3 +1,6 @@
|
|||||||
|
## 0.8.0
|
||||||
|
- Add a feature to delete an empty note automatically when closing its pane
|
||||||
|
|
||||||
## 0.7.0
|
## 0.7.0
|
||||||
- Add `extensions` setting
|
- Add `extensions` setting
|
||||||
|
|
||||||
|
|||||||
@@ -47,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()
|
||||||
@@ -70,6 +70,17 @@ module.exports =
|
|||||||
return unless path.extname(uri) in atom.config.get('nvatom.extensions')
|
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()
|
||||||
|
|
||||||
@@ -79,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)
|
||||||
@@ -104,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)
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "nvatom",
|
"name": "nvatom",
|
||||||
"main": "./lib/notational-velocity",
|
"main": "./lib/notational-velocity",
|
||||||
"version": "0.7.1",
|
"version": "0.8.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Seongjae Lee <seongjae@gmail.com>",
|
"Seongjae Lee <seongjae@gmail.com>",
|
||||||
|
|||||||
Reference in New Issue
Block a user