Procházet zdrojové kódy

Small improvements in docs, variables, etc.

Mateusz Samsel před 6 roky
rodič
revize
364ef6ec44

+ 6 - 6
packages/ckeditor5-font/src/ui/colortableview.js

@@ -167,7 +167,7 @@ export default class ColorTableView extends View {
 		this.items.add( this.staticColorsGrid );
 
 		if ( documentColorsCount ) {
-			// Create Label for Document Colors.
+			// Create a label for document colors.
 			const bind = Template.bind( this.documentColors, this.documentColors );
 			const label = new LabelView( this.locale );
 
@@ -190,15 +190,15 @@ export default class ColorTableView extends View {
 	}
 
 	/**
-	 * Method scans through editor's model and searches for text node attributes with componentName.
+	 * Method scans through the editor's model and searches for text node attributes with attributeName.
 	 * Found entries are set as document colors.
 	 *
 	 * All the previously stored document colors will be lost in the process.
 	 *
 	 * @param {module:engine/model/model~Model} model Model used as a source to obtain document colors.
-	 * @param {String} componentName Determines what is the name of related model's attribute for given dropdown.
+	 * @param {String} attributeName Determines what is the name of a related model's attribute for given dropdown.
 	 */
-	updateDocumentColors( model, componentName ) {
+	updateDocumentColors( model, attributeName ) {
 		const document = model.document;
 		const maxCount = this.documentColorsCount;
 
@@ -209,8 +209,8 @@ export default class ColorTableView extends View {
 			const range = model.createRangeIn( root );
 
 			for ( const node of range.getItems() ) {
-				if ( node.is( 'textProxy' ) && node.hasAttribute( componentName ) ) {
-					this._addColorToDocumentColors( node.getAttribute( componentName ) );
+				if ( node.is( 'textProxy' ) && node.hasAttribute( attributeName ) ) {
+					this._addColorToDocumentColors( node.getAttribute( attributeName ) );
 
 					if ( this.documentColors.length >= maxCount ) {
 						return;

+ 2 - 2
packages/ckeditor5-font/src/ui/colorui.js

@@ -131,8 +131,8 @@ export default class ColorUI extends Plugin {
 				editor.editing.view.focus();
 			} );
 
-			dropdownView.on( 'change:isOpen', ( evt, name, val ) => {
-				if ( val ) {
+			dropdownView.on( 'change:isOpen', ( evt, name, isVisible ) => {
+				if ( isVisible ) {
 					if ( documentColorsCount !== 0 ) {
 						this.colorTableView.updateDocumentColors( editor.model, this.componentName );
 					}

+ 2 - 2
packages/ckeditor5-font/tests/manual/font-color.js

@@ -48,5 +48,5 @@ function updateText( styleName ) {
 	};
 }
 
-document.querySelector( '#color-box #color' ).addEventListener( 'change', updateText( 'color' ) );
-document.querySelector( '#color-box #bgcolor' ).addEventListener( 'change', updateText( 'backgroundColor' ) );
+document.getElementById( 'color' ).addEventListener( 'change', updateText( 'color' ) );
+document.getElementById( 'bgcolor' ).addEventListener( 'change', updateText( 'backgroundColor' ) );