Przeglądaj źródła

Rename strike to strikethrough.

Rémy HUBSCHER 8 lat temu
rodzic
commit
ca44d89207

+ 1 - 1
packages/ckeditor5-basic-styles/lang/contexts.json

@@ -3,5 +3,5 @@
 	"Italic": "Toolbar button tooltip for the Italic feature.",
 	"Underline": "Toolbar button tooltip for the Underline feature.",
 	"Code": "Toolbar button tooltip for the Code feature.",
-	"Strike": "Toolbar button tooltip for the Strike feature."
+	"Strikethrough": "Toolbar button tooltip for the Strikethrough feature."
 }

+ 15 - 15
packages/ckeditor5-basic-styles/src/strike.js

@@ -4,34 +4,34 @@
  */
 
 /**
- * @module basic-styles/strike
+ * @module basic-styles/strikethrough
  */
 
 import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
-import StrikeEngine from './strikeengine';
+import StrikethroughEngine from './strikethroughengine';
 import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
-import strikeIcon from '../theme/icons/strike.svg';
+import strikethroughIcon from '../theme/icons/strikethrough.svg';
 
 /**
- * The strike feature. It introduces the Strike button and the <kbd>Ctrl+Shift+X</kbd> keystroke.
+ * The strikethrough feature. It introduces the Strikethrough button and the <kbd>Ctrl+Shift+X</kbd> keystroke.
  *
- * It uses the {@link module:basic-styles/strikeengine~StrikeEngine strike engine feature}.
+ * It uses the {@link module:basic-styles/strikethroughengine~StrikethroughEngine strikethrough engine feature}.
  *
  * @extends module:core/plugin~Plugin
  */
-export default class Strike extends Plugin {
+export default class Strikethrough extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
 	static get requires() {
-		return [ StrikeEngine ];
+		return [ StrikethroughEngine ];
 	}
 
 	/**
 	 * @inheritDoc
 	 */
 	static get pluginName() {
-		return 'Strike';
+		return 'Strikethrough';
 	}
 
 	/**
@@ -40,16 +40,16 @@ export default class Strike extends Plugin {
 	init() {
 		const editor = this.editor;
 		const t = editor.t;
-		const command = editor.commands.get( 'strike' );
+		const command = editor.commands.get( 'strikethrough' );
 		const keystroke = 'CTRL+SHIFT+X';
 
-		// Add strike button to feature components.
-		editor.ui.componentFactory.add( 'strike', locale => {
+		// Add strikethrough button to feature components.
+		editor.ui.componentFactory.add( 'strikethrough', locale => {
 			const view = new ButtonView( locale );
 
 			view.set( {
-				label: t( 'Strike' ),
-				icon: strikeIcon,
+				label: t( 'Strikethrough' ),
+				icon: strikethroughIcon,
 				keystroke,
 				tooltip: true
 			} );
@@ -57,12 +57,12 @@ export default class Strike extends Plugin {
 			view.bind( 'isOn', 'isEnabled' ).to( command, 'value', 'isEnabled' );
 
 			// Execute command.
-			this.listenTo( view, 'execute', () => editor.execute( 'strike' ) );
+			this.listenTo( view, 'execute', () => editor.execute( 'strikethrough' ) );
 
 			return view;
 		} );
 
 		// Set the Ctrl+Shift+X keystroke.
-		editor.keystrokes.set( keystroke, 'strike' );
+		editor.keystrokes.set( keystroke, 'strikethrough' );
 	}
 }

+ 13 - 13
packages/ckeditor5-basic-styles/src/strikeengine.js

@@ -12,18 +12,18 @@ import buildModelConverter from '@ckeditor/ckeditor5-engine/src/conversion/build
 import buildViewConverter from '@ckeditor/ckeditor5-engine/src/conversion/buildviewconverter';
 import AttributeCommand from './attributecommand';
 
-const STRIKE = 'strike';
+const STRIKETHROUGH = 'strikethrough';
 
 /**
- * The strike engine feature.
+ * The strikethrough engine feature.
  *
- * It registers the `strike` command and introduces the
- * `strikesthrough` attribute in the model which renders to the view
+ * It registers the `strikethrough` command and introduces the
+ * `strikethroughsthrough` attribute in the model which renders to the view
  * as a `<s>` element.
  *
  * @extends module:core/plugin~Plugin
  */
-export default class StrikeEngine extends Plugin {
+export default class StrikethroughEngine extends Plugin {
 	/**
 	 * @inheritDoc
 	 */
@@ -32,25 +32,25 @@ export default class StrikeEngine extends Plugin {
 		const data = editor.data;
 		const editing = editor.editing;
 
-		// Allow strike attribute on all inline nodes.
-		editor.document.schema.allow( { name: '$inline', attributes: STRIKE, inside: '$block' } );
+		// Allow strikethrough attribute on all inline nodes.
+		editor.document.schema.allow( { name: '$inline', attributes: STRIKETHROUGH, inside: '$block' } );
 		// Temporary workaround. See https://github.com/ckeditor/ckeditor5/issues/477.
-		editor.document.schema.allow( { name: '$inline', attributes: STRIKE, inside: '$clipboardHolder' } );
+		editor.document.schema.allow( { name: '$inline', attributes: STRIKETHROUGH, inside: '$clipboardHolder' } );
 
 		// Build converter from model to view for data and editing pipelines.
 		buildModelConverter().for( data.modelToView, editing.modelToView )
-			.fromAttribute( STRIKE )
+			.fromAttribute( STRIKETHROUGH )
 			.toElement( 's' );
 
 		// Build converter from view to model for data pipeline.
 		buildViewConverter().for( data.viewToModel )
 			.fromElement( 's' )
 			.fromElement( 'del' )
-			.fromElement( 'strike' )
+			.fromElement( 'strikethrough' )
 			.fromAttribute( 'style', { 'text-decoration': 'line-through' } )
-			.toAttribute( STRIKE, true );
+			.toAttribute( STRIKETHROUGH, true );
 
-		// Create strike command.
-		editor.commands.add( STRIKE, new AttributeCommand( editor, STRIKE ) );
+		// Create strikethrough command.
+		editor.commands.add( STRIKETHROUGH, new AttributeCommand( editor, STRIKETHROUGH ) );
 	}
 }

+ 3 - 3
packages/ckeditor5-basic-styles/tests/manual/basic-styles.js

@@ -10,14 +10,14 @@ import Essentials from '@ckeditor/ckeditor5-essentials/src/essentials';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import Bold from '../../src/bold';
 import Italic from '../../src/italic';
-import Strike from '../../src/strike';
+import Strikethrough from '../../src/strikethrough';
 import Underline from '../../src/underline';
 import Code from '../../src/code';
 
 ClassicEditor
 	.create( document.querySelector( '#editor' ), {
-		plugins: [ Essentials, Paragraph, Bold, Italic, Strike, Underline, Code ],
-		toolbar: [ 'bold', 'italic', 'strike', 'underline', 'code', 'undo', 'redo' ]
+		plugins: [ Essentials, Paragraph, Bold, Italic, Strikethrough, Underline, Code ],
+		toolbar: [ 'bold', 'italic', 'strikethrough', 'underline', 'code', 'undo', 'redo' ]
 	} )
 	.then( editor => {
 		window.editor = editor;

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

@@ -4,6 +4,6 @@
   * italic _"This"_,
   * bold **"editor"**,
   * underline "instance",
-  * strike ~~"is"~~,
+  * strikethrough ~~"is"~~,
   * code `"an"`.
-2. Test the bold, italic, strike, underline and code features live.
+2. Test the bold, italic, strikethrough, underline and code features live.

+ 8 - 8
packages/ckeditor5-basic-styles/tests/strike.js

@@ -6,15 +6,15 @@
 /* globals document */
 
 import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
-import Strike from '../src/strike';
-import StrikeEngine from '../src/strikeengine';
+import Strikethrough from '../src/strike';
+import StrikethroughEngine from '../src/strikeengine';
 import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import { keyCodes } from '@ckeditor/ckeditor5-utils/src/keyboard';
 
 testUtils.createSinonSandbox();
 
-describe( 'Strike', () => {
+describe( 'Strikethrough', () => {
 	let editor, strikeView;
 
 	beforeEach( () => {
@@ -23,7 +23,7 @@ describe( 'Strike', () => {
 
 		return ClassicTestEditor
 			.create( editorElement, {
-				plugins: [ Strike ]
+				plugins: [ Strikethrough ]
 			} )
 			.then( newEditor => {
 				editor = newEditor;
@@ -37,17 +37,17 @@ describe( 'Strike', () => {
 	} );
 
 	it( 'should be loaded', () => {
-		expect( editor.plugins.get( Strike ) ).to.be.instanceOf( Strike );
+		expect( editor.plugins.get( Strikethrough ) ).to.be.instanceOf( Strikethrough );
 	} );
 
-	it( 'should load StrikeEngine', () => {
-		expect( editor.plugins.get( StrikeEngine ) ).to.be.instanceOf( StrikeEngine );
+	it( 'should load StrikethroughEngine', () => {
+		expect( editor.plugins.get( StrikethroughEngine ) ).to.be.instanceOf( StrikethroughEngine );
 	} );
 
 	it( 'should register strike feature component', () => {
 		expect( strikeView ).to.be.instanceOf( ButtonView );
 		expect( strikeView.isOn ).to.be.false;
-		expect( strikeView.label ).to.equal( 'Strike' );
+		expect( strikeView.label ).to.equal( 'Strikethrough' );
 		expect( strikeView.icon ).to.match( /<svg / );
 		expect( strikeView.keystroke ).to.equal( 'CTRL+SHIFT+X' );
 	} );

+ 4 - 4
packages/ckeditor5-basic-styles/tests/strikeengine.js

@@ -3,7 +3,7 @@
  * For licensing, see LICENSE.md.
  */
 
-import StrikeEngine from '../src/strikeengine';
+import StrikethroughEngine from '../src/strikeengine';
 
 import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
 import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
@@ -12,13 +12,13 @@ import AttributeCommand from '../src/attributecommand';
 import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
-describe( 'StrikeEngine', () => {
+describe( 'StrikethroughEngine', () => {
 	let editor, doc;
 
 	beforeEach( () => {
 		return VirtualTestEditor
 			.create( {
-				plugins: [ Paragraph, StrikeEngine ]
+				plugins: [ Paragraph, StrikethroughEngine ]
 			} )
 			.then( newEditor => {
 				editor = newEditor;
@@ -32,7 +32,7 @@ describe( 'StrikeEngine', () => {
 	} );
 
 	it( 'should be loaded', () => {
-		expect( editor.plugins.get( StrikeEngine ) ).to.be.instanceOf( StrikeEngine );
+		expect( editor.plugins.get( StrikethroughEngine ) ).to.be.instanceOf( StrikethroughEngine );
 	} );
 
 	it( 'should set proper schema rules', () => {