From 62f30ef22719b489e61fdc25cf9767436e5611bc Mon Sep 17 00:00:00 2001 From: ThinLiquid Date: Wed, 25 Oct 2023 10:53:29 +0000 Subject: [PATCH 1/5] =?UTF-8?q?[=E2=9A=A1]=20Made=20editor=20app=20open=20?= =?UTF-8?q?files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apps/editor.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/apps/editor.ts b/src/apps/editor.ts index ecac6c6..684cad1 100644 --- a/src/apps/editor.ts +++ b/src/apps/editor.ts @@ -193,6 +193,11 @@ export default class EditorApp implements App { (win.content.querySelector('#save') as HTMLElement).onclick = async () => { await window.fs.promises.writeFile(data.path, editor.value) } + } else { + window.flow.openApp('flow.files'); + setTimeout(() => { + win.close() + }, 10) } return win From 8c2744b5d475e95094f911bc9bc4dc393a6461b3 Mon Sep 17 00:00:00 2001 From: ThinLiquid Date: Wed, 25 Oct 2023 10:56:19 +0000 Subject: [PATCH 2/5] =?UTF-8?q?[=F0=9F=94=A8]=20Follow=20ts-standard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apps/editor.ts | 2 +- src/types.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/apps/editor.ts b/src/apps/editor.ts index 684cad1..a54e4da 100644 --- a/src/apps/editor.ts +++ b/src/apps/editor.ts @@ -194,7 +194,7 @@ export default class EditorApp implements App { await window.fs.promises.writeFile(data.path, editor.value) } } else { - window.flow.openApp('flow.files'); + await window.flow.openApp('flow.files') setTimeout(() => { win.close() }, 10) diff --git a/src/types.ts b/src/types.ts index efc497f..d44775e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -32,7 +32,6 @@ export interface FlowWindowConfig { export interface App { meta: { - id: any name: string description: string pkg: string From 7a728fca7020a8e5fa18a224a25c7683d20933ee Mon Sep 17 00:00:00 2001 From: proudparrot2 Date: Wed, 25 Oct 2023 07:31:08 -0500 Subject: [PATCH 3/5] =?UTF-8?q?[=F0=9F=90=9B]=20Fixed=20ts-expect-error=20?= =?UTF-8?q?giving=20errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/apps.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/plugins/apps.ts b/src/plugins/apps.ts index 3f5d960..60ad755 100644 --- a/src/plugins/apps.ts +++ b/src/plugins/apps.ts @@ -12,7 +12,6 @@ export const run = (element: HTMLDivElement): void => { element.style.alignItems = 'center' element.style.gap = '5px' element.style.flex = '1' - // @ts-expect-error window.addEventListener('app_opened', (e: AppOpenedEvent): void => { const appIcon = document.createElement('app') const app = e.detail.app @@ -28,7 +27,6 @@ export const run = (element: HTMLDivElement): void => { } element.appendChild(appIcon) }) - // @ts-expect-error window.addEventListener('app_closed', (e: AppClosedEvent): void => { const win = e.detail.win element.querySelector(`img[data-id="${win.id}"]`)?.parentElement?.remove() From 4ed7251873c3b1940cbed72eb696cdcdf9c9bfda Mon Sep 17 00:00:00 2001 From: proudparrot2 Date: Wed, 25 Oct 2023 07:31:22 -0500 Subject: [PATCH 4/5] =?UTF-8?q?[=E2=9C=A8]=20Added=20type=20for=20FlowPlug?= =?UTF-8?q?in?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/types.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/types.ts b/src/types.ts index efc497f..ef39528 100644 --- a/src/types.ts +++ b/src/types.ts @@ -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 + openWindow?: (data: any) => FlowWindow | Promise + addStatusbarItem: (data: any) => void | Promise + loadTheme: (data: any) => void | Promise +} + export interface AppClosedEvent extends CustomEvent { detail: { win: FlowWindow From 30a4e85f963914dffcdedd984f217db354a7f6c0 Mon Sep 17 00:00:00 2001 From: proudparrot2 Date: Wed, 25 Oct 2023 07:34:10 -0500 Subject: [PATCH 5/5] =?UTF-8?q?[=E2=86=A9=EF=B8=8F]=20Okay=20never=20mind?= =?UTF-8?q?=20it=20was=20supposed=20to=20be=20there?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/apps.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/apps.ts b/src/plugins/apps.ts index f17b3ef..384b82d 100644 --- a/src/plugins/apps.ts +++ b/src/plugins/apps.ts @@ -12,7 +12,7 @@ export const run = (element: HTMLDivElement): void => { element.style.alignItems = 'center' element.style.gap = '5px' element.style.flex = '1' - + // @ts-expect-error window.addEventListener('app_opened', (e: AppOpenedEvent): void => { const appIcon = document.createElement('app') const app = e.detail.app @@ -28,7 +28,7 @@ export const run = (element: HTMLDivElement): void => { } element.appendChild(appIcon) }) - + // @ts-expect-error window.addEventListener('app_closed', (e: AppClosedEvent): void => { const win = e.detail.win element.querySelector(`img[data-id="${win.id}"]`)?.parentElement?.remove()