From ebe791395a7af6a93a6150ba8b11b7e4279e34f5 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Mon, 8 Jan 2024 08:42:19 +0000 Subject: [PATCH] fix: in richtext editor on backspace field status changes to deleted field --- .../components/smartsheet/details/Fields.vue | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/details/Fields.vue b/packages/nc-gui/components/smartsheet/details/Fields.vue index e9c5ade692..8361b960aa 100644 --- a/packages/nc-gui/components/smartsheet/details/Fields.vue +++ b/packages/nc-gui/components/smartsheet/details/Fields.vue @@ -631,8 +631,14 @@ onKeyDown('ArrowUp', () => { onKeyDown('Delete', () => { if (isLocked.value) return - if (document.activeElement?.tagName === 'INPUT') return - if (document.activeElement?.tagName === 'TEXTAREA') return + if ( + document.activeElement?.tagName === 'INPUT' || + document.activeElement?.tagName === 'TEXTAREA' || + // A rich text editor is a div with the contenteditable attribute set to true. + document.activeElement?.getAttribute('contenteditable') + ) { + return + } const isDeletedField = fieldStatus(activeField.value) === 'delete' if (!isDeletedField && activeField.value) { @@ -643,8 +649,14 @@ onKeyDown('Delete', () => { onKeyDown('Backspace', () => { if (isLocked.value) return - if (document.activeElement?.tagName === 'INPUT') return - if (document.activeElement?.tagName === 'TEXTAREA') return + if ( + document.activeElement?.tagName === 'INPUT' || + document.activeElement?.tagName === 'TEXTAREA' || + // A rich text editor is a div with the contenteditable attribute set to true. + document.activeElement?.getAttribute('contenteditable') + ) { + return + } const isDeletedField = fieldStatus(activeField.value) === 'delete' if (!isDeletedField && activeField.value) {