fix slash menu dismissal and anchor

This commit is contained in:
lix-2026
2026-05-29 11:34:41 +08:00
parent cbe789e034
commit 631205ba2f
5 changed files with 282 additions and 28 deletions
@@ -18,7 +18,7 @@ pub(crate) struct SlashMenuViewProps {
pub(crate) editor: TiptapEditorHandle,
pub(crate) signals: SlashMenuSignals,
pub(crate) runtime: SlashMenuRuntimeContext,
pub(crate) anchor_style: Arc<dyn Fn() -> String + Send + Sync>,
pub(crate) anchor_style: ReadSignal<String>,
}
#[derive(Clone, Copy)]
@@ -213,7 +213,14 @@ pub(crate) fn slash_menu_view(props: SlashMenuViewProps) -> impl IntoView {
<div
class="slash-menu"
data-testid="mnote-leptos-tiptap-slash-menu"
style=anchor_style()
style=move || {
let style = anchor_style.get();
if style.trim().is_empty() {
"top:24px;left:24px;".to_string()
} else {
style
}
}
>
<div class="slash-list">
{move || {