Unverified Commit b92da8f1 authored by boojack's avatar boojack Committed by GitHub

fix: check localsetting exists (#1076)

parent bdf0c442
...@@ -34,7 +34,6 @@ const Memo: React.FC<Props> = (props: Props) => { ...@@ -34,7 +34,6 @@ const Memo: React.FC<Props> = (props: Props) => {
const locationStore = useLocationStore(); const locationStore = useLocationStore();
const userStore = useUserStore(); const userStore = useUserStore();
const memoStore = useMemoStore(); const memoStore = useMemoStore();
const { localSetting } = userStore.state.user as User;
const [displayTimeStr, setDisplayTimeStr] = useState<string>(getFormatedMemoTimeStr(memo.displayTs, i18n.language)); const [displayTimeStr, setDisplayTimeStr] = useState<string>(getFormatedMemoTimeStr(memo.displayTs, i18n.language));
const memoContainerRef = useRef<HTMLDivElement>(null); const memoContainerRef = useRef<HTMLDivElement>(null);
const isVisitorMode = userStore.isVisitorMode(); const isVisitorMode = userStore.isVisitorMode();
...@@ -152,7 +151,8 @@ const Memo: React.FC<Props> = (props: Props) => { ...@@ -152,7 +151,8 @@ const Memo: React.FC<Props> = (props: Props) => {
}; };
const handleMemoContentDoubleClick = (e: React.MouseEvent) => { const handleMemoContentDoubleClick = (e: React.MouseEvent) => {
if (!localSetting.enableDoubleClickEditing) { const loginUser = userStore.state.user;
if (loginUser && !loginUser.localSetting.enableDoubleClickEditing) {
return; return;
} }
const targetEl = e.target as HTMLElement; const targetEl = e.target as HTMLElement;
......
import { Select, Switch, Option } from "@mui/joy"; import { Select, Switch, Option } from "@mui/joy";
import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useGlobalStore, useUserStore } from "../../store/module"; import { useGlobalStore, useUserStore } from "../../store/module";
import { VISIBILITY_SELECTOR_ITEMS, MEMO_DISPLAY_TS_OPTION_SELECTOR_ITEMS } from "../../helpers/consts"; import { VISIBILITY_SELECTOR_ITEMS, MEMO_DISPLAY_TS_OPTION_SELECTOR_ITEMS } from "../../helpers/consts";
import AppearanceSelect from "../AppearanceSelect"; import AppearanceSelect from "../AppearanceSelect";
import LocaleSelect from "../LocaleSelect"; import LocaleSelect from "../LocaleSelect";
import "../../less/settings/preferences-section.less"; import "../../less/settings/preferences-section.less";
import React from "react";
const PreferencesSection = () => { const PreferencesSection = () => {
const { t } = useTranslation(); const { t } = useTranslation();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment