From 268d70f33d81f81f98ec91ccd6f33119f57d60d8 Mon Sep 17 00:00:00 2001 From: goose-life <32566441+goose-life@users.noreply.github.com> Date: Fri, 13 Dec 2024 14:17:58 +0200 Subject: [PATCH] check parentNode, parentElement (null when editing Entire document) --- indigo_app/static/javascript/indigo/views/document_editor.js | 2 +- .../static/javascript/indigo/views/document_xml_editor.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indigo_app/static/javascript/indigo/views/document_editor.js b/indigo_app/static/javascript/indigo/views/document_editor.js index df9e4a711..4c2a51754 100644 --- a/indigo_app/static/javascript/indigo/views/document_editor.js +++ b/indigo_app/static/javascript/indigo/views/document_editor.js @@ -142,7 +142,7 @@ if (elements.length) { this.onTextElementParsed(elements); this.closeTextEditor(); - } else if (this.xmlElement.parentElement.tagName === 'portionBody') { + } else if (this.xmlElement.parentNode.tagName === 'portionBody') { alert($t('You cannot delete the whole provision in provision editing mode.')); } else if (confirm($t('Go ahead and delete this provision from the document?'))) { this.parent.removeFragment(this.editingXmlElement); diff --git a/indigo_app/static/javascript/indigo/views/document_xml_editor.js b/indigo_app/static/javascript/indigo/views/document_xml_editor.js index db0106a6c..3923a9434 100644 --- a/indigo_app/static/javascript/indigo/views/document_xml_editor.js +++ b/indigo_app/static/javascript/indigo/views/document_xml_editor.js @@ -136,7 +136,7 @@ class AknTextEditor { let newElement = $.parseXML(xml); // if the top-level eId changed in provision mode, reload the page when saving later (just set the flag here) - if (this.xmlElement.parentElement.tagName === 'portionBody') { + if (this.xmlElement.parentNode.tagName === 'portionBody') { // set it back to false if the eId is changed back before saving too this.reloadOnSave = newElement.firstChild.firstChild.getAttribute('eId') !== Indigo.Preloads.provisionEid; }