Merge branch 'master' into feature/searchbar

This commit is contained in:
ThinLiquid 2023-10-26 00:45:39 +01:00 committed by GitHub
commit 1caa56c148
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 3 deletions

View file

@ -193,6 +193,11 @@ export default class EditorApp implements App {
(win.content.querySelector('#save') as HTMLElement).onclick = async () => { (win.content.querySelector('#save') as HTMLElement).onclick = async () => {
await window.fs.promises.writeFile(data.path, editor.value) await window.fs.promises.writeFile(data.path, editor.value)
} }
} else {
await window.flow.openApp('flow.files')
setTimeout(() => {
win.close()
}, 10)
} }
return win return win

View file

@ -12,7 +12,7 @@ export const run = (element: HTMLDivElement): void => {
element.style.alignItems = 'center' element.style.alignItems = 'center'
element.style.gap = '5px' element.style.gap = '5px'
element.style.flex = '1' element.style.flex = '1'
// @ts-expect-error
window.addEventListener('app_opened', (e: AppOpenedEvent): void => { window.addEventListener('app_opened', (e: AppOpenedEvent): void => {
const appIcon = document.createElement('app') const appIcon = document.createElement('app')
const app = e.detail.app const app = e.detail.app
@ -28,7 +28,7 @@ export const run = (element: HTMLDivElement): void => {
} }
element.appendChild(appIcon) element.appendChild(appIcon)
}) })
// @ts-expect-error
window.addEventListener('app_closed', (e: AppClosedEvent): void => { window.addEventListener('app_closed', (e: AppClosedEvent): void => {
const win = e.detail.win const win = e.detail.win
element.querySelector(`img[data-id="${win.id}"]`)?.parentElement?.remove() element.querySelector(`img[data-id="${win.id}"]`)?.parentElement?.remove()

View file

@ -11,6 +11,18 @@ export interface AppOpenedEvent extends CustomEvent {
} }
} }
export interface FlowPlugin {
name: string
pkg: string
version?: string
authors?: string[]
init: (data: any) => void | Promise<void>
openWindow?: (data: any) => FlowWindow | Promise<FlowWindow>
addStatusbarItem: (data: any) => void | Promise<void>
loadTheme: (data: any) => void | Promise<void>
}
export interface AppClosedEvent extends CustomEvent { export interface AppClosedEvent extends CustomEvent {
detail: { detail: {
win: FlowWindow win: FlowWindow
@ -32,7 +44,6 @@ export interface FlowWindowConfig {
export interface App { export interface App {
meta: { meta: {
id: any
name: string name: string
description: string description: string
pkg: string pkg: string