mirror of
https://github.com/usememos/memos.git
synced 2024-11-11 01:12:40 +08:00
chore: rename enableFoldMemo
(#671)
* chore: rename `enableFoldMemo` * chore: update
This commit is contained in:
parent
4767ee3293
commit
4a9314c476
6 changed files with 11 additions and 11 deletions
|
@ -4,10 +4,10 @@ import { useTranslation } from "react-i18next";
|
||||||
import { RouterProvider } from "react-router-dom";
|
import { RouterProvider } from "react-router-dom";
|
||||||
import { globalService, locationService } from "./services";
|
import { globalService, locationService } from "./services";
|
||||||
import { useAppSelector } from "./store";
|
import { useAppSelector } from "./store";
|
||||||
import Loading from "./pages/Loading";
|
|
||||||
import router from "./router";
|
import router from "./router";
|
||||||
import * as storage from "./helpers/storage";
|
import * as storage from "./helpers/storage";
|
||||||
import { getSystemColorScheme } from "./helpers/utils";
|
import { getSystemColorScheme } from "./helpers/utils";
|
||||||
|
import Loading from "./pages/Loading";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const { i18n } = useTranslation();
|
const { i18n } = useTranslation();
|
||||||
|
@ -69,7 +69,7 @@ function App() {
|
||||||
const root = document.documentElement;
|
const root = document.documentElement;
|
||||||
if (mode === "light") {
|
if (mode === "light") {
|
||||||
root.classList.remove("dark");
|
root.classList.remove("dark");
|
||||||
} else {
|
} else if (mode === "dark") {
|
||||||
root.classList.add("dark");
|
root.classList.add("dark");
|
||||||
}
|
}
|
||||||
}, [mode]);
|
}, [mode]);
|
||||||
|
|
|
@ -52,7 +52,7 @@ const MemoContent: React.FC<Props> = (props: Props) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displayConfig.enableExpand && user && user.localSetting.isFoldingEnabled) {
|
if (displayConfig.enableExpand && user && user.localSetting.enableFoldMemo) {
|
||||||
if (foldedContent.length !== content.length) {
|
if (foldedContent.length !== content.length) {
|
||||||
setState({
|
setState({
|
||||||
...state,
|
...state,
|
||||||
|
@ -65,7 +65,7 @@ const MemoContent: React.FC<Props> = (props: Props) => {
|
||||||
expandButtonStatus: -1,
|
expandButtonStatus: -1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [user?.localSetting.isFoldingEnabled]);
|
}, [user?.localSetting.enableFoldMemo]);
|
||||||
|
|
||||||
const handleMemoContentClick = async (e: React.MouseEvent) => {
|
const handleMemoContentClick = async (e: React.MouseEvent) => {
|
||||||
if (onMemoContentClick) {
|
if (onMemoContentClick) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ const PreferencesSection = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleIsFoldingEnabledChanged = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleIsFoldingEnabledChanged = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
userService.upsertLocalSetting("isFoldingEnabled", event.target.checked);
|
userService.upsertLocalSetting("enableFoldMemo", event.target.checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -129,7 +129,7 @@ const PreferencesSection = () => {
|
||||||
</label>
|
</label>
|
||||||
<label className="form-label selector">
|
<label className="form-label selector">
|
||||||
<span className="normal-text">{t("setting.preference-section.enable-folding-memo")}</span>
|
<span className="normal-text">{t("setting.preference-section.enable-folding-memo")}</span>
|
||||||
<Switch className="ml-2" checked={localSetting.isFoldingEnabled} onChange={handleIsFoldingEnabledChanged} />
|
<Switch className="ml-2" checked={localSetting.enableFoldMemo} onChange={handleIsFoldingEnabledChanged} />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -71,13 +71,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
> .resource-action-list {
|
> .resource-action-list {
|
||||||
@apply hidden flex-col justify-start items-start absolute top-6 left-0 mt-1 p-1 z-1 rounded w-36 max-h-52 overflow-auto font-mono bg-zinc-100;
|
@apply hidden flex-col justify-start items-start absolute top-6 left-0 mt-1 p-1 z-1 rounded w-auto overflow-auto font-mono shadow bg-zinc-200 dark:bg-zinc-600;
|
||||||
|
|
||||||
> .resource-action-item {
|
> .resource-action-item {
|
||||||
@apply w-full flex text-black cursor-pointer rounded text-sm leading-6 px-2 truncate hover:bg-zinc-300 shrink-0;
|
@apply w-full flex text-black dark:text-gray-300 cursor-pointer rounded text-sm leading-6 px-2 truncate hover:bg-zinc-300 dark:hover:bg-zinc-700 shrink-0;
|
||||||
|
|
||||||
> .icon-img {
|
> .icon-img {
|
||||||
@apply w-4 mr-2;
|
@apply w-4 mr-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ const defaultSetting: Setting = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultLocalSetting: LocalSetting = {
|
const defaultLocalSetting: LocalSetting = {
|
||||||
isFoldingEnabled: true,
|
enableFoldMemo: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const convertResponseModelUser = (user: User): User => {
|
export const convertResponseModelUser = (user: User): User => {
|
||||||
|
|
2
web/src/types/modules/setting.d.ts
vendored
2
web/src/types/modules/setting.d.ts
vendored
|
@ -8,7 +8,7 @@ interface Setting {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface LocalSetting {
|
interface LocalSetting {
|
||||||
isFoldingEnabled: boolean;
|
enableFoldMemo: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface UserLocaleSetting {
|
interface UserLocaleSetting {
|
||||||
|
|
Loading…
Reference in a new issue