Skip to content

Commit

Permalink
解决 Ctrl+Shift+V 快捷键与其他插件冲突的问题 (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
TevinLi committed Apr 28, 2017
1 parent 77b39cb commit 7d24212
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/autoNavigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ module.exports = {
//从atom目录树监听用户拖拽操作
atom.packages.activatePackage('tree-view').then((pkg) => {
this._treeViewPkgMain = pkg.mainModule;
pkg.mainModule.treeView[0].addEventListener('drop', (e) => {
const elm = pkg.mainModule.treeView[0] || pkg.mainModule.treeView.element;
elm.addEventListener('drop', (e) => {
let path, wId;
for (let item of e.path) {
if (item.className.indexOf('project-root') >= 0) {
Expand Down
6 changes: 4 additions & 2 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,15 @@ module.exports = {
alert('只有当你打开一个 amWiki 文库时,才能手动更新导航文件!');
},
//命令:粘帖截图
'amWiki:paste': () => {
'amWiki:paste': (e) => {
const [isOnEdit, editor, editPath] = this._getEditorPath();
if (isOnEdit) {
pasteImg.paster(editor, editPath);
mngWiki.checkAddWiki(editPath);
} else {
alert('只有当你打开 library 文件夹下的 .md 文档时,才能快捷粘贴图片!');
if (mngFolder.isAmWiki(editPath)) {
alert('只有当你打开 library 文件夹下的 .md 文档时,才能快捷粘贴图片!');
}
}
},
//命令:启动node静态服务器
Expand Down
3 changes: 3 additions & 0 deletions menus/awiki.cson
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
}, {
'label': '提取 h2,h3 标题为页内目录',
'command': 'amWiki:catalogue'
}, {
'label': '从剪切板粘贴截图',
'command': 'amWiki:paste'
}, {
'label': '手动更新当前文库导航文件',
'command': 'amWiki:makeNav'
Expand Down

0 comments on commit 7d24212

Please sign in to comment.