Mailspring/docs/gitbook/gitbook-plugin-editlink/plugin.js
2017-01-30 02:49:48 -08:00

23 lines
No EOL
624 B
JavaScript

require(["gitbook", "jQuery"], function(gitbook, $) {
gitbook.events.bind('start', function (e, config) {
var conf = config.editlink
var label = conf.label
var base = conf.base
var multilingual = conf.multilingual || false
if (base.slice(-1) !== "/") {
base += "/"
}
gitbook.toolbar.createButton({
icon: 'fa fa-edit',
text: label,
onClick: function() {
var filepath = gitbook.state.filepath
var lang = multilingual && $('html').attr('lang') ? $('html').attr('lang') + '/' : ''
window.open(base + lang + filepath)
}
})
})
})