34 Commits
Author SHA1 Message Date
Seongjae Lee ce9869362a Make title search independent from DocQuery search 2015-09-18 00:14:52 -07:00
Seongjae Lee 4e4688fe78 Prepare 0.8.1 release 2015-09-16 19:56:14 -07:00
Seongjae Lee 0fffc6a6b1 Avoid using regexp for searching title
Fixes #28.
2015-09-16 19:56:00 -07:00
Seongjae Lee 547617f485 Refactor code based on CoffeeScript style guide
https://github.com/polarmobile/coffeescript-style-guide
2015-09-12 12:14:56 -07:00
Seongjae Lee 74735eec82 Prepare 0.8.0 release 2015-09-12 10:52:12 -07:00
Seongjae Lee fa873af344 Update changelog 2015-09-12 10:51:48 -07:00
Seongjae Lee a31f490a70 Fix a bug on warning messages
Ruby-style string interpolation is only with double-quoted strings.
2015-09-12 10:49:44 -07:00
Seongjae Lee 27f2a5bb8d Delete an empty note when closing a pane
Close #18. This is against nvALT, but I think this is more intuitive way.
2015-09-12 10:47:29 -07:00
Seongjae Lee 95093df286 Prepare 0.7.1 release 2015-09-12 10:17:10 -07:00
Seongjae Lee 5e4345f719 Make autosave also consider nvatom.extensions 2015-09-12 10:16:52 -07:00
Seongjae Lee cee47a8fd7 Prepare 0.7.0 release 2015-09-12 02:02:59 -07:00
Seongjae Lee 15bf1e741b Update changelog 2015-09-12 02:02:43 -07:00
Seongjae Lee bd19c270b3 Support other extensions than ".md"
Close #13.
2015-09-12 01:58:59 -07:00
Seongjae Lee b5f7ba7b75 Prepare 0.6.0 release 2015-09-12 01:36:40 -07:00
Seongjae Lee da888fa461 Prepare to move git repository from notational-velocity to nvatom 2015-09-12 01:36:12 -07:00
Seongjae Lee 97830b31db Prepare to move git repository from notational-velocity to nvatom 2015-09-12 01:33:38 -07:00
Seongjae Lee a06e0127c2 Prepare 0.5.1 release 2015-09-12 01:15:24 -07:00
Seongjae Lee cfd9dcef85 Fix typo on readme 2015-09-12 01:15:09 -07:00
Seongjae Lee ca6f9e76a3 Prepare 0.5.0 release 2015-09-12 01:08:24 -07:00
Seongjae Lee 5e44098ae3 Update changelog 2015-09-12 01:08:19 -07:00
Seongjae Lee a3f5d445c0 Make lunr pipeline feature optionable
If we have a note "Atom", and if the user types "a" or "at", then lunr pipeline ignores searching them because they are stop words. However, turning off this feature might not be a good idea when we have tons of body texts. So we turn it on as a default, but provide a way to turn it off as an option.
2015-09-12 01:04:11 -07:00
Seongjae Lee abb7339a6e Improve autoselect/autocomplete logic
Say we have two notes "Mark" and "Markdown". When the user type "Markd", then it will autocomplete to "Markd[own]". Say the user presses backspace key twice to make it to "Mark". In this case, we want to autoselect "Mark".
2015-09-12 00:54:56 -07:00
Seongjae Lee 4ddc133920 Refactor schedulePopulateList 2015-09-12 00:42:11 -07:00
Seongjae Lee bca1646f8f Refactor filter 2015-09-12 00:40:21 -07:00
Seongjae Lee 40e785ef57 Remove unnessary whitespaces
Refer https://github.com/polarmobile/coffeescript-style-guide#whitespace-in-expressions-and-statements.
2015-09-11 22:51:03 -07:00
Seongjae Lee 273d506f38 Make the searching query to be the non-selected text, not the full text
For example, if we have two notes "Car" and "Care", when we type "Ca", then it automatically fills "Care" and drops "Car". (Assume "Care" comes ahead of "Car"). However, we still want to search with "Ca".
2015-09-11 22:46:06 -07:00
Seongjae Lee 09d0efc06f Make the first found item to be automatically selected
This is a regression caused by docquery integration (56821bccbc). indexof always returns -1. Since the selected item is always the first filtered item, we can safely set it to 1.
2015-09-11 22:43:09 -07:00
Seongjae Lee 4dd0b518aa Prepare 0.4.2 release 2015-09-11 14:08:59 -07:00
Seongjae Lee bdf384f158 Fix #26 causing DocQuery loading error on case sensitive OS 2015-09-11 14:05:57 -07:00
Seongjae Lee c2db598f17 Prepare 0.4.1 release 2015-09-10 23:56:57 -07:00
Seongjae Lee 1e1aa06e3c Remove debug code 2015-09-10 23:56:17 -07:00
Seongjae Lee 8384b81a04 Prepare 0.4.0 release 2015-09-10 23:26:09 -07:00
Seongjae Lee ef3fb73c88 Make the first version of nvatom to be 0.4.0 2015-09-10 23:26:03 -07:00
Seongjae Lee 6c9752ae25 Rename notational-velocity to nvatom, copy notational-velocity settings/notes on initialization 2015-09-10 22:10:34 -07:00
9 changed files with 200 additions and 97 deletions
+15
View File
@@ -1,3 +1,18 @@
## 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
- Add `useLunrPipeline` setting
- Improve autoselect/autocomplete logic
- Fix a bug that autocomplete feature does not work
## 0.4.0
- Rename `notational-velocity` to `nvatom`
- Copy `notational-velocity` settings/notes on initialization
## 0.3.0 ## 0.3.0
- Fix the bug that the default note directory is within packages directory. If it happens, it **deletes** all of existing notes. If you read this before updating the package, please check your note directory before updating it. - Fix the bug that the default note directory is within packages directory. If it happens, it **deletes** all of existing notes. If you read this before updating the package, please check your note directory before updating it.
+16 -5
View File
@@ -1,5 +1,7 @@
# Notational Velocity for Atom # Notational Velocity for Atom
*`notational-velocity` package is renamed to `nvatom` package due to a fatal bug. For more info, refer [migration section](#migration).*
[![Build Status][3]][4] [![Build Status][3]][4]
[Notational Velocity][1] is an application that stores and retrieves notes. [Notational Velocity][1] is an application that stores and retrieves notes.
@@ -26,13 +28,13 @@ We do believe Notational Velocity is the precursor of the famous note-taking app
## Settings ## Settings
To configure your note directory, set `notational-velocity.directory`: To configure your note directory, set `nvatom.directory`:
* Open your `~/.atom/config.cson` file from the menu: *Atom > Open Your Config* * Open your `~/.atom/config.cson` file from the menu: *Atom > Open Your Config*
* Append the following lines: * Append the following lines:
```cson ```cson
'notational-velocity': 'nvatom':
directory: '/path/to/your/notes' directory: '/path/to/your/notes'
``` ```
@@ -52,9 +54,17 @@ You can also override `cmd-l` if you want to keep your muscle memory from Notati
'atom-text-editor': 'atom-text-editor':
'cmd-l': 'unset!' 'cmd-l': 'unset!'
'atom-workspace': 'atom-workspace':
'cmd-l': 'notational-velocity:toggle' 'cmd-l': 'nvatom:toggle'
``` ```
## Migration
v0.1.0 under published package name `notational-velocity` had a fatal bug that sets the default value of its note directory under package directory. In that case, all notes are deleted once the user updates the package, since package directory is overwritten when the user. For more information, refer [#25][6].
To resolve this problem, we renamed our package name to `nvatom`. Users who have the old `notational-velocity` need to **install `nvatom` package first**, activate the package to automatically migrate the existing notes, and then delete `notational-velocity` package.
Since keymaps overlap with `notational-velocity`, follow the menu *Packages > nvAtom > Toggle* to activate this package.
## References ## References
- [Notational Velocity](http://notational.net/) - [Notational Velocity](http://notational.net/)
@@ -66,6 +76,7 @@ You can also override `cmd-l` if you want to keep your muscle memory from Notati
[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/nvatom/issues/25
+1 -1
View File
@@ -8,4 +8,4 @@
# For more detailed documentation see # For more detailed documentation see
# https://atom.io/docs/latest/advanced/keymaps # https://atom.io/docs/latest/advanced/keymaps
'atom-workspace': 'atom-workspace':
'alt-cmd-l': 'notational-velocity:toggle' 'alt-cmd-l': 'nvatom:toggle'
+83 -50
View File
@@ -2,22 +2,22 @@ path = require 'path'
fs = require 'fs-plus' fs = require 'fs-plus'
_ = require 'underscore-plus' _ = require 'underscore-plus'
{$, $$, SelectListView} = require 'atom-space-pen-views' {$, $$, SelectListView} = require 'atom-space-pen-views'
DocQuery = require 'DocQuery' DocQuery = require 'docquery'
module.exports = module.exports =
class NotationalVelocityView extends SelectListView class NotationalVelocityView extends SelectListView
initialize: (state) -> initialize: (state) ->
@initializedAt = new Date() @initializedAt = new Date()
super super
@addClass('notational-velocity from-top overlay') @addClass('nvatom from-top overlay')
@rootDirectory = atom.config.get('notational-velocity.directory') @rootDirectory = atom.config.get('nvatom.directory')
if !fs.existsSync(@rootDirectory) unless fs.existsSync(@rootDirectory)
throw new Error("The given directory #{@rootDirectory} does not exist. " throw new Error("The given directory #{@rootDirectory} does not exist. "
+ "Set the note directory to the existing one from Settings.") + "Set the note directory to the existing one from Settings.")
@prevFilterQuery = '' @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()
@@ -28,28 +28,15 @@ class NotationalVelocityView extends SelectListView
@populateList() if @documentsLoaded @populateList() if @documentsLoaded
@docQuery.on "removed", (fileDetails) => @docQuery.on "removed", (fileDetails) =>
@populateList() if @documentsLoaded @populateList() if @documentsLoaded
unless atom.config.get('nvatom.enableLunrPipeline')
@docQuery.searchIndex.pipeline.reset()
selectItem: (filterQuery) -> isCursorProceeded: ->
if filterQuery.length == 0
@prevCursorPosition = 0
return null
titleItem = @docQuery.search(filterQuery)[0]
# If title item is not null, auto-fill the search panel.
# But we don't want to fill it when deleting.
editor = @filterEditorView.model editor = @filterEditorView.model
currCursorPosition = editor.getCursorBufferPosition().column currCursorPosition = editor.getCursorBufferPosition().column
if titleItem != undefined && @prevCursorPosition < currCursorPosition isCursorProceeded = @prevCursorPosition < currCursorPosition
@prevFilterQuery = titleItem.title
editor.setText(filterQuery + titleItem.title.slice(filterQuery.length))
editor.selectLeft(titleItem.title.length - filterQuery.length)
@prevCursorPosition = currCursorPosition @prevCursorPosition = currCursorPosition
return isCursorProceeded
return titleItem
filter: (filterQuery) ->
return @docQuery.search(filterQuery)
getFilterKey: -> getFilterKey: ->
'filetext' 'filetext'
@@ -75,10 +62,11 @@ class NotationalVelocityView extends SelectListView
@div class: 'secondary-line', "#{content}" @div class: 'secondary-line', "#{content}"
confirmSelection: -> confirmSelection: ->
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)
@@ -115,36 +103,81 @@ class NotationalVelocityView extends SelectListView
hide: -> hide: ->
@panel?.hide() @panel?.hide()
getFilterQuery: ->
editor = @filterEditorView.model
fullText = editor.getText()
selectedText = editor.getSelectedText()
return fullText.substring(0, fullText.length - selectedText.length)
filterByTitle: (filterQuery) ->
if (filterQuery is "") or (filterQuery is undefined)
return []
filterQuery = filterQuery.toLowerCase()
matchingNotes = []
filteredNotes = []
for note in @docQuery.documents
title = note.title.toLowerCase()
if title is filterQuery
matchingNotes.push(note)
else if filteredNotes.length < @maxItems and title.startsWith(filterQuery)
filteredNotes.push(note)
notes = matchingNotes.concat(filteredNotes)
if notes.length > @maxItems
notes = notes.slice(0, @maxItems)
return notes
filterByLunr: (filterQuery) ->
notes = []
if (filterQuery is "") or (filterQuery is undefined)
notes = @docQuery.documents
else
notes = @docQuery.search(filterQuery)
if notes.length > @maxItems
notes = notes.slice(0, @maxItems)
return notes
populateList: -> populateList: ->
filterQuery = @getFilterQuery() filterQuery = @getFilterQuery()
filteredItems = null notesByTitle = @filterByTitle(filterQuery)
if filterQuery == "" || filterQuery == undefined notesByLunr = @filterByLunr(filterQuery)
filteredItems = @docQuery.documents isCursorProceeded = @isCursorProceeded()
else
filteredItems = @filter(filterQuery)
selectedItem = @selectItem(filterQuery)
@list.empty() @list.empty()
if filteredItems.length if notesByTitle.length + notesByLunr.length == 0
@setError(null) @setError(@getEmptyMessage(@docQuery.documents.length, 0))
return
for i in [0...Math.min(filteredItems.length, @maxItems)] @setError(null)
item = filteredItems[i] for note in notesByTitle
itemView = $(@viewForItem(item)) itemView = $(@viewForItem(note))
itemView.data('select-list-item', item) itemView.data('select-list-item', note)
@list.append(itemView) @list.append(itemView)
if selectedItem if notesByTitle.length
n = filteredItems.indexOf(selectedItem) + 1 # autoselect
@selectItemView(@list.find("li:nth-child(#{n})")) @selectItemView(@list.find("li:nth-child(1)"))
else #autocomplete
@setError(@getEmptyMessage(@docQuery.documents.length, filteredItems.length)) note = notesByTitle[0]
if note.title.toLowerCase() is filterQuery.toLowerCase() or isCursorProceeded
@skipPopulateList = true
editor = @filterEditorView.model
editor.setText(filterQuery + note.title.slice(filterQuery.length))
editor.selectLeft(note.title.length - filterQuery.length)
if @list.length >= @maxItems
return
for note in notesByLunr
if @list.length >= @maxItems
break
if filterQuery?.length and note.title.toLowerCase().startsWith(filterQuery.toLowerCase())
continue
itemView = $(@viewForItem(note))
itemView.data('select-list-item', note)
@list.append(itemView)
schedulePopulateList: -> schedulePopulateList: ->
# We can skip it when we are just moving the position of the cursor. unless @skipPopulateList
currFilterQuery = @getFilterQuery()
if @prevFilterQuery != currFilterQuery
super super
@prevFilterQuery = currFilterQuery @skipPopulateList = false
+63 -19
View File
@@ -8,7 +8,19 @@ module.exports =
title: 'Note Directory' title: 'Note Directory'
description: 'The directory to archive notes' description: 'The directory to archive notes'
type: 'string' type: 'string'
default: path.join(process.env.ATOM_HOME, 'notational-velocity-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:
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".'
type: 'boolean'
default: true
notationalVelocityView: null notationalVelocityView: null
@@ -21,7 +33,7 @@ module.exports =
# Register command that toggles this view # Register command that toggles this view
@subscriptions.add atom.commands.add 'atom-workspace', @subscriptions.add atom.commands.add 'atom-workspace',
'notational-velocity:toggle': => @createView(state).toggle() 'nvatom:toggle': => @createView(state).toggle()
handleBeforeUnload = @autosaveAll.bind(this) handleBeforeUnload = @autosaveAll.bind(this)
window.addEventListener('beforeunload', handleBeforeUnload, true) window.addEventListener('beforeunload', handleBeforeUnload, true)
@@ -35,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()
@@ -54,31 +66,63 @@ module.exports =
return unless paneItem?.getURI?()? return unless paneItem?.getURI?()?
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) is 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) is 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()
ensureNoteDirectory: -> ensureNoteDirectory: ->
noteDirectory = atom.config.get('notational-velocity.directory') noteDirectory = atom.config.get('nvatom.directory')
packagesDirectory = path.join(process.env.ATOM_HOME, 'packages') packagesDirectory = path.join(process.env.ATOM_HOME, 'packages')
defaultNoteDirectory = path.join(packagesDirectory, 'notational-velocity', 'notebook') defaultNoteDirectory = path.join(packagesDirectory, 'nvatom', 'notebook')
if noteDirectory.startsWith(packagesDirectory) if noteDirectory.startsWith(packagesDirectory)
storageDirectory = path.join(packagesDirectory, 'storage') throw new Error("Note directory #{noteDirectory} cannot reside within atom packages directory. Please change its value from package settings.")
throw new Error("""
The note directory (#{noteDirectory}) should NOT nest under #{packagesDirectory}.
It is likely that you updated the package to a newer version from v0.1.0.
It is likely that the note directory is overwritten.
Unfortunately, I couldn't find a way to recover overwritten notes.
You might recover partial notes from #{storageDirectory}.
I am extremely sorry.
- Seongjae Lee""")
if !fs.existsSync(noteDirectory) # Initialize note directory.
fs.makeTreeSync(noteDirectory) unless fs.existsSync(noteDirectory)
fs.copySync(defaultNoteDirectory, noteDirectory) @tryMigrateFromNotationalVelocity()
noteDirectory = atom.config.get('nvatom.directory')
unless fs.existsSync(noteDirectory)
fs.makeTreeSync(noteDirectory)
fs.copySync(defaultNoteDirectory, noteDirectory)
return fs.realpathSync(noteDirectory) return fs.realpathSync(noteDirectory)
tryMigrateFromNotationalVelocity: ->
prevNoteDirectory = atom.config.get('notational-velocity.directory')
currNoteDirectory = atom.config.get('nvatom.directory')
packagesDirectory = path.join(process.env.ATOM_HOME, 'packages')
defaultNoteDirectory = path.join(packagesDirectory, 'nvatom', 'notebook')
# notational-velocity does not exist.
if prevNoteDirectory is undefined
return
atom.notifications.addInfo('Migrating from notational-velocity package...')
unless fs.existsSync(prevNoteDirectory)
atom.notifications.addError("notational-velocity.directory #{prevNoteDirectory} does not exists. Migration process is failed.")
return
if prevNoteDirectory.startsWith(packagesDirectory)
fs.makeTreeSync(currNoteDirectory)
fs.copySync(prevNoteDirectory, currNoteDirectory)
else
if path.join(process.env.ATOM_HOME, 'nvatom-notes') == currNoteDirectory
atom.config.set('nvatom.directory', prevNoteDirectory)
atom.notifications.addInfo('Finished migration.')
+2 -2
View File
@@ -3,11 +3,11 @@
{ {
'label': 'Packages' 'label': 'Packages'
'submenu': [ 'submenu': [
'label': 'Notational Velocity' 'label': 'nvAtom'
'submenu': [ 'submenu': [
{ {
'label': 'Toggle' 'label': 'Toggle'
'command': 'notational-velocity:toggle' 'command': 'nvatom:toggle'
} }
] ]
] ]
+6 -6
View File
@@ -1,7 +1,7 @@
{ {
"name": "notational-velocity", "name": "nvatom",
"main": "./lib/notational-velocity", "main": "./lib/notational-velocity",
"version": "0.3.0", "version": "0.8.1",
"private": true, "private": true,
"contributors": [ "contributors": [
"Seongjae Lee <seongjae@gmail.com>", "Seongjae Lee <seongjae@gmail.com>",
@@ -10,17 +10,17 @@
], ],
"description": "Notational Velocity for Atom", "description": "Notational Velocity for Atom",
"activationCommands": { "activationCommands": {
"atom-workspace": "notational-velocity: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",
+13 -13
View File
@@ -1,31 +1,31 @@
path = require 'path' path = require 'path'
describe "NotationalVelocity", -> describe "nvAtom", ->
defaultDirectory = atom.config.get('notational-velocity.directory') defaultDirectory = atom.config.get('nvatom.directory')
activationPromise = null activationPromise = null
workspaceElement = null workspaceElement = null
beforeEach -> beforeEach ->
workspaceElement = atom.views.getView(atom.workspace) workspaceElement = atom.views.getView(atom.workspace)
activationPromise = atom.packages.activatePackage('notational-velocity') activationPromise = atom.packages.activatePackage('nvatom')
atom.config.set('notational-velocity.directory', 'testdata') atom.config.set('nvatom.directory', 'testdata')
afterEach -> afterEach ->
atom.config.set('notational-velocity.directory', defaultDirectory) atom.config.set('nvatom.directory', defaultDirectory)
describe "when the notational-velocity:toggle event is triggered", -> describe "when the nvatom:toggle event is triggered", ->
it "attaches and then detaches the view", -> it "attaches and then detaches the view", ->
expect(workspaceElement.querySelector('.notational-velocity')).not.toExist() expect(workspaceElement.querySelector('.nvatom')).not.toExist()
# This is an activation event, triggering it will cause the package to be activated. # This is an activation event, triggering it will cause the package to be activated.
atom.commands.dispatch workspaceElement, 'notational-velocity:toggle' atom.commands.dispatch workspaceElement, 'nvatom:toggle'
waitsForPromise -> waitsForPromise ->
activationPromise activationPromise
runs -> runs ->
expect(workspaceElement.querySelector('.notational-velocity')).toExist() expect(workspaceElement.querySelector('.nvatom')).toExist()
atom.commands.dispatch workspaceElement, 'notational-velocity:toggle' atom.commands.dispatch workspaceElement, 'nvatom:toggle'
it "checks if we banned the default directory under packages directory", -> it "checks if we banned the default directory under packages directory", ->
atom.notifications.clear() atom.notifications.clear()
@@ -34,11 +34,11 @@ describe "NotationalVelocity", ->
atom.packages.activatePackage('notifications') atom.packages.activatePackage('notifications')
runs -> runs ->
defaultNoteDirectory = path.join(process.env.ATOM_HOME, 'packages', 'notational-velocity', 'notebook') noteDirectoryUnderPackageDirectory = path.join(process.env.ATOM_HOME, 'packages', 'nvatom', 'notebook')
atom.config.set('notational-velocity.directory', defaultNoteDirectory) atom.config.set('nvatom.directory', noteDirectoryUnderPackageDirectory)
# This is an activation event, triggering it will cause the package to be activated. # This is an activation event, triggering it will cause the package to be activated.
atom.commands.dispatch workspaceElement, 'notational-velocity:toggle' atom.commands.dispatch workspaceElement, 'nvatom:toggle'
waitsForPromise -> waitsForPromise ->
activationPromise activationPromise
+1 -1
View File
@@ -4,7 +4,7 @@
// for a full listing of what's available. // for a full listing of what's available.
@import "ui-variables"; @import "ui-variables";
.notational-velocity { .nvatom {
li { li {
text-overflow: ellipsis; text-overflow: ellipsis;
overflow-x: hidden; overflow-x: hidden;