对齐 Wolai 编辑器搜索与文档画布

This commit is contained in:
lix-2026
2026-04-30 18:36:50 +08:00
parent afb2a5b8a0
commit 2b88ecb4b9
14 changed files with 317 additions and 138 deletions
+6 -4
View File
@@ -214,10 +214,10 @@ fn runtime_block_type_for_raw_type(raw_type: &str) -> (&'static str, bool) {
match raw_type {
"paragraph" => ("paragraph", true),
"heading" => ("heading", true),
"bulletListItem" => ("bullet_list_item", true),
"numberedListItem" => ("numbered_list_item", true),
"checkListItem" | "advancedTodo" => ("todo", true),
"quote" => ("quote", true),
"bulletListItem" | "bullet_list_item" => ("bullet_list_item", true),
"numberedListItem" | "numbered_list_item" => ("numbered_list_item", true),
"checkListItem" | "advancedTodo" | "todo" => ("todo", true),
"quote" | "blockquote" => ("quote", true),
"divider" => ("divider", true),
"codeBlock" => ("code_block", true),
"pageReference" => ("page_reference", false),
@@ -237,6 +237,8 @@ fn raw_type_for_runtime_block_type(block_type: &str, fallback_raw_type: &str) ->
"todo" => {
if fallback_raw_type == "advancedTodo" {
"advancedTodo".into()
} else if fallback_raw_type == "todo" {
"todo".into()
} else {
"checkListItem".into()
}
@@ -266,6 +266,22 @@ fn fallback_search_dataset(workspace_id: &str) -> Value {
"rawText": "mnote-web search documents transport",
"createdAt": "2026-04-28T00:00:00Z",
"updatedAt": "2026-04-28T00:00:00Z"
},
{
"id": "doc_hermes",
"workspaceId": workspace_id,
"title": "Hermes",
"rawText": "Hermes 技能知识图谱开发 Wolai aline fixture",
"createdAt": "2026-04-30T00:00:00Z",
"updatedAt": "2026-04-30T00:00:00Z"
},
{
"id": "doc_hermes_skill",
"workspaceId": workspace_id,
"title": "技能知识图谱开发",
"rawText": "Hermes 页面路径 个人 软件开发",
"createdAt": "2026-04-30T00:00:00Z",
"updatedAt": "2026-04-30T00:00:00Z"
}
],
"mindmaps": [],
@@ -315,16 +315,16 @@ pub(crate) fn render_editor_island_adapter_script() -> &'static str {
const level = Number(block?.props?.level || block?.level || 1) || 1;
return { type: 'heading', attrs: { level: Math.max(1, Math.min(6, level)) }, content };
}
if (type === 'bulletListItem') {
if (type === 'bulletListItem' || type === 'bullet_list_item') {
return { type: 'bulletList', content: [{ type: 'listItem', content: [{ type: 'paragraph', content }] }] };
}
if (type === 'numberedListItem') {
if (type === 'numberedListItem' || type === 'numbered_list_item') {
return { type: 'orderedList', content: [{ type: 'listItem', content: [{ type: 'paragraph', content }] }] };
}
if (type === 'checkListItem' || type === 'advancedTodo') {
if (type === 'checkListItem' || type === 'advancedTodo' || type === 'todo') {
return { type: 'taskList', content: [{ type: 'taskItem', attrs: { checked: Boolean(block?.props?.checked) }, content: [{ type: 'paragraph', content }] }] };
}
if (type === 'quote') {
if (type === 'quote' || type === 'blockquote') {
return { type: 'blockquote', content: [{ type: 'paragraph', content }] };
}
if (type === 'codeBlock') {