8
0
Pārlūkot izejas kodu

Merge pull request #11 from ckeditor/t/8

Renamed Formats to Headings.
Szymon Kupś 9 gadi atpakaļ
vecāks
revīzija
4240e4668f

+ 3 - 3
packages/ckeditor5-heading/CHANGES.md

@@ -1,7 +1,7 @@
-CKEditor5 Formats Feature Changelog
+CKEditor5 Headings Feature Changelog
 ========================================
 
-## CKEditor5 Formats Feature 0.0.2
+## CKEditor5 Headings Feature 0.0.2
 
 **Major|Minor|Patch Release** - Build Date: yyyy-mm-dd
 
@@ -20,6 +20,6 @@ Other Changes:
 * Item 1
 * Item 2
 
-## CKEditor5 Formats Feature 0.0.1
+## CKEditor5 Headings Feature 0.0.1
 
 ...

+ 1 - 1
packages/ckeditor5-heading/LICENSE.md

@@ -1,7 +1,7 @@
 Software License Agreement
 ==========================
 
-**CKEditor5 Formats Feature** – https://github.com/ckeditor/ckeditor5-format <br>
+**CKEditor5 Headings Feature** – https://github.com/ckeditor/ckeditor5-headings <br>
 Copyright (c) 2003-2016, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved.
 
 Licensed under the terms of any of the following licenses at your choice:

+ 3 - 3
packages/ckeditor5-heading/README.md

@@ -1,9 +1,9 @@
-CKEditor5 Formats Feature
+CKEditor5 Headings Feature
 ========================================
 
-[![devDependency Status](https://david-dm.org/ckeditor/ckeditor5-formats/dev-status.svg)](https://david-dm.org/ckeditor/ckeditor5-formats#info=devDependencies)
+[![devDependency Status](https://david-dm.org/ckeditor/ckeditor5-headings/dev-status.svg)](https://david-dm.org/ckeditor/ckeditor5-headings#info=devDependencies)
 
- More information about the project can be found at the following url: <https://github.com/ckeditor/ckeditor5-formats>.
+ More information about the project can be found at the following url: <https://github.com/ckeditor/ckeditor5-headings>.
 
 ## License
 

+ 2 - 2
packages/ckeditor5-heading/package.json

@@ -1,7 +1,7 @@
 {
-  "name": "ckeditor5-formats",
+  "name": "ckeditor5-headings",
   "version": "0.0.1",
-  "description": "Formats feature for CKEditor 5.",
+  "description": "Headings feature for CKEditor 5.",
   "keywords": [],
   "dependencies": {},
   "devDependencies": {

+ 7 - 7
packages/ckeditor5-heading/src/formats.js

@@ -6,20 +6,20 @@
 'use strict';
 
 import Feature from '../feature.js';
-import FormatsEngine from './formatsengine.js';
+import HeadingsEngine from './headingsengine.js';
 import Model from '../ui/model.js';
 import ListDropdownController from '../ui/dropdown/list/listdropdown.js';
 import ListDropdownView from '../ui/dropdown/list/listdropdownview.js';
 import Collection from '../utils/collection.js';
 
-export default class Formats extends Feature {
+export default class Headings extends Feature {
 	static get requires() {
-		return [ FormatsEngine ];
+		return [ HeadingsEngine ];
 	}
 
 	init() {
 		const editor = this.editor;
-		const command = editor.commands.get( 'format' );
+		const command = editor.commands.get( 'headings' );
 		const formats = command.formats;
 		const collection = new Collection();
 
@@ -40,7 +40,7 @@ export default class Formats extends Feature {
 		const dropdownModel = new Model( {
 			isEnabled: true,
 			isOn: false,
-			label: 'Formats',
+			label: 'Headings',
 			content: itemListModel
 		} );
 
@@ -50,9 +50,9 @@ export default class Formats extends Feature {
 
 		// Execute command when item from dropdown is selected.
 		this.listenTo( itemListModel, 'execute', ( evt, itemModel ) => {
-			editor.execute( 'format', itemModel.id );
+			editor.execute( 'headings', itemModel.id );
 		} );
 
-		editor.ui.featureComponents.add( 'formats', ListDropdownController, ListDropdownView, dropdownModel );
+		editor.ui.featureComponents.add( 'headings', ListDropdownController, ListDropdownView, dropdownModel );
 	}
 }

+ 1 - 1
packages/ckeditor5-heading/src/formatscommand.js

@@ -8,7 +8,7 @@
 import Command from '../command/command.js';
 import RootElement from '../engine/model/rootelement.js';
 
-export default class FormatsCommand extends Command {
+export default class HeadingsCommand extends Command {
 	constructor( editor, formats ) {
 		super( editor );
 

+ 4 - 4
packages/ckeditor5-heading/src/formatsengine.js

@@ -9,7 +9,7 @@ import Feature from '../feature.js';
 import BuildModelConverterFor from '../engine/conversion/model-converter-builder.js';
 import BuildViewConverterFor from '../engine/conversion/view-converter-builder.js';
 import Paragraph from '../paragraph/paragraph.js';
-import FormatsCommand from './formatscommand.js';
+import HeadingsCommand from './headingscommand.js';
 
 const formats = [
 	{ id: 'paragraph', viewElement: 'p', label: 'Paragraph' },
@@ -18,7 +18,7 @@ const formats = [
 	{ id: 'heading3', viewElement: 'h4', label: 'Heading 3' }
 ];
 
-export default class FormatsEngine extends Feature {
+export default class HeadingsEngine extends Feature {
 	static get requires() {
 		return [ Paragraph ];
 	}
@@ -47,7 +47,7 @@ export default class FormatsEngine extends Feature {
 		}
 
 		// Register command.
-		const command = new FormatsCommand( editor, formats );
-		editor.commands.set( 'format', command );
+		const command = new HeadingsCommand( editor, formats );
+		editor.commands.set( 'headings', command );
 	}
 }

+ 13 - 13
packages/ckeditor5-heading/tests/formats.js

@@ -6,14 +6,14 @@
 'use strict';
 
 import ClassicTestEditor from '/tests/ckeditor5/_utils/classictesteditor.js';
-import Formats from '/ckeditor5/formats/formats.js';
-import FormatsEngine from '/ckeditor5/formats/formatsengine.js';
+import Headings from '/ckeditor5/headings/headings.js';
+import HeadingsEngine from '/ckeditor5/headings/headingsengine.js';
 import ListDropdown from '/ckeditor5/ui/dropdown/list/listdropdown.js';
 import testUtils from '/tests/ckeditor5/_utils/utils.js';
 
 testUtils.createSinonSandbox();
 
-describe( 'Formats', () => {
+describe( 'Headings', () => {
 	let editor, controller;
 
 	beforeEach( () => {
@@ -21,12 +21,12 @@ describe( 'Formats', () => {
 		document.body.appendChild( editorElement );
 
 		return ClassicTestEditor.create( editorElement, {
-			features: [ Formats ],
-			toolbar: [ 'formats' ]
+			features: [ Headings ],
+			toolbar: [ 'headings' ]
 		} )
 		.then( newEditor => {
 			editor = newEditor;
-			controller = editor.ui.featureComponents.create( 'formats' );
+			controller = editor.ui.featureComponents.create( 'headings' );
 		} );
 	} );
 
@@ -35,36 +35,36 @@ describe( 'Formats', () => {
 	} );
 
 	it( 'should be loaded', () => {
-		expect( editor.plugins.get( Formats ) ).to.be.instanceOf( Formats );
+		expect( editor.plugins.get( Headings ) ).to.be.instanceOf( Headings );
 	} );
 
 	it( 'should load FormatsEngine', () => {
-		expect( editor.plugins.get( FormatsEngine ) ).to.be.instanceOf( FormatsEngine );
+		expect( editor.plugins.get( HeadingsEngine ) ).to.be.instanceOf( HeadingsEngine );
 	} );
 
 	it( 'should register formats feature component', () => {
-		const controller = editor.ui.featureComponents.create( 'formats' );
+		const controller = editor.ui.featureComponents.create( 'headings' );
 
 		expect( controller ).to.be.instanceOf( ListDropdown );
 	} );
 
 	it( 'should execute format command on model execute event', () => {
 		const executeSpy = testUtils.sinon.spy( editor, 'execute' );
-		const controller = editor.ui.featureComponents.create( 'formats' );
+		const controller = editor.ui.featureComponents.create( 'headings' );
 		const model = controller.model.content;
 
 		model.fire( 'execute', { id: 'paragraph', label: 'Paragraph' } );
 
 		sinon.assert.calledOnce( executeSpy );
-		sinon.assert.calledWithExactly( executeSpy, 'format', 'paragraph' );
+		sinon.assert.calledWithExactly( executeSpy, 'headings', 'paragraph' );
 	} );
 
-	describe( 'model to commanad binding', () => {
+	describe( 'model to command binding', () => {
 		let model, command;
 
 		beforeEach( () => {
 			model = controller.model;
-			command = editor.commands.get( 'format' );
+			command = editor.commands.get( 'headings' );
 		} );
 
 		it( 'isEnabled', () => {

+ 3 - 3
packages/ckeditor5-heading/tests/formatscommand.js

@@ -6,7 +6,7 @@
 'use strict';
 
 import ModelTestEditor from '/tests/ckeditor5/_utils/modeltesteditor.js';
-import FormatsCommand from '/ckeditor5/formats/formatscommand.js';
+import HeadingsCommand from '/ckeditor5/headings/headingscommand.js';
 import Range from '/ckeditor5/engine/model/range.js';
 import { setData, getData } from '/tests/engine/_utils/model.js';
 
@@ -17,7 +17,7 @@ const formats = [
 	{ id: 'heading3', viewElement: 'h4' }
 ];
 
-describe( 'FormatsCommand', () => {
+describe( 'HeadingsCommand', () => {
 	let editor, document, command, root;
 
 	beforeEach( () => {
@@ -25,7 +25,7 @@ describe( 'FormatsCommand', () => {
 			.then( newEditor => {
 				editor = newEditor;
 				document = editor.document;
-				command = new FormatsCommand( editor, formats );
+				command = new HeadingsCommand( editor, formats );
 				const schema = document.schema;
 
 				for ( let format of formats ) {

+ 8 - 8
packages/ckeditor5-heading/tests/formatsengine.js

@@ -5,18 +5,18 @@
 
 'use strict';
 
-import FormatsEngine from '/ckeditor5/formats/formatsengine.js';
+import HeadingsEngine from '/ckeditor5/headings/headingsengine.js';
 import Paragraph from '/ckeditor5/paragraph/paragraph.js';
 import VirtualTestEditor from '/tests/ckeditor5/_utils/virtualtesteditor.js';
-import FormatsCommand from '/ckeditor5/formats/formatscommand.js';
+import HeadingsCommand from '/ckeditor5/headings/headingscommand.js';
 import { getData } from '/tests/engine/_utils/model.js';
 
-describe( 'FormatsEngine', () => {
+describe( 'HeadingsEngine', () => {
 	let editor, document;
 
 	beforeEach( () => {
 		return VirtualTestEditor.create( {
-			features: [ FormatsEngine ]
+			features: [ HeadingsEngine ]
 		} )
 		.then( newEditor => {
 			editor = newEditor;
@@ -25,7 +25,7 @@ describe( 'FormatsEngine', () => {
 	} );
 
 	it( 'should be loaded', () => {
-		expect( editor.plugins.get( FormatsEngine ) ).to.be.instanceOf( FormatsEngine );
+		expect( editor.plugins.get( HeadingsEngine ) ).to.be.instanceOf( HeadingsEngine );
 	} );
 
 	it( 'should load paragraph feature', () => {
@@ -48,10 +48,10 @@ describe( 'FormatsEngine', () => {
 	} );
 
 	it( 'should register format command', () => {
-		expect( editor.commands.has( 'format' ) ).to.be.true;
-		const command = editor.commands.get( 'format' );
+		expect( editor.commands.has( 'headings' ) ).to.be.true;
+		const command = editor.commands.get( 'headings' );
 
-		expect( command ).to.be.instanceOf( FormatsCommand );
+		expect( command ).to.be.instanceOf( HeadingsCommand );
 	} );
 
 	it( 'should convert heading1', () => {

+ 0 - 10
packages/ckeditor5-heading/tests/manual/formats.md

@@ -1,10 +0,0 @@
-@bender-ui: collapsed
-
-## Formats
-
-1. The data should be loaded with three headings and one paragraph.
-2. Put selection inside each block and check if dropdown label is changing properly.
-3. Play with formatting:
-	- Switch formats using dropdown.
-	- Apply same format twice to same block to see if its switching with paragraph.
-	- Put selection that spans across multiple blocks and switch formats.

packages/ckeditor5-heading/tests/manual/formats.html → packages/ckeditor5-heading/tests/manual/headings.html


+ 2 - 2
packages/ckeditor5-heading/tests/manual/formats.js

@@ -10,8 +10,8 @@
 import ClassicEditor from '/ckeditor5/creator-classic/classic.js';
 
 ClassicEditor.create( document.querySelector( '#editor' ), {
-	features: [ 'delete', 'enter', 'typing', 'paragraph', 'formats' ],
-	toolbar: [ 'formats' ]
+	features: [ 'delete', 'enter', 'typing', 'headings' ],
+	toolbar: [ 'headings' ]
 } )
 	.then( editor => {
 		window.editor = editor;

+ 10 - 0
packages/ckeditor5-heading/tests/manual/headings.md

@@ -0,0 +1,10 @@
+@bender-ui: collapsed
+
+## Headings
+
+1. The data should be loaded with three headings and one paragraph.
+2. Put selection inside each block and check if dropdown label is changing properly.
+3. Play with headings:
+	- Switch headings using dropdown.
+	- Apply same heading twice to same block to see if its switching with paragraph.
+	- Put selection that spans across multiple blocks and switch headings.