mirror of
https://github.com/wassname/nvatom.git
synced 2026-07-10 00:30:20 +08:00
Rename notelink to interlink
This commit is contained in:
@@ -3,10 +3,10 @@ fs = require 'fs-plus'
|
||||
Utility = require './utility'
|
||||
|
||||
module.exports =
|
||||
class NoteLink
|
||||
class Interlink
|
||||
constructor: ->
|
||||
@subscriptions = new CompositeDisposable
|
||||
@subscriptions.add atom.commands.add 'atom-workspace', 'nvatom:openInterlink': => NoteLink.openInterlink()
|
||||
@subscriptions.add atom.commands.add 'atom-workspace', 'nvatom:openInterlink': => Interlink.openInterlink()
|
||||
|
||||
destroy: ->
|
||||
@subscriptions.dispose()
|
||||
@@ -16,7 +16,7 @@ class NoteLink
|
||||
return unless editor?
|
||||
return unless Utility.isNote(editor.getPath())
|
||||
|
||||
noteTitle = NoteLink.getInterlinkUnderCursor(editor)
|
||||
noteTitle = Interlink.getInterlinkUnderCursor(editor)
|
||||
return unless noteTitle?
|
||||
return unless noteTitle.length
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
path = require 'path'
|
||||
fs = require 'fs-plus'
|
||||
{CompositeDisposable, Disposable} = require 'atom'
|
||||
NoteLink = require './notelink'
|
||||
Interlink = require './interlink'
|
||||
Utility = require './utility'
|
||||
|
||||
module.exports =
|
||||
@@ -51,11 +51,11 @@ module.exports =
|
||||
|
||||
@subscriptions.add atom.workspace.onWillDestroyPaneItem ({item}) => @autosave(item) unless @autodelete(item)
|
||||
|
||||
@noteLink = new NoteLink()
|
||||
@interlink = new Interlink()
|
||||
|
||||
deactivate: ->
|
||||
@subscriptions.dispose()
|
||||
@noteLink.destroy()
|
||||
@interlnk.destroy()
|
||||
@notationalVelocityView.destroy()
|
||||
|
||||
serialize: ->
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
fs = require 'fs-plus'
|
||||
path = require 'path'
|
||||
temp = require 'temp'
|
||||
NoteLink = require '../lib/notelink'
|
||||
Interlink = require '../lib/interlink'
|
||||
|
||||
describe 'Notelink', ->
|
||||
describe 'Interlink', ->
|
||||
defaultDirectory = atom.config.get('nvatom.directory')
|
||||
noteDirectory = null
|
||||
|
||||
@@ -40,7 +40,7 @@ describe 'Notelink', ->
|
||||
for testitem in testdata
|
||||
editor.setText testitem.text
|
||||
editor.setCursorBufferPosition testitem.position
|
||||
expect(NoteLink.getInterlinkUnderCursor(editor)).toBe testitem.expected
|
||||
expect(Interlink.getInterlinkUnderCursor(editor)).toBe testitem.expected
|
||||
|
||||
it 'returns undefined for invalid text', ->
|
||||
testdata = [
|
||||
@@ -57,7 +57,7 @@ describe 'Notelink', ->
|
||||
for testitem in testdata
|
||||
editor.setText testitem.text
|
||||
editor.setCursorBufferPosition testitem.position
|
||||
expect(NoteLink.getInterlinkUnderCursor(editor)).toBe undefined
|
||||
expect(Interlink.getInterlinkUnderCursor(editor)).toBe undefined
|
||||
|
||||
describe 'when openInterlink is called', ->
|
||||
describe 'when the editor path is under the note directory', ->
|
||||
@@ -71,7 +71,7 @@ describe 'Notelink', ->
|
||||
editor.setText '[[Car]]'
|
||||
editor.setCursorBufferPosition [0, 2]
|
||||
|
||||
editorPromise = NoteLink.openInterlink()
|
||||
editorPromise = Interlink.openInterlink()
|
||||
expect(editorPromise).not.toBe undefined
|
||||
waitsForPromise ->
|
||||
editorPromise
|
||||
@@ -90,5 +90,5 @@ describe 'Notelink', ->
|
||||
editor.setText '[[Car]]'
|
||||
editor.setCursorBufferPosition [0, 2]
|
||||
|
||||
editorPromise = NoteLink.openInterlink()
|
||||
editorPromise = Interlink.openInterlink()
|
||||
expect(editorPromise).toBe undefined
|
||||
Reference in New Issue
Block a user