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

Marked font size and font family attributes with the AttributeProperties#isFormatting property #27

Merged
merged 1 commit into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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