請問js檔要怎麼在obsidian run?
請問火冷大佬網頁的js檔要怎麼在obsidian run?
我想學火冷大佬設成快捷鍵, 一鍵完成面板配置.
謝謝
js代碼資料來源: 火冷大佬
splitRight() {
var leftIsSource = this.app.workspace.activeLeaf.view.getMode() === "source";
this.app.commands.executeCommandById("workspace:close-others"); //关闭所有其他面板
this.app.commands.executeCommandById('workspace:split-vertical'); //左右拆分
var ot = setInterval(function() {
if (document.querySelector(".mod-active").previousElementSibling.className === "workspace-leaf") {
//已激活右边面板
clearInterval(ot);
//处理逻辑
if (leftIsSource) {
this.app.commands.executeCommandById("markdown:toggle-preview"); //右边转成预览模式
setTimeout(function() {
this.app.commands.executeCommandById("editor:focus-left"); //焦点切换到左边
console.log("left");
}, 200); //NOTE 必须,时间可优化
} else {
this.app.commands.executeCommandById("editor:focus-left"); //焦点切换到左边
this.app.commands.executeCommandById("markdown:toggle-preview"); //转成编辑模式
}
}
}, 100);
}