-
-
- {nodes.map((node, index) => {
- if (prevNode?.type !== NodeType.LINE_BREAK && node.type === NodeType.LINE_BREAK && skipNextLineBreakFlag) {
- skipNextLineBreakFlag = false;
- return null;
- }
-
- prevNode = node;
- skipNextLineBreakFlag = true;
- return ;
- })}
-
- {showCompactMode && (
-
- setShowCompactMode(false)}
- >
- {t("memo.show-more")}
-
-
+
+
+
+ {nodes.map((node, index) => {
+ if (prevNode?.type !== NodeType.LINE_BREAK && node.type === NodeType.LINE_BREAK && skipNextLineBreakFlag) {
+ skipNextLineBreakFlag = false;
+ return null;
+ }
+
+ prevNode = node;
+ skipNextLineBreakFlag = true;
+ return ;
+ })}
-
- >
+ {showCompactMode && (
+
+ setShowCompactMode(false)}
+ >
+ {t("memo.show-more")}
+
+
+ )}
+
+
);
};
diff --git a/web/src/components/MemoView.tsx b/web/src/components/MemoView.tsx
index bcb16836..0ba4e064 100644
--- a/web/src/components/MemoView.tsx
+++ b/web/src/components/MemoView.tsx
@@ -4,14 +4,17 @@ import { memo, useCallback, useEffect, useRef, useState } from "react";
import { Link, useLocation } from "react-router-dom";
import useCurrentUser from "@/hooks/useCurrentUser";
import useNavigateTo from "@/hooks/useNavigateTo";
-import { useUserStore } from "@/store/v1";
+import { useUserStore, useWorkspaceSettingStore } from "@/store/v1";
import { MemoRelation_Type } from "@/types/proto/api/v1/memo_relation_service";
import { Memo, Visibility } from "@/types/proto/api/v1/memo_service";
+import { WorkspaceMemoRelatedSetting } from "@/types/proto/api/v1/workspace_setting_service";
+import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";
import { useTranslate } from "@/utils/i18n";
import { convertVisibilityToString } from "@/utils/memo";
import Icon from "./Icon";
import MemoActionMenu from "./MemoActionMenu";
import MemoContent from "./MemoContent";
+import showMemoEditorDialog from "./MemoEditor/MemoEditorDialog";
import MemoReactionistView from "./MemoReactionListView";
import MemoRelationListView from "./MemoRelationListView";
import MemoResourceListView from "./MemoResourceListView";
@@ -38,6 +41,10 @@ const MemoView: React.FC
= (props: Props) => {
const currentUser = useCurrentUser();
const userStore = useUserStore();
const user = useCurrentUser();
+ const workspaceSettingStore = useWorkspaceSettingStore();
+ const workspaceMemoRelatedSetting =
+ workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.MEMO_RELATED).memoRelatedSetting ||
+ WorkspaceMemoRelatedSetting.fromPartial({});
const [creator, setCreator] = useState(userStore.getUserByName(memo.creator));
const memoContainerRef = useRef(null);
const referencedMemos = memo.relations.filter((relation) => relation.type === MemoRelation_Type.REFERENCE);
@@ -71,6 +78,20 @@ const MemoView: React.FC = (props: Props) => {
}
}, []);
+ const handleMemoContentDoubleClick = useCallback(async (e: React.MouseEvent) => {
+ if (readonly) {
+ return;
+ }
+
+ if (workspaceMemoRelatedSetting.enableDoubleClickEdit) {
+ e.preventDefault();
+ showMemoEditorDialog({
+ memoName: memo.name,
+ cacheKey: `${memo.name}-${memo.updateTime}`,
+ });
+ }
+ }, []);
+
const displayTime =
props.displayTimeFormat === "time" ? (
memo.displayTime?.toLocaleTimeString()
@@ -154,7 +175,8 @@ const MemoView: React.FC = (props: Props) => {
nodes={memo.nodes}
readonly={readonly}
onClick={handleMemoContentClick}
- compact={props.compact ?? true}
+ onDoubleClick={handleMemoContentDoubleClick}
+ compact={props.compact && workspaceMemoRelatedSetting.enableAutoCompact}
/>
diff --git a/web/src/components/Settings/WorkspaceSection.tsx b/web/src/components/Settings/WorkspaceSection.tsx
index ea42ecac..46db058d 100644
--- a/web/src/components/Settings/WorkspaceSection.tsx
+++ b/web/src/components/Settings/WorkspaceSection.tsx
@@ -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)}
/>
+
+ {t("setting.system-section.enable-auto-compact")}
+ handleMemoEnableAutoCompact(event.target.checked)}
+ />
+
+
+ {t("setting.system-section.enable-double-click-to-edit")}
+ handleMemoEnableDoubleClickToEdit(event.target.checked)}
+ />
+
Content length limit(Byte)
{
useEffect(() => {
const initialWorkspace = async () => {
const workspaceProfile = await workspaceServiceClient.getWorkspaceProfile({});
- await workspaceSettingStore.fetchWorkspaceSetting(WorkspaceSettingKey.GENERAL);
+ // Initial fetch for workspace settings.
+ (async () => {
+ [WorkspaceSettingKey.GENERAL, WorkspaceSettingKey.MEMO_RELATED].forEach(async (key) => {
+ await workspaceSettingStore.fetchWorkspaceSetting(key);
+ });
+ })();
const workspaceGeneralSetting =
workspaceSettingStore.getWorkspaceSettingByKey(WorkspaceSettingKey.GENERAL).generalSetting ||
diff --git a/web/src/locales/en.json b/web/src/locales/en.json
index e9dc39bf..42401b4f 100644
--- a/web/src/locales/en.json
+++ b/web/src/locales/en.json
@@ -290,6 +290,8 @@
"disable-password-login-warning": "This will disable password login for all users. It is not possible to log in without reverting this setting in the database if your configured identity providers fail. You’ll also have to be extra carefull when removing an identity provider",
"disable-public-memos": "Disable public memos",
"display-with-updated-time": "Display with updated time",
+ "enable-auto-compact": "Enable auto compact",
+ "enable-double-click-to-edit": "Enable double click to edit",
"enable-password-login": "Enable password login",
"enable-password-login-warning": "This will enable password login for all users. Continue only if you want to users to be able to log in using both SSO and password",
"max-upload-size": "Maximum upload size (MiB)",