diff --git a/src/bold/boldediting.js b/src/bold/boldediting.js index 60da082..ee1438e 100644 --- a/src/bold/boldediting.js +++ b/src/bold/boldediting.js @@ -28,6 +28,7 @@ export default class BoldEditing extends Plugin { const editor = this.editor; // Allow bold attribute on text nodes. editor.model.schema.extend( '$text', { allowAttributes: BOLD } ); + editor.model.schema.setAttributeProperties( BOLD, { isFormatting: true } ); // Build converter from model to view for data and editing pipelines. diff --git a/src/code/codeediting.js b/src/code/codeediting.js index 1a52de1..04a6132 100644 --- a/src/code/codeediting.js +++ b/src/code/codeediting.js @@ -29,6 +29,7 @@ export default class CodeEditing extends Plugin { // Allow code attribute on text nodes. editor.model.schema.extend( '$text', { allowAttributes: CODE } ); + editor.model.schema.setAttributeProperties( CODE, { isFormatting: true } ); editor.conversion.attributeToElement( { model: CODE, diff --git a/src/italic/italicediting.js b/src/italic/italicediting.js index 72cd210..cb37870 100644 --- a/src/italic/italicediting.js +++ b/src/italic/italicediting.js @@ -29,6 +29,7 @@ export default class ItalicEditing extends Plugin { // Allow italic attribute on text nodes. editor.model.schema.extend( '$text', { allowAttributes: ITALIC } ); + editor.model.schema.setAttributeProperties( ITALIC, { isFormatting: true } ); editor.conversion.attributeToElement( { model: ITALIC, diff --git a/src/strikethrough/strikethroughediting.js b/src/strikethrough/strikethroughediting.js index 8393a2f..d03a419 100644 --- a/src/strikethrough/strikethroughediting.js +++ b/src/strikethrough/strikethroughediting.js @@ -30,6 +30,7 @@ export default class StrikethroughEditing extends Plugin { // Allow strikethrough attribute on text nodes. editor.model.schema.extend( '$text', { allowAttributes: STRIKETHROUGH } ); + editor.model.schema.setAttributeProperties( STRIKETHROUGH, { isFormatting: true } ); editor.conversion.attributeToElement( { model: STRIKETHROUGH, diff --git a/src/subscript/subscriptediting.js b/src/subscript/subscriptediting.js index 7624679..a965432 100644 --- a/src/subscript/subscriptediting.js +++ b/src/subscript/subscriptediting.js @@ -28,6 +28,7 @@ export default class SubscriptEditing extends Plugin { const editor = this.editor; // Allow sub attribute on text nodes. editor.model.schema.extend( '$text', { allowAttributes: SUBSCRIPT } ); + editor.model.schema.setAttributeProperties( SUBSCRIPT, { isFormatting: true } ); // Build converter from model to view for data and editing pipelines. diff --git a/src/superscript/superscriptediting.js b/src/superscript/superscriptediting.js index 63fc8b9..60218c6 100644 --- a/src/superscript/superscriptediting.js +++ b/src/superscript/superscriptediting.js @@ -28,6 +28,7 @@ export default class SuperscriptEditing extends Plugin { const editor = this.editor; // Allow super attribute on text nodes. editor.model.schema.extend( '$text', { allowAttributes: SUPERSCRIPT } ); + editor.model.schema.setAttributeProperties( SUPERSCRIPT, { isFormatting: true } ); // Build converter from model to view for data and editing pipelines. diff --git a/src/underline/underlineediting.js b/src/underline/underlineediting.js index 561e63b..e16c624 100644 --- a/src/underline/underlineediting.js +++ b/src/underline/underlineediting.js @@ -29,6 +29,7 @@ export default class UnderlineEditing extends Plugin { // Allow strikethrough attribute on text nodes. editor.model.schema.extend( '$text', { allowAttributes: UNDERLINE } ); + editor.model.schema.setAttributeProperties( UNDERLINE, { isFormatting: true } ); editor.conversion.attributeToElement( { model: UNDERLINE, diff --git a/tests/bold/boldediting.js b/tests/bold/boldediting.js index e918cd5..06212db 100644 --- a/tests/bold/boldediting.js +++ b/tests/bold/boldediting.js @@ -40,6 +40,12 @@ describe( 'BoldEditing', () => { expect( model.schema.checkAttribute( [ '$clipboardHolder', '$text' ], 'bold' ) ).to.be.true; } ); + it( 'should be marked with a formatting property', () => { + expect( model.schema.getAttributeProperties( 'bold' ) ).to.deep.equal( { + isFormatting: true + } ); + } ); + it( 'should set editor keystroke', () => { const spy = sinon.spy( editor, 'execute' ); const keyEventData = { diff --git a/tests/code/codeediting.js b/tests/code/codeediting.js index e9e7ee2..1a06954 100644 --- a/tests/code/codeediting.js +++ b/tests/code/codeediting.js @@ -39,6 +39,12 @@ describe( 'CodeEditing', () => { expect( model.schema.checkAttribute( [ '$clipboardHolder', '$text' ], 'code' ) ).to.be.true; } ); + it( 'should be marked with a formatting property', () => { + expect( model.schema.getAttributeProperties( 'code' ) ).to.deep.equal( { + isFormatting: true + } ); + } ); + describe( 'command', () => { it( 'should register code command', () => { const command = editor.commands.get( 'code' ); diff --git a/tests/italic/italicediting.js b/tests/italic/italicediting.js index 61bf465..9b97dac 100644 --- a/tests/italic/italicediting.js +++ b/tests/italic/italicediting.js @@ -39,6 +39,12 @@ describe( 'ItalicEditing', () => { expect( model.schema.checkAttribute( [ '$clipboardHolder', '$text' ], 'italic' ) ).to.be.true; } ); + it( 'should be marked with a formatting property', () => { + expect( model.schema.getAttributeProperties( 'italic' ) ).to.deep.equal( { + isFormatting: true + } ); + } ); + describe( 'command', () => { it( 'should register italic command', () => { const command = editor.commands.get( 'italic' ); diff --git a/tests/strikethrough/strikethroughediting.js b/tests/strikethrough/strikethroughediting.js index 3960a55..a7f2f00 100644 --- a/tests/strikethrough/strikethroughediting.js +++ b/tests/strikethrough/strikethroughediting.js @@ -39,6 +39,12 @@ describe( 'StrikethroughEditing', () => { expect( model.schema.checkAttribute( [ '$clipboardHolder', '$text' ], 'strikethrough' ) ).to.be.true; } ); + it( 'should be marked with a formatting property', () => { + expect( model.schema.getAttributeProperties( 'strikethrough' ) ).to.deep.equal( { + isFormatting: true + } ); + } ); + describe( 'command', () => { it( 'should register strikethrough command', () => { const command = editor.commands.get( 'strikethrough' ); diff --git a/tests/subscript/subscriptediting.js b/tests/subscript/subscriptediting.js index 9ef8dff..2ff9c77 100644 --- a/tests/subscript/subscriptediting.js +++ b/tests/subscript/subscriptediting.js @@ -39,6 +39,12 @@ describe( 'SubEditing', () => { expect( model.schema.checkAttribute( [ '$clipboardHolder', '$text' ], 'subscript' ) ).to.be.true; } ); + it( 'should be marked with a formatting property', () => { + expect( model.schema.getAttributeProperties( 'subscript' ) ).to.deep.equal( { + isFormatting: true + } ); + } ); + describe( 'command', () => { it( 'should register subscript command', () => { const command = editor.commands.get( 'subscript' ); diff --git a/tests/superscript/superscriptediting.js b/tests/superscript/superscriptediting.js index e41ea4b..058ef37 100644 --- a/tests/superscript/superscriptediting.js +++ b/tests/superscript/superscriptediting.js @@ -39,6 +39,12 @@ describe( 'SuperEditing', () => { expect( model.schema.checkAttribute( [ '$clipboardHolder', '$text' ], 'superscript' ) ).to.be.true; } ); + it( 'should be marked with a formatting property', () => { + expect( model.schema.getAttributeProperties( 'superscript' ) ).to.deep.equal( { + isFormatting: true + } ); + } ); + describe( 'command', () => { it( 'should register superscript command', () => { const command = editor.commands.get( 'superscript' ); diff --git a/tests/underline/underlineediting.js b/tests/underline/underlineediting.js index e25da30..1722456 100644 --- a/tests/underline/underlineediting.js +++ b/tests/underline/underlineediting.js @@ -39,6 +39,12 @@ describe( 'UnderlineEditing', () => { expect( model.schema.checkAttribute( [ '$clipboardHolder', '$text' ], 'underline' ) ).to.be.true; } ); + it( 'should be marked with a formatting property', () => { + expect( model.schema.getAttributeProperties( 'underline' ) ).to.deep.equal( { + isFormatting: true + } ); + } ); + describe( 'command', () => { it( 'should register underline command', () => { const command = editor.commands.get( 'underline' );