Permalink
Browse files

Fix: It will be possible to configure toolbar offset without overridi…

…ng preconfigured toolbar items. See ckeditor/ckeditor5#572.
  • Loading branch information...
Reinmar committed Sep 30, 2017
1 parent 668691f commit e7fbda92d35ba5ac7ed227dadaffe85b96dee3f3
Showing with 73 additions and 22 deletions.
  1. +13 −11 build-config.js
  2. +13 −11 src/ckeditor.js
  3. +47 −0 tests/ckeditor.js
@@ -38,17 +38,19 @@ module.exports = {

// Editor config.
config: {
toolbar: [
'headings',
'bold',
'italic',
'link',
'bulletedList',
'numberedList',
'blockQuote',
'undo',
'redo'
],
toolbar: {
items: [
'headings',
'bold',
'italic',
'link',
'bulletedList',
'numberedList',
'blockQuote',
'undo',
'redo'
]
},

image: {
toolbar: [ 'imageStyleFull', 'imageStyleSide', '|', 'imageTextAlternative' ]
@@ -43,17 +43,19 @@ ClassicEditor.build = {
ImageuploadPlugin
],
config: {
toolbar: [
'headings',
'bold',
'italic',
'link',
'bulletedList',
'numberedList',
'blockQuote',
'undo',
'redo'
],
toolbar: {
items: [
'headings',
'bold',
'italic',
'link',
'bulletedList',
'numberedList',
'blockQuote',
'undo',
'redo'
]
},
image: {
toolbar: [
'imageStyleFull',
@@ -20,6 +20,7 @@ describe( 'ClassicEditor build', () => {

afterEach( () => {
editorElement.remove();
editor = null;
} );

describe( 'buid', () => {
@@ -82,6 +83,17 @@ describe( 'ClassicEditor build', () => {
} );

describe( 'plugins', () => {
beforeEach( () => {
return ClassicEditor.create( editorElement )
.then( newEditor => {
editor = newEditor;
} );
} );

afterEach( () => {
return editor.destroy();
} );

it( 'paragraph works', () => {
const data = '<p>Some text inside a paragraph.</p>';

@@ -153,4 +165,39 @@ describe( 'ClassicEditor build', () => {
expect( editor.getData() ).to.equal( data );
} );
} );

describe( 'config', () => {
afterEach( () => {
return editor.destroy();
} );

// https://github.com/ckeditor/ckeditor5/issues/572
it( 'allows configure toolbar items through config.toolbar', () => {
return ClassicEditor
.create( editorElement, {
toolbar: [ 'bold' ]
} )
.then( newEditor => {
editor = newEditor;

expect( editor.ui.view.toolbar.items.length ).to.equal( 1 );
} );
} );

// https://github.com/ckeditor/ckeditor5/issues/572
it( 'allows configure toolbar offset without overriding toolbar items', () => {
return ClassicEditor
.create( editorElement, {
toolbar: {
viewportTopOffset: 42
}
} )
.then( newEditor => {
editor = newEditor;

expect( editor.ui.view.toolbar.items.length ).to.equal( 9 );
expect( editor.ui.view.stickyPanel.viewportTopOffset ).to.equal( 42 );
} );
} );
} );
} );

0 comments on commit e7fbda9

Please sign in to comment.