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

Fix: Special characters grid tile should render correctly when the scrollbar shows up in the panel.

Aleksander Nowodzinski пре 6 година
родитељ
комит
ad2067b013

+ 12 - 1
packages/ckeditor5-special-characters/src/ui/charactergridview.js

@@ -37,7 +37,18 @@ export default class CharacterGridView extends View {
 
 		this.setTemplate( {
 			tag: 'div',
-			children: this.tiles,
+			children: [
+				{
+					tag: 'div',
+					attributes: {
+						class: [
+							'ck',
+							'ck-character-grid__tiles'
+						]
+					},
+					children: this.tiles
+				}
+			],
 			attributes: {
 				class: [
 					'ck',

+ 10 - 0
packages/ckeditor5-special-characters/tests/ui/charactergridview.js

@@ -28,8 +28,18 @@ describe( 'CharacterGridView', () => {
 		} );
 
 		it( 'creates #element from template', () => {
+			const tile = view.createTile( 'ε', 'foo bar baz' );
+			const tilesElement = view.element.firstChild;
+
+			view.tiles.add( tile );
+
 			expect( view.element.classList.contains( 'ck' ) ).to.be.true;
 			expect( view.element.classList.contains( 'ck-character-grid' ) ).to.be.true;
+
+			expect( tilesElement.classList.contains( 'ck' ) ).to.be.true;
+			expect( tilesElement.classList.contains( 'ck-character-grid__tiles' ) ).to.be.true;
+
+			expect( tile.element.parentNode ).to.equal( tilesElement );
 		} );
 	} );
 

+ 4 - 2
packages/ckeditor5-special-characters/theme/charactergrid.css

@@ -4,6 +4,8 @@
  */
 
 .ck.ck-character-grid {
-	display: grid;
-	grid-template-columns: repeat(10, 1fr);
+	& .ck-character-grid__tiles {
+		display: grid;
+		grid-template-columns: repeat( 10, 1fr );
+	}
 }