浏览代码

Internal: Marked font color and background color as formatting attribute using isFormatting property.

Marek Lewandowski 6 年之前
父节点
当前提交
ed4df623ce

+ 2 - 0
packages/ckeditor5-font/src/fontbackgroundcolor/fontbackgroundcolorediting.js

@@ -117,5 +117,7 @@ export default class FontBackgroundColorEditing extends Plugin {
 
 		// Allow fontBackgroundColor attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: FONT_BACKGROUND_COLOR } );
+
+		editor.model.schema.setAttributeProperties( FONT_BACKGROUND_COLOR, { isFormatting: true } );
 	}
 }

+ 2 - 0
packages/ckeditor5-font/src/fontcolor/fontcolorediting.js

@@ -117,5 +117,7 @@ export default class FontColorEditing extends Plugin {
 
 		// Allow fontColor attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: FONT_COLOR } );
+
+		editor.model.schema.setAttributeProperties( FONT_COLOR, { isFormatting: true } );
 	}
 }

+ 6 - 0
packages/ckeditor5-font/tests/fontbackgroundcolor/fontbackgroundcoloreditng.js

@@ -36,6 +36,12 @@ describe( 'FontBackgroundColorEditing', () => {
 		expect( editor.model.schema.checkAttribute( [ '$block' ], 'fontBackgroundColor' ) ).to.be.false;
 	} );
 
+	it( 'its attribute is marked with a formatting property', () => {
+		expect( editor.model.schema.getAttributeProperties( 'fontBackgroundColor' ) ).to.deep.equal( {
+			isFormatting: true
+		} );
+	} );
+
 	describe( 'config', () => {
 		describe( 'default value', () => {
 			it( 'should be set', () => {

+ 6 - 0
packages/ckeditor5-font/tests/fontcolor/fontcolorediting.js

@@ -35,6 +35,12 @@ describe( 'FontColorEditing', () => {
 		expect( editor.model.schema.checkAttribute( [ '$block' ], 'fontColor' ) ).to.be.false;
 	} );
 
+	it( 'its attribute is marked with a formatting property', () => {
+		expect( editor.model.schema.getAttributeProperties( 'fontColor' ) ).to.deep.equal( {
+			isFormatting: true
+		} );
+	} );
+
 	describe( 'config', () => {
 		describe( 'default value', () => {
 			it( 'should be set', () => {