請問js檔要怎麼在obsidian run?謝謝您

請問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);
}

这个代码是不是没有更新,我运行 run 了好像只是左右分屏并没有左编辑右预览。

如果没有特殊要求,Ctrl + 右键点击视图图标可快速打开当前页面关联标签页,并且一个编辑视图一个阅读视图。

image

1 个赞

PlayerMiller 大佬,多謝回覆。:+1::+1::+1::+1::+1:
我是希望能做到不用滑鼠,能一鍵調整左、右筆記的佈局(layout)。
我補充說明如連結,謝謝您。