From 73332a18780ac090134c63929f05da6a95c918a4 Mon Sep 17 00:00:00 2001 From: mcmics Date: Wed, 2 Jan 2019 13:25:27 +0100 Subject: [PATCH 1/6] Fix: Provide h4, h5, h6 as defaultIcons for button view --- src/headingbuttonsui.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/headingbuttonsui.js b/src/headingbuttonsui.js index 890c868..35c24cb 100644 --- a/src/headingbuttonsui.js +++ b/src/headingbuttonsui.js @@ -1,5 +1,5 @@ /** - * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved. + * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md. */ @@ -14,11 +14,17 @@ import { getLocalizedOptions } from './utils'; import iconHeading1 from '../theme/icons/heading1.svg'; import iconHeading2 from '../theme/icons/heading2.svg'; import iconHeading3 from '../theme/icons/heading3.svg'; +import iconHeading4 from '../theme/icons/heading4.svg'; +import iconHeading5 from '../theme/icons/heading5.svg'; +import iconHeading6 from '../theme/icons/heading6.svg'; const defaultIcons = { heading1: iconHeading1, heading2: iconHeading2, - heading3: iconHeading3 + heading3: iconHeading3, + heading4: iconHeading4, + heading5: iconHeading5, + heading6: iconHeading6 }; /** From 76a4dcde2751bec3d885486ac1a32941e99ea249 Mon Sep 17 00:00:00 2001 From: mcmics Date: Wed, 2 Jan 2019 15:00:38 +0100 Subject: [PATCH 2/6] Provide h4, h5, h6 as defaultIcons for button view and add translations for items --- lang/contexts.json | 5 ++++- lang/translations/de.po | 12 ++++++++++++ lang/translations/en.po | 12 ++++++++++++ src/utils.js | 5 ++++- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/lang/contexts.json b/lang/contexts.json index 958920a..f969773 100644 --- a/lang/contexts.json +++ b/lang/contexts.json @@ -4,5 +4,8 @@ "Choose heading": "Default label for the heading dropdown.", "Heading 1": "Dropdown option label for the heading level 1 format.", "Heading 2": "Dropdown option label for the heading level 2 format.", - "Heading 3": "Dropdown option label for the heading level 3 format." + "Heading 3": "Dropdown option label for the heading level 3 format.", + "Heading 4": "Dropdown option label for the heading level 4 format.", + "Heading 5": "Dropdown option label for the heading level 5 format.", + "Heading 6": "Dropdown option label for the heading level 6 format." } diff --git a/lang/translations/de.po b/lang/translations/de.po index bf57e0b..d8647ca 100644 --- a/lang/translations/de.po +++ b/lang/translations/de.po @@ -28,3 +28,15 @@ msgstr "Überschrift 2" msgctxt "Dropdown option label for the heading level 3 format." msgid "Heading 3" msgstr "Überschrift 3" + +msgctxt "Dropdown option label for the heading level 4 format." +msgid "Heading 4" +msgstr "Überschrift 4" + +msgctxt "Dropdown option label for the heading level 5 format." +msgid "Heading 5" +msgstr "Überschrift 5" + +msgctxt "Dropdown option label for the heading level 6 format." +msgid "Heading 6" +msgstr "Überschrift 6" diff --git a/lang/translations/en.po b/lang/translations/en.po index 377a9ae..a93806e 100644 --- a/lang/translations/en.po +++ b/lang/translations/en.po @@ -28,3 +28,15 @@ msgstr "Heading 2" msgctxt "Dropdown option label for the heading level 3 format." msgid "Heading 3" msgstr "Heading 3" + +msgctxt "Dropdown option label for the heading level 4 format." +msgid "Heading 4" +msgstr "Heading 4" + +msgctxt "Dropdown option label for the heading level 5 format." +msgid "Heading 5" +msgstr "Heading 5" + +msgctxt "Dropdown option label for the heading level 6 format." +msgid "Heading 6" +msgstr "Heading 6" diff --git a/src/utils.js b/src/utils.js index 2c23183..d403523 100644 --- a/src/utils.js +++ b/src/utils.js @@ -15,7 +15,10 @@ export function getLocalizedOptions( editor ) { Paragraph: t( 'Paragraph' ), 'Heading 1': t( 'Heading 1' ), 'Heading 2': t( 'Heading 2' ), - 'Heading 3': t( 'Heading 3' ) + 'Heading 3': t( 'Heading 3' ), + 'Heading 4': t( 'Heading 4' ), + 'Heading 5': t( 'Heading 5' ), + 'Heading 6': t( 'Heading 6' ) }; return editor.config.get( 'heading.options' ).map( option => { From f188bcd9275b2a553c6f0fa046eee2d61d7b03d2 Mon Sep 17 00:00:00 2001 From: Aleksander Nowodzinski Date: Thu, 3 Jan 2019 15:49:08 +0100 Subject: [PATCH 3/6] Reverted translation changes, which are auto-generated by Transifex scripts. --- lang/translations/de.po | 12 ------------ lang/translations/en.po | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/lang/translations/de.po b/lang/translations/de.po index d8647ca..bf57e0b 100644 --- a/lang/translations/de.po +++ b/lang/translations/de.po @@ -28,15 +28,3 @@ msgstr "Überschrift 2" msgctxt "Dropdown option label for the heading level 3 format." msgid "Heading 3" msgstr "Überschrift 3" - -msgctxt "Dropdown option label for the heading level 4 format." -msgid "Heading 4" -msgstr "Überschrift 4" - -msgctxt "Dropdown option label for the heading level 5 format." -msgid "Heading 5" -msgstr "Überschrift 5" - -msgctxt "Dropdown option label for the heading level 6 format." -msgid "Heading 6" -msgstr "Überschrift 6" diff --git a/lang/translations/en.po b/lang/translations/en.po index a93806e..377a9ae 100644 --- a/lang/translations/en.po +++ b/lang/translations/en.po @@ -28,15 +28,3 @@ msgstr "Heading 2" msgctxt "Dropdown option label for the heading level 3 format." msgid "Heading 3" msgstr "Heading 3" - -msgctxt "Dropdown option label for the heading level 4 format." -msgid "Heading 4" -msgstr "Heading 4" - -msgctxt "Dropdown option label for the heading level 5 format." -msgid "Heading 5" -msgstr "Heading 5" - -msgctxt "Dropdown option label for the heading level 6 format." -msgid "Heading 6" -msgstr "Heading 6" From 0476e08a717c911f9203c3b21a43264346652301 Mon Sep 17 00:00:00 2001 From: Aleksander Nowodzinski Date: Thu, 3 Jan 2019 16:01:34 +0100 Subject: [PATCH 4/6] Tests: Included the heading[4,5,6] UI components in heading buttons tests. --- tests/headingbuttonsui.js | 16 +++++++++++++++- tests/manual/heading-buttons.js | 13 ++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/headingbuttonsui.js b/tests/headingbuttonsui.js index 5f87d5c..c8bfc1f 100644 --- a/tests/headingbuttonsui.js +++ b/tests/headingbuttonsui.js @@ -24,7 +24,18 @@ describe( 'HeadingButtonUI', () => { return ClassicTestEditor .create( editorElement, { plugins: [ HeadingButtonsUI, HeadingEditing ], - toolbar: [ 'heading1', 'heading2', 'heading3' ] + toolbar: [ 'heading1', 'heading2', 'heading3', 'heading3' ], + heading: { + options: [ + { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' }, + { model: 'heading1', view: 'h2', title: 'Heading 1', class: 'ck-heading_heading1' }, + { model: 'heading2', view: 'h3', title: 'Heading 2', class: 'ck-heading_heading2' }, + { model: 'heading3', view: 'h4', title: 'Heading 3', class: 'ck-heading_heading3' }, + { model: 'heading4', view: 'h5', title: 'Heading 4', class: 'ck-heading_heading4' }, + { model: 'heading5', view: 'h6', title: 'Heading 5', class: 'ck-heading_heading5' }, + { model: 'heading6', view: 'p', title: 'Heading 6', class: 'ck-heading_heading6' } + ] + } } ) .then( newEditor => { editor = newEditor; @@ -46,6 +57,9 @@ describe( 'HeadingButtonUI', () => { expect( factory.create( 'heading1' ) ).to.be.instanceOf( ButtonView ); expect( factory.create( 'heading2' ) ).to.be.instanceOf( ButtonView ); expect( factory.create( 'heading3' ) ).to.be.instanceOf( ButtonView ); + expect( factory.create( 'heading4' ) ).to.be.instanceOf( ButtonView ); + expect( factory.create( 'heading5' ) ).to.be.instanceOf( ButtonView ); + expect( factory.create( 'heading6' ) ).to.be.instanceOf( ButtonView ); } ); it( 'should intialize buttons with correct localized data', () => { diff --git a/tests/manual/heading-buttons.js b/tests/manual/heading-buttons.js index 270497a..23aa2ff 100644 --- a/tests/manual/heading-buttons.js +++ b/tests/manual/heading-buttons.js @@ -17,7 +17,18 @@ import Undo from '@ckeditor/ckeditor5-undo/src/undo'; ClassicEditor .create( document.querySelector( '#editor' ), { plugins: [ Enter, Typing, Undo, Heading, Paragraph, HeadingButtonsUI, ParagraphButtonUI ], - toolbar: [ 'paragraph', 'heading1', 'heading2', 'heading3', '|', 'undo', 'redo' ] + toolbar: [ 'paragraph', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6', '|', 'undo', 'redo' ], + heading: { + options: [ + { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' }, + { model: 'heading1', view: 'h2', title: 'Heading 1', class: 'ck-heading_heading1' }, + { model: 'heading2', view: 'h3', title: 'Heading 2', class: 'ck-heading_heading2' }, + { model: 'heading3', view: 'h4', title: 'Heading 3', class: 'ck-heading_heading3' }, + { model: 'heading4', view: 'h5', title: 'Heading 4', class: 'ck-heading_heading4' }, + { model: 'heading5', view: 'h6', title: 'Heading 5', class: 'ck-heading_heading5' }, + { model: 'heading6', view: 'p', title: 'Heading 6', class: 'ck-heading_heading6' } + ] + } } ) .then( editor => { window.editor = editor; From c672a0ed407e1ebbb515f10a793b627c1aa1f915 Mon Sep 17 00:00:00 2001 From: Aleksander Nowodzinski Date: Thu, 3 Jan 2019 16:02:53 +0100 Subject: [PATCH 5/6] Docs: Reverted the headingbuttonsui copyright year. To be bumped in the entire project. --- src/headingbuttonsui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/headingbuttonsui.js b/src/headingbuttonsui.js index 35c24cb..57a871f 100644 --- a/src/headingbuttonsui.js +++ b/src/headingbuttonsui.js @@ -1,5 +1,5 @@ /** - * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved. + * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md. */ From 5175878123abf2c5c6c2ee51ea027f896d1c9a09 Mon Sep 17 00:00:00 2001 From: Aleksander Nowodzinski Date: Fri, 4 Jan 2019 10:49:26 +0100 Subject: [PATCH 6/6] Tests: Provided the missing toolbar configuration in the HeadingButtonUI tests. --- tests/headingbuttonsui.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/headingbuttonsui.js b/tests/headingbuttonsui.js index c8bfc1f..b4bae0c 100644 --- a/tests/headingbuttonsui.js +++ b/tests/headingbuttonsui.js @@ -24,7 +24,7 @@ describe( 'HeadingButtonUI', () => { return ClassicTestEditor .create( editorElement, { plugins: [ HeadingButtonsUI, HeadingEditing ], - toolbar: [ 'heading1', 'heading2', 'heading3', 'heading3' ], + toolbar: [ 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6' ], heading: { options: [ { model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },