refactor: extract dnd target and sidebar helpers

This commit is contained in:
lix-2026
2026-05-25 04:16:35 +08:00
parent 32adfb38a1
commit 1e097a9597
9 changed files with 201 additions and 57 deletions
+3 -6
View File
@@ -22,8 +22,8 @@ use web_sys::{
use editor_runtime::attachment_upload::dispatch_editor_upload_request;
use editor_runtime::block_dnd::{
drop_indicator_top, drop_placement_from_block_point, pointer_in_handle_corridor_geometry,
HandleCorridorGeometry,
drop_indicator_top, drop_placement_from_block_point, event_target_from_point,
pointer_in_handle_corridor_geometry, HandleCorridorGeometry,
};
use editor_runtime::block_menu_overlay;
use editor_runtime::block_menu_legacy_html::{
@@ -5430,10 +5430,7 @@ fn drop_indicator_from_target(
}
fn drop_indicator_from_point(client_x: i32, client_y: i32) -> Option<DropIndicatorState> {
let target = window()
.and_then(|win| win.document())
.and_then(|document| document.element_from_point(client_x as f32, client_y as f32))?;
let target: web_sys::EventTarget = target.into();
let target = event_target_from_point(client_x, client_y)?;
drop_indicator_from_target(target, client_y)
}