diff --git a/src/bold/boldediting.js b/src/bold/boldediting.js index 50f61e1..40602c4 100644 --- a/src/bold/boldediting.js +++ b/src/bold/boldediting.js @@ -28,7 +28,10 @@ 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 } ); + editor.model.schema.setAttributeProperties( BOLD, { + isFormatting: true, + copyOnEnter: 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 ecda4ed..334b5df 100644 --- a/src/code/codeediting.js +++ b/src/code/codeediting.js @@ -29,7 +29,10 @@ 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.model.schema.setAttributeProperties( CODE, { + isFormatting: true, + copyOnEnter: true + } ); editor.conversion.attributeToElement( { model: CODE, diff --git a/src/italic/italicediting.js b/src/italic/italicediting.js index 8161720..607499e 100644 --- a/src/italic/italicediting.js +++ b/src/italic/italicediting.js @@ -29,7 +29,10 @@ 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.model.schema.setAttributeProperties( ITALIC, { + isFormatting: true, + copyOnEnter: true + } ); editor.conversion.attributeToElement( { model: ITALIC, diff --git a/src/strikethrough/strikethroughediting.js b/src/strikethrough/strikethroughediting.js index d398d48..7514a53 100644 --- a/src/strikethrough/strikethroughediting.js +++ b/src/strikethrough/strikethroughediting.js @@ -30,7 +30,10 @@ 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.model.schema.setAttributeProperties( STRIKETHROUGH, { + isFormatting: true, + copyOnEnter: true + } ); editor.conversion.attributeToElement( { model: STRIKETHROUGH, diff --git a/src/subscript/subscriptediting.js b/src/subscript/subscriptediting.js index 21ffab8..a23ea68 100644 --- a/src/subscript/subscriptediting.js +++ b/src/subscript/subscriptediting.js @@ -28,7 +28,10 @@ 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 } ); + editor.model.schema.setAttributeProperties( SUBSCRIPT, { + isFormatting: true, + copyOnEnter: 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 7e6c02e..1ce5768 100644 --- a/src/superscript/superscriptediting.js +++ b/src/superscript/superscriptediting.js @@ -28,7 +28,10 @@ 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 } ); + editor.model.schema.setAttributeProperties( SUPERSCRIPT, { + isFormatting: true, + copyOnEnter: 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 c8e8aef..f00fc51 100644 --- a/src/underline/underlineediting.js +++ b/src/underline/underlineediting.js @@ -29,7 +29,10 @@ 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.model.schema.setAttributeProperties( UNDERLINE, { + isFormatting: true, + copyOnEnter: true + } ); editor.conversion.attributeToElement( { model: UNDERLINE, diff --git a/tests/bold/boldediting.js b/tests/bold/boldediting.js index 5e5bb5a..91d3f5c 100644 --- a/tests/bold/boldediting.js +++ b/tests/bold/boldediting.js @@ -41,11 +41,17 @@ describe( 'BoldEditing', () => { } ); it( 'should be marked with a formatting property', () => { - expect( model.schema.getAttributeProperties( 'bold' ) ).to.deep.equal( { + expect( model.schema.getAttributeProperties( 'bold' ) ).to.include( { isFormatting: true } ); } ); + it( 'its attribute is marked with a copOnEnter property', () => { + expect( model.schema.getAttributeProperties( 'bold' ) ).to.include( { + copyOnEnter: 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 33b968d..6723357 100644 --- a/tests/code/codeediting.js +++ b/tests/code/codeediting.js @@ -40,11 +40,17 @@ describe( 'CodeEditing', () => { } ); it( 'should be marked with a formatting property', () => { - expect( model.schema.getAttributeProperties( 'code' ) ).to.deep.equal( { + expect( model.schema.getAttributeProperties( 'code' ) ).to.include( { isFormatting: true } ); } ); + it( 'its attribute is marked with a copOnEnter property', () => { + expect( model.schema.getAttributeProperties( 'code' ) ).to.include( { + copyOnEnter: 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 5b9f1a5..3ed018a 100644 --- a/tests/italic/italicediting.js +++ b/tests/italic/italicediting.js @@ -40,11 +40,17 @@ describe( 'ItalicEditing', () => { } ); it( 'should be marked with a formatting property', () => { - expect( model.schema.getAttributeProperties( 'italic' ) ).to.deep.equal( { + expect( model.schema.getAttributeProperties( 'italic' ) ).to.include( { isFormatting: true } ); } ); + it( 'its attribute is marked with a copOnEnter property', () => { + expect( model.schema.getAttributeProperties( 'italic' ) ).to.include( { + copyOnEnter: 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 c2d39a9..3b89366 100644 --- a/tests/strikethrough/strikethroughediting.js +++ b/tests/strikethrough/strikethroughediting.js @@ -40,11 +40,17 @@ describe( 'StrikethroughEditing', () => { } ); it( 'should be marked with a formatting property', () => { - expect( model.schema.getAttributeProperties( 'strikethrough' ) ).to.deep.equal( { + expect( model.schema.getAttributeProperties( 'strikethrough' ) ).to.include( { isFormatting: true } ); } ); + it( 'its attribute is marked with a copOnEnter property', () => { + expect( model.schema.getAttributeProperties( 'strikethrough' ) ).to.include( { + copyOnEnter: 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 86a58f7..29c90a9 100644 --- a/tests/subscript/subscriptediting.js +++ b/tests/subscript/subscriptediting.js @@ -40,11 +40,17 @@ describe( 'SubEditing', () => { } ); it( 'should be marked with a formatting property', () => { - expect( model.schema.getAttributeProperties( 'subscript' ) ).to.deep.equal( { + expect( model.schema.getAttributeProperties( 'subscript' ) ).to.include( { isFormatting: true } ); } ); + it( 'its attribute is marked with a copOnEnter property', () => { + expect( model.schema.getAttributeProperties( 'subscript' ) ).to.include( { + copyOnEnter: 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 e0da6ba..132b491 100644 --- a/tests/superscript/superscriptediting.js +++ b/tests/superscript/superscriptediting.js @@ -40,11 +40,17 @@ describe( 'SuperEditing', () => { } ); it( 'should be marked with a formatting property', () => { - expect( model.schema.getAttributeProperties( 'superscript' ) ).to.deep.equal( { + expect( model.schema.getAttributeProperties( 'superscript' ) ).to.include( { isFormatting: true } ); } ); + it( 'its attribute is marked with a copOnEnter property', () => { + expect( model.schema.getAttributeProperties( 'superscript' ) ).to.include( { + copyOnEnter: 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 548c5ce..61f3c1f 100644 --- a/tests/underline/underlineediting.js +++ b/tests/underline/underlineediting.js @@ -40,11 +40,17 @@ describe( 'UnderlineEditing', () => { } ); it( 'should be marked with a formatting property', () => { - expect( model.schema.getAttributeProperties( 'underline' ) ).to.deep.equal( { + expect( model.schema.getAttributeProperties( 'underline' ) ).to.include( { isFormatting: true } ); } ); + it( 'its attribute is marked with a copOnEnter property', () => { + expect( model.schema.getAttributeProperties( 'underline' ) ).to.include( { + copyOnEnter: true + } ); + } ); + describe( 'command', () => { it( 'should register underline command', () => { const command = editor.commands.get( 'underline' );