菜单栏添加“关于amWiki”按钮

This commit is contained in:
TevinLi 2016-11-29 22:06:17 +08:00
parent 5c2db8836d
commit 783e4952b4
3 changed files with 25 additions and 5 deletions

View File

@ -36,7 +36,7 @@ module.exports = {
.replace(/\[(.*?)]\(.*?\)/g, '$1') //去除链接
.replace(/<.*?>/g, '') //去除html标签
.replace(/'/g, '&#39;') //转义单引号
.replace(/"/g, '&#34;') //转义双引号,由于双引号无法正确传给html属性当作为hash时删除
.replace(/"/g, '&#34;') //转义双引号,由于双引号无法正确传给html属性当作为hash时删除处理
.replace(/\(/g, '&#40;') //转义左圆括号
.replace(/\)/g, '&#41;') //转义右圆括号
.replace(/\[/g, '&#91;') //转义左中括号

View File

@ -60,6 +60,10 @@ module.exports = {
//命令,浏览打开当前页面
'amWiki:browser': function () {
webServer.browser(that.state.libraryList);
},
//命令显示about
'amWiki:about': function () {
that.showAbout();
}
}));
//自动化模块启动
@ -81,5 +85,16 @@ module.exports = {
libraryList: this.state.libraryList,
libraryMD5: this.state.libraryMD5
};
},
//显示相关
showAbout: function () {
atom.packages.activatePackage('amWiki').then(function (pkg) {
var content = 'amWiki v' + pkg.metadata.version + '\n' +
'https://github.com/TevinLi/amWiki\n' +
'MIT Copyright(c) 2016-2099 Tevin Li\n';
alert(content);
//TODO: 升级关于弹窗
//var c = atom.workspace.addModalPanel({item: document.createElement('div'), className: 'amWiki-about'})
});
}
};

View File

@ -1,21 +1,26 @@
'menu': [{
'label': 'amWiki轻文库',
'submenu': [{
'label': '通过 “config.json” 创建新文库',
'label': '通过 "config.json" 创建新文库',
'command': 'amWiki:create'
}, {
'label': '手动更新当前文库导航文件',
'command': 'amWiki:makeNav'
}, {
'label': '提取h2、h3标题为页内目录',
'label': '提取 h2,h3 标题为页内目录',
'command': 'amWiki:catalogue'
}, {
'type': 'separator'
}, {
'label': '启动本地静态web服务器',
'label': '启动本地静态 Web 服务器',
'command': 'amWiki:runServer'
}, {
'label': '在浏览器打开当前文档',
'command': 'amWiki:browser'
}]
}, {
'type': 'separator'
}, {
'label': '关于 amWiki',
'command': 'amWiki:about'
}]
}]