mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 08:07:49 +00:00
feat(editor): paste and drop images into Markdown files (#489)
Pasting or dropping an image into a Markdown editor saves it beside the document in `assets/` and inserts a URL-encoded relative link as one undo step, in local and remote projects. Existing names get numbered suffixes; the folder and clipboard name pattern are in Settings › Editor › General. Non-Markdown editors, text paste and other dropped files keep their behavior. Fixes #308
This commit is contained in:
@@ -19,6 +19,12 @@ pub fn fs_create_file(window: Window, state: State<'_, AppState>, path: PathBuf)
|
||||
fs::create_file(&state.host, window.label(), path)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn fs_create_file_bytes(state: State<'_, AppState>, path: PathBuf, data: Vec<u8>) -> IdeResult<()> {
|
||||
fs::create_file_bytes(&state.host, path, data).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub fn fs_create_dir(path: PathBuf) -> IdeResult<()> {
|
||||
|
||||
@@ -126,6 +126,7 @@ pub fn builder() -> tauri_specta::Builder<tauri::Wry> {
|
||||
bytes::fs_read_range,
|
||||
bytes::fs_read_image,
|
||||
fs::fs_create_file,
|
||||
fs::fs_create_file_bytes,
|
||||
fs::fs_create_dir,
|
||||
fs::fs_rename,
|
||||
fs::fs_set_writable,
|
||||
|
||||
Reference in New Issue
Block a user