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

Commit 0afbc20

Browse files
authored
Merge pull request #92 from ckeditor/t/ckeditor5-enter/40
Other: Mark basic-styles attributes with 'copyOnEnter' property.
2 parents ad25260 + efa1313 commit 0afbc20

File tree

14 files changed

+77
-14
lines changed

14 files changed

+77
-14
lines changed

src/bold/boldediting.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ 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 } );
31+
editor.model.schema.setAttributeProperties( BOLD, {
32+
isFormatting: true,
33+
copyOnEnter: true
34+
} );
3235

3336
// Build converter from model to view for data and editing pipelines.
3437

src/code/codeediting.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ 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 } );
32+
editor.model.schema.setAttributeProperties( CODE, {
33+
isFormatting: true,
34+
copyOnEnter: true
35+
} );
3336

3437
editor.conversion.attributeToElement( {
3538
model: CODE,

src/italic/italicediting.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ 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 } );
32+
editor.model.schema.setAttributeProperties( ITALIC, {
33+
isFormatting: true,
34+
copyOnEnter: true
35+
} );
3336

3437
editor.conversion.attributeToElement( {
3538
model: ITALIC,

src/strikethrough/strikethroughediting.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ 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 } );
33+
editor.model.schema.setAttributeProperties( STRIKETHROUGH, {
34+
isFormatting: true,
35+
copyOnEnter: true
36+
} );
3437

3538
editor.conversion.attributeToElement( {
3639
model: STRIKETHROUGH,

src/subscript/subscriptediting.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ 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 } );
31+
editor.model.schema.setAttributeProperties( SUBSCRIPT, {
32+
isFormatting: true,
33+
copyOnEnter: true
34+
} );
3235

3336
// Build converter from model to view for data and editing pipelines.
3437

src/superscript/superscriptediting.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ 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 } );
31+
editor.model.schema.setAttributeProperties( SUPERSCRIPT, {
32+
isFormatting: true,
33+
copyOnEnter: true
34+
} );
3235

3336
// Build converter from model to view for data and editing pipelines.
3437

src/underline/underlineediting.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ 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 } );
32+
editor.model.schema.setAttributeProperties( UNDERLINE, {
33+
isFormatting: true,
34+
copyOnEnter: true
35+
} );
3336

3437
editor.conversion.attributeToElement( {
3538
model: UNDERLINE,

tests/bold/boldediting.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,17 @@ describe( 'BoldEditing', () => {
4141
} );
4242

4343
it( 'should be marked with a formatting property', () => {
44-
expect( model.schema.getAttributeProperties( 'bold' ) ).to.deep.equal( {
44+
expect( model.schema.getAttributeProperties( 'bold' ) ).to.include( {
4545
isFormatting: true
4646
} );
4747
} );
4848

49+
it( 'its attribute is marked with a copOnEnter property', () => {
50+
expect( model.schema.getAttributeProperties( 'bold' ) ).to.include( {
51+
copyOnEnter: true
52+
} );
53+
} );
54+
4955
it( 'should set editor keystroke', () => {
5056
const spy = sinon.spy( editor, 'execute' );
5157
const keyEventData = {

tests/code/codeediting.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@ describe( 'CodeEditing', () => {
4040
} );
4141

4242
it( 'should be marked with a formatting property', () => {
43-
expect( model.schema.getAttributeProperties( 'code' ) ).to.deep.equal( {
43+
expect( model.schema.getAttributeProperties( 'code' ) ).to.include( {
4444
isFormatting: true
4545
} );
4646
} );
4747

48+
it( 'its attribute is marked with a copOnEnter property', () => {
49+
expect( model.schema.getAttributeProperties( 'code' ) ).to.include( {
50+
copyOnEnter: true
51+
} );
52+
} );
53+
4854
describe( 'command', () => {
4955
it( 'should register code command', () => {
5056
const command = editor.commands.get( 'code' );

tests/italic/italicediting.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,17 @@ describe( 'ItalicEditing', () => {
4040
} );
4141

4242
it( 'should be marked with a formatting property', () => {
43-
expect( model.schema.getAttributeProperties( 'italic' ) ).to.deep.equal( {
43+
expect( model.schema.getAttributeProperties( 'italic' ) ).to.include( {
4444
isFormatting: true
4545
} );
4646
} );
4747

48+
it( 'its attribute is marked with a copOnEnter property', () => {
49+
expect( model.schema.getAttributeProperties( 'italic' ) ).to.include( {
50+
copyOnEnter: true
51+
} );
52+
} );
53+
4854
describe( 'command', () => {
4955
it( 'should register italic command', () => {
5056
const command = editor.commands.get( 'italic' );

0 commit comments

Comments
 (0)