Add option to remember editor position and zoom
This commit is contained in:
parent
fa3eba219e
commit
764f9fe5a4
3 changed files with 50 additions and 4 deletions
|
@ -4,6 +4,7 @@ import {Plugin, showMessage} from "siyuan";
|
|||
import {SettingUtils} from "@/libs/setting-utils";
|
||||
|
||||
type Options = {
|
||||
restorePosition: boolean;
|
||||
grid: boolean
|
||||
background: string
|
||||
dialogOnDesktop: boolean
|
||||
|
@ -11,6 +12,7 @@ type Options = {
|
|||
};
|
||||
|
||||
export type DefaultEditorOptions = {
|
||||
restorePosition: boolean;
|
||||
grid: boolean
|
||||
background: string
|
||||
}
|
||||
|
@ -30,8 +32,9 @@ export class PluginConfig {
|
|||
|
||||
getDefaultEditorOptions(): DefaultEditorOptions {
|
||||
return {
|
||||
restorePosition: this.options.restorePosition,
|
||||
grid: this.options.grid,
|
||||
background: this.options.background,
|
||||
background: this.options.background
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -50,6 +53,7 @@ export class PluginConfig {
|
|||
background: "#00000000",
|
||||
dialogOnDesktop: false,
|
||||
analytics: true,
|
||||
restorePosition: true,
|
||||
};
|
||||
this.firstRun = true;
|
||||
}
|
||||
|
@ -107,6 +111,7 @@ export class PluginConfigViewer {
|
|||
background: color,
|
||||
dialogOnDesktop: data.dialogOnDesktop,
|
||||
analytics: data.analytics,
|
||||
restorePosition: data.restorePosition,
|
||||
});
|
||||
await this.config.save();
|
||||
|
||||
|
@ -148,6 +153,14 @@ export class PluginConfigViewer {
|
|||
type: 'textinput',
|
||||
});
|
||||
|
||||
this.settingUtils.addItem({
|
||||
key: "restorePosition",
|
||||
title: this.plugin.i18n.settings.restorePosition.title,
|
||||
description: this.plugin.i18n.settings.restorePosition.description,
|
||||
value: this.config.options.restorePosition,
|
||||
type: 'checkbox'
|
||||
});
|
||||
|
||||
this.settingUtils.addItem({
|
||||
key: "dialogOnDesktop",
|
||||
title: this.plugin.i18n.settings.dialogOnDesktop.title,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue