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 #48 from ckeditor/t/ckeditor5-enter/40
Browse files Browse the repository at this point in the history
Other: Mark fonts' attributes with 'copyOnEnter' property.
  • Loading branch information
jodator committed Jul 16, 2019
2 parents 77cc2f8 + e1f5df2 commit 552f742
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/fontbackgroundcolor/fontbackgroundcolorediting.js
Expand Up @@ -118,6 +118,9 @@ export default class FontBackgroundColorEditing extends Plugin {
// Allow the font backgroundColor attribute on text nodes.
editor.model.schema.extend( '$text', { allowAttributes: FONT_BACKGROUND_COLOR } );

editor.model.schema.setAttributeProperties( FONT_BACKGROUND_COLOR, { isFormatting: true } );
editor.model.schema.setAttributeProperties( FONT_BACKGROUND_COLOR, {
isFormatting: true,
copyOnEnter: true
} );
}
}
5 changes: 4 additions & 1 deletion src/fontcolor/fontcolorediting.js
Expand Up @@ -118,6 +118,9 @@ export default class FontColorEditing extends Plugin {
// Allow the font color attribute on text nodes.
editor.model.schema.extend( '$text', { allowAttributes: FONT_COLOR } );

editor.model.schema.setAttributeProperties( FONT_COLOR, { isFormatting: true } );
editor.model.schema.setAttributeProperties( FONT_COLOR, {
isFormatting: true,
copyOnEnter: true
} );
}
}
5 changes: 4 additions & 1 deletion src/fontfamily/fontfamilyediting.js
Expand Up @@ -54,7 +54,10 @@ 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 } );
editor.model.schema.setAttributeProperties( FONT_FAMILY, {
isFormatting: true,
copyOnEnter: true
} );

// Get configured font family options without "default" option.
const options = normalizeOptions( editor.config.get( 'fontFamily.options' ) ).filter( item => item.model );
Expand Down
5 changes: 4 additions & 1 deletion src/fontsize/fontsizeediting.js
Expand Up @@ -63,6 +63,9 @@ 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 } );
editor.model.schema.setAttributeProperties( FONT_SIZE, {
isFormatting: true,
copyOnEnter: true
} );
}
}
8 changes: 7 additions & 1 deletion tests/fontbackgroundcolor/fontbackgroundcoloreditng.js
Expand Up @@ -37,11 +37,17 @@ describe( 'FontBackgroundColorEditing', () => {
} );

it( 'has the attribute marked with the isFormatting property', () => {
expect( editor.model.schema.getAttributeProperties( 'fontBackgroundColor' ) ).to.deep.equal( {
expect( editor.model.schema.getAttributeProperties( 'fontBackgroundColor' ) ).to.include( {
isFormatting: true
} );
} );

it( 'its attribute is marked with a copOnEnter property', () => {
expect( editor.model.schema.getAttributeProperties( 'fontBackgroundColor' ) ).to.include( {
copyOnEnter: true
} );
} );

describe( 'config', () => {
describe( 'default value', () => {
it( 'should be set', () => {
Expand Down
8 changes: 7 additions & 1 deletion tests/fontcolor/fontcolorediting.js
Expand Up @@ -36,11 +36,17 @@ describe( 'FontColorEditing', () => {
} );

it( 'has the attribute marked with the isFormatting property', () => {
expect( editor.model.schema.getAttributeProperties( 'fontColor' ) ).to.deep.equal( {
expect( editor.model.schema.getAttributeProperties( 'fontColor' ) ).to.include( {
isFormatting: true
} );
} );

it( 'its attribute is marked with a copOnEnter property', () => {
expect( editor.model.schema.getAttributeProperties( 'fontColor' ) ).to.include( {
copyOnEnter: true
} );
} );

describe( 'config', () => {
describe( 'default value', () => {
it( 'should be set', () => {
Expand Down
8 changes: 7 additions & 1 deletion tests/fontfamily/fontfamilyediting.js
Expand Up @@ -37,11 +37,17 @@ describe( 'FontFamilyEditing', () => {
} );

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

it( 'its attribute is marked with a copOnEnter property', () => {
expect( editor.model.schema.getAttributeProperties( 'fontFamily' ) ).to.include( {
copyOnEnter: true
} );
} );

describe( 'config', () => {
describe( 'default value', () => {
it( 'should be set', () => {
Expand Down
8 changes: 7 additions & 1 deletion tests/fontsize/fontsizeediting.js
Expand Up @@ -37,11 +37,17 @@ describe( 'FontSizeEditing', () => {
} );

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

it( 'its attribute is marked with a copOnEnter property', () => {
expect( editor.model.schema.getAttributeProperties( 'fontSize' ) ).to.include( {
copyOnEnter: true
} );
} );

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

0 comments on commit 552f742

Please sign in to comment.