fix(web): editor bugfix

This commit is contained in:
zhaoying
2026-03-26 18:47:44 +08:00
parent 91d38c0648
commit 0fdb489227
2 changed files with 17 additions and 9 deletions

View File

@@ -161,10 +161,12 @@ const Neo4j: FC = () => {
<RelationshipNetwork /> <RelationshipNetwork />
</Flex> </Flex>
</Flex> </Flex>
<EndUserProfile ref={ref} onDataLoaded={handleNameUpdate} className={selectedKey === 'userProfile' ? 'rb:block!' : 'rb:hidden!'} /> <div onClick={(e) => e.stopPropagation()}>
<AboutMe ref={aboutMeRef} className={selectedKey === 'aboutMe' ? 'rb:block!' : 'rb:hidden!'} /> <EndUserProfile ref={ref} onDataLoaded={handleNameUpdate} className={selectedKey === 'userProfile' ? 'rb:block!' : 'rb:hidden!'} />
<InterestDistribution className={selectedKey === 'interestDistribution' ? 'rb:block!' : 'rb:hidden!'} /> <AboutMe ref={aboutMeRef} className={selectedKey === 'aboutMe' ? 'rb:block!' : 'rb:hidden!'} />
<MemoryInsight ref={memoryInsightRef} className={selectedKey === 'memoryInsight' ? 'rb:block!' : 'rb:hidden!'} /> <InterestDistribution className={selectedKey === 'interestDistribution' ? 'rb:block!' : 'rb:hidden!'} />
<MemoryInsight ref={memoryInsightRef} className={selectedKey === 'memoryInsight' ? 'rb:block!' : 'rb:hidden!'} />
</div>
</div> </div>
) )
} }

View File

@@ -53,7 +53,7 @@ const InitialValuePlugin: React.FC<InitialValuePluginProps> = ({ value, options
const root = $getRoot(); const root = $getRoot();
root.clear(); root.clear();
const parts = value.split(/(\{\{[^}]+\}\})/); const parts = value.split(/(\{\{[^}]+\}\}|\n)/);
if (enableLineNumbers) { if (enableLineNumbers) {
const lines = value.split('\n'); const lines = value.split('\n');
@@ -63,8 +63,14 @@ const InitialValuePlugin: React.FC<InitialValuePluginProps> = ({ value, options
root.append(paragraph); root.append(paragraph);
}); });
} else { } else {
const paragraph = $createParagraphNode(); let paragraph = $createParagraphNode();
parts.forEach(part => { parts.forEach(part => {
if (part === '\n') {
root.append(paragraph);
paragraph = $createParagraphNode();
return;
}
const match = part.match(/^\{\{([^.]+)\.([^}]+)\}\}$/); const match = part.match(/^\{\{([^.]+)\.([^}]+)\}\}$/);
const contextMatch = part.match(/^\{\{context\}\}$/); const contextMatch = part.match(/^\{\{context\}\}$/);
const conversationMatch = part.match(/^\{\{conv\.([^}]+)\}\}$/); const conversationMatch = part.match(/^\{\{conv\.([^}]+)\}\}$/);
@@ -78,10 +84,10 @@ const InitialValuePlugin: React.FC<InitialValuePluginProps> = ({ value, options
} }
return return
} }
if (conversationMatch) { if (conversationMatch) {
const [_, variableName] = conversationMatch; const [_, variableName] = conversationMatch;
const conversationSuggestion = optionsRef.current.find(s => const conversationSuggestion = optionsRef.current.find(s =>
s.group === 'CONVERSATION' && s.label === variableName s.group === 'CONVERSATION' && s.label === variableName
); );
if (conversationSuggestion) { if (conversationSuggestion) {
@@ -91,7 +97,7 @@ const InitialValuePlugin: React.FC<InitialValuePluginProps> = ({ value, options
} }
return return
} }
if (match) { if (match) {
const [_, nodeId, label] = match; const [_, nodeId, label] = match;