Skip to content

Commit

Permalink
Added DataProcessor#useFillerType(). Added `GFMDataProcessor#useFil…
Browse files Browse the repository at this point in the history
…lerType()`.
  • Loading branch information
scofalik committed Apr 14, 2021
1 parent 5af00ec commit 93b106b
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/ckeditor5-engine/src/dataprocessor/dataprocessor.jsdoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,16 @@
* @param {module:engine/view/matcher~MatcherPattern} pattern Pattern matching all view elements whose content should
* be treated as plain text.
*/

/**
* If the processor is set to use marked fillers, it will insert nbsp fillers wrapped in spans
* (`<span data-cke-filler="true">&nbsp;</span>`), instead of regular nbsp characters (`&nbsp;`).
*
* This mode allows for more precise handling of block fillers (so they don't leak into editor content) but bloats the editor
* data with additional markup.
*
* This mode may be required by some features and will be turned on by them automatically.
*
* @method #useFillerType
* @param {'default'|'marked'} type Whether to use default or marked nbsp block fillers.
*/
6 changes: 6 additions & 0 deletions packages/ckeditor5-markdown-gfm/src/gfmdataprocessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,10 @@ export default class GFMDataProcessor {
registerRawContentMatcher( pattern ) {
this._htmlDP.registerRawContentMatcher( pattern );
}

/**
* This method does not have an effect on data processor result. It exists for compatibility with
* {@link module:engine/dataprocessor/dataprocessor~DataProcessor `DataProcessor` interface}.
*/
useFillerType() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

import GFMDataProcessor from '../../src/gfmdataprocessor';
import ViewDocument from '@ckeditor/ckeditor5-engine/src/view/document';
import { StylesProcessor } from '@ckeditor/ckeditor5-engine/src/view/stylesmap';

describe( 'GFMDataProcessor', () => {
let dataProcessor, viewDocument;

beforeEach( () => {
viewDocument = new ViewDocument( new StylesProcessor() );
dataProcessor = new GFMDataProcessor( viewDocument );
} );

describe( 'useFillerType()', () => {
it( 'should have this method to be compatible with `DataProcessor` interface', () => {
expect( () => {
dataProcessor.useFillerType( 'default' );
} ).not.to.throw();
} );
} );
} );

0 comments on commit 93b106b

Please sign in to comment.