refactor: split tree shell filetree dnd
This commit is contained in:
@@ -186,6 +186,10 @@ pub fn build_router(state: AppState) -> Router {
|
||||
"/api/mnote-browser-runtime/tree-shell-filetree-menu-runtime.js",
|
||||
get(web_shell::tree_shell_filetree_menu_runtime_asset),
|
||||
)
|
||||
.route(
|
||||
"/api/mnote-browser-runtime/tree-shell-filetree-dnd-runtime.js",
|
||||
get(web_shell::tree_shell_filetree_dnd_runtime_asset),
|
||||
)
|
||||
.route(
|
||||
"/api/mnote-browser-runtime/tree-shell-picker-runtime.js",
|
||||
get(web_shell::tree_shell_picker_runtime_asset),
|
||||
@@ -650,6 +654,7 @@ mod tests {
|
||||
"/api/mnote-browser-runtime/tree-shell-icons-runtime.js",
|
||||
"/api/mnote-browser-runtime/tree-shell-filetree-runtime.js",
|
||||
"/api/mnote-browser-runtime/tree-shell-filetree-menu-runtime.js",
|
||||
"/api/mnote-browser-runtime/tree-shell-filetree-dnd-runtime.js",
|
||||
"/api/mnote-browser-runtime/tree-shell-picker-runtime.js",
|
||||
"/api/mnote-browser-runtime/tree-shell-dom-runtime.js",
|
||||
"/api/mnote-browser-runtime/document-conflict-panel-runtime.js",
|
||||
|
||||
@@ -2397,6 +2397,8 @@ mod tests {
|
||||
include_str!("../../browser/tree-shell-filetree-runtime.js");
|
||||
const TREE_SHELL_FILETREE_MENU_RUNTIME_JS: &str =
|
||||
include_str!("../../browser/tree-shell-filetree-menu-runtime.js");
|
||||
const TREE_SHELL_FILETREE_DND_RUNTIME_JS: &str =
|
||||
include_str!("../../browser/tree-shell-filetree-dnd-runtime.js");
|
||||
|
||||
use super::{
|
||||
collect_filetree_render_rows, create_command_wire, TreeCommandEnvelopeContext,
|
||||
@@ -2679,11 +2681,14 @@ mod tests {
|
||||
assert!(html.contains("\"resourceMeta\""));
|
||||
assert!(TREE_SHELL_RUNTIME_JS.contains("tree-shell-filetree-runtime.js"));
|
||||
assert!(TREE_SHELL_RUNTIME_JS.contains("tree-shell-filetree-menu-runtime.js"));
|
||||
assert!(TREE_SHELL_RUNTIME_JS.contains("tree-shell-filetree-dnd-runtime.js"));
|
||||
assert!(
|
||||
TREE_SHELL_FILETREE_RUNTIME_JS.contains("function getFileTreeRowOwnerDocumentId(item)")
|
||||
);
|
||||
assert!(TREE_SHELL_FILETREE_MENU_RUNTIME_JS
|
||||
.contains("function buildFileTreeMenuTarget(context"));
|
||||
assert!(TREE_SHELL_FILETREE_DND_RUNTIME_JS
|
||||
.contains("function createTreeShellFileTreeDndRuntime(context)"));
|
||||
assert!(TREE_SHELL_RUNTIME_JS
|
||||
.contains("row.dataset.ownerDocumentId = ownerDocumentId || \"\";"));
|
||||
assert!(
|
||||
|
||||
@@ -1008,6 +1008,20 @@ pub async fn tree_shell_filetree_menu_runtime_asset() -> Response {
|
||||
.unwrap_or_else(|_| Response::new(Body::empty()))
|
||||
}
|
||||
|
||||
pub async fn tree_shell_filetree_dnd_runtime_asset() -> Response {
|
||||
const JS: &str = include_str!("../../browser/tree-shell-filetree-dnd-runtime.js");
|
||||
Response::builder()
|
||||
.status(StatusCode::OK)
|
||||
.header(
|
||||
header::CONTENT_TYPE,
|
||||
"application/javascript; charset=utf-8",
|
||||
)
|
||||
.header(header::CACHE_CONTROL, "no-store")
|
||||
.header(HEADER_MNOTE_WEB_OWNER, "mnote-web")
|
||||
.body(Body::from(JS))
|
||||
.unwrap_or_else(|_| Response::new(Body::empty()))
|
||||
}
|
||||
|
||||
pub async fn tree_shell_picker_runtime_asset() -> Response {
|
||||
const JS: &str = include_str!("../../browser/tree-shell-picker-runtime.js");
|
||||
Response::builder()
|
||||
|
||||
Reference in New Issue
Block a user