Made it so the editor knows what folder your in
I put all the stuff for getting the current folder in comments since the current folder is unused for now.
This commit is contained in:
1 parent
3097541dc8
commit
530c290202
3 files changed
+9
-5
No files matched your search
@@ -6,7 +6,7 @@ use tokio::fs;
|
||||
use zip::ZipArchive;
|
||||
|
||||
#[tauri::command]
|
||||
fn create_window(app: AppHandle, window_type: i32) {
|
||||
fn create_window(app: AppHandle, window_type: i32, editor_folder: Option<String>) {
|
||||
match window_type {
|
||||
0 => {
|
||||
let _ = WebviewWindowBuilder::new(
|
||||
@@ -34,7 +34,7 @@ fn create_window(app: AppHandle, window_type: i32) {
|
||||
}
|
||||
2 => {
|
||||
let _ =
|
||||
WebviewWindowBuilder::new(&app, "editor", tauri::WebviewUrl::App("editor".into()))
|
||||
WebviewWindowBuilder::new(&app, "editor", tauri::WebviewUrl::App(format!("editor?folder={}", editor_folder.unwrap()).into()))
|
||||
.maximized(true)
|
||||
.title("PHP Fly: Editor")
|
||||
.inner_size(800.0, 600.0)
|
||||
@@ -154,7 +154,7 @@ pub fn run() {
|
||||
.invoke_handler(tauri::generate_handler![create_project, create_window])
|
||||
.setup(|app| {
|
||||
let handle = app.handle();
|
||||
create_window(handle.clone(), 0);
|
||||
create_window(handle.clone(), 0, None);
|
||||
Ok(())
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
import './Editor_globals.css'
|
||||
|
||||
import Image from "next/image";
|
||||
// import { useSearchParams } from 'next/navigation';
|
||||
// import { useState } from 'react'
|
||||
|
||||
import file_list_icon from "./assets/file_list_icon.svg";
|
||||
|
||||
@@ -11,6 +13,8 @@ export default function Editor_Layout ({
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
// const [projectType, setProjectType] = useState<string>(useSearchParams().get("folder") ?? "")
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className='sidebar'>
|
||||
|
||||
@@ -18,7 +18,7 @@ export default function ProjectManager_Projects () {
|
||||
'projectmanager'
|
||||
)
|
||||
if (!projectManager) return
|
||||
invoke('create_window', { windowType: 1 })
|
||||
invoke('create_window', { windowType: 1, editorFolder: null })
|
||||
const popup = await WebviewWindow.getByLabel('newprojectpopup')
|
||||
if (!popup) return
|
||||
await projectManager.setClosable(false)
|
||||
@@ -41,7 +41,7 @@ export default function ProjectManager_Projects () {
|
||||
'projectmanager'
|
||||
)
|
||||
if (!projectManager) return
|
||||
invoke('create_window', { windowType: 2 })
|
||||
invoke('create_window', { windowType: 2, editorFolder: "~/Desktop/php-fly-debug-folder" })
|
||||
const editor = await WebviewWindow.getByLabel('editor')
|
||||
if (!editor) return
|
||||
projectManager.close()
|
||||
|
||||
Reference in new issue
Block a user