8
0
Pārlūkot izejas kodu

Merge branch 'master' into t/ckeditor5/488

Szymon Cofalik 7 gadi atpakaļ
vecāks
revīzija
70d3308359

+ 13 - 10
packages/ckeditor5-basic-styles/src/bold/boldediting.js

@@ -8,8 +8,6 @@
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import { downcastAttributeToElement } from '@ckeditor/ckeditor5-engine/src/conversion/downcast-converters';
-import { upcastElementToAttribute } from '@ckeditor/ckeditor5-engine/src/conversion/upcast-converters';
 import AttributeCommand from '../attributecommand';
 
 const BOLD = 'bold';
@@ -32,14 +30,19 @@ export default class BoldEditing extends Plugin {
 		editor.model.schema.extend( '$text', { allowAttributes: BOLD } );
 
 		// Build converter from model to view for data and editing pipelines.
-		editor.conversion.for( 'downcast' )
-			.add( downcastAttributeToElement( BOLD, { view: 'strong' } ) );
-
-		// Build converter from view to model for data pipeline.
-		editor.conversion.for( 'upcast' )
-			.add( upcastElementToAttribute( { view: 'b', model: BOLD } ) )
-			.add( upcastElementToAttribute( { view: 'strong', model: BOLD } ) )
-			.add( upcastElementToAttribute( { view: { style: { 'font-weight': 'bold' } }, model: BOLD } ) );
+
+		editor.conversion.attributeToElement( {
+			model: BOLD,
+			view: 'strong',
+			upcastAlso: [
+				'b',
+				{
+					style: {
+						'font-weight': 'bold'
+					}
+				}
+			]
+		} );
 
 		// Create bold command.
 		editor.commands.add( BOLD, new AttributeCommand( editor, BOLD ) );

+ 9 - 10
packages/ckeditor5-basic-styles/src/code/codeediting.js

@@ -8,8 +8,6 @@
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import { downcastAttributeToElement } from '@ckeditor/ckeditor5-engine/src/conversion/downcast-converters';
-import { upcastElementToAttribute } from '@ckeditor/ckeditor5-engine/src/conversion/upcast-converters';
 import AttributeCommand from '../attributecommand';
 
 const CODE = 'code';
@@ -32,14 +30,15 @@ export default class CodeEditing extends Plugin {
 		// Allow code attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: CODE } );
 
-		// Build converter from model to view for data and editing pipelines.
-		editor.conversion.for( 'downcast' )
-			.add( downcastAttributeToElement( CODE, { view: 'code' } ) );
-
-		// Build converter from view to model for data pipeline.
-		editor.conversion.for( 'upcast' )
-			.add( upcastElementToAttribute( { view: 'code', model: CODE } ) )
-			.add( upcastElementToAttribute( { view: { style: { 'word-wrap': 'break-word' } }, model: CODE } ) );
+		editor.conversion.attributeToElement( {
+			model: CODE,
+			view: 'code',
+			upcastAlso: {
+				style: {
+					'word-wrap': 'break-word'
+				}
+			}
+		} );
 
 		// Create code command.
 		editor.commands.add( CODE, new AttributeCommand( editor, CODE ) );

+ 12 - 11
packages/ckeditor5-basic-styles/src/italic/italicediting.js

@@ -8,8 +8,6 @@
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import { downcastAttributeToElement } from '@ckeditor/ckeditor5-engine/src/conversion/downcast-converters';
-import { upcastElementToAttribute } from '@ckeditor/ckeditor5-engine/src/conversion/upcast-converters';
 import AttributeCommand from '../attributecommand';
 
 const ITALIC = 'italic';
@@ -32,15 +30,18 @@ export default class ItalicEditing extends Plugin {
 		// Allow italic attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: ITALIC } );
 
-		// Build converter from model to view for data and editing pipelines.
-		editor.conversion.for( 'downcast' )
-			.add( downcastAttributeToElement( ITALIC, { view: 'i' } ) );
-
-		// Build converter from view to model for data pipeline.
-		editor.conversion.for( 'upcast' )
-			.add( upcastElementToAttribute( { view: 'em', model: ITALIC } ) )
-			.add( upcastElementToAttribute( { view: 'i', model: ITALIC } ) )
-			.add( upcastElementToAttribute( { view: { style: { 'font-style': 'italic' } }, model: ITALIC } ) );
+		editor.conversion.attributeToElement( {
+			model: ITALIC,
+			view: 'i',
+			upcastAlso: [
+				'em',
+				{
+					style: {
+						'font-style': 'italic'
+					}
+				}
+			]
+		} );
 
 		// Create italic command.
 		editor.commands.add( ITALIC, new AttributeCommand( editor, ITALIC ) );

+ 13 - 12
packages/ckeditor5-basic-styles/src/strikethrough/strikethroughediting.js

@@ -8,8 +8,6 @@
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import { downcastAttributeToElement } from '@ckeditor/ckeditor5-engine/src/conversion/downcast-converters';
-import { upcastElementToAttribute } from '@ckeditor/ckeditor5-engine/src/conversion/upcast-converters';
 import AttributeCommand from '../attributecommand';
 
 const STRIKETHROUGH = 'strikethrough';
@@ -33,16 +31,19 @@ export default class StrikethroughEditing extends Plugin {
 		// Allow strikethrough attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: STRIKETHROUGH } );
 
-		// Build converter from model to view for data and editing pipelines.
-		editor.conversion.for( 'downcast' )
-			.add( downcastAttributeToElement( STRIKETHROUGH, { view: 's' } ) );
-
-		// Build converter from view to model for data pipeline.
-		editor.conversion.for( 'upcast' )
-			.add( upcastElementToAttribute( { view: 's', model: STRIKETHROUGH } ) )
-			.add( upcastElementToAttribute( { view: 'del', model: STRIKETHROUGH } ) )
-			.add( upcastElementToAttribute( { view: 'strike', model: STRIKETHROUGH } ) )
-			.add( upcastElementToAttribute( { view: { style: { 'text-decoration': 'line-through' } }, model: STRIKETHROUGH } ) );
+		editor.conversion.attributeToElement( {
+			model: STRIKETHROUGH,
+			view: 's',
+			upcastAlso: [
+				'del',
+				'strike',
+				{
+					style: {
+						'text-decoration': 'line-through'
+					}
+				}
+			]
+		} );
 
 		// Create strikethrough command.
 		editor.commands.add( STRIKETHROUGH, new AttributeCommand( editor, STRIKETHROUGH ) );

+ 9 - 10
packages/ckeditor5-basic-styles/src/underline/underlineediting.js

@@ -8,8 +8,6 @@
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import { downcastAttributeToElement } from '@ckeditor/ckeditor5-engine/src/conversion/downcast-converters';
-import { upcastElementToAttribute } from '@ckeditor/ckeditor5-engine/src/conversion/upcast-converters';
 import AttributeCommand from '../attributecommand';
 
 const UNDERLINE = 'underline';
@@ -32,14 +30,15 @@ export default class UnderlineEditing extends Plugin {
 		// Allow strikethrough attribute on text nodes.
 		editor.model.schema.extend( '$text', { allowAttributes: UNDERLINE } );
 
-		// Build converter from model to view for data and editing pipelines.
-		editor.conversion.for( 'downcast' )
-			.add( downcastAttributeToElement( UNDERLINE, { view: 'u' } ) );
-
-		// Build converter from view to model for data pipeline.
-		editor.conversion.for( 'upcast' )
-			.add( upcastElementToAttribute( { view: 'u', model: UNDERLINE } ) )
-			.add( upcastElementToAttribute( { view: { style: { 'text-decoration': 'underline' } }, model: UNDERLINE } ) );
+		editor.conversion.attributeToElement( {
+			model: UNDERLINE,
+			view: 'u',
+			upcastAlso: {
+				style: {
+					'text-decoration': 'underline'
+				}
+			}
+		} );
 
 		// Create underline command.
 		editor.commands.add( UNDERLINE, new AttributeCommand( editor, UNDERLINE ) );

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
packages/ckeditor5-basic-styles/theme/icons/bold.svg