Skip to content

Commit

Permalink
Merge f89381c into 9156a11
Browse files Browse the repository at this point in the history
  • Loading branch information
peterchappell committed Mar 7, 2019
2 parents 9156a11 + f89381c commit c1f65d4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/js/core.js
Expand Up @@ -180,6 +180,12 @@
this.options.ownerDocument.execCommand('formatBlock', false, 'p');
}

// https://github.com/yabwe/medium-editor/issues/1455
// if somehow we have the BR as the selected element, typing does nothing, so move the cursor
if (node.nodeName === 'BR') {
MediumEditor.selection.moveCursor(this.options.ownerDocument, node.parentElement);
}

// https://github.com/yabwe/medium-editor/issues/834
// https://github.com/yabwe/medium-editor/pull/382
// Don't call format block if this is a block element (ie h1, figCaption, etc.)
Expand All @@ -193,6 +199,14 @@
this.options.ownerDocument.execCommand('unlink', false, null);
} else if (!event.shiftKey && !event.ctrlKey) {
this.options.ownerDocument.execCommand('formatBlock', false, 'p');
// https://github.com/yabwe/medium-editor/issues/1455
// firefox puts the focus on the br - so we need to move the cursor to the newly created p
if (MediumEditor.util.isFF) {
var newParagraph = node.querySelector('p');
if (newParagraph) {
MediumEditor.selection.moveCursor(this.options.ownerDocument, newParagraph);
}
}
}
}
}
Expand Down

0 comments on commit c1f65d4

Please sign in to comment.