Explorar o código

Merge pull request #92 from ckeditor/t/ckeditor5-enter/40

Other: Mark basic-styles attributes with 'copyOnEnter' property.
Maciej %!s(int64=6) %!d(string=hai) anos
pai
achega
b8634f3267

+ 4 - 1
packages/ckeditor5-basic-styles/src/bold/boldediting.js

@@ -28,7 +28,10 @@ export default class BoldEditing extends Plugin {
 		const editor = this.editor;
 		const editor = this.editor;
 		// Allow bold attribute on text nodes.
 		// Allow bold attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: BOLD } );
 		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.
 		// Build converter from model to view for data and editing pipelines.
 
 

+ 4 - 1
packages/ckeditor5-basic-styles/src/code/codeediting.js

@@ -29,7 +29,10 @@ export default class CodeEditing extends Plugin {
 
 
 		// Allow code attribute on text nodes.
 		// Allow code attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: CODE } );
 		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( {
 		editor.conversion.attributeToElement( {
 			model: CODE,
 			model: CODE,

+ 4 - 1
packages/ckeditor5-basic-styles/src/italic/italicediting.js

@@ -29,7 +29,10 @@ export default class ItalicEditing extends Plugin {
 
 
 		// Allow italic attribute on text nodes.
 		// Allow italic attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: ITALIC } );
 		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( {
 		editor.conversion.attributeToElement( {
 			model: ITALIC,
 			model: ITALIC,

+ 4 - 1
packages/ckeditor5-basic-styles/src/strikethrough/strikethroughediting.js

@@ -30,7 +30,10 @@ export default class StrikethroughEditing extends Plugin {
 
 
 		// Allow strikethrough attribute on text nodes.
 		// Allow strikethrough attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: STRIKETHROUGH } );
 		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( {
 		editor.conversion.attributeToElement( {
 			model: STRIKETHROUGH,
 			model: STRIKETHROUGH,

+ 4 - 1
packages/ckeditor5-basic-styles/src/subscript/subscriptediting.js

@@ -28,7 +28,10 @@ export default class SubscriptEditing extends Plugin {
 		const editor = this.editor;
 		const editor = this.editor;
 		// Allow sub attribute on text nodes.
 		// Allow sub attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: SUBSCRIPT } );
 		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.
 		// Build converter from model to view for data and editing pipelines.
 
 

+ 4 - 1
packages/ckeditor5-basic-styles/src/superscript/superscriptediting.js

@@ -28,7 +28,10 @@ export default class SuperscriptEditing extends Plugin {
 		const editor = this.editor;
 		const editor = this.editor;
 		// Allow super attribute on text nodes.
 		// Allow super attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: SUPERSCRIPT } );
 		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.
 		// Build converter from model to view for data and editing pipelines.
 
 

+ 4 - 1
packages/ckeditor5-basic-styles/src/underline/underlineediting.js

@@ -29,7 +29,10 @@ export default class UnderlineEditing extends Plugin {
 
 
 		// Allow strikethrough attribute on text nodes.
 		// Allow strikethrough attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: UNDERLINE } );
 		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( {
 		editor.conversion.attributeToElement( {
 			model: UNDERLINE,
 			model: UNDERLINE,

+ 7 - 1
packages/ckeditor5-basic-styles/tests/bold/boldediting.js

@@ -41,11 +41,17 @@ describe( 'BoldEditing', () => {
 	} );
 	} );
 
 
 	it( 'should be marked with a formatting property', () => {
 	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
 			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', () => {
 	it( 'should set editor keystroke', () => {
 		const spy = sinon.spy( editor, 'execute' );
 		const spy = sinon.spy( editor, 'execute' );
 		const keyEventData = {
 		const keyEventData = {

+ 7 - 1
packages/ckeditor5-basic-styles/tests/code/codeediting.js

@@ -40,11 +40,17 @@ describe( 'CodeEditing', () => {
 	} );
 	} );
 
 
 	it( 'should be marked with a formatting property', () => {
 	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
 			isFormatting: true
 		} );
 		} );
 	} );
 	} );
 
 
+	it( 'its attribute is marked with a copOnEnter property', () => {
+		expect( model.schema.getAttributeProperties( 'code' ) ).to.include( {
+			copyOnEnter: true
+		} );
+	} );
+
 	describe( 'command', () => {
 	describe( 'command', () => {
 		it( 'should register code command', () => {
 		it( 'should register code command', () => {
 			const command = editor.commands.get( 'code' );
 			const command = editor.commands.get( 'code' );

+ 7 - 1
packages/ckeditor5-basic-styles/tests/italic/italicediting.js

@@ -40,11 +40,17 @@ describe( 'ItalicEditing', () => {
 	} );
 	} );
 
 
 	it( 'should be marked with a formatting property', () => {
 	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
 			isFormatting: true
 		} );
 		} );
 	} );
 	} );
 
 
+	it( 'its attribute is marked with a copOnEnter property', () => {
+		expect( model.schema.getAttributeProperties( 'italic' ) ).to.include( {
+			copyOnEnter: true
+		} );
+	} );
+
 	describe( 'command', () => {
 	describe( 'command', () => {
 		it( 'should register italic command', () => {
 		it( 'should register italic command', () => {
 			const command = editor.commands.get( 'italic' );
 			const command = editor.commands.get( 'italic' );

+ 7 - 1
packages/ckeditor5-basic-styles/tests/strikethrough/strikethroughediting.js

@@ -40,11 +40,17 @@ describe( 'StrikethroughEditing', () => {
 	} );
 	} );
 
 
 	it( 'should be marked with a formatting property', () => {
 	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
 			isFormatting: true
 		} );
 		} );
 	} );
 	} );
 
 
+	it( 'its attribute is marked with a copOnEnter property', () => {
+		expect( model.schema.getAttributeProperties( 'strikethrough' ) ).to.include( {
+			copyOnEnter: true
+		} );
+	} );
+
 	describe( 'command', () => {
 	describe( 'command', () => {
 		it( 'should register strikethrough command', () => {
 		it( 'should register strikethrough command', () => {
 			const command = editor.commands.get( 'strikethrough' );
 			const command = editor.commands.get( 'strikethrough' );

+ 7 - 1
packages/ckeditor5-basic-styles/tests/subscript/subscriptediting.js

@@ -40,11 +40,17 @@ describe( 'SubEditing', () => {
 	} );
 	} );
 
 
 	it( 'should be marked with a formatting property', () => {
 	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
 			isFormatting: true
 		} );
 		} );
 	} );
 	} );
 
 
+	it( 'its attribute is marked with a copOnEnter property', () => {
+		expect( model.schema.getAttributeProperties( 'subscript' ) ).to.include( {
+			copyOnEnter: true
+		} );
+	} );
+
 	describe( 'command', () => {
 	describe( 'command', () => {
 		it( 'should register subscript command', () => {
 		it( 'should register subscript command', () => {
 			const command = editor.commands.get( 'subscript' );
 			const command = editor.commands.get( 'subscript' );

+ 7 - 1
packages/ckeditor5-basic-styles/tests/superscript/superscriptediting.js

@@ -40,11 +40,17 @@ describe( 'SuperEditing', () => {
 	} );
 	} );
 
 
 	it( 'should be marked with a formatting property', () => {
 	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
 			isFormatting: true
 		} );
 		} );
 	} );
 	} );
 
 
+	it( 'its attribute is marked with a copOnEnter property', () => {
+		expect( model.schema.getAttributeProperties( 'superscript' ) ).to.include( {
+			copyOnEnter: true
+		} );
+	} );
+
 	describe( 'command', () => {
 	describe( 'command', () => {
 		it( 'should register superscript command', () => {
 		it( 'should register superscript command', () => {
 			const command = editor.commands.get( 'superscript' );
 			const command = editor.commands.get( 'superscript' );

+ 7 - 1
packages/ckeditor5-basic-styles/tests/underline/underlineediting.js

@@ -40,11 +40,17 @@ describe( 'UnderlineEditing', () => {
 	} );
 	} );
 
 
 	it( 'should be marked with a formatting property', () => {
 	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
 			isFormatting: true
 		} );
 		} );
 	} );
 	} );
 
 
+	it( 'its attribute is marked with a copOnEnter property', () => {
+		expect( model.schema.getAttributeProperties( 'underline' ) ).to.include( {
+			copyOnEnter: true
+		} );
+	} );
+
 	describe( 'command', () => {
 	describe( 'command', () => {
 		it( 'should register underline command', () => {
 		it( 'should register underline command', () => {
 			const command = editor.commands.get( 'underline' );
 			const command = editor.commands.get( 'underline' );