Преглед на файлове

Merge pull request #48 from ckeditor/t/ckeditor5-enter/40

Other: Mark fonts' attributes with 'copyOnEnter' property.
Maciej преди 6 години
родител
ревизия
c9f09b9812

+ 4 - 1
packages/ckeditor5-font/src/fontbackgroundcolor/fontbackgroundcolorediting.js

@@ -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
+		} );
 	}
 }

+ 4 - 1
packages/ckeditor5-font/src/fontcolor/fontcolorediting.js

@@ -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
+		} );
 	}
 }

+ 4 - 1
packages/ckeditor5-font/src/fontfamily/fontfamilyediting.js

@@ -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 );

+ 4 - 1
packages/ckeditor5-font/src/fontsize/fontsizeediting.js

@@ -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
+		} );
 	}
 }

+ 7 - 1
packages/ckeditor5-font/tests/fontbackgroundcolor/fontbackgroundcoloreditng.js

@@ -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', () => {

+ 7 - 1
packages/ckeditor5-font/tests/fontcolor/fontcolorediting.js

@@ -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', () => {

+ 7 - 1
packages/ckeditor5-font/tests/fontfamily/fontfamilyediting.js

@@ -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', () => {

+ 7 - 1
packages/ckeditor5-font/tests/fontsize/fontsizeediting.js

@@ -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', () => {