feat: 配置面板添加搜索功能

This commit is contained in:
fofolee 2021-12-31 18:12:22 +08:00
parent 04b2becbef
commit 5e2498ce2d
4 changed files with 35 additions and 9 deletions

View File

@ -55,6 +55,15 @@ let getAllQuickCommands = () => {
return allQcs
}
let searchFeatures = keyword => {
let fts = UTOOLS.getDocs(UTOOLS.DBPRE.QC).filter(x => x.data.features.explain.toLowerCase().includes(keyword.toLowerCase()))
if (!fts.length) return quickcommand.showMessageBox(`${keyword} 未找到!`, "warning")
if (fts.length == 1) return locateToFeature(fts[0].data.tags, fts[0].data.features.code)
quickcommand.showButtonBox(fts.map(x => x.data.features.explain)).then(y =>
locateToFeature(fts[y.id].data.tags, fts[y.id].data.features.code)
)
}
let getCurrentFts = () => {
let features = utools.getFeatures()
@ -278,6 +287,10 @@ let setYuQueToken = async () => {
// **************************************************
// *********************底部按钮**********************
// **************************************************
$("#options").on('change', '#searchFts', function () {
searchFeatures($("#searchFts").val())
})
$("#options").on('click', '.footBtn', async function () {
switch ($(this).attr('id')) {
case 'viewHelps':

View File

@ -1,6 +1,7 @@
let featurelist = {
footer: `
<div class="foot">
<input id="searchFts" placeholder="search">
<div id="clear" class="footBtn danger"><img src="img/clear.svg"><span>清除数据</span></div>
<div id="disableAll" class="footBtn danger"><img src="img/disable.svg"><span>禁用本页</span></div>
<div id="enableAll" class="footBtn"><img src="img/enable.svg"><span>启用本页</span></div>

View File

@ -333,6 +333,17 @@ body {
padding: 3px;
}
#options .foot input {
height: 60%;
width: 200px;
position: absolute;
left: 10px;
bottom: 5px;
border: 1px solid #068506;
border-radius: 5px;
outline: none;
}
#options .sidebar {
position: absolute;
top: 0;

View File

@ -545,6 +545,7 @@ let parseItem = item => {
return item.toString()
}
// The vm module of Node.js is deprecated in the renderer process and will be removed
runCodeInVm = (cmd, cb, enterData = {}) => {
const vm = createNodeVM(enterData)
//重定向 console