新增用户变量

This commit is contained in:
fofolee
2022-04-26 00:26:09 +08:00
parent 31f5d3c94c
commit 9b1a4a883b
5 changed files with 159 additions and 12 deletions

View File

@@ -144,7 +144,19 @@ const specialVars = {
type: "command",
match: /{{py:(.*?)}}/mg,
repl: py => window.runPythonCommand(py.slice(5, -2))
},
userData: {
name: "userData",
label: "{{usr:}}",
desc: "用户设置的变量",
match: /{{usr:(.*?)}}/mg,
repl: (text, userData) => {
console.log(userData);
let filterd = userData.filter(x => x.id === text.slice(6, -2))
return filterd.length ? filterd[0].value : ''
},
tooltip: "仅本机可用时,该变量值只在本机有效,否则,所有电脑有效",
}
}
export default specialVars
export default specialVars