2
0
mirror of https://github.com/frappe/books.git synced 2025-01-03 15:17:30 +00:00

Merge pull request #711 from frappe/fix-kb-issue

fix: prevent back if editing
This commit is contained in:
Alan 2023-08-20 22:32:53 -07:00 committed by GitHub
commit 93da8b5b78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -951,7 +951,6 @@ export class Doc extends Observable<DocValue | Doc[]> {
return;
}
await this.trigger('beforeCancel');
await this.trigger('beforeCancel');
await this.setAndSync('cancelled', true);
await this.trigger('afterCancel');

View File

@ -41,7 +41,13 @@ export default function registerIpcMainActionListeners(main: Main) {
ipcMain.handle(
IPC_ACTIONS.GET_DB_DEFAULT_PATH,
async (_, companyName: string) => {
let root = app.getPath('documents');
let root: string;
try {
root = app.getPath('documents');
} catch {
root = app.getPath('userData');
}
if (main.isDevelopment) {
root = 'dbs';
}

View File

@ -31,9 +31,15 @@ export function useKeys() {
});
const keydownListener = (e: KeyboardEvent) => {
const notMods = !(e.altKey || e.metaKey || e.ctrlKey);
if (e.target instanceof HTMLInputElement && notMods) {
return;
}
if (
e.target instanceof HTMLInputElement &&
!(e.altKey || e.metaKey || e.ctrlKey)
e.target instanceof HTMLElement &&
e.target.contentEditable === 'true' &&
notMods
) {
return;
}