Apply the interlink extended grammar only on valid notes

To do so, we need to activate the package on Atom startup.
This commit is contained in:
Seongjae Lee
2015-09-28 01:14:39 -07:00
parent ca7c14e3b7
commit 51f769a017
6 changed files with 65 additions and 74 deletions
+3
View File
@@ -7,6 +7,9 @@ class Interlink
constructor: ->
@subscriptions = new CompositeDisposable
@subscriptions.add atom.commands.add 'atom-workspace', 'nvatom:openInterlink': => Interlink.openInterlink()
@subscriptions.add atom.workspace.observeTextEditors (editor) ->
if Utility.isNote(editor.getPath())
editor.setGrammar(atom.grammars.grammarForScopeName('source.gfm.nvatom'))
destroy: ->
@subscriptions.dispose()
+3 -7
View File
@@ -24,16 +24,12 @@ module.exports =
type: 'boolean'
default: true
notationalVelocityView: null
activate: (state) ->
@rootDirectory = @ensureNoteDirectory()
# Events subscribed to in atom's system can be easily cleaned up with a
# CompositeDisposable
@subscriptions = new CompositeDisposable
# Register command that toggles this view
@subscriptions.add atom.commands.add 'atom-workspace',
'nvatom:toggle': => @createView(state).toggle()
@@ -55,11 +51,11 @@ module.exports =
deactivate: ->
@subscriptions.dispose()
@interlnk.destroy()
@notationalVelocityView.destroy()
@interlnk?.destroy()
@notationalVelocityView?.destroy()
serialize: ->
notationalVelocityViewState: @notationalVelocityView.serialize()
notationalVelocityViewState: @notationalVelocityView?.serialize()
createView: (state, docQuery) ->
unless @notationalVelocityView?