,
+) -> impl IntoView {
+ view! {
+ <>
+ {move || {
+ if !table_toolbar_open.get()
+ || slash_open.get()
+ || block_menu_open.get()
+ || dragging_block_index.get().is_some()
+ {
+ return ().into_any();
+ }
+ let Some(anchor) = table_overlay_anchor.get() else {
+ return ().into_any();
+ };
+ let controls_style = format!(
+ "left:{:.1}px;top:{:.1}px;width:{:.1}px;height:{:.1}px;",
+ anchor.left, anchor.top, anchor.width, anchor.height
+ );
+ view! {
+
+ {move || {
+ table_selection_overlay
+ .get()
+ .map(|selection| {
+ view! {
+
+ }
+ })
+ .into_any()
+ }}
+ {(0..anchor.rows).map(|index| {
+ let active = table_selection_overlay
+ .get()
+ .map(|selection| {
+ selection.kind == TableSelectionKind::Row && selection.index == index
+ })
+ .unwrap_or(false);
+ view! {
+
+ }
+ }).collect_view()}
+ {(0..anchor.cols).map(|index| {
+ let active = table_selection_overlay
+ .get()
+ .map(|selection| {
+ selection.kind == TableSelectionKind::Column
+ && selection.index == index
+ })
+ .unwrap_or(false);
+ view! {
+
+ }
+ }).collect_view()}
+
+ }
+ .into_any()
+ }}
+ {move || {
+ if !table_toolbar_open.get()
+ || slash_open.get()
+ || block_menu_open.get()
+ || dragging_block_index.get().is_some()
+ {
+ return ().into_any();
+ }
+ view! {
+
+ {TABLE_TOOLBAR_ACTIONS.iter().enumerate().map(|(index, action)| {
+ let action = *action;
+ let testid = format!("table-toolbar-{}", action.id());
+ view! {
+ <>
+ {if index == 3 {
+ view! {
+
+ }
+ .into_any()
+ } else {
+ ().into_any()
+ }}
+
+ >
+ }
+ }).collect_view()}
+
+
+ {move || {
+ if !table_options_open.get() {
+ return ().into_any();
+ }
+ view! {
+
+ }
+ .into_any()
+ }}
+
+ }
+ .into_any()
+ }}
+ >
+ }
+}
diff --git a/rust/spikes/leptos-tiptap-spike/src/lib.rs b/rust/spikes/leptos-tiptap-spike/src/lib.rs
index c3bfed07..0d716fd5 100644
--- a/rust/spikes/leptos-tiptap-spike/src/lib.rs
+++ b/rust/spikes/leptos-tiptap-spike/src/lib.rs
@@ -58,23 +58,19 @@ use editor_runtime::mindmap_node_view::{
};
use editor_runtime::overlays::{
clamp_overlay_anchor,
- close_editor_floating_overlays_if_escape, current_table_overlay_anchor,
+ close_editor_floating_overlays_if_escape,
image_element_from_target, image_toolbar_anchor_from_image, open_block_menu_overlay,
open_image_toolbar_overlay, open_slash_menu_overlay, selection_bounding_rect,
- should_auto_close_toolbar_overlays, sync_overlays_on_selection_change, table_col_aux_style,
- table_overlay_anchor_from_table, table_row_aux_style, table_selection_overlay_style,
- toolbar_overlay_locked, try_sync_editor_overlay_state, FloatingToolbarAnchor, ImageToolbarAnchor,
- TableOverlayAnchor, TableSelectionKind, TableSelectionOverlayState,
+ should_auto_close_toolbar_overlays, sync_overlays_on_selection_change,
+ table_overlay_anchor_from_table, toolbar_overlay_locked, try_sync_editor_overlay_state,
+ FloatingToolbarAnchor, ImageToolbarAnchor, TableOverlayAnchor, TableSelectionOverlayState,
};
use editor_runtime::persistence::{
load_persisted_document, normalize_identity_value, persist_document_state,
persisted_document_identity, PersistedDocumentIdentity,
};
use editor_runtime::slash_actions::{SlashActionKind, SLASH_ACTIONS};
-use editor_runtime::table_commands::{
- run_table_option_action, run_table_toolbar_action, table_option_checked, TableToolbarAction,
- TABLE_OPTION_ACTIONS, TABLE_TOOLBAR_ACTIONS,
-};
+use editor_runtime::table_toolbar_view::table_toolbar_view;
#[cfg(test)]
use editor_runtime::persistence::persisted_document_storage_key;
@@ -6078,263 +6074,29 @@ fn App(mount_options: MountOptions) -> impl IntoView {
set_hovered_block.set(None);
}
>
- {move || {
- if !table_toolbar_open.get() || slash_open.get() || block_menu_open.get() || dragging_block_index.get().is_some() {
- return ().into_any();
- }
- let Some(anchor) = table_overlay_anchor.get() else {
- return ().into_any();
- };
- let controls_style = format!(
- "left:{:.1}px;top:{:.1}px;width:{:.1}px;height:{:.1}px;",
- anchor.left,
- anchor.top,
- anchor.width,
- anchor.height
- );
- view! {
-
- {move || {
- table_selection_overlay.get().map(|selection| {
- view! {
-
- }
- }).into_any()
- }}
- {(0..anchor.rows).map(|index| {
- let active = table_selection_overlay.get()
- .map(|selection| selection.kind == TableSelectionKind::Row && selection.index == index)
- .unwrap_or(false);
- view! {
-
- }
- }).collect_view()}
- {(0..anchor.cols).map(|index| {
- let active = table_selection_overlay.get()
- .map(|selection| selection.kind == TableSelectionKind::Column && selection.index == index)
- .unwrap_or(false);
- view! {
-
- }
- }).collect_view()}
-
- }.into_any()
- }}
- {move || {
- if !table_toolbar_open.get() || slash_open.get() || block_menu_open.get() || dragging_block_index.get().is_some() {
- return ().into_any();
- }
- view! {
-
- {TABLE_TOOLBAR_ACTIONS.iter().enumerate().map(|(index, action)| {
- let action = *action;
- let testid = format!("table-toolbar-{}", action.id());
- view! {
- <>
- {if index == 3 {
- view! { }.into_any()
- } else {
- ().into_any()
- }}
-
- >
- }
- }).collect_view()}
-
-
- {move || {
- if !table_options_open.get() {
- return ().into_any();
- }
- view! {
-
- }.into_any()
- }}
-
- }.into_any()
- }}
+ {table_toolbar_view(
+ editor,
+ table_toolbar_open,
+ set_table_toolbar_open,
+ table_options_open,
+ set_table_options_open,
+ table_overlay_anchor,
+ set_table_overlay_anchor,
+ table_selection_overlay,
+ set_table_selection_overlay,
+ slash_open,
+ block_menu_open,
+ dragging_block_index,
+ document_json,
+ set_document_json,
+ set_dirty_count,
+ set_html_output,
+ set_json_output,
+ title,
+ document_id,
+ workspace_id,
+ set_command_feedback,
+ )}
{move || {
let Some(anchor) = image_toolbar_anchor.get() else {
return ().into_any();