第一个:方框输错了
{trigger: "999 ", replacement: () => {
app.commands.executeCommandById('editing-toolbar:editor-paste');
return "";
}, options: "tA"},
函数要用 () 包裹
第二个我猜测是时序问题,你运行这个 Command 的时候没来得及完成替换。
试试这个:
{trigger: "888 ", replacement: () => {
function myFunction() {
app.commands.executeCommandById("editing-toolbar:editor:swap-line-up");
}
// 等待 500 毫秒后执行函数
setTimeout(myFunction, 300);
return "";
}, options: "tA"},
会先等待 300 毫秒再执行命令,这样应该能稳定成功。