Skip to content

Commit

Permalink
fix: add 'New Whiteboard' to primary
Browse files Browse the repository at this point in the history
  • Loading branch information
uhrjun committed Nov 21, 2024
1 parent 609e1c6 commit a89c205
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions frontend/src/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,32 @@ export default {
isEnabled: () => this.selectedEntities?.length === 0,
},
{
label: "New Whiteboard",
icon: NewFile,
onClick: async () => {
await this.$resources.createWhiteboard.submit({
title: "Untitled Whiteboard",
content: null,
parent: this.$store.state.currentFolderID,
})
if (this.$store.state.editorNewTab) {
window.open(
this.$router.resolve({
name: "Whiteboard",
params: { entityName: this.previewEntity.name },
}).href,
"_blank"
)
} else {
this.$router.push({
name: "Whiteboard",
params: { entityName: this.previewEntity.name },
})
}
},
isEnabled: () => this.selectedEntities?.length === 0,
},
],
},
],
Expand Down Expand Up @@ -471,6 +497,23 @@ export default {
auto: false,
}
},
createWhiteboard() {
return {
method: "POST",
url: "drive.api.files.create_whiteboard_entity",
onSuccess(data) {
data.modified = formatDate(data.modified)
data.creation = formatDate(data.creation)
this.$store.commit("setEntityInfo", [data])
this.previewEntity = data
data.owner = "You"
},
onError(error) {
console.log(error)
},
auto: false,
}
},
toggleFavourite() {
return {
method: "POST",
Expand Down

0 comments on commit a89c205

Please sign in to comment.