refactor: extract block dnd handle predicate

This commit is contained in:
lix-2026
2026-05-25 06:09:42 +08:00
parent 4d08b69d2e
commit 6017a0ad7c
6 changed files with 70 additions and 13 deletions
@@ -4,7 +4,7 @@
//! 也不分发 editor command;调用方负责保留编辑器状态编排。
use crate::editor_runtime::block_hover_state::{DropIndicatorState, DropPlacement};
use web_sys::{window, EventTarget};
use web_sys::{window, Element, EventTarget};
pub(crate) struct HandleCorridorGeometry {
pub(crate) stage_left: f64,
@@ -81,6 +81,10 @@ pub(crate) fn event_target_from_point(client_x: i32, client_y: i32) -> Option<Ev
.map(Into::into)
}
pub(crate) fn element_within_handle_shell(element: &Element, handle_selector: &str) -> bool {
element.closest(handle_selector).ok().flatten().is_some()
}
#[cfg(test)]
mod tests {
use super::*;