refactor: split sidebar filetree upload runtime

This commit is contained in:
lix-2026
2026-05-26 02:27:08 +08:00
parent 7909b3f9be
commit bc3b199c32
6 changed files with 348 additions and 270 deletions
+14 -12
View File
@@ -205,6 +205,8 @@ mod tests {
include_str!("../../../browser/sidebar-filetree-open-runtime.js");
const SIDEBAR_FILETREE_COMMAND_RUNTIME_JS: &str =
include_str!("../../../browser/sidebar-filetree-command-runtime.js");
const SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS: &str =
include_str!("../../../browser/sidebar-filetree-upload-runtime.js");
const SIDEBAR_ATTACHMENT_OPEN_RUNTIME_JS: &str =
include_str!("../../../browser/sidebar-attachment-open-runtime.js");
const SIDEBAR_SHELL_RUNTIME_JS: &str =
@@ -599,15 +601,15 @@ mod tests {
assert!(
SIDEBAR_TREE_RUNTIME_JS.contains("fileTreeRuntimeFunction('appendUploadedAssetRow')")
);
assert!(SIDEBAR_TREE_RUNTIME_JS
assert!(SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS
.contains("fileTreeRuntimeFunction('fileTreeUploadTargetFallback')"));
assert!(SIDEBAR_TREE_RUNTIME_JS
assert!(SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS
.contains("fileTreeRuntimeFunction('fileTreeRowsForUploadPreflight')"));
assert!(SIDEBAR_TREE_RUNTIME_JS
assert!(SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS
.contains("fileTreeRuntimeFunction('fileTreeDocumentParentsForPreflight')"));
assert!(SIDEBAR_TREE_RUNTIME_JS
assert!(SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS
.contains("fileTreeRuntimeFunction('fileTreeTargetChildrenForPreflight')"));
assert!(SIDEBAR_TREE_RUNTIME_JS
assert!(SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS
.contains("fileTreeRuntimeFunction('fileTreeDropPreflightRows')"));
assert!(SIDEBAR_TREE_LIVE_APPLY_RUNTIME_JS
.contains("fileTreeRuntimeFunction('readProjection')"));
@@ -741,11 +743,11 @@ mod tests {
assert!(FILETREE_RUNTIME_JS.contains("requestMethod: requestMethod"));
assert!(FILETREE_RUNTIME_JS
.contains("requestBodyHasMindmapCreateOnly: requestBodyHasMindmapCreateOnly"));
assert!(SIDEBAR_TREE_RUNTIME_JS
assert!(SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS
.contains("fileTreeRuntimeFunction('fileTreeDocumentWorkspacesForUploadPreflight')"));
assert!(SIDEBAR_TREE_RUNTIME_JS
assert!(SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS
.contains("fileTreeRuntimeFunction('fileTreeUploadTargetPreflightBody')"));
assert!(SIDEBAR_TREE_RUNTIME_JS
assert!(SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS
.contains("fileTreeRowsForUploadPreflight: fileTreeRowsForUploadPreflight"));
assert!(SIDEBAR_TREE_RUNTIME_JS.contains("fileTreeRuntimeFunction('shortMindmapFileName')"));
assert!(
@@ -1023,13 +1025,13 @@ mod tests {
#[test]
fn sidebar_filetree_blocks_readonly_paste_and_drop_with_action_status() {
assert!(SIDEBAR_TREE_RUNTIME_JS.contains("function blockReadonlyFileTreeAction"));
assert!(SIDEBAR_TREE_RUNTIME_JS.contains("data-mnote-filetree-readonly-blocked"));
assert!(SIDEBAR_TREE_RUNTIME_JS.contains("data-mnote-filetree-readonly-message"));
assert!(SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS.contains("function blockReadonlyFileTreeAction"));
assert!(SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS.contains("data-mnote-filetree-readonly-blocked"));
assert!(SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS.contains("data-mnote-filetree-readonly-message"));
assert!(
SIDEBAR_FILETREE_COMMAND_RUNTIME_JS.contains("recordFileTreeActionStatus('blocked'")
);
assert!(SIDEBAR_TREE_RUNTIME_JS.contains("/api/tree/filetree/drop-preflight"));
assert!(SIDEBAR_FILETREE_UPLOAD_RUNTIME_JS.contains("/api/tree/filetree/drop-preflight"));
assert!(
SIDEBAR_FILETREE_COMMAND_RUNTIME_JS.contains("ensureFileTreeWritableTarget('paste'")
);