Skip to content

Commit 107ff44

Browse files
committed
show release note in modal
1 parent 9e1e281 commit 107ff44

File tree

5 files changed

+41
-17
lines changed

5 files changed

+41
-17
lines changed

lib/julia-client.coffee

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ module.exports = JuliaClient =
4444
minor = semver.minor(LATEST_RELEASE_NOTE_VERSION)
4545
if semver.minor(v) < minor
4646
major = semver.major(LATEST_RELEASE_NOTE_VERSION)
47-
release.showStartupNote("#{major}.#{minor}.0") # current minor release
47+
release.activate("#{major}.#{minor}.0") # current minor release
4848
else
49-
release.showStartupNote(LATEST_RELEASE_NOTE_VERSION) # current patch
49+
release.activate(LATEST_RELEASE_NOTE_VERSION) # current patch
50+
else
51+
release.activate()
5052
catch err
5153
console.log(err)
5254
finally
@@ -131,11 +133,10 @@ module.exports = JuliaClient =
131133
config: config
132134

133135
deactivate: ->
134-
x.deactivate() for x in [commands, menu, toolbar, @connection, @runtime, @ui]
136+
x.deactivate() for x in [commands, menu, toolbar, release, @connection, @runtime, @ui]
135137

136138
consumeInk: (ink) ->
137139
commands.ink = ink
138-
release.activate(ink)
139140
x.consumeInk ink for x in [@connection, @runtime, @ui]
140141

141142
consumeStatusBar: (bar) -> @runtime.consumeStatusBar bar

lib/package/release-note.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
/** @babel */
22

3-
import { CompositeDisposable } from 'atom'
3+
import { CompositeDisposable, Disposable } from 'atom'
44
import path from 'path'
55
import fs from 'fs'
6+
import marked from 'marked'
67
import { show } from '../ui/selector'
78
import { readCode } from '../misc/paths'
89

9-
let startupNoteVersion, subs
10+
let subs
1011
const RELEASE_NOTE_DIR = path.join(__dirname, '..', '..', 'release-notes')
1112

12-
export function activate (ink) {
13-
const pane = ink.NotePane.fromId('Note')
13+
export function activate (startupNoteVersion) {
14+
subs = new CompositeDisposable()
15+
const view = document.createElement('div')
16+
view.classList.add('julia-client-release-note')
17+
const panel = atom.workspace.addModalPanel({ item: view })
1418
const showNote = (version) => {
1519
const p = path.join(RELEASE_NOTE_DIR, version + '.md')
1620
const markdown = readCode(p)
17-
pane.setNote(markdown)
18-
pane.setTitle(`Juno release note – v${version}`)
19-
pane.ensureVisible()
21+
view.innerHTML = marked(markdown)
22+
panel.show()
2023
}
21-
subs = new CompositeDisposable()
24+
const close = () => {
25+
panel.hide()
26+
}
27+
const panelView = panel.getElement()
28+
panelView.style['max-width'] = '75em'
29+
panelView.addEventListener('blur', close) // BUG: doesn't work
2230
subs.add(
2331
atom.commands.add('atom-workspace', 'julia-client:open-release-note', () => {
2432
const versions = fs.readdirSync(RELEASE_NOTE_DIR)
@@ -27,13 +35,12 @@ export function activate (ink) {
2735
show(versions)
2836
.then(version => showNote(version.replace(/v\s(.+)/, '$1')))
2937
.catch(err => console.log(err))
38+
}),
39+
new Disposable(() => {
40+
panel.destroy()
3041
})
3142
)
32-
if (startupNoteVersion) showNote(startupNoteVersion)
33-
}
34-
35-
export function showStartupNote (version) {
36-
startupNoteVersion = version
43+
if (startupNoteVersion) showNote(startupNoteVersion) // BUG: doesn't work
3744
}
3845

3946
export function deactivate () {

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"atom-space-pen-views": "^2.0.0",
3030
"etch": "^0.14",
3131
"fuzzaldrin-plus": "^0.6.0",
32+
"marked": "^0.8.2",
3233
"node-pty-prebuilt-multiarch": "0.9.0",
3334
"object-hash": "^2.0.3",
3435
"physical-cpu-count": "*",

styles/julia-client.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,13 @@ atom-text-editor.editor[data-grammar$="source weave latex"] {
191191
position: absolute;
192192
border: 1px solid fade(@text-color, 70%);
193193
}
194+
195+
.julia-client-release-note {
196+
overflow: auto !important;
197+
font-size: var(--editor-font-size);
198+
padding: 1em;
199+
img {
200+
max-height: 20em;
201+
display: block;
202+
}
203+
}

0 commit comments

Comments
 (0)