update
This commit is contained in:
93
.obsidian/plugins/cycle-in-sidebar/main.js
vendored
Normal file
93
.obsidian/plugins/cycle-in-sidebar/main.js
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||
if you want to view the source, please visit the github repository of this plugin
|
||||
*/
|
||||
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
__defProp(target, name, { get: all[name], enumerable: true });
|
||||
};
|
||||
var __copyProps = (to, from, except, desc) => {
|
||||
if (from && typeof from === "object" || typeof from === "function") {
|
||||
for (let key of __getOwnPropNames(from))
|
||||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// main.ts
|
||||
var main_exports = {};
|
||||
__export(main_exports, {
|
||||
default: () => CycleInSidebarPlugin
|
||||
});
|
||||
module.exports = __toCommonJS(main_exports);
|
||||
var import_obsidian = require("obsidian");
|
||||
var CycleInSidebarPlugin = class extends import_obsidian.Plugin {
|
||||
getLeavesOfSidebar(split) {
|
||||
const oneSideSplitRoot = split.getRoot();
|
||||
const leaves = [];
|
||||
this.app.workspace.iterateAllLeaves((l) => {
|
||||
leaves.push(l);
|
||||
});
|
||||
return leaves.filter((l) => l.getRoot() === oneSideSplitRoot).filter((l) => l.view.getViewType() !== "empty");
|
||||
}
|
||||
isSidebarOpen(split) {
|
||||
return this.getLeavesOfSidebar(split).some((l) => l.view.containerEl.clientHeight > 0);
|
||||
}
|
||||
cycleInSideBar(split, offset) {
|
||||
const leaves = this.getLeavesOfSidebar(split);
|
||||
var currentIndex = 0;
|
||||
for (; currentIndex < leaves.length; currentIndex++) {
|
||||
if (leaves[currentIndex].view.containerEl.clientHeight > 0)
|
||||
break;
|
||||
}
|
||||
if (currentIndex == leaves.length)
|
||||
return;
|
||||
const nextIndex = (currentIndex + offset < 0 ? leaves.length - 1 : currentIndex + offset) % leaves.length;
|
||||
this.app.workspace.revealLeaf(leaves[nextIndex]);
|
||||
}
|
||||
async cycleRightSideBar(offset) {
|
||||
this.cycleInSideBar(this.app.workspace.rightSplit, offset);
|
||||
}
|
||||
async cycleLeftSideBar(offset) {
|
||||
this.cycleInSideBar(this.app.workspace.leftSplit, offset);
|
||||
}
|
||||
async onload() {
|
||||
this.addCommand({
|
||||
id: "cycle-right-sidebar",
|
||||
name: "Cycle tabs of right sidebar",
|
||||
callback: () => {
|
||||
this.cycleRightSideBar(1);
|
||||
}
|
||||
});
|
||||
this.addCommand({
|
||||
id: "cycle-right-sidebar-reverse",
|
||||
name: "Cycle tabs of right sidebar in reverse",
|
||||
callback: () => {
|
||||
this.cycleRightSideBar(-1);
|
||||
}
|
||||
});
|
||||
this.addCommand({
|
||||
id: "cycle-left-sidebar",
|
||||
name: "Cycle tabs of left sidebar",
|
||||
callback: () => {
|
||||
this.cycleLeftSideBar(1);
|
||||
}
|
||||
});
|
||||
this.addCommand({
|
||||
id: "cycle-left-sidebar-reverse",
|
||||
name: "Cycle tabs of left sidebar in reverse",
|
||||
callback: () => {
|
||||
this.cycleLeftSideBar(-1);
|
||||
}
|
||||
});
|
||||
}
|
||||
onunload() {
|
||||
}
|
||||
};
|
10
.obsidian/plugins/cycle-in-sidebar/manifest.json
vendored
Normal file
10
.obsidian/plugins/cycle-in-sidebar/manifest.json
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"id": "cycle-in-sidebar",
|
||||
"name": "Cycle In Sidebar",
|
||||
"version": "1.0.2",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "This a plugin provides hotkeys to cycle through tabs in the left or right sidebars.",
|
||||
"author": "Houcheng",
|
||||
"authorUrl": "https://www.flickr.com/photos/houcheng_tw/",
|
||||
"isDesktopOnly": false
|
||||
}
|
8
.obsidian/plugins/cycle-in-sidebar/styles.css
vendored
Normal file
8
.obsidian/plugins/cycle-in-sidebar/styles.css
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
|
||||
This CSS file will be included with your plugin, and
|
||||
available in the app when your plugin is enabled.
|
||||
|
||||
If your plugin does not need CSS, delete this file.
|
||||
|
||||
*/
|
Reference in New Issue
Block a user