Fix tiptap selection sync and toolbar event loop

This commit is contained in:
lix-2026
2026-04-19 21:03:25 +08:00
parent 111a87d4fd
commit 394e2a155c
87 changed files with 17415 additions and 527 deletions
+6 -5
View File
@@ -261,7 +261,8 @@ mod tests {
page_id: "page_2".into(),
workspace_id: Some("ws_1".into()),
revision: Some(7),
content_json: "{\"blocks\":[{\"id\":\"block_1\",\"type\":\"pageReference\"}]}".into(),
content_json: "{\"blocks\":[{\"id\":\"block_1\",\"type\":\"pageReference\"}]}"
.into(),
conflict_detection_key: Some("rev:7".into()),
},
reason: Some("嵌入页面".into()),
@@ -274,7 +275,9 @@ mod tests {
build_write_request(&demo_context(), &command).expect("write request should build");
assert_eq!(request.function_name, "documents:updateContent");
assert_eq!(request.workspace_id.as_deref(), Some("ws_1"));
assert!(request.payload_json.contains("\"name\":\"documents.embed\""));
assert!(request
.payload_json
.contains("\"name\":\"documents.embed\""));
}
#[test]
@@ -769,9 +772,7 @@ mod tests {
build_query_request(&demo_context(), &query).expect("query request should build");
assert_eq!(request.function_name, "search:recent");
assert_eq!(request.workspace_id.as_deref(), Some("ws_1"));
assert!(request
.payload_json
.contains("\"name\":\"search.recent\""));
assert!(request.payload_json.contains("\"name\":\"search.recent\""));
}
#[test]
@@ -28,6 +28,34 @@ impl BridgeError {
message: message.into(),
}
}
pub fn unauthorized(message: impl Into<String>) -> Self {
Self {
kind: BridgeErrorKind::Unauthorized,
message: message.into(),
}
}
pub fn conflict(message: impl Into<String>) -> Self {
Self {
kind: BridgeErrorKind::Conflict,
message: message.into(),
}
}
pub fn not_found(message: impl Into<String>) -> Self {
Self {
kind: BridgeErrorKind::NotFound,
message: message.into(),
}
}
pub fn rejected(message: impl Into<String>) -> Self {
Self {
kind: BridgeErrorKind::Rejected,
message: message.into(),
}
}
}
pub type BridgeResult<T> = Result<T, BridgeError>;