Skip to content

Commit f72b720

Browse files
committed
Apply CR remarks.
1 parent d8cafb7 commit f72b720

File tree

5 files changed

+34
-48
lines changed

5 files changed

+34
-48
lines changed

packages/ckeditor5-html-support/src/emptyblock.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export default class EmptyBlock extends Plugin {
7474
public afterInit(): void {
7575
const { model, conversion, plugins, config } = this.editor;
7676
const schema = model.schema;
77-
const preserveInEditingView = config.get( 'emptyBlock.preserveInEditingView' );
77+
const preserveInEditingView = config.get( 'htmlSupport.emptyBlock.preserveInEditingView' );
7878

7979
schema.extend( '$block', { allowAttributes: [ EMPTY_BLOCK_MODEL_ATTRIBUTE ] } );
8080
schema.extend( '$container', { allowAttributes: [ EMPTY_BLOCK_MODEL_ATTRIBUTE ] } );
@@ -99,13 +99,11 @@ export default class EmptyBlock extends Plugin {
9999
/**
100100
* Handle clipboard paste events:
101101
*
102-
* * It does not affect *copying* content from the editor, only *pasting*.
103-
* * When content is pasted from another editor instance with `<p></p>`,
104-
* the `&nbsp;` filler is added, so the getData result is `<p>&nbsp;</p>`.
105-
* * When content is pasted from the same editor instance with `<p></p>`,
106-
* the `&nbsp;` filler is not added, so the getData result is `<p></p>`.
107-
*
108-
* @internal
102+
* * It does not affect *copying* content from the editor, only *pasting*.
103+
* * When content is pasted from another editor instance with `<p></p>`,
104+
* the `&nbsp;` filler is added, so the getData result is `<p>&nbsp;</p>`.
105+
* * When content is pasted from the same editor instance with `<p></p>`,
106+
* the `&nbsp;` filler is not added, so the getData result is `<p></p>`.
109107
*/
110108
private _registerClipboardPastingHandler() {
111109
const clipboardPipeline: ClipboardPipeline = this.editor.plugins.get( 'ClipboardPipeline' );

packages/ckeditor5-html-support/src/emptyblockconfig.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

packages/ckeditor5-html-support/src/generalhtmlsupportconfig.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,20 @@ export interface GeneralHtmlSupportConfig {
8080
* ```
8181
*/
8282
allowEmpty?: Array<string>;
83+
84+
/**
85+
* The configuration of allowed empty block elements that should not be removed.
86+
*
87+
* The option is used by the {@link module:html-support/emptyblock~EmptyBlock} feature.
88+
*/
89+
emptyBlock?: {
90+
91+
/**
92+
* When set to `true`, empty blocks will be preserved in the editing view.
93+
* When `false` (default), empty blocks are only preserved in the data output.
94+
*
95+
* @default false
96+
*/
97+
preserveInEditingView?: boolean;
98+
};
8399
}

packages/ckeditor5-html-support/tests/emptyblock.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,10 @@ describe( 'EmptyBlock', () => {
332332

333333
editor = await ClassicTestEditor.create( element, {
334334
plugins: [ Paragraph, TableEditing, EmptyBlock, Heading, ListEditing, BlockQuote, Clipboard ],
335-
emptyBlock: {
336-
preserveInEditingView: true
335+
htmlSupport: {
336+
emptyBlock: {
337+
preserveInEditingView: true
338+
}
337339
}
338340
} );
339341

@@ -352,8 +354,10 @@ describe( 'EmptyBlock', () => {
352354

353355
editor = await ClassicTestEditor.create( element, {
354356
plugins: [ Paragraph, TableEditing, EmptyBlock, Heading, ListEditing, BlockQuote, Clipboard ],
355-
emptyBlock: {
356-
preserveInEditingView: false
357+
htmlSupport: {
358+
emptyBlock: {
359+
preserveInEditingView: false
360+
}
357361
}
358362
} );
359363

packages/ckeditor5-html-support/tests/manual/emptyblock.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ function createEditor1( preserveInEditingView ) {
2626
return ClassicEditor
2727
.create( document.getElementById( 'editor1' ), {
2828
...config,
29-
emptyBlock: {
30-
preserveInEditingView
29+
htmlSupport: {
30+
emptyBlock: {
31+
preserveInEditingView
32+
}
3133
}
3234
} )
3335
.then( instance => {

0 commit comments

Comments
 (0)