Fix blog after refactoring

This commit is contained in:
cyber-dream 2023-05-11 02:26:57 +03:00
parent 3702495714
commit 6dc162f3ff
2 changed files with 16 additions and 18 deletions

View File

@ -4,28 +4,26 @@ class BlogViewer{
}
/**
* @param {string[]} chroot //TODO
* @param {string[]} args
*/
NewWindow(args){
fetch(`${window.location.origin}/application/${this.appId}/render?` + new URLSearchParams({
async NewWindow(args){
const response = await fetch(`app/${this.appId}/render?` + new URLSearchParams({
isMobile: WebDesktopEnvironment.isMobile,
path: args[0],
}))
.then((response) => response.text())
.then((html) => {
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 500, 350 )
newWindow.innerHTML = html
// let fileView = new FileView("/kek", newWindow.querySelector(".FileTileView"), Finder.Click)
if (!WebDesktopEnvironment.isMobile){
let scrollBar = new WdeScrollBar(newWindow.querySelector(".ScrollbarPlace"), newWindow.querySelector(".ScrollContent"))
newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) {
WebDesktopEnvironment.CloseWindow(newWindow)
})
}
})
.catch((error) => {
WebDesktopEnvironment.Alert(error);
if (response.status != 200){
WebDesktopEnvironment.Alert("Error render TODO") //TODO
return
}
const html = await response.text()
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 500, 350 )
newWindow.innerHTML = html
let scrollBar = new WdeScrollBar(newWindow.querySelector(".ScrollbarPlace"), newWindow.querySelector(".ScrollContent"))
newWindow.querySelector("#closeWindowButton").addEventListener('click', function (params) {
WebDesktopEnvironment.CloseWindow(newWindow)
})
}

View File

@ -249,7 +249,7 @@ class FinderWindow{
}
break
case "blog":
WebDesktopEnvironment.Open("blog-viewer", [`${this.CurPath}/${fileName}`])
WebDesktopEnvironment.Open("/Applications/BlogViewer.app", [`${this.CurPath}/${fileName}`])
break
case "personal-properties":
WebDesktopEnvironment.Open("personal-properties", [`${this.CurPath}/${fileName}`])