diff --git a/quasar.conf.js b/quasar.conf.js index f71b694..122ac0c 100644 --- a/quasar.conf.js +++ b/quasar.conf.js @@ -26,7 +26,8 @@ module.exports = configure(function (ctx) { // https://quasar.dev/quasar-cli/boot-files boot: [ "i18n", - "axios" + "axios", + 'notify-defaults' ], // https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-css diff --git a/src-electron/main-process/electron-main.js b/src-electron/main-process/electron-main.js index d2fca30..770e378 100644 --- a/src-electron/main-process/electron-main.js +++ b/src-electron/main-process/electron-main.js @@ -17,6 +17,7 @@ if (process.env.PROD) { let mainWindow function createWindow () { + app.commandLine.appendSwitch('disable-software-rasterizer', 'true') /** * Initial window options */ diff --git a/src/App.vue b/src/App.vue index 513a08d..48e398a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -28,10 +28,17 @@ export default class App extends BaseClass { } this.registerDefaultKeybinds() - window.addEventListener("keyup", this.triggerKeyPush) + window.addEventListener("keydown", this.triggerKeyPush) } triggerKeyPush (e:any) { + // console.log("") + // console.log(`Key: ${e.key}`) + // console.log(`Ctrl: ${e.ctrlKey}`) + // console.log(`Shift: ${e.shiftKey}`) + // console.log(`Alt: ${e.altKey}`) + // console.log(e) + if (e?.altKey === true || e?.ctrlKey || e?.shiftKey) { const ouputKeycombo = { altKey: e.altKey, @@ -48,7 +55,7 @@ export default class App extends BaseClass { window.removeEventListener("auxclick", this.reactToMiddleClick) this.deregisterDefaultKeybinds() - window.removeEventListener("keyup", this.triggerKeyPush) + window.removeEventListener("keydown", this.triggerKeyPush) } reactToMiddleClick (e: {button: number, preventDefault: ()=> void}) { diff --git a/src/BaseClass.ts b/src/BaseClass.ts index 8cbc263..2c4c76a 100644 --- a/src/BaseClass.ts +++ b/src/BaseClass.ts @@ -163,7 +163,13 @@ export default class BaseClass extends Vue { // Open documents management /****************************************************************/ - @OpenedDocuments.Getter("getAllDocuments") SGET_allOpenedDocuments !: {treeAction: boolean, timestamp: string, docs: I_OpenedDocument[]} + @OpenedDocuments.Getter("getAllDocuments") SGET_allOpenedDocuments !: { + treeAction: boolean, + lastRemovedIndex: number, + timestamp: string, + docs: I_OpenedDocument[] + } + @OpenedDocuments.Getter("getDocument") SGET_openedDocument!: (id: string) => I_OpenedDocument @OpenedDocuments.Action("addDocument") SSET_addOpenedDocument!: (input: { @@ -183,6 +189,7 @@ export default class BaseClass extends Vue { @OpenedDocuments.Action("triggerTreeAction") SSET_triggerTreeAction!: () => void @OpenedDocuments.Action("resetDocuments") SSET_resetDocuments!: () => void + @OpenedDocuments.Action("resetRemoveIndex") SSET_resetRemoveIndex!: () => void findRequestedOrActiveDocument (doc?: I_OpenedDocument) { if (doc) { @@ -236,9 +243,17 @@ export default class BaseClass extends Vue { refreshRoute () { const remainingDocuments = this.SGET_allOpenedDocuments.docs + const lastIndex = this.SGET_allOpenedDocuments.lastRemovedIndex + + const newIndex = (lastIndex > -1 && lastIndex < remainingDocuments.length) ? lastIndex : remainingDocuments.length - 1 + + if (lastIndex > -1) { + this.SSET_resetRemoveIndex() + } + // Assuming there are any documents in the current list if (remainingDocuments.length > 0) { - const lastDocument = remainingDocuments[remainingDocuments.length - 1] + const lastDocument = remainingDocuments[newIndex] const currentRoute = this.$router.currentRoute.path const existingDocument = this.SGET_allOpenedDocuments.docs.find(e => { return e.url === currentRoute diff --git a/src/boot/notify-defaults.js b/src/boot/notify-defaults.js new file mode 100644 index 0000000..2ada6cf --- /dev/null +++ b/src/boot/notify-defaults.js @@ -0,0 +1,8 @@ +import { Notify } from "quasar" + +Notify.setDefaults({ + position: "bottom-right", + timeout: 4000, + progress: true, + textColor: "cultured" +}) diff --git a/src/components/DocumentControl.vue b/src/components/DocumentControl.vue index db2fb07..ab893b1 100644 --- a/src/components/DocumentControl.vue +++ b/src/components/DocumentControl.vue @@ -142,7 +142,7 @@ 0) { this.deleteObjectAssignUID() } // Edit document - CTRL + E - if (this.determineKeyBind("editDocument") && this.currentyEditable) { + if (this.determineKeyBind("editDocument") && this.currentyEditable && this.SGET_allOpenedDocuments.docs.length > 0) { this.toggleEditMode() } - // Save document - if (this.determineKeyBind("saveDocument") && !this.currentyEditable) { + // Save document - CTRL + S + if (this.determineKeyBind("saveDocument") && !this.currentyEditable && this.SGET_allOpenedDocuments.docs.length > 0) { this.saveCurrentDocument().catch(e => console.log(e)) } } @@ -342,11 +342,18 @@ export default class DocumentControl extends BaseClass { /****************************************************************/ retrieveCurrentProjectName = retrieveCurrentProjectName - exportProject = exportProject - async commenceExport () { const projectName = await retrieveCurrentProjectName() - this.exportProject(projectName) + const setup = { + message: "

Exporting current project...

", + spinnerColor: "primary", + messageColor: "cultured", + spinnerSize: 120, + backgroundColor: "dark", + // @ts-ignore + spinner: QSpinnerGears + } + exportProject(projectName, Loading, setup, this.$q) } /****************************************************************/ @@ -378,6 +385,10 @@ export default class DocumentControl extends BaseClass { } async saveCurrentDocument () { + if (document.activeElement) { + (document.activeElement as HTMLElement).blur() + } + const currentDoc = this.findRequestedOrActiveDocument() const allDocuments = this.SGET_allOpenedDocuments @@ -408,12 +419,27 @@ export default class DocumentControl extends BaseClass { onUrlChange () { this.checkEditability() this.checkNew() + this.checkHasEdits() } @Watch("SGET_allOpenedDocuments", { deep: true }) onDocChange () { this.checkEditability() this.checkNew() + this.checkHasEdits() + } + + hasEdits = false + + checkHasEdits () { + const currentDocument = this.findRequestedOrActiveDocument() + + if (currentDocument && !currentDocument.hasEdits) { + this.hasEdits = true + } + else { + this.hasEdits = false + } } checkEditability () { diff --git a/src/components/ObjectTree.vue b/src/components/ObjectTree.vue index 9f69e81..94d3b0c 100644 --- a/src/components/ObjectTree.vue +++ b/src/components/ObjectTree.vue @@ -13,6 +13,17 @@ +
+ + {{projectName}} + + This is your currently opened project's name. + + +
+