Procházet zdrojové kódy

Minor fixes in bold feature.

Szymon Kupś před 9 roky
rodič
revize
f06b59bf44

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

@@ -34,9 +34,7 @@ export default class Bold extends Feature {
 		buttonModel.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
 
 		// Execute command.
-		this.listenTo( buttonModel, 'execute', () => {
-			editor.execute( 'bold' );
-		} );
+		this.listenTo( buttonModel, 'execute', () => editor.execute( 'bold' ) );
 
 		// Add bold button to feature components.
 		ui.featureComponents.add( 'bold', ButtonController, ButtonView, buttonModel );

+ 6 - 6
packages/ckeditor5-basic-styles/src/boldengine.js

@@ -10,7 +10,7 @@ import BuildModelConverterFor from '../engine/conversion/model-converter-builder
 import BuildViewConverterFor from '../engine/conversion/view-converter-builder.js';
 import AttributeCommand from '../command/attributecommand.js';
 
-const BOLD_ATTRIBUTE = 'bold';
+const BOLD = 'bold';
 
 export default class BoldEngine extends Feature {
 	init() {
@@ -20,12 +20,12 @@ export default class BoldEngine extends Feature {
 		const data = editor.data;
 
 		// Schema.
-		schema.allow( { name: '$inline', attributes: [ BOLD_ATTRIBUTE ] } );
+		schema.allow( { name: '$inline', attributes: [ BOLD ] } );
 
 		// Build converter from model to view for data pipeline.
 		// TODO: Converter for editing pipeline.
 		BuildModelConverterFor( data.modelToView )
-			.fromAttribute( BOLD_ATTRIBUTE )
+			.fromAttribute( BOLD )
 			.toElement( 'strong' );
 
 		// Build converter from view to model for data pipeline.
@@ -34,10 +34,10 @@ export default class BoldEngine extends Feature {
 			.fromElement( 'strong' )
 			.fromElement( 'b' )
 			.fromAttribute( 'style', { 'font-weight': 'bold' } )
-			.toAttribute( BOLD_ATTRIBUTE, true );
+			.toAttribute( BOLD, true );
 
 		// Command.
-		const command = new AttributeCommand( editor, BOLD_ATTRIBUTE );
-		editor.commands.set( BOLD_ATTRIBUTE, command );
+		const command = new AttributeCommand( editor, BOLD );
+		editor.commands.set( BOLD, command );
 	}
 }

+ 0 - 3
packages/ckeditor5-basic-styles/tests/bold.html

@@ -1,4 +1 @@
-<head>
-	<link rel="stylesheet" href="%APPS_DIR%ckeditor/build/amd/theme/ckeditor.css">
-</head>
 <div id="editor"></div>

+ 1 - 1
packages/ckeditor5-basic-styles/tests/manual/bold.html

@@ -3,5 +3,5 @@
 </head>
 
 <div id="editor1">
-	<h1>Hello world!</h1>
+	<p>Hello world!</p>
 </div>

+ 1 - 2
packages/ckeditor5-basic-styles/tests/manual/bold.md

@@ -1,4 +1,3 @@
 @bender-ui: collapsed
 ## Bold feature
-1. Check if bold button is added to toolbar.
-1. Check if bold button can be toggled on and off.
+TODO: Create valid test description once feature is finished.