Skip to content

Commit

Permalink
Remove deprecated settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxymillion committed Feb 16, 2023
1 parent 8700806 commit bc611c5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
18 changes: 3 additions & 15 deletions src/components/Settings/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {App, ButtonComponent, PluginSettingTab, Setting} from "obsidian";
import {pluginConfig} from "../../plugin.config";
import Zen from "../../main";
import {VIEW_TYPE_ZEN} from "../../constants";

export class SettingsTab extends PluginSettingTab {
plugin: Zen;
Expand Down Expand Up @@ -67,8 +66,8 @@ export class SettingsTab extends PluginSettingTab {

new Setting(containerEl)
.setName("Left side-dock")
.addButton(bc => this.highlightElement(bc, ".workspace-split.mod-horizontal.mod-left-split", false, `.workspace-tab-header[data-type='${VIEW_TYPE_ZEN}']`))
.setDesc("Including the side-dock toggle button(s), except the 'zen-toggle-button'.")
.addButton(bc => this.highlightElement(bc, ".workspace-split.mod-horizontal.mod-left-split", false))
.setDesc("Including the side-dock toggle button(s).")
.addToggle(tc => tc
.setValue(this.plugin.settings.preferences.sideDockLeft)
.onChange(async (value) => {
Expand All @@ -91,36 +90,25 @@ export class SettingsTab extends PluginSettingTab {
);
}

highlightElement(c: ButtonComponent, el: string, isAbsolute: boolean = false, exceptionEls: string|null = null) {
highlightElement(c: ButtonComponent, el: string, isAbsolute: boolean = false) {
//Status bar is outside of this.app.workspace.containerEl
const element = document.body.find(el);

const exceptionElements = exceptionEls && document.querySelectorAll(exceptionEls);
const highlightClass = isAbsolute ? "zen-highlight-el-ab" : "zen-highlight-el";
const exceptionClass = "zen-highlight-el--exception";

c.setIcon("eye");
c.setTooltip("Highlight");

c.buttonEl.addEventListener("mousedown", () => {
element?.classList.add(highlightClass);
exceptionElements && exceptionElements.forEach((sEl) =>{
sEl.classList.add(exceptionClass);
})
});

c.buttonEl.addEventListener("mouseup", () => {
element?.classList.remove(highlightClass);
exceptionElements && exceptionElements.forEach((sEl) =>{
sEl.classList.remove(exceptionClass);
})
});

c.buttonEl.addEventListener("mouseleave", () => {
element?.classList.remove(highlightClass);
exceptionElements && exceptionElements.forEach((sEl) =>{
sEl.classList.remove(exceptionClass);
})
});
}
}
3 changes: 1 addition & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
MarkdownView,
Plugin,
WorkspaceLeaf
Plugin
} from 'obsidian';
import {DEFAULT_SETTINGS, Settings} from "./utils/types";
import {SettingsTab} from "./components/Settings";
Expand Down
3 changes: 1 addition & 2 deletions src/ui/ZenView.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {getIcon, Menu, setIcon, View, WorkspaceLeaf} from "obsidian";
import {getIcon, setIcon, View, WorkspaceLeaf} from "obsidian";
import {VIEW_TYPE_ZEN} from "../constants";
import Zen from "../main";
import {pluginConfig} from "../plugin.config";


export class ZenLeaf extends WorkspaceLeaf{
Expand Down

0 comments on commit bc611c5

Please sign in to comment.