feat: add more memo settings

This commit is contained in:
Steven
2024-05-29 23:17:53 +08:00
parent 1894ef161f
commit 0f4b7c5f4a
12 changed files with 251 additions and 109 deletions

View File

@ -142,6 +142,24 @@ const WorkspaceSection = () => {
});
};
const handleMemoEnableAutoCompact = async (value: boolean) => {
const update: WorkspaceMemoRelatedSetting = { ...workspaceMemoRelatedSetting, enableAutoCompact: value };
setWorkspaceMemoRelatedSetting(update);
await workspaceSettingStore.setWorkspaceSetting({
name: `${WorkspaceSettingPrefix}${WorkspaceSettingKey.MEMO_RELATED}`,
memoRelatedSetting: update,
});
};
const handleMemoEnableDoubleClickToEdit = async (value: boolean) => {
const update: WorkspaceMemoRelatedSetting = { ...workspaceMemoRelatedSetting, enableDoubleClickEdit: value };
setWorkspaceMemoRelatedSetting(update);
await workspaceSettingStore.setWorkspaceSetting({
name: `${WorkspaceSettingPrefix}${WorkspaceSettingKey.MEMO_RELATED}`,
memoRelatedSetting: update,
});
};
const handleMemoContentLengthLimitChanges = async (value: number) => {
if (value < 8 * 1024) {
toast.error("Content length limit should be greater than 8KB");
@ -271,6 +289,20 @@ const WorkspaceSection = () => {
onChange={(event) => handleMemoDisplayWithUpdatedTs(event.target.checked)}
/>
</div>
<div className="w-full flex flex-row justify-between items-center">
<span>{t("setting.system-section.enable-auto-compact")}</span>
<Switch
checked={workspaceMemoRelatedSetting.enableAutoCompact}
onChange={(event) => handleMemoEnableAutoCompact(event.target.checked)}
/>
</div>
<div className="w-full flex flex-row justify-between items-center">
<span>{t("setting.system-section.enable-double-click-to-edit")}</span>
<Switch
checked={workspaceMemoRelatedSetting.enableDoubleClickEdit}
onChange={(event) => handleMemoEnableDoubleClickToEdit(event.target.checked)}
/>
</div>
<div className="w-full flex flex-row justify-between items-center">
<span>Content length limit(Byte)</span>
<Input