@lobehub/lobehub 2.0.0-next.254 → 2.0.0-next.256
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/changelog/v1.json +18 -0
- package/locales/en-US/plugin.json +1 -0
- package/locales/zh-CN/plugin.json +1 -0
- package/package.json +1 -1
- package/packages/builtin-tool-notebook/src/client/Placeholder/CreateDocument.tsx +6 -6
- package/packages/builtin-tool-notebook/src/client/Render/CreateDocument/DocumentCard.tsx +23 -10
- package/packages/builtin-tool-notebook/src/client/Streaming/CreateDocument/index.tsx +1 -1
- package/packages/database/src/models/__tests__/agent.test.ts +91 -4
- package/packages/database/src/models/agent.ts +15 -7
- package/packages/editor-runtime/src/EditorRuntime.ts +1 -1
- package/packages/editor-runtime/src/__tests__/EditorRuntime.real.test.ts +65 -4
- package/packages/editor-runtime/src/__tests__/__snapshots__/EditorRuntime.real.test.ts.snap +108 -17
- package/packages/editor-runtime/src/__tests__/fixtures/remove-then-add.json +636 -0
- package/packages/editor-runtime/src/__tests__/fixtures/remove.json +1 -0
- package/packages/types/src/agent/agentConfig.ts +8 -8
- package/src/app/[variants]/(main)/chat/features/Portal/_layout/Mobile.tsx +2 -1
- package/src/app/[variants]/(main)/group/features/Portal/_layout/Mobile.tsx +2 -1
- package/src/app/[variants]/(main)/home/_layout/hooks/useCreateMenuItems.tsx +2 -2
- package/src/app/[variants]/(main)/page/{features/PageTitle → PageTitle}/index.tsx +0 -1
- package/src/app/[variants]/(main)/page/[id]/index.tsx +43 -1
- package/src/app/[variants]/(main)/page/_layout/Body/AllPagesDrawer/Content.tsx +15 -15
- package/src/app/[variants]/(main)/page/_layout/Body/List/Item/Editing.tsx +3 -3
- package/src/app/[variants]/(main)/page/_layout/Body/List/Item/index.tsx +7 -12
- package/src/app/[variants]/(main)/page/_layout/Body/List/Item/useDropdownMenu.tsx +5 -5
- package/src/app/[variants]/(main)/page/_layout/Body/List/index.tsx +7 -7
- package/src/app/[variants]/(main)/page/_layout/Body/index.tsx +15 -9
- package/src/app/[variants]/(main)/page/_layout/Body/useDropdownMenu.tsx +3 -3
- package/src/app/[variants]/(main)/page/_layout/DataSync.tsx +15 -0
- package/src/app/[variants]/(main)/page/_layout/Header/AddButton.tsx +2 -2
- package/src/app/[variants]/(main)/page/_layout/index.tsx +2 -0
- package/src/app/[variants]/(main)/page/index.tsx +3 -7
- package/src/components/Editor/AutoSaveHint.tsx +1 -1
- package/src/features/Conversation/Messages/AssistantGroup/Tool/Render/Intervention/ApprovalActions.tsx +2 -2
- package/src/features/Conversation/Messages/AssistantGroup/Tool/index.tsx +18 -15
- package/src/features/Conversation/Messages/AssistantGroup/components/Group.tsx +3 -3
- package/src/features/Conversation/Messages/Contexts/MessageAggregationContext.ts +15 -0
- package/src/features/Conversation/Messages/Supervisor/components/Group.tsx +3 -3
- package/src/features/Conversation/Messages/User/Actions/index.tsx +5 -1
- package/src/features/EditorCanvas/AutoSaveHint.tsx +37 -0
- package/src/features/{PageEditor → EditorCanvas}/DiffAllToolbar.tsx +57 -16
- package/src/features/EditorCanvas/DocumentIdMode.tsx +111 -0
- package/src/features/EditorCanvas/EditorCanvas.tsx +148 -0
- package/src/features/EditorCanvas/EditorDataMode.tsx +64 -0
- package/src/features/EditorCanvas/ErrorBoundary.tsx +66 -0
- package/src/features/EditorCanvas/InlineToolbar.tsx +245 -0
- package/src/features/EditorCanvas/InternalEditor.tsx +134 -0
- package/src/features/{PageEditor/EditorCanvas → EditorCanvas}/actions.ts +10 -8
- package/src/features/EditorCanvas/index.ts +9 -0
- package/src/features/PageEditor/EditorCanvas/index.tsx +14 -111
- package/src/features/PageEditor/EditorCanvas/useAskCopilotItem.tsx +95 -0
- package/src/features/PageEditor/EditorCanvas/useSlashItems.tsx +1 -1
- package/src/features/PageEditor/Header/Breadcrumb.tsx +2 -2
- package/src/features/PageEditor/Header/index.tsx +15 -18
- package/src/features/PageEditor/Header/useMenu.tsx +12 -9
- package/src/features/PageEditor/PageEditor.tsx +45 -21
- package/src/features/PageEditor/PageEditorProvider.tsx +13 -1
- package/src/features/PageEditor/PageTitle/index.tsx +2 -2
- package/src/features/PageEditor/StoreUpdater.tsx +35 -308
- package/src/features/PageEditor/{Body/Title.tsx → TitleSection.tsx} +16 -16
- package/src/features/PageEditor/store/action.ts +96 -188
- package/src/features/PageEditor/store/initialState.ts +16 -21
- package/src/features/PageEditor/store/selectors.ts +3 -4
- package/src/features/PageExplorer/PageExplorerPlaceholder.tsx +22 -14
- package/src/features/PageExplorer/index.tsx +34 -67
- package/src/features/Portal/Artifacts/index.ts +0 -2
- package/src/features/Portal/Document/AutoSaveHint.tsx +7 -6
- package/src/features/Portal/Document/Body.tsx +1 -3
- package/src/features/Portal/Document/EditorCanvas.tsx +7 -50
- package/src/features/Portal/Document/Header.tsx +13 -10
- package/src/features/Portal/Document/TodoList.tsx +6 -4
- package/src/features/Portal/Document/Wrapper.tsx +3 -11
- package/src/features/Portal/Document/index.ts +0 -2
- package/src/features/Portal/FilePreview/index.ts +0 -2
- package/src/features/Portal/GroupThread/index.ts +0 -3
- package/src/features/Portal/MessageDetail/index.ts +0 -2
- package/src/features/Portal/Notebook/index.ts +0 -2
- package/src/features/Portal/Plugins/index.ts +0 -2
- package/src/features/Portal/Thread/index.ts +0 -3
- package/src/features/Portal/components/Header.tsx +18 -6
- package/src/features/Portal/router.tsx +34 -97
- package/src/features/Portal/type.ts +0 -2
- package/src/libs/next/config/define-config.ts +4 -1
- package/src/locales/default/plugin.ts +1 -0
- package/src/store/chat/slices/portal/action.test.ts +218 -15
- package/src/store/chat/slices/portal/action.ts +194 -41
- package/src/store/chat/slices/portal/initialState.ts +40 -1
- package/src/store/chat/slices/portal/selectors/thread.ts +44 -3
- package/src/store/chat/slices/portal/selectors.test.ts +119 -17
- package/src/store/chat/slices/portal/selectors.ts +117 -36
- package/src/store/document/index.ts +17 -5
- package/src/store/document/slices/document/action.ts +209 -0
- package/src/store/document/slices/document/index.ts +6 -0
- package/src/store/document/slices/editor/action.test.ts +340 -0
- package/src/store/document/slices/editor/action.ts +133 -149
- package/src/store/document/slices/editor/index.ts +9 -2
- package/src/store/document/slices/editor/initialState.ts +66 -29
- package/src/store/document/slices/editor/reducer.test.ts +217 -0
- package/src/store/document/slices/editor/reducer.ts +67 -0
- package/src/store/document/slices/editor/selectors.test.ts +395 -0
- package/src/store/document/slices/editor/selectors.ts +107 -5
- package/src/store/document/store.ts +12 -13
- package/src/store/file/slices/document/action.ts +19 -188
- package/src/store/file/slices/document/initialState.ts +0 -30
- package/src/store/file/slices/document/selectors.ts +25 -59
- package/src/store/notebook/index.ts +5 -4
- package/src/store/page/index.ts +2 -0
- package/src/store/page/initialState.ts +92 -0
- package/src/store/page/selectors.ts +5 -0
- package/src/store/page/slices/crud/action.ts +477 -0
- package/src/store/page/slices/crud/index.ts +2 -0
- package/src/store/page/slices/crud/initialState.ts +7 -0
- package/src/store/page/slices/internal/action.ts +32 -0
- package/src/store/page/slices/internal/index.ts +2 -0
- package/src/store/page/slices/internal/reducer.ts +105 -0
- package/src/store/page/slices/list/action.ts +206 -0
- package/src/store/page/slices/list/index.ts +3 -0
- package/src/store/page/slices/list/initialState.ts +29 -0
- package/src/store/page/slices/list/selectors.ts +90 -0
- package/src/store/page/slices/selection/action.ts +67 -0
- package/src/store/page/slices/selection/index.ts +2 -0
- package/src/store/page/slices/selection/initialState.ts +11 -0
- package/src/store/page/store.ts +29 -0
- package/src/store/tool/slices/lobehubSkillStore/selectors.ts +10 -20
- package/src/utils/identifier.ts +8 -2
- package/src/features/Conversation/Messages/AssistantGroup/components/GroupContext.ts +0 -15
- package/src/features/Conversation/Messages/Supervisor/components/GroupContext.ts +0 -15
- package/src/features/PageEditor/Body/index.tsx +0 -68
- package/src/features/PageEditor/EditorCanvas/InlineToolbar.tsx +0 -316
- package/src/features/PageEditor/Header/AutoSaveHint.tsx +0 -27
- package/src/features/Portal/Artifacts/useEnable.ts +0 -4
- package/src/features/Portal/Document/DocumentEditorProvider.tsx +0 -34
- package/src/features/Portal/Document/StoreUpdater.tsx +0 -80
- package/src/features/Portal/Document/Title.tsx +0 -54
- package/src/features/Portal/Document/store/action.ts +0 -114
- package/src/features/Portal/Document/store/index.ts +0 -21
- package/src/features/Portal/Document/store/initialState.ts +0 -24
- package/src/features/Portal/Document/useEnable.ts +0 -8
- package/src/features/Portal/FilePreview/useEnable.ts +0 -6
- package/src/features/Portal/GroupThread/hook.ts +0 -9
- package/src/features/Portal/MessageDetail/useEnable.ts +0 -4
- package/src/features/Portal/Notebook/useEnable.ts +0 -6
- package/src/features/Portal/Plugins/useEnable.ts +0 -6
- package/src/features/Portal/Thread/hook.ts +0 -8
- package/src/store/document/slices/notebook/action.ts +0 -119
- package/src/store/document/slices/notebook/index.ts +0 -3
- package/src/store/document/slices/notebook/initialState.ts +0 -12
- package/src/store/document/slices/notebook/selectors.ts +0 -26
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { ActionIcon, Avatar, Dropdown,
|
|
3
|
+
import { ActionIcon, Avatar, Dropdown, Text } from '@lobehub/ui';
|
|
4
4
|
import { ArrowLeftIcon, BotMessageSquareIcon, MoreHorizontal } from 'lucide-react';
|
|
5
5
|
import { memo } from 'react';
|
|
6
6
|
import { useTranslation } from 'react-i18next';
|
|
7
7
|
|
|
8
8
|
import { DESKTOP_HEADER_ICON_SIZE } from '@/const/layoutTokens';
|
|
9
|
+
import { AutoSaveHint } from '@/features/EditorCanvas';
|
|
9
10
|
import NavHeader from '@/features/NavHeader';
|
|
10
11
|
import ToggleRightPanelButton from '@/features/RightPanel/ToggleRightPanelButton';
|
|
11
12
|
|
|
12
13
|
import { usePageEditorStore } from '../store';
|
|
13
|
-
import AutoSaveHint from './AutoSaveHint';
|
|
14
14
|
import Breadcrumb from './Breadcrumb';
|
|
15
15
|
import { useMenu } from './useMenu';
|
|
16
16
|
|
|
17
17
|
const Header = memo(() => {
|
|
18
18
|
const { t } = useTranslation('file');
|
|
19
|
-
const [
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const [documentId, emoji, title, parentId, onBack] = usePageEditorStore((s) => [
|
|
20
|
+
s.documentId,
|
|
21
|
+
s.emoji,
|
|
22
|
+
s.title,
|
|
23
|
+
s.parentId,
|
|
24
|
+
s.onBack,
|
|
25
|
+
]);
|
|
22
26
|
const { menuItems } = useMenu();
|
|
23
27
|
|
|
24
28
|
return (
|
|
@@ -32,22 +36,15 @@ const Header = memo(() => {
|
|
|
32
36
|
{!parentId && (
|
|
33
37
|
<>
|
|
34
38
|
{/* Icon */}
|
|
35
|
-
{
|
|
39
|
+
{emoji && <Avatar avatar={emoji} shape={'square'} size={28} />}
|
|
36
40
|
{/* Title */}
|
|
37
|
-
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
style={{ height: 20, marginLeft: 4, maxWidth: 200, width: 200 }}
|
|
41
|
-
/>
|
|
42
|
-
) : (
|
|
43
|
-
<Text ellipsis style={{ marginLeft: 4 }} weight={500}>
|
|
44
|
-
{currentTitle || t('pageEditor.titlePlaceholder')}
|
|
45
|
-
</Text>
|
|
46
|
-
)}
|
|
41
|
+
<Text ellipsis style={{ marginLeft: 4 }} weight={500}>
|
|
42
|
+
{title || t('pageEditor.titlePlaceholder')}
|
|
43
|
+
</Text>
|
|
47
44
|
</>
|
|
48
45
|
)}
|
|
49
|
-
{/* Auto Save Status
|
|
50
|
-
{
|
|
46
|
+
{/* Auto Save Status */}
|
|
47
|
+
{documentId && <AutoSaveHint documentId={documentId} style={{ marginLeft: 6 }} />}
|
|
51
48
|
</>
|
|
52
49
|
}
|
|
53
50
|
right={
|
|
@@ -6,6 +6,8 @@ import { CopyPlus, Download, Link2, Trash2 } from 'lucide-react';
|
|
|
6
6
|
import { useMemo } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
|
|
9
|
+
import { useDocumentStore } from '@/store/document';
|
|
10
|
+
import { editorSelectors } from '@/store/document/slices/editor';
|
|
9
11
|
import { useFileStore } from '@/store/file';
|
|
10
12
|
import { useGlobalStore } from '@/store/global';
|
|
11
13
|
import { systemStatusSelectors } from '@/store/global/selectors';
|
|
@@ -21,9 +23,12 @@ export const useMenu = (): { menuItems: any[] } => {
|
|
|
21
23
|
const storeApi = useStoreApi();
|
|
22
24
|
const { lg = true } = useResponsive();
|
|
23
25
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
const documentId = usePageEditorStore((s) => s.documentId);
|
|
27
|
+
|
|
28
|
+
// Get lastUpdatedTime from DocumentStore
|
|
29
|
+
const lastUpdatedTime = useDocumentStore((s) =>
|
|
30
|
+
documentId ? editorSelectors.lastUpdatedTime(documentId)(s) : null,
|
|
31
|
+
);
|
|
27
32
|
|
|
28
33
|
const duplicateDocument = useFileStore((s) => s.duplicateDocument);
|
|
29
34
|
|
|
@@ -36,9 +41,9 @@ export const useMenu = (): { menuItems: any[] } => {
|
|
|
36
41
|
const showViewModeSwitch = lg;
|
|
37
42
|
|
|
38
43
|
const handleDuplicate = async () => {
|
|
39
|
-
if (!
|
|
44
|
+
if (!documentId) return;
|
|
40
45
|
try {
|
|
41
|
-
await duplicateDocument(
|
|
46
|
+
await duplicateDocument(documentId);
|
|
42
47
|
message.success(t('pageEditor.duplicateSuccess'));
|
|
43
48
|
} catch (error) {
|
|
44
49
|
console.error('Failed to duplicate page:', error);
|
|
@@ -48,7 +53,7 @@ export const useMenu = (): { menuItems: any[] } => {
|
|
|
48
53
|
|
|
49
54
|
const handleExportMarkdown = () => {
|
|
50
55
|
const state = storeApi.getState();
|
|
51
|
-
const { editor,
|
|
56
|
+
const { editor, title } = state;
|
|
52
57
|
|
|
53
58
|
if (!editor) return;
|
|
54
59
|
|
|
@@ -58,7 +63,7 @@ export const useMenu = (): { menuItems: any[] } => {
|
|
|
58
63
|
const url = URL.createObjectURL(blob);
|
|
59
64
|
const a = document.createElement('a');
|
|
60
65
|
a.href = url;
|
|
61
|
-
a.download = `${
|
|
66
|
+
a.download = `${title || 'Untitled'}.md`;
|
|
62
67
|
document.body.append(a);
|
|
63
68
|
a.click();
|
|
64
69
|
a.remove();
|
|
@@ -143,7 +148,6 @@ export const useMenu = (): { menuItems: any[] } => {
|
|
|
143
148
|
key: 'page-info',
|
|
144
149
|
label: (
|
|
145
150
|
<div style={{ color: cssVar.colorTextTertiary, fontSize: 12, lineHeight: 1.6 }}>
|
|
146
|
-
<div>{t('pageEditor.wordCount', { wordCount })}</div>
|
|
147
151
|
<div>
|
|
148
152
|
{lastUpdatedTime
|
|
149
153
|
? t('pageEditor.editedAt', {
|
|
@@ -156,7 +160,6 @@ export const useMenu = (): { menuItems: any[] } => {
|
|
|
156
160
|
},
|
|
157
161
|
],
|
|
158
162
|
[
|
|
159
|
-
wordCount,
|
|
160
163
|
lastUpdatedTime,
|
|
161
164
|
storeApi,
|
|
162
165
|
t,
|
|
@@ -1,43 +1,54 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { BUILTIN_AGENT_SLUGS } from '@lobechat/builtin-agents';
|
|
4
|
+
import { EditorProvider } from '@lobehub/editor/react';
|
|
4
5
|
import { Flexbox } from '@lobehub/ui';
|
|
5
6
|
import { cssVar } from 'antd-style';
|
|
6
7
|
import { type FC, memo, useEffect } from 'react';
|
|
7
8
|
|
|
8
9
|
import Loading from '@/components/Loading/BrandTextLoading';
|
|
10
|
+
import DiffAllToolbar from '@/features/EditorCanvas/DiffAllToolbar';
|
|
9
11
|
import WideScreenContainer from '@/features/WideScreenContainer';
|
|
10
|
-
import { useRegisterFilesHotkeys
|
|
12
|
+
import { useRegisterFilesHotkeys } from '@/hooks/useHotkeys';
|
|
11
13
|
import { useAgentStore } from '@/store/agent';
|
|
12
14
|
import { builtinAgentSelectors } from '@/store/agent/selectors';
|
|
13
|
-
import {
|
|
15
|
+
import { useDocumentStore } from '@/store/document';
|
|
16
|
+
import { editorSelectors } from '@/store/document/slices/editor';
|
|
17
|
+
import { usePageStore } from '@/store/page';
|
|
14
18
|
|
|
15
|
-
import Body from './Body';
|
|
16
19
|
import Copilot from './Copilot';
|
|
17
|
-
import
|
|
20
|
+
import EditorCanvas from './EditorCanvas';
|
|
18
21
|
import Header from './Header';
|
|
19
22
|
import PageAgentProvider from './PageAgentProvider';
|
|
20
23
|
import { PageEditorProvider } from './PageEditorProvider';
|
|
21
24
|
import PageTitle from './PageTitle';
|
|
25
|
+
import TitleSection from './TitleSection';
|
|
22
26
|
import { usePageEditorStore } from './store';
|
|
23
27
|
|
|
24
28
|
interface PageEditorProps {
|
|
29
|
+
emoji?: string;
|
|
25
30
|
knowledgeBaseId?: string;
|
|
26
31
|
onBack?: () => void;
|
|
27
32
|
onDelete?: () => void;
|
|
28
33
|
onDocumentIdChange?: (newId: string) => void;
|
|
34
|
+
onEmojiChange?: (emoji: string | undefined) => void;
|
|
29
35
|
onSave?: () => void;
|
|
36
|
+
onTitleChange?: (title: string) => void;
|
|
30
37
|
pageId?: string;
|
|
38
|
+
title?: string;
|
|
31
39
|
}
|
|
32
40
|
|
|
33
41
|
const PageEditorCanvas = memo(() => {
|
|
34
42
|
const editor = usePageEditorStore((s) => s.editor);
|
|
35
|
-
const
|
|
36
|
-
|
|
43
|
+
const documentId = usePageEditorStore((s) => s.documentId);
|
|
44
|
+
|
|
45
|
+
// Get isDirty from DocumentStore
|
|
46
|
+
const isDirty = useDocumentStore((s) =>
|
|
47
|
+
documentId ? editorSelectors.isDirty(documentId)(s) : false,
|
|
48
|
+
);
|
|
37
49
|
|
|
38
50
|
// Register Files scope and save document hotkey
|
|
39
51
|
useRegisterFilesHotkeys();
|
|
40
|
-
useSaveDocumentHotkey(flushSave);
|
|
41
52
|
|
|
42
53
|
// Warn user before leaving page with unsaved changes
|
|
43
54
|
useEffect(() => {
|
|
@@ -75,10 +86,13 @@ const PageEditorCanvas = memo(() => {
|
|
|
75
86
|
width={'100%'}
|
|
76
87
|
>
|
|
77
88
|
<WideScreenContainer onClick={() => editor?.focus()} wrapperStyle={{ cursor: 'text' }}>
|
|
78
|
-
<
|
|
89
|
+
<Flexbox flex={1} style={{ overflowY: 'auto', position: 'relative' }}>
|
|
90
|
+
<TitleSection />
|
|
91
|
+
<EditorCanvas />
|
|
92
|
+
</Flexbox>
|
|
79
93
|
</WideScreenContainer>
|
|
80
94
|
</Flexbox>
|
|
81
|
-
<DiffAllToolbar />
|
|
95
|
+
{documentId && <DiffAllToolbar documentId={documentId} editor={editor!} />}
|
|
82
96
|
</Flexbox>
|
|
83
97
|
<Copilot />
|
|
84
98
|
</Flexbox>
|
|
@@ -95,31 +109,41 @@ export const PageEditor: FC<PageEditorProps> = ({
|
|
|
95
109
|
pageId,
|
|
96
110
|
knowledgeBaseId,
|
|
97
111
|
onDocumentIdChange,
|
|
112
|
+
onEmojiChange,
|
|
98
113
|
onSave,
|
|
114
|
+
onTitleChange,
|
|
99
115
|
onBack,
|
|
116
|
+
title,
|
|
117
|
+
emoji,
|
|
100
118
|
}) => {
|
|
101
119
|
const useInitBuiltinAgent = useAgentStore((s) => s.useInitBuiltinAgent);
|
|
102
120
|
const pageAgentId = useAgentStore(builtinAgentSelectors.pageAgentId);
|
|
103
121
|
|
|
104
122
|
useInitBuiltinAgent(BUILTIN_AGENT_SLUGS.pageAgent);
|
|
105
123
|
|
|
106
|
-
const
|
|
124
|
+
const deletePage = usePageStore((s) => s.deletePage);
|
|
107
125
|
|
|
108
126
|
if (!pageAgentId) return <Loading debugId="PageEditor > PageAgent Init" />;
|
|
109
127
|
|
|
110
128
|
return (
|
|
111
129
|
<PageAgentProvider pageAgentId={pageAgentId}>
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
130
|
+
<EditorProvider>
|
|
131
|
+
<PageEditorProvider
|
|
132
|
+
emoji={emoji}
|
|
133
|
+
key={pageId}
|
|
134
|
+
knowledgeBaseId={knowledgeBaseId}
|
|
135
|
+
onBack={onBack}
|
|
136
|
+
onDelete={() => deletePage(pageId || '')}
|
|
137
|
+
onDocumentIdChange={onDocumentIdChange}
|
|
138
|
+
onEmojiChange={onEmojiChange}
|
|
139
|
+
onSave={onSave}
|
|
140
|
+
onTitleChange={onTitleChange}
|
|
141
|
+
pageId={pageId}
|
|
142
|
+
title={title}
|
|
143
|
+
>
|
|
144
|
+
<PageEditorCanvas />
|
|
145
|
+
</PageEditorProvider>
|
|
146
|
+
</EditorProvider>
|
|
123
147
|
</PageAgentProvider>
|
|
124
148
|
);
|
|
125
149
|
};
|
|
@@ -19,10 +19,14 @@ export const PageEditorProvider = memo<PageEditorProviderProps>(
|
|
|
19
19
|
pageId,
|
|
20
20
|
knowledgeBaseId,
|
|
21
21
|
onDocumentIdChange,
|
|
22
|
+
onEmojiChange,
|
|
22
23
|
onSave,
|
|
24
|
+
onTitleChange,
|
|
23
25
|
onDelete,
|
|
24
26
|
onBack,
|
|
25
27
|
parentId,
|
|
28
|
+
title,
|
|
29
|
+
emoji,
|
|
26
30
|
}) => {
|
|
27
31
|
const editor = useEditor();
|
|
28
32
|
|
|
@@ -30,25 +34,33 @@ export const PageEditorProvider = memo<PageEditorProviderProps>(
|
|
|
30
34
|
<Provider
|
|
31
35
|
createStore={() =>
|
|
32
36
|
createStore({
|
|
37
|
+
documentId: pageId,
|
|
33
38
|
editor,
|
|
39
|
+
emoji,
|
|
34
40
|
knowledgeBaseId,
|
|
35
41
|
onBack,
|
|
36
42
|
onDelete,
|
|
37
43
|
onDocumentIdChange,
|
|
44
|
+
onEmojiChange,
|
|
38
45
|
onSave,
|
|
39
|
-
|
|
46
|
+
onTitleChange,
|
|
40
47
|
parentId,
|
|
48
|
+
title,
|
|
41
49
|
})
|
|
42
50
|
}
|
|
43
51
|
>
|
|
44
52
|
<StoreUpdater
|
|
53
|
+
emoji={emoji}
|
|
45
54
|
knowledgeBaseId={knowledgeBaseId}
|
|
46
55
|
onBack={onBack}
|
|
47
56
|
onDelete={onDelete}
|
|
48
57
|
onDocumentIdChange={onDocumentIdChange}
|
|
58
|
+
onEmojiChange={onEmojiChange}
|
|
49
59
|
onSave={onSave}
|
|
60
|
+
onTitleChange={onTitleChange}
|
|
50
61
|
pageId={pageId}
|
|
51
62
|
parentId={parentId}
|
|
63
|
+
title={title}
|
|
52
64
|
/>
|
|
53
65
|
{children}
|
|
54
66
|
</Provider>
|
|
@@ -6,8 +6,8 @@ import PageTitle from '@/components/PageTitle';
|
|
|
6
6
|
import { selectors, usePageEditorStore } from '@/features/PageEditor/store';
|
|
7
7
|
|
|
8
8
|
const Title = memo(() => {
|
|
9
|
-
const pageTitle = usePageEditorStore(selectors.
|
|
10
|
-
return <PageTitle title={pageTitle} />;
|
|
9
|
+
const pageTitle = usePageEditorStore(selectors.title);
|
|
10
|
+
return pageTitle && <PageTitle title={pageTitle} />;
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
export default Title;
|