-
Notifications
You must be signed in to change notification settings - Fork 40
T/1012: Handles with a paragraph when the entire content was removed #1022
Conversation
tests/model/schema/schema.js
Outdated
@@ -49,6 +49,10 @@ describe( 'Schema', () => { | |||
expect( schema.limits ).to.be.instanceOf( Set ); | |||
} ); | |||
|
|||
it( 'should have defined the limits elements', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"should mark $root as a limit element"
tests/controller/deletecontent.js
Outdated
@@ -233,12 +233,6 @@ describe( 'DataController', () => { | |||
'<heading1>f[]</heading1><paragraph>x</paragraph>' | |||
); | |||
|
|||
test( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to avoid deleting tests completely. This may be the only test which checks if the middle paragraph (foo) is deleted. So, either just adjust its result or add some content outside to not make it a full content selection (and adjust the title).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PS. Note that you haven't added this test in the "should leave a paragraph if the entire content was selected" block.
src/controller/deletecontent.js
Outdated
@@ -32,8 +32,15 @@ export default function deleteContent( selection, batch, options = {} ) { | |||
return; | |||
} | |||
|
|||
const selRange = selection.getFirstRange(); | |||
// 0. Replace the entire content with paragraph. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to fix the numbering.
Some minor issues. |
Ready to review once again. |
Suggested merge commit message (convention)
Feature:
DataController#deleteContent
will leave a paragraph if the entire content was selected and removed. Closes ckeditor/ckeditor5#4110.On the occasion
$root
element has been as a limit element in Schema in order to simplify the checks.Additional information
Branch
t/ckeditor5-engine/1012
inckeditor5-enter
should be merged along with this PR.