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

Commit

Permalink
Feature: Marked font family and font size attributes with the Attribu…
Browse files Browse the repository at this point in the history
…teProperties#isFormatting property.
  • Loading branch information
mlewand committed Mar 29, 2019
1 parent 27815b3 commit 73bb3cc
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 73bb3cc

Please sign in to comment.