浏览代码

Changed: Pass all `ConverterDefinition`s to modelAttributeToViewAttributeElement as an array.

Maciej Gołaszewski 8 年之前
父节点
当前提交
c75db52f35

+ 3 - 2
packages/ckeditor5-font/src/fontsize/fontsizecommand.js

@@ -37,10 +37,11 @@ export default class FontSizeCommand extends Command {
 	 * @inheritDoc
 	 */
 	refresh() {
-		const doc = this.editor.model.document;
+		const model = this.editor.model;
+		const doc = model.document;
 
 		this.value = doc.selection.getAttribute( 'fontSize' ) === this.fontSize;
-		this.isEnabled = this.editor.model.schema.checkAttributeInSelection( doc.selection, 'fontSize' );
+		this.isEnabled = model.schema.checkAttributeInSelection( doc.selection, 'fontSize' );
 	}
 
 	/**

+ 4 - 4
packages/ckeditor5-font/src/fontsize/fontsizeediting.js

@@ -51,12 +51,12 @@ export default class FontSizeEditing extends Plugin {
 			// Covert view to model.
 			viewToModelAttribute( 'fontSize', item, [ data.viewToModel ] );
 
-			// Covert model to view.
-			modelAttributeToViewAttributeElement( 'fontSize', item, [ data.modelToView, editing.modelToView ] );
-
 			// Add command.
 			editor.commands.add( 'font-size:' + item.model, new FontSizeCommand( editor, item.model ) );
 		}
+
+		// Covert model to view.
+		modelAttributeToViewAttributeElement( 'fontSize', this.configuredItems, [ data.modelToView, editing.modelToView ] );
 	}
 
 	get configuredItems() {
@@ -88,7 +88,7 @@ export default class FontSizeEditing extends Plugin {
 	init() {
 		const editor = this.editor;
 
-		// Allow highlight attribute on all elements
+		// Allow fontSize attribute on all elements
 		editor.model.schema.allow( { name: '$inline', attributes: 'fontSize', inside: '$block' } );
 		// Temporary workaround. See https://github.com/ckeditor/ckeditor5/issues/477.
 		editor.model.schema.allow( { name: '$inline', attributes: 'fontSize', inside: '$clipboardHolder' } );