Commit ba3e29a4 authored by Medicean's avatar Medicean

(Enhancement: Plugin) 插件支持的脚本类型支持通配符 *

parent e06ab07f
...@@ -50,8 +50,8 @@ class ContextMenu { ...@@ -50,8 +50,8 @@ class ContextMenu {
[ [
'copyurl', 'copy', selectedData, 'copyurl', 'copy', selectedData,
this this
.copyUrl .copyUrl
.bind(this, data[0]) .bind(this, data[0])
], ],
false, false,
[ [
...@@ -60,27 +60,27 @@ class ContextMenu { ...@@ -60,27 +60,27 @@ class ContextMenu {
[ [
'pluginStore', 'cart-arrow-down', false, 'pluginStore', 'cart-arrow-down', false,
antSword['menubar'] antSword['menubar']
.run .run
.bind(antSword['menubar'], 'plugin-store') .bind(antSword['menubar'], 'plugin-store')
], ],
false, false,
[ [
'add', 'plus-circle', false, 'add', 'plus-circle', false,
this this
.addData .addData
.bind(this) .bind(this)
], ],
[ [
'edit', 'edit', selectedData, 'edit', 'edit', selectedData,
this this
.editData .editData
.bind(this, data[0]) .bind(this, data[0])
], ],
[ [
'delete', 'remove', selectedMultiData, 'delete', 'remove', selectedMultiData,
this this
.delData .delData
.bind(this, ids) .bind(this, ids)
], ],
false, false,
[ [
...@@ -89,27 +89,27 @@ class ContextMenu { ...@@ -89,27 +89,27 @@ class ContextMenu {
[ [
'copy', 'copy', selectedData, 'copy', 'copy', selectedData,
this this
.copyData .copyData
.bind(this, data[0]) .bind(this, data[0])
], ],
[ [
'search', 'search', false, 'search', 'search', false,
this this
.searchData .searchData
.bind(this, event) .bind(this, event)
], ],
false, false,
[ [
'clearCache', 'trash-o', selectedData, 'clearCache', 'trash-o', selectedData,
this this
.clearCache .clearCache
.bind(this, id) .bind(this, id)
], ],
[ [
'clearAllCache', 'trash', false, 'clearAllCache', 'trash', false,
this this
.clearAllCache .clearAllCache
.bind(this) .bind(this)
] ]
].map((menu) => { ].map((menu) => {
// 分隔符号 // 分隔符号
...@@ -177,7 +177,8 @@ class ContextMenu { ...@@ -177,7 +177,8 @@ class ContextMenu {
// 判断脚本是否支持,不支持则禁止 // 判断脚本是否支持,不支持则禁止
if (p['info']['scripts'] && p['info']['scripts'].length > 0) { if (p['info']['scripts'] && p['info']['scripts'].length > 0) {
infos.map((_info) => { infos.map((_info) => {
if (p['info']['scripts'].indexOf(_info['type']) === -1) { console.log(p['info']['scripts'])
if (p['info']['scripts'].indexOf("*") === -1 && p['info']['scripts'].indexOf(_info['type']) === -1) {
// 如果检测到不支持的脚本,则禁止 // 如果检测到不支持的脚本,则禁止
ret = true; ret = true;
} }
...@@ -185,7 +186,7 @@ class ContextMenu { ...@@ -185,7 +186,7 @@ class ContextMenu {
} }
// 判断是否支持多目标执行 // 判断是否支持多目标执行
return ret || !p['info']['multiple']; return ret || !p['info']['multiple'];
})() : info && (p['info']['scripts'] || []).indexOf(info['type']) === -1, })() : info && (p['info']['scripts'] || []).indexOf("*") === -1 && (p['info']['scripts'] || []).indexOf(info['type']) === -1,
action: ((plug) => () => { action: ((plug) => () => {
// 如果没有加载到内存,则加载 // 如果没有加载到内存,则加载
if (!antSword['plugins'][plug['_id']]['module']) { if (!antSword['plugins'][plug['_id']]['module']) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment