|
@@ -60,16 +60,16 @@ export default function deleteContent( model, selection, options = {} ) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const schema = model.schema;
|
|
|
|
|
|
|
+ const selRange = selection.getFirstRange();
|
|
|
|
|
|
|
|
- model.change( writer => {
|
|
|
|
|
- const selRange = selection.getFirstRange();
|
|
|
|
|
|
|
+ // If the selection is already removed, don't do anything.
|
|
|
|
|
+ if ( selRange.root.rootName == '$graveyard' ) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // If the selection is already removed, don't do anything.
|
|
|
|
|
- if ( selRange.root.rootName == '$graveyard' ) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const schema = model.schema;
|
|
|
|
|
|
|
|
|
|
+ model.change( writer => {
|
|
|
// 1. Replace the entire content with paragraph.
|
|
// 1. Replace the entire content with paragraph.
|
|
|
// See: https://github.com/ckeditor/ckeditor5-engine/issues/1012#issuecomment-315017594.
|
|
// See: https://github.com/ckeditor/ckeditor5-engine/issues/1012#issuecomment-315017594.
|
|
|
if ( !options.doNotResetEntireContent && shouldEntireContentBeReplacedWithParagraph( schema, selection ) ) {
|
|
if ( !options.doNotResetEntireContent && shouldEntireContentBeReplacedWithParagraph( schema, selection ) ) {
|