From 8dd8257bf7944090a0c638e4a34d7ef294588b3c Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 26 Apr 2018 17:49:14 +0100 Subject: [PATCH] Koenig - Fixed error on Enter if card is selected refs https://github.com/TryGhost/Ghost/issues/9505 - depending on the location of the caret around the selected card Enter could throw an error due to the assumption of a `tagName` property in the enter-at-start-of-header handling --- ghost/admin/lib/koenig-editor/addon/components/koenig-editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghost/admin/lib/koenig-editor/addon/components/koenig-editor.js b/ghost/admin/lib/koenig-editor/addon/components/koenig-editor.js index 92d82f6023..a42510441e 100644 --- a/ghost/admin/lib/koenig-editor/addon/components/koenig-editor.js +++ b/ghost/admin/lib/koenig-editor/addon/components/koenig-editor.js @@ -605,7 +605,7 @@ export default Component.extend({ let {isCollapsed, head: {offset, section}} = editor.range; // if cursor is at beginning of a heading, insert a blank paragraph above - if (isCollapsed && offset === 0 && section.tagName.match(/^h\d$/)) { + if (isCollapsed && offset === 0 && section.tagName && section.tagName.match(/^h\d$/)) { editor.run((postEditor) => { let newPara = postEditor.builder.createMarkupSection('p'); let collection = section.parent.sections;