Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #27 from ckeditor/t/ckeditor5/1664
Browse files Browse the repository at this point in the history
Feature: Marked font size and font family as a formatting attribute using the `AttributeProperties#isFormatting` property. Closes ckeditor/ckeditor5#1664.
  • Loading branch information
jodator authored Mar 29, 2019
2 parents 27815b3 + 73bb3cc commit d9f0a51
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/fontfamily/fontfamilyediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default class FontFamilyEditing extends Plugin {

// Allow fontFamily attribute on text nodes.
editor.model.schema.extend( '$text', { allowAttributes: FONT_FAMILY } );
editor.model.schema.setAttributeProperties( FONT_FAMILY, { isFormatting: true } );

// Get configured font family options without "default" option.
const options = normalizeOptions( editor.config.get( 'fontFamily.options' ) ).filter( item => item.model );
Expand Down
1 change: 1 addition & 0 deletions src/fontsize/fontsizeediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ export default class FontSizeEditing extends Plugin {

// Allow fontSize attribute on text nodes.
editor.model.schema.extend( '$text', { allowAttributes: FONT_SIZE } );
editor.model.schema.setAttributeProperties( FONT_SIZE, { isFormatting: true } );
}
}
6 changes: 6 additions & 0 deletions tests/fontfamily/fontfamilyediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ describe( 'FontFamilyEditing', () => {
expect( editor.model.schema.checkAttribute( [ '$block' ], 'fontFamily' ) ).to.be.false;
} );

it( 'should be marked with a formatting property', () => {
expect( editor.model.schema.getAttributeProperties( 'fontFamily' ) ).to.deep.equal( {
isFormatting: true
} );
} );

describe( 'config', () => {
describe( 'default value', () => {
it( 'should be set', () => {
Expand Down
6 changes: 6 additions & 0 deletions tests/fontsize/fontsizeediting.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ describe( 'FontSizeEditing', () => {
expect( editor.model.schema.checkAttribute( [ '$block' ], 'fontSize' ) ).to.be.false;
} );

it( 'should be marked with a formatting property', () => {
expect( editor.model.schema.getAttributeProperties( 'fontSize' ) ).to.deep.equal( {
isFormatting: true
} );
} );

describe( 'config', () => {
describe( 'default value', () => {
it( 'should be set', () => {
Expand Down

0 comments on commit d9f0a51

Please sign in to comment.