Skip to content

Commit

Permalink
Merge pull request #1011 from bridge-core/dev
Browse files Browse the repository at this point in the history
2.7.2
  • Loading branch information
outercloudstudio authored Nov 11, 2023
2 parents f6e29ae + 79d42a5 commit c10194a
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 30 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bridge",
"version": "2.7.1",
"version": "2.7.2",
"private": true,
"scripts": {
"dev": "vite",
Expand Down
4 changes: 4 additions & 0 deletions src/components/Editors/Text/TextTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,14 @@ export class TextTab extends FileTab {
}
protected async saveFile() {
if (this.editorModel && !this.editorModel.isDisposed()) {
App.eventSystem.dispatch('beforeModifiedProject', null)

const writeWorked = await this.writeFile(
this.editorModel.getValue()
)

App.eventSystem.dispatch('modifiedProject', null)

if (writeWorked) {
this.setIsUnsaved(false)
this.initialVersionId =
Expand Down
5 changes: 4 additions & 1 deletion src/components/Projects/ProjectManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,10 @@ export class ProjectManager extends Signal<void> {
this.projectBeingModified++
}
handleModifiedProjectEvent() {
this.projectBeingModified--
// Sometimes a the writer await will resolve before the poller actually detects the change so we need to wait a tiny bit before unlocking to catch the delay
setTimeout(() => {
this.projectBeingModified--
}, 1)
}
async handleWatchEvent(event: any) {
if (this.selectedProject === null) return
Expand Down
29 changes: 16 additions & 13 deletions src/components/Toolbar/Category/download.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { vuetify } from '../../App/Vuetify'
import { ToolbarButton } from '../ToolbarButton'
import { App } from '/@/App'

export function setupDownloadButton(app: App) {
App.toolbar.add({
type: 'button',
id: 'download',
name: 'toolbar.download.name',
trigger() {
App.openUrl(
'https://bridge-core.app/guide/download/',
undefined,
true
)
},
shouldRender: { value: !import.meta.env.VITE_IS_TAURI_APP },
})
App.toolbar.add(
new ToolbarButton(
'mdi-download',
'toolbar.download.name',
() => {
App.openUrl(
'https://bridge-core.app/guide/download/',
undefined,
true
)
},
{ value: !import.meta.env.VITE_IS_TAURI_APP }
)
)
}
20 changes: 11 additions & 9 deletions src/components/Toolbar/Category/settings.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { ToolbarButton } from '../ToolbarButton'
import { App } from '/@/App'

export function setupSettingsButton(app: App) {
App.toolbar.add({
type: 'button',
id: 'openSettings',
name: 'actions.settings.name',
trigger() {
app.windows.settings.open()
},
shouldRender: { value: true },
})
App.toolbar.add(
new ToolbarButton(
'mdi-cog',
'actions.settings.name',
() => {
app.windows.settings.open()
},
{ value: true }
)
)
}
32 changes: 32 additions & 0 deletions src/components/Toolbar/ToolbarButton.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { v4 as uuid } from 'uuid'
import { EventDispatcher } from '../Common/Event/EventDispatcher'
import { UnwrapNestedRefs } from 'vue'

export class ToolbarButton extends EventDispatcher<void> {
public readonly id = uuid()
protected type = 'button'
constructor(
protected icon: string,
protected name: string,
protected callback: () => void,
protected shouldRender: UnwrapNestedRefs<{ value: boolean }>
) {
super()
}

toNestedMenu() {
return <const>{
type: 'button',
icon: this.icon,
name: this.name,
onTrigger: () => this.trigger(),
}
}

trigger() {
this.callback()
this.dispatch()
}

dispose() {}
}
5 changes: 1 addition & 4 deletions src/components/Toolbar/ToolbarCategory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ import { Action } from '/@/components/Actions/Action'
import { IDisposable } from '/@/types/disposable'
import { v4 as uuid } from 'uuid'
import { EventDispatcher } from '../Common/Event/EventDispatcher'
import { Ref, del, reactive, ref, set } from 'vue'
import { del, reactive, set } from 'vue'
import { Divider } from './Divider'

export class ToolbarCategory extends EventDispatcher<void> {
public readonly id = uuid()
protected type = 'category'
public shouldRender = reactive({ value: true })

protected isVisible = false

protected state: Record<string, Action | ToolbarCategory | Divider> =
reactive({})
protected disposableItems: Record<string, IDisposable | undefined> = {}
Expand Down Expand Up @@ -58,7 +56,6 @@ export class ToolbarCategory extends EventDispatcher<void> {
}

trigger() {
this.isVisible = false
this.dispatch()
}

Expand Down

0 comments on commit c10194a

Please sign in to comment.