Module moras::menu::file

source ยท

Functionsยง

  • Check if the file is dirty, if so, display a dialog to ask user to save the file or not. If user choose to save, save the file and then close the tab. If user choose not to save, close the tab directly.
  • close_handler ๐Ÿ”’
  • exit_handler ๐Ÿ”’
    Iterate all tabs, check if each tab is dirty, if so, display a dialog to ask user to save the file or not. If user choose to save, save the file and then close the tab. If user choose not to save, close the tab directly.
  • new_tab ๐Ÿ”’
    Create a new tab with the file in provided file path
  • open_handler ๐Ÿ”’
    event emit: front_file_open payload: OpenFile { file_path: String, content: String }
  • save_as_handler ๐Ÿ”’
    event emit: front_file_save_as payload: String FIXME: the emit event maybe unused?
  • save_handler ๐Ÿ”’
    event emit: front_file_save payload: String fn save_handler(event: &WindowMenuEvent) { let name = get_current_tab_name(&event); let tab_map = event.window().state::(); let mut lock = tab_map.tabs.lock().unwrap();
  • share_handler ๐Ÿ”’