Fix blog after refactoring
This commit is contained in:
parent
3702495714
commit
6dc162f3ff
@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -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}`])
|
||||
|
Loading…
Reference in New Issue
Block a user