Fix finder context menu in desktop mode and add error on link giletype
This commit is contained in:
parent
8facac5d19
commit
1b3f17777e
@ -153,9 +153,12 @@ class FinderWindow{
|
|||||||
const html = await response.text()
|
const html = await response.text()
|
||||||
args[2].innerHTML = html
|
args[2].innerHTML = html
|
||||||
|
|
||||||
this.fileView = new FileView(args[2].querySelector(".FileTileView"), (event) =>{
|
this.fileView = new FileView(
|
||||||
this.Click(event, true)
|
args[2].querySelector(".FileTileView"), (event) =>{this.Click(event)},
|
||||||
})
|
(event) => { this.RightClick(event) },
|
||||||
|
(event, draggedElem) => { this.DropEvent(event, draggedElem)},
|
||||||
|
() => { this.ReRenderDir() }
|
||||||
|
)
|
||||||
this.RenderDir(args[0])
|
this.RenderDir(args[0])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -170,7 +173,6 @@ class FinderWindow{
|
|||||||
let newWindow = WebDesktopEnvironment.CreateNewWindow(Finder.appId, 500, 350 )
|
let newWindow = WebDesktopEnvironment.CreateNewWindow(Finder.appId, 500, 350 )
|
||||||
newWindow.innerHTML = html
|
newWindow.innerHTML = html
|
||||||
|
|
||||||
// console.log(this.ReRenderDir)
|
|
||||||
this.fileView = new FileView(
|
this.fileView = new FileView(
|
||||||
newWindow.querySelector(".FileTileView"),
|
newWindow.querySelector(".FileTileView"),
|
||||||
(event) => { this.Click(event) },
|
(event) => { this.Click(event) },
|
||||||
@ -257,22 +259,24 @@ class FinderWindow{
|
|||||||
Click(event){
|
Click(event){
|
||||||
let fileType = event.target.getAttribute("fileType")
|
let fileType = event.target.getAttribute("fileType")
|
||||||
let fileName = event.target.getAttribute("name")
|
let fileName = event.target.getAttribute("name")
|
||||||
|
|
||||||
const fileExtension = fileName.split(".")[fileName.split(".").length - 1] //FIXME
|
const fileExtension = fileName.split(".")[fileName.split(".").length - 1] //FIXME
|
||||||
switch (fileType) {
|
switch (true) {
|
||||||
case "directory":
|
case fileType == "objectlink":
|
||||||
if (fileExtension == "app"){
|
WebDesktopEnvironment.Alert("Links not supported yet")
|
||||||
WebDesktopEnvironment.Open(`${this.CurPath}/${fileName}`, [])
|
|
||||||
} else{
|
|
||||||
WebDesktopEnvironment.Open(`/Applications/Finder.app`, [`${this.CurPath}/${fileName}`])
|
|
||||||
}
|
|
||||||
break
|
break
|
||||||
case "blog":
|
case fileType == "directory":
|
||||||
|
WebDesktopEnvironment.Open(`/Applications/Finder.app`, [`${this.CurPath}/${fileName}`])
|
||||||
|
break
|
||||||
|
case fileExtension == "blog":
|
||||||
WebDesktopEnvironment.Open("/Applications/BlogViewer.app", [`${this.CurPath}/${fileName}`])
|
WebDesktopEnvironment.Open("/Applications/BlogViewer.app", [`${this.CurPath}/${fileName}`])
|
||||||
break
|
break
|
||||||
case "jpeg":
|
case fileExtension == "jpeg" | fileExtension == "png":
|
||||||
case "png":
|
|
||||||
WebDesktopEnvironment.Open("img-viewer", [this.CurPath + "/" + fileName])
|
WebDesktopEnvironment.Open("img-viewer", [this.CurPath + "/" + fileName])
|
||||||
break;
|
break;
|
||||||
|
case fileExtension == "app":
|
||||||
|
WebDesktopEnvironment.Open(`${this.CurPath}/${fileName}`, [])
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
// console.log("Unsupported file type")
|
// console.log("Unsupported file type")
|
||||||
WebDesktopEnvironment.Alert("Unsupported file type")
|
WebDesktopEnvironment.Alert("Unsupported file type")
|
||||||
|
Loading…
Reference in New Issue
Block a user