refactor: extract block dnd handle predicate
This commit is contained in:
@@ -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::*;
|
||||
|
||||
Reference in New Issue
Block a user