refactor: delegate filetree upload fallback
This commit is contained in:
@@ -3093,6 +3093,13 @@ const SIDEBAR_TREE_JS: &str = r##"
|
||||
}
|
||||
|
||||
function fallbackFileTreeUploadTarget(detail) {
|
||||
var runtimeFn = fileTreeRuntimeFunction('fileTreeUploadTargetFallback');
|
||||
if (runtimeFn) {
|
||||
return runtimeFn(detail || {}, {
|
||||
resolveWorkspaceId: resolveWorkspaceId,
|
||||
currentDocumentId: currentDocumentId
|
||||
});
|
||||
}
|
||||
var workspaceId = String(detail && detail.workspaceId || resolveWorkspaceId(document.body) || '').trim();
|
||||
var documentId = String(detail && detail.documentId || currentDocumentId() || '').trim();
|
||||
if (detail && Object.prototype.hasOwnProperty.call(detail, 'targetRelativePath')) {
|
||||
@@ -11031,6 +11038,7 @@ mod tests {
|
||||
assert!(SIDEBAR_TREE_JS.contains("fileTreeRuntimeFunction('fileTreeAssetDownloadDetail')"));
|
||||
assert!(SIDEBAR_TREE_JS.contains("fileTreeRuntimeFunction('fileTreeRowsByRowIds')"));
|
||||
assert!(SIDEBAR_TREE_JS.contains("fileTreeRuntimeFunction('fileTreeChildCount')"));
|
||||
assert!(SIDEBAR_TREE_JS.contains("fileTreeRuntimeFunction('fileTreeUploadTargetFallback')"));
|
||||
let document_id_body = js_function_body(SIDEBAR_TREE_JS, "fileTreeRowDocumentId");
|
||||
assert!(
|
||||
document_id_body.contains("data-document-id")
|
||||
@@ -11050,6 +11058,11 @@ mod tests {
|
||||
assert!(FILETREE_RUNTIME_JS.contains("function fileTreeAssetDownloadDetail"));
|
||||
assert!(FILETREE_RUNTIME_JS.contains("function fileTreeRowsByRowIds"));
|
||||
assert!(FILETREE_RUNTIME_JS.contains("function fileTreeChildCount"));
|
||||
assert!(FILETREE_RUNTIME_JS.contains("function fileTreeUploadTargetFallback"));
|
||||
assert!(FILETREE_RUNTIME_JS
|
||||
.contains("uploadIntent: String(detail.uploadIntent || 'filetree.folder.drop')"));
|
||||
assert!(FILETREE_RUNTIME_JS
|
||||
.contains("uploadIntent: String(detail.uploadIntent || 'editor.markdown.attach')"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user