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; return;
} }
await this.trigger('beforeCancel');
await this.trigger('beforeCancel'); await this.trigger('beforeCancel');
await this.setAndSync('cancelled', true); await this.setAndSync('cancelled', true);
await this.trigger('afterCancel'); await this.trigger('afterCancel');

View File

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

View File

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