Skip to content

Commit a00ce06

Browse files
committed
some fixes
1 parent e5a44e4 commit a00ce06

File tree

3 files changed

+41
-15
lines changed

3 files changed

+41
-15
lines changed

lib/julia-client.coffee

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,15 @@ module.exports = JuliaClient =
4040

4141
try
4242
v = atom.config.get('julia-client.currentVersion')
43-
if not semver.gte(v, LATEST_RELEASE_NOTE_VERSION)
44-
minor = semver.minor(LATEST_RELEASE_NOTE_VERSION)
45-
if semver.minor(v) < minor
46-
major = semver.major(LATEST_RELEASE_NOTE_VERSION)
47-
release.activate("#{major}.#{minor}.0") # current minor release
48-
else
49-
release.activate(LATEST_RELEASE_NOTE_VERSION) # current patch
43+
if v isnt LATEST_RELEASE_NOTE_VERSION
44+
atom.config.set('julia-client.currentVersion', LATEST_RELEASE_NOTE_VERSION)
45+
release.activate(LATEST_RELEASE_NOTE_VERSION)
5046
else
5147
release.activate()
5248
catch err
5349
console.log(err)
5450
finally
55-
juliaClientVersion = atom.packages.loadedPackages["julia-client"].metadata.version
56-
atom.config.set('julia-client.currentVersion', juliaClientVersion)
51+
atom.config.set('julia-client.currentVersion', LATEST_RELEASE_NOTE_VERSION)
5752

5853
requireDeps: (fn) ->
5954
isLoaded = atom.packages.isPackageLoaded("ink") and atom.packages.isPackageLoaded("language-julia")

lib/package/release-note.js

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,35 @@ const RELEASE_NOTE_DIR = path.join(__dirname, '..', '..', 'release-notes')
1313
export function activate (startupNoteVersion) {
1414
subs = new CompositeDisposable()
1515
const view = document.createElement('div')
16-
view.classList.add('julia-client-release-note')
1716
const panel = atom.workspace.addModalPanel({ item: view })
18-
const showNote = (version) => {
17+
18+
const inner = document.createElement('div')
19+
inner.classList.add('julia-client-release-note')
20+
inner.setAttribute('tabindex', "1")
21+
22+
const closeButton = document.createElement('button')
23+
closeButton.classList.add('btn', 'icon', 'icon-remove-close', 'release-note-close-button')
24+
25+
view.appendChild(closeButton)
26+
view.appendChild(inner)
27+
28+
closeButton.onclick = () => panel.hide()
29+
30+
const showNote = (version, versions) => {
1931
const p = path.join(RELEASE_NOTE_DIR, version + '.md')
2032
const markdown = readCode(p)
21-
view.innerHTML = marked(markdown)
33+
inner.innerHTML = marked(markdown)
2234
panel.show()
35+
view.focus()
2336
}
2437
const close = () => {
2538
panel.hide()
2639
}
2740
const panelView = panel.getElement()
2841
panelView.style['max-width'] = '75em'
29-
panelView.addEventListener('blur', close) // BUG: doesn't work
42+
3043
subs.add(
31-
atom.commands.add('atom-workspace', 'julia-client:open-release-note', () => {
44+
atom.commands.add('atom-workspace', 'julia-client:open-release-note', () => {
3245
const versions = fs.readdirSync(RELEASE_NOTE_DIR)
3346
.filter(path => path !== 'README.md')
3447
.map(path => path.replace(/(.+)\.md/, 'v $1'))
@@ -38,9 +51,17 @@ export function activate (startupNoteVersion) {
3851
}),
3952
new Disposable(() => {
4053
panel.destroy()
54+
}),
55+
atom.commands.add(panelView, 'julia-client:cancel-release-note', (event) => {
56+
console.log(event);
57+
panel.hide()
58+
event.stopPropagation()
4159
})
4260
)
43-
if (startupNoteVersion) showNote(startupNoteVersion) // BUG: doesn't work
61+
62+
if (startupNoteVersion) {
63+
setTimeout(() => showNote(startupNoteVersion), 500)
64+
}
4465
}
4566

4667
export function deactivate () {

styles/julia-client.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,3 +201,13 @@ atom-text-editor.editor[data-grammar$="source weave latex"] {
201201
display: block;
202202
}
203203
}
204+
205+
.julia-client-release-note {
206+
max-height: 90vh;
207+
overflow: scroll;
208+
}
209+
210+
.release-note-close-button {
211+
position: absolute;
212+
right: 1em;
213+
}

0 commit comments

Comments
 (0)