FIX: Adds sheet "block" navigation

This was a left over from the old days

Control+right arrow takes you to the next cell with text
or the end of the block

NB: Missing tests
This commit is contained in:
Nicolás Hatcher
2025-07-17 07:28:50 +02:00
committed by Nicolás Hatcher Andrés
parent 1eea2a8c46
commit 46b1ade34a
4 changed files with 118 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ use wasm_bindgen::{
use ironcalc_base::{
expressions::{lexer::util::get_tokens as tokenizer, types::Area, utils::number_to_column},
types::{CellType, Style},
worksheet::NavigationDirection,
BorderArea, ClipboardData, UserModel as BaseModel,
};
@@ -530,6 +531,20 @@ impl Model {
self.model.on_page_up().map_err(to_js_error)
}
#[wasm_bindgen(js_name = "onNavigateToEdgeInDirection")]
pub fn on_navigate_to_edge_in_direction(&mut self, direction: &str) -> Result<(), JsError> {
let direction = match direction {
"ArrowLeft" => NavigationDirection::Left,
"ArrowRight" => NavigationDirection::Right,
"ArrowUp" => NavigationDirection::Up,
"ArrowDown" => NavigationDirection::Down,
_ => return Err(JsError::new(&format!("Invalid direction: {direction}"))),
};
self.model
.on_navigate_to_edge_in_direction(direction)
.map_err(to_js_error)
}
#[wasm_bindgen(js_name = "setWindowWidth")]
pub fn set_window_width(&mut self, window_width: f64) {
self.model.set_window_width(window_width);