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 <kbd>Enter</kbd> could throw an error due to the assumption of a `tagName` property in the enter-at-start-of-header handling
This commit is contained in:
Kevin Ansfield 2018-04-26 17:49:14 +01:00
parent 8f135264dc
commit 8dd8257bf7

View File

@ -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;