From 73bb3ccbf2cb9c51e22d2d897fb1be981d4a69f1 Mon Sep 17 00:00:00 2001 From: Marek Lewandowski Date: Fri, 29 Mar 2019 10:36:20 +0100 Subject: [PATCH] Feature: Marked font family and font size attributes with the AttributeProperties#isFormatting property. --- src/fontfamily/fontfamilyediting.js | 1 + src/fontsize/fontsizeediting.js | 1 + tests/fontfamily/fontfamilyediting.js | 6 ++++++ tests/fontsize/fontsizeediting.js | 6 ++++++ 4 files changed, 14 insertions(+) diff --git a/src/fontfamily/fontfamilyediting.js b/src/fontfamily/fontfamilyediting.js index d2dcd93..604b87a 100644 --- a/src/fontfamily/fontfamilyediting.js +++ b/src/fontfamily/fontfamilyediting.js @@ -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 ); diff --git a/src/fontsize/fontsizeediting.js b/src/fontsize/fontsizeediting.js index db45b44..9f5def9 100644 --- a/src/fontsize/fontsizeediting.js +++ b/src/fontsize/fontsizeediting.js @@ -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 } ); } } diff --git a/tests/fontfamily/fontfamilyediting.js b/tests/fontfamily/fontfamilyediting.js index 9b7824f..5bdafad 100644 --- a/tests/fontfamily/fontfamilyediting.js +++ b/tests/fontfamily/fontfamilyediting.js @@ -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', () => { diff --git a/tests/fontsize/fontsizeediting.js b/tests/fontsize/fontsizeediting.js index 35b6c7c..6b123d5 100644 --- a/tests/fontsize/fontsizeediting.js +++ b/tests/fontsize/fontsizeediting.js @@ -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', () => {