Merge branch 'idk' of https://github.com/Flow-Works/FlowOS-2.0 into idk
This commit is contained in:
commit
00d8726ca3
5 changed files with 30 additions and 37 deletions
|
|
@ -34,7 +34,7 @@ export default class EditorApp implements App {
|
|||
})
|
||||
|
||||
if (data != null) {
|
||||
win.setTitle('Editor - ' + data.path)
|
||||
win.setTitle(`Editor - ${data.path}`)
|
||||
|
||||
win.content.style.display = 'flex'
|
||||
win.content.style.flexDirection = 'column'
|
||||
|
|
@ -99,34 +99,30 @@ export default class EditorApp implements App {
|
|||
const fileBtn = win.content.querySelector('#file-open')
|
||||
const editBtn = win.content.querySelector('#edit-open')
|
||||
|
||||
const toggleDropdown = function (id: string): void {
|
||||
const toggleDropdown = (id: string): void => {
|
||||
const el = win.content.querySelector(`#${id}`)
|
||||
el?.classList.toggle('show')
|
||||
}
|
||||
|
||||
fileBtn?.addEventListener('click', function (e) {
|
||||
fileBtn?.addEventListener('click', (e) => {
|
||||
e.stopPropagation()
|
||||
toggleDropdown('file')
|
||||
})
|
||||
|
||||
editBtn?.addEventListener('click', function (e) {
|
||||
editBtn?.addEventListener('click', (e) => {
|
||||
e.stopPropagation()
|
||||
toggleDropdown('edit')
|
||||
})
|
||||
|
||||
win.content.addEventListener('click', function () {
|
||||
const file = win.content.querySelector('#file')
|
||||
const edit = win.content.querySelector('#edit')
|
||||
if (file !== null) {
|
||||
win.content.addEventListener('click', () => {
|
||||
const file = (win.content.querySelector('#file') as HTMLElement)
|
||||
const edit = (win.content.querySelector('#edit') as HTMLElement)
|
||||
if (file.classList.contains('show')) {
|
||||
toggleDropdown('file')
|
||||
}
|
||||
}
|
||||
if (edit !== null) {
|
||||
if (edit.classList.contains('show')) {
|
||||
toggleDropdown('edit')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const value = (await window.fs.promises.readFile(data.path)).toString()
|
||||
|
|
|
|||
|
|
@ -39,22 +39,22 @@ export default class FilesApp implements App {
|
|||
if (back !== '<i class=\'bx bx-arrow-to-left\'></i>') {
|
||||
(win.content.querySelector('.back') as HTMLElement).onclick = async () => {
|
||||
if (dir.split('/')[1] === dir.replace('/', '')) {
|
||||
await setDir('/' + dir.split('/')[0])
|
||||
await setDir(`/${dir.split('/')[0]}`)
|
||||
} else {
|
||||
await setDir('/' + dir.split('/')[1])
|
||||
await setDir(`/${dir.split('/')[1]}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(win.content.querySelector('.file') as HTMLElement).onclick = async () => {
|
||||
const title: string = prompt('Enter file name') ?? 'new-file.txt'
|
||||
await window.fs.promises.open(dir + '/' + title, 'w')
|
||||
await window.fs.promises.open(`${dir}/${title}`, 'w')
|
||||
await setDir(dir)
|
||||
}
|
||||
|
||||
(win.content.querySelector('.folder') as HTMLElement).onclick = async () => {
|
||||
const title: string = prompt('Enter folder name') ?? 'new-folder'
|
||||
await window.fs.promises.mkdir(dir + '/' + title)
|
||||
await window.fs.promises.mkdir(`${dir}/${title}`)
|
||||
await setDir(dir)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ class StatusBar {
|
|||
add (item: StatusItem): void {
|
||||
if (this.items.some(x => x.meta.id === item.meta.id)) {
|
||||
console.error(`Unable to register tool; ${item.meta.id} is already registered.`)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
const element = document.createElement('div')
|
||||
element.setAttribute('data-toolbar-id', item.meta.id)
|
||||
|
||||
|
|
@ -37,6 +39,5 @@ class StatusBar {
|
|||
item.run(element)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default StatusBar
|
||||
|
|
|
|||
|
|
@ -185,11 +185,7 @@ class WM {
|
|||
|
||||
const max = Math.max(...indexes)
|
||||
|
||||
if (max === -Infinity) {
|
||||
return 0
|
||||
} else {
|
||||
return max
|
||||
}
|
||||
return max === -Infinity ? 0 : max
|
||||
}
|
||||
|
||||
createWindow (config: FlowWindowConfig): FlowWindow {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue