Преглед изворни кода

Enabled alignment feature.

Oskar Wróbel пре 6 година
родитељ
комит
4adef9cc92

+ 1 - 1
packages/ckeditor5-heading/src/title.js

@@ -65,7 +65,7 @@ export default class Title extends Plugin {
 		//
 		// See: https://github.com/ckeditor/ckeditor5/issues/2005.
 		model.schema.register( 'title', { isBlock: true, allowIn: '$root' } );
-		model.schema.register( 'title-content', { isBlock: true, allowIn: 'title' } );
+		model.schema.register( 'title-content', { isBlock: true, allowIn: 'title', allowAttributes: [ 'alignment' ] } );
 		model.schema.extend( '$text', { allowIn: 'title-content' } );
 
 		// Disallow all attributes in `title-content`.

+ 3 - 2
packages/ckeditor5-heading/tests/manual/title.js

@@ -16,11 +16,12 @@ import { UploadAdapterMock } from '@ckeditor/ckeditor5-upload/tests/_utils/mocks
 import Image from '@ckeditor/ckeditor5-image/src/image';
 import ImageUpload from '@ckeditor/ckeditor5-image/src/imageupload';
 import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
+import Alignment from '@ckeditor/ckeditor5-alignment/src/alignment';
 
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
-		plugins: [ Enter, Typing, Undo, Heading, Title, Clipboard, Image, ImageUpload, Bold ],
-		toolbar: [ 'heading', '|', 'undo', 'redo', 'bold', 'imageUpload' ]
+		plugins: [ Enter, Typing, Undo, Heading, Title, Clipboard, Image, ImageUpload, Bold, Alignment ],
+		toolbar: [ 'heading', '|', 'undo', 'redo', 'bold', 'imageUpload', 'alignment' ]
 	} )
 	.then( editor => {
 		window.editor = editor;

+ 1 - 0
packages/ckeditor5-heading/tests/manual/title.md

@@ -26,3 +26,4 @@ There should be no empty paragraph at the end of document, title should contains
 - put selection in the middle of the title
 
 Heading dropdown, upload and bold icons should be disabled as long as selection stay in the title element.
+Alignment feature should be enabled.

+ 2 - 5
packages/ckeditor5-heading/tests/title.js

@@ -62,13 +62,10 @@ describe( 'Title', () => {
 		expect( model.schema.checkChild( 'title-content', '$text' ) ).to.equal( true );
 		expect( model.schema.checkChild( 'title-content', '$block' ) ).to.equal( false );
 
-		model.schema.extend( '$text', { allowAttributes: [ 'bold', 'foo' ] } );
+		expect( model.schema.checkAttribute( [ 'title-content' ], 'alignment' ) ).to.equal( true );
 
+		model.schema.extend( '$text', { allowAttributes: [ 'bold' ] } );
 		expect( model.schema.checkAttribute( [ 'title-content', '$text' ], 'bold' ) ).to.equal( false );
-		expect( model.schema.checkAttribute( [ 'paragraph', '$text' ], 'bold' ) ).to.equal( true );
-
-		expect( model.schema.checkAttribute( [ 'title-content', '$text' ], 'foo' ) ).to.equal( false );
-		expect( model.schema.checkAttribute( [ 'paragraph', '$text' ], 'foo' ) ).to.equal( true );
 	} );
 
 	it( 'should convert title to h1', () => {