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

Commit fcfba54

Browse files
authored
Merge pull request #86 from ckeditor/t/ckeditor5/1664
Feature: Marked basic style attributes as a formatting using the `AttributeProperties#isFormatting` property. Closes ckeditor/ckeditor5#1664.
2 parents bc3710e + 634e1cb commit fcfba54

File tree

14 files changed

+49
-0
lines changed

14 files changed

+49
-0
lines changed

src/bold/boldediting.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default class BoldEditing extends Plugin {
2828
const editor = this.editor;
2929
// Allow bold attribute on text nodes.
3030
editor.model.schema.extend( '$text', { allowAttributes: BOLD } );
31+
editor.model.schema.setAttributeProperties( BOLD, { isFormatting: true } );
3132

3233
// Build converter from model to view for data and editing pipelines.
3334

src/code/codeediting.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default class CodeEditing extends Plugin {
2929

3030
// Allow code attribute on text nodes.
3131
editor.model.schema.extend( '$text', { allowAttributes: CODE } );
32+
editor.model.schema.setAttributeProperties( CODE, { isFormatting: true } );
3233

3334
editor.conversion.attributeToElement( {
3435
model: CODE,

src/italic/italicediting.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default class ItalicEditing extends Plugin {
2929

3030
// Allow italic attribute on text nodes.
3131
editor.model.schema.extend( '$text', { allowAttributes: ITALIC } );
32+
editor.model.schema.setAttributeProperties( ITALIC, { isFormatting: true } );
3233

3334
editor.conversion.attributeToElement( {
3435
model: ITALIC,

src/strikethrough/strikethroughediting.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default class StrikethroughEditing extends Plugin {
3030

3131
// Allow strikethrough attribute on text nodes.
3232
editor.model.schema.extend( '$text', { allowAttributes: STRIKETHROUGH } );
33+
editor.model.schema.setAttributeProperties( STRIKETHROUGH, { isFormatting: true } );
3334

3435
editor.conversion.attributeToElement( {
3536
model: STRIKETHROUGH,

src/subscript/subscriptediting.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default class SubscriptEditing extends Plugin {
2828
const editor = this.editor;
2929
// Allow sub attribute on text nodes.
3030
editor.model.schema.extend( '$text', { allowAttributes: SUBSCRIPT } );
31+
editor.model.schema.setAttributeProperties( SUBSCRIPT, { isFormatting: true } );
3132

3233
// Build converter from model to view for data and editing pipelines.
3334

src/superscript/superscriptediting.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default class SuperscriptEditing extends Plugin {
2828
const editor = this.editor;
2929
// Allow super attribute on text nodes.
3030
editor.model.schema.extend( '$text', { allowAttributes: SUPERSCRIPT } );
31+
editor.model.schema.setAttributeProperties( SUPERSCRIPT, { isFormatting: true } );
3132

3233
// Build converter from model to view for data and editing pipelines.
3334

src/underline/underlineediting.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export default class UnderlineEditing extends Plugin {
2929

3030
// Allow strikethrough attribute on text nodes.
3131
editor.model.schema.extend( '$text', { allowAttributes: UNDERLINE } );
32+
editor.model.schema.setAttributeProperties( UNDERLINE, { isFormatting: true } );
3233

3334
editor.conversion.attributeToElement( {
3435
model: UNDERLINE,

tests/bold/boldediting.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ describe( 'BoldEditing', () => {
4040
expect( model.schema.checkAttribute( [ '$clipboardHolder', '$text' ], 'bold' ) ).to.be.true;
4141
} );
4242

43+
it( 'should be marked with a formatting property', () => {
44+
expect( model.schema.getAttributeProperties( 'bold' ) ).to.deep.equal( {
45+
isFormatting: true
46+
} );
47+
} );
48+
4349
it( 'should set editor keystroke', () => {
4450
const spy = sinon.spy( editor, 'execute' );
4551
const keyEventData = {

tests/code/codeediting.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ describe( 'CodeEditing', () => {
3939
expect( model.schema.checkAttribute( [ '$clipboardHolder', '$text' ], 'code' ) ).to.be.true;
4040
} );
4141

42+
it( 'should be marked with a formatting property', () => {
43+
expect( model.schema.getAttributeProperties( 'code' ) ).to.deep.equal( {
44+
isFormatting: true
45+
} );
46+
} );
47+
4248
describe( 'command', () => {
4349
it( 'should register code command', () => {
4450
const command = editor.commands.get( 'code' );

tests/italic/italicediting.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ describe( 'ItalicEditing', () => {
3939
expect( model.schema.checkAttribute( [ '$clipboardHolder', '$text' ], 'italic' ) ).to.be.true;
4040
} );
4141

42+
it( 'should be marked with a formatting property', () => {
43+
expect( model.schema.getAttributeProperties( 'italic' ) ).to.deep.equal( {
44+
isFormatting: true
45+
} );
46+
} );
47+
4248
describe( 'command', () => {
4349
it( 'should register italic command', () => {
4450
const command = editor.commands.get( 'italic' );

0 commit comments

Comments
 (0)