mirror of
https://github.com/eondrcode/obsidian-manager.git
synced 2026-07-22 11:40:24 +00:00
0.0.2
This commit is contained in:
parent
9fbe0ab210
commit
36aa88ba1b
5 changed files with 13 additions and 15 deletions
4
main.ts
4
main.ts
|
|
@ -1,3 +1,3 @@
|
|||
import I18n from './src/main'
|
||||
import Manager from './src/main'
|
||||
|
||||
export default I18n
|
||||
export default Manager
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { App } from "obsidian";
|
||||
import I18N from "./main";
|
||||
import Manager from "./main";
|
||||
import { ManagerModal } from "./modal/manager-modal";
|
||||
import { t } from "./lang/inxdex";
|
||||
|
||||
const Commands = (app: App, i18n: I18N) => {
|
||||
i18n.addCommand({
|
||||
id: 'i18n-translate',
|
||||
const Commands = (app: App, manager: Manager) => {
|
||||
manager.addCommand({
|
||||
id: 'manager-view',
|
||||
name: t('命令_管理面板_描述'),
|
||||
callback: () => { new ManagerModal(app, i18n).open() }
|
||||
callback: () => { new ManagerModal(app, manager).open() }
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import { ManagerPlugin } from './data/types';
|
|||
export default class Manager extends Plugin {
|
||||
settings: ManagerSettings;
|
||||
managerModal: ManagerModal;
|
||||
|
||||
appPlugins: any;
|
||||
|
||||
async onload() {
|
||||
|
|
@ -32,7 +31,7 @@ export default class Manager extends Plugin {
|
|||
plugins.forEach((plugin: PluginManifest) => this.initPlugin(plugin));
|
||||
plugins.forEach((plugin: PluginManifest) => this.startPlugin(plugin.id));
|
||||
}
|
||||
|
||||
|
||||
async onunload() {
|
||||
const plugins = Object.values(this.appPlugins.manifests).filter((pm: PluginManifest) => pm.id !== this.manifest.id);
|
||||
plugins.forEach(async (pm: PluginManifest) => {
|
||||
|
|
@ -79,5 +78,6 @@ export default class Manager extends Plugin {
|
|||
await this.appPlugins.enablePlugin(id);
|
||||
}, plugin.delay * 1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import { t } from "src/lang/inxdex";
|
|||
|
||||
export default class ManagerBasis extends BaseSetting {
|
||||
main(): void {
|
||||
new Setting(this.containerEl).setName(t('设置_基础设置_样式_标题')).setHeading();
|
||||
|
||||
const itemStyleBar = new Setting(this.containerEl).setName(t('设置_基础设置_目录样式_标题')).setDesc(t('设置_基础设置_目录样式_描述'));
|
||||
const itemStyleDropdown = new DropdownComponent(itemStyleBar.controlEl);
|
||||
|
|
@ -34,8 +33,6 @@ export default class ManagerBasis extends BaseSetting {
|
|||
this.manager.saveSettings();
|
||||
});
|
||||
|
||||
new Setting(this.containerEl).setName(t('设置_基础设置_功能_标题')).setHeading();
|
||||
|
||||
const fadeOutDisabledPluginsBar = new Setting(this.containerEl).setName(t('设置_基础设置_淡化插件_标题')).setDesc(t('设置_基础设置_淡化插件_描述'));
|
||||
const fadeOutDisabledPluginsToggle = new ToggleComponent(fadeOutDisabledPluginsBar.controlEl);
|
||||
fadeOutDisabledPluginsToggle.setValue(this.settings.FADE_OUT_DISABLED_PLUGINS);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { Notice } from 'obsidian';
|
||||
import { Notice, Platform } from 'obsidian';
|
||||
import { exec } from 'child_process';
|
||||
import { t } from './lang/inxdex';
|
||||
|
||||
|
|
@ -10,14 +10,15 @@ import { t } from './lang/inxdex';
|
|||
* 如果操作成功,显示成功通知;如果失败,显示错误通知。
|
||||
*/
|
||||
export const managerOpen = (dir: string) => {
|
||||
if (navigator.userAgent.match(/Win/i)) {
|
||||
if (Platform.isDesktop) {
|
||||
exec(`start "" "${dir}"`, (error) => {
|
||||
if (error) { new Notice(t('通用_失败_文本')); } else { new Notice(t('通用_成功_文本')); }
|
||||
});
|
||||
}
|
||||
if (navigator.userAgent.match(/Mac/i)) {
|
||||
if (Platform.isMacOS) {
|
||||
exec(`open ${dir}`, (error) => {
|
||||
if (error) { new Notice(t('通用_失败_文本')); } else { new Notice(t('通用_成功_文本')); }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue