Skip to content

Commit

Permalink
feat: 增加配置字段
Browse files Browse the repository at this point in the history
  • Loading branch information
frostime committed Jun 4, 2023
1 parent 3a02dcf commit a715a31
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
14 changes: 9 additions & 5 deletions src/components/libs/reserve.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { i18n, lute } from "../../utils";
import { showMessage, confirm } from "siyuan";
import * as serverApi from "../../serverApi";
import { reservation } from "../../global-status";
import { reservation, settings } from "../../global-status";


const Zh1to9 = '一二三四五六七八九';
Expand Down Expand Up @@ -159,10 +159,14 @@ export async function reserveBlock(blockId) {
return;
}

let html = createConfirmDialog(kramdown, resMatch);
confirm(`${i18n.ReserveMenu.Title}: ${resDate.toLocaleDateString()}?`, html
, () => doReserveBlock(blockId, resDate)
);
if (settings.get('PopupReserveDialog')) {
let html = createConfirmDialog(kramdown, resMatch);
confirm(`${i18n.ReserveMenu.Title}: ${resDate.toLocaleDateString()}?`, html
, () => doReserveBlock(blockId, resDate)
);
} else {
doReserveBlock(blockId, resDate);
}
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/global-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type IconPosition = 'left' | 'right';
type SettingKey = (
'OpenOnStart' | 'DefaultNotebook' | 'IconPosition' |
'DiaryUpToDate' | 'PluginVersion' | "EnableMove" |
'EnableReserve' | "ExpandGutterMenu"
'EnableReserve' | "ExpandGutterMenu" | 'PopupReserveDialog'
);

interface Item {
Expand All @@ -32,10 +32,10 @@ class SettingManager {
DefaultNotebook: '', //默认笔记本的 ID
IconPosition: 'left' as IconPosition, //图标放置位置
PluginVersion: '',
EnableMove: false as boolean,
EnableReserve: false as boolean,
ExpandGutterMenu: true as boolean //是否将菜单项目展开

EnableMove: true as boolean,
EnableReserve: true as boolean,
ExpandGutterMenu: true as boolean, //是否将菜单项目展开
PopupReserveDialog: true as boolean //是否弹出预约对话框
};

constructor() {
Expand Down

0 comments on commit a715a31

Please sign in to comment.