Commit bc9da6a3 authored by Piotrek Koszuliński's avatar Piotrek Koszuliński

Other: Renamed the export name from `DecoupledDocumentEditor` to `DecoupledEditor`. Closes #6.

BREAKING CHANGES: The global variable exported by the build is now called `DecoupledEditor` instead of `DecoupledDocumentEditor`. See #6.
parent 7b4aef11
...@@ -33,7 +33,7 @@ And use it in your website: ...@@ -33,7 +33,7 @@ And use it in your website:
</div> </div>
<script src="./node_modules/@ckeditor/ckeditor5-build-decoupled-document/build/ckeditor.js"></script> <script src="./node_modules/@ckeditor/ckeditor5-build-decoupled-document/build/ckeditor.js"></script>
<script> <script>
DecoupledDocumentEditor DecoupledEditor
.create( '<h2>Hello world!</h2>', { .create( '<h2>Hello world!</h2>', {
toolbarContainer: document.querySelector( '.toolbar-container' ), toolbarContainer: document.querySelector( '.toolbar-container' ),
editableContainer: document.querySelector( '.editable-container' ) editableContainer: document.querySelector( '.editable-container' )
...@@ -50,12 +50,12 @@ And use it in your website: ...@@ -50,12 +50,12 @@ And use it in your website:
Or in your JavaScript application: Or in your JavaScript application:
```js ```js
import DecoupledDocumentEditor from '@ckeditor/ckeditor5-build-decoupled-document'; import DecoupledEditor from '@ckeditor/ckeditor5-build-decoupled-document';
// Or using the CommonJS version: // Or using the CommonJS version:
// const DecoupledDocumentEditor = require( '@ckeditor/ckeditor5-build-decoupled-document' ); // const DecoupledEditor = require( '@ckeditor/ckeditor5-build-decoupled-document' );
DecoupledDocumentEditor DecoupledEditor
.create( '<h2>Hello world!</h2>', { .create( '<h2>Hello world!</h2>', {
toolbarContainer: document.querySelector( '.toolbar-container' ), toolbarContainer: document.querySelector( '.toolbar-container' ),
editableContainer: document.querySelector( '.editable-container' ) editableContainer: document.querySelector( '.editable-container' )
......
...@@ -10,7 +10,7 @@ module.exports = { ...@@ -10,7 +10,7 @@ module.exports = {
editor: '@ckeditor/ckeditor5-editor-decoupled/src/decouplededitor', editor: '@ckeditor/ckeditor5-editor-decoupled/src/decouplededitor',
// The name under which the editor will be exported. // The name under which the editor will be exported.
moduleName: 'DecoupledDocumentEditor', moduleName: 'DecoupledEditor',
// Plugins to include in the build. // Plugins to include in the build.
plugins: [ plugins: [
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
</figure> </figure>
<p>You can use this sample to validate whether your <a href="https://docs.ckeditor.com/ckeditor5/latest/builds/guides/development/custom-builds.html">custom build</a> works fine.</p>`; <p>You can use this sample to validate whether your <a href="https://docs.ckeditor.com/ckeditor5/latest/builds/guides/development/custom-builds.html">custom build</a> works fine.</p>`;
DecoupledDocumentEditor.create( editorData ) DecoupledEditor.create( editorData )
.then( editor => { .then( editor => {
window.editor = editor; window.editor = editor;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* For licensing, see LICENSE.md. * For licensing, see LICENSE.md.
*/ */
import DecoupledDocumentEditorBase from '@ckeditor/ckeditor5-editor-decoupled/src/decouplededitor'; import DecoupledEditorBase from '@ckeditor/ckeditor5-editor-decoupled/src/decouplededitor';
import EssentialsPlugin from '@ckeditor/ckeditor5-essentials/src/essentials'; import EssentialsPlugin from '@ckeditor/ckeditor5-essentials/src/essentials';
import AlignmentPlugin from '@ckeditor/ckeditor5-alignment/src/alignment'; import AlignmentPlugin from '@ckeditor/ckeditor5-alignment/src/alignment';
import FontsizePlugin from '@ckeditor/ckeditor5-font/src/fontsize'; import FontsizePlugin from '@ckeditor/ckeditor5-font/src/fontsize';
...@@ -27,9 +27,9 @@ import LinkPlugin from '@ckeditor/ckeditor5-link/src/link'; ...@@ -27,9 +27,9 @@ import LinkPlugin from '@ckeditor/ckeditor5-link/src/link';
import ListPlugin from '@ckeditor/ckeditor5-list/src/list'; import ListPlugin from '@ckeditor/ckeditor5-list/src/list';
import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph'; import ParagraphPlugin from '@ckeditor/ckeditor5-paragraph/src/paragraph';
export default class DecoupledDocumentEditor extends DecoupledDocumentEditorBase {} export default class DecoupledEditor extends DecoupledEditorBase {}
DecoupledDocumentEditor.build = { DecoupledEditor.build = {
plugins: [ plugins: [
EssentialsPlugin, EssentialsPlugin,
AlignmentPlugin, AlignmentPlugin,
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
/* globals document */ /* globals document */
import DecoupledDocumentEditor from '../src/ckeditor'; import DecoupledEditor from '../src/ckeditor';
import DecoupledEditor from '@ckeditor/ckeditor5-editor-decoupled/src/decouplededitor'; import BaseDecoupledEditor from '@ckeditor/ckeditor5-editor-decoupled/src/decouplededitor';
describe( 'DecoupledDocumentEditor build', () => { describe( 'DecoupledEditor build', () => {
let editor, editorData, editorElement; let editor, editorData, editorElement;
beforeEach( () => { beforeEach( () => {
...@@ -27,11 +27,11 @@ describe( 'DecoupledDocumentEditor build', () => { ...@@ -27,11 +27,11 @@ describe( 'DecoupledDocumentEditor build', () => {
describe( 'buid', () => { describe( 'buid', () => {
it( 'contains plugins', () => { it( 'contains plugins', () => {
expect( DecoupledDocumentEditor.build.plugins ).to.not.be.empty; expect( DecoupledEditor.build.plugins ).to.not.be.empty;
} ); } );
it( 'contains config', () => { it( 'contains config', () => {
expect( DecoupledDocumentEditor.build.config.toolbar ).to.not.be.empty; expect( DecoupledEditor.build.config.toolbar ).to.not.be.empty;
} ); } );
} ); } );
...@@ -39,7 +39,7 @@ describe( 'DecoupledDocumentEditor build', () => { ...@@ -39,7 +39,7 @@ describe( 'DecoupledDocumentEditor build', () => {
test( () => editorData ); test( () => editorData );
it( 'does not define the UI DOM structure', () => { it( 'does not define the UI DOM structure', () => {
return DecoupledDocumentEditor.create( editorData ) return DecoupledEditor.create( editorData )
.then( newEditor => { .then( newEditor => {
expect( newEditor.ui.view.element ).to.be.null; expect( newEditor.ui.view.element ).to.be.null;
expect( newEditor.ui.view.toolbar.element.parentElement ).to.be.null; expect( newEditor.ui.view.toolbar.element.parentElement ).to.be.null;
...@@ -52,7 +52,7 @@ describe( 'DecoupledDocumentEditor build', () => { ...@@ -52,7 +52,7 @@ describe( 'DecoupledDocumentEditor build', () => {
test( () => editorElement ); test( () => editorElement );
it( 'uses the provided editable element', () => { it( 'uses the provided editable element', () => {
return DecoupledDocumentEditor.create( editorElement ) return DecoupledEditor.create( editorElement )
.then( newEditor => { .then( newEditor => {
expect( newEditor.ui.view.editable.element.parentElement ).to.equal( document.body ); expect( newEditor.ui.view.editable.element.parentElement ).to.equal( document.body );
} ); } );
...@@ -62,7 +62,7 @@ describe( 'DecoupledDocumentEditor build', () => { ...@@ -62,7 +62,7 @@ describe( 'DecoupledDocumentEditor build', () => {
function test( getEditorDataOrElement ) { function test( getEditorDataOrElement ) {
describe( 'create()', () => { describe( 'create()', () => {
beforeEach( () => { beforeEach( () => {
return DecoupledDocumentEditor.create( getEditorDataOrElement() ) return DecoupledEditor.create( getEditorDataOrElement() )
.then( newEditor => { .then( newEditor => {
editor = newEditor; editor = newEditor;
} ); } );
...@@ -72,9 +72,9 @@ describe( 'DecoupledDocumentEditor build', () => { ...@@ -72,9 +72,9 @@ describe( 'DecoupledDocumentEditor build', () => {
return editor.destroy(); return editor.destroy();
} ); } );
it( 'creates an instance which inherits from the DecoupledDocumentEditor', () => { it( 'creates an instance which inherits from the DecoupledEditor', () => {
expect( editor ).to.be.instanceof( DecoupledDocumentEditor ); expect( editor ).to.be.instanceof( BaseDecoupledEditor );
expect( editor ).to.be.instanceof( DecoupledEditor ); expect( editor ).to.be.instanceof( BaseDecoupledEditor );
} ); } );
it( 'loads passed data', () => { it( 'loads passed data', () => {
...@@ -84,7 +84,7 @@ describe( 'DecoupledDocumentEditor build', () => { ...@@ -84,7 +84,7 @@ describe( 'DecoupledDocumentEditor build', () => {
describe( 'destroy()', () => { describe( 'destroy()', () => {
beforeEach( () => { beforeEach( () => {
return DecoupledDocumentEditor.create( getEditorDataOrElement() ) return DecoupledEditor.create( getEditorDataOrElement() )
.then( newEditor => { .then( newEditor => {
editor = newEditor; editor = newEditor;
} ); } );
...@@ -93,7 +93,7 @@ describe( 'DecoupledDocumentEditor build', () => { ...@@ -93,7 +93,7 @@ describe( 'DecoupledDocumentEditor build', () => {
describe( 'plugins', () => { describe( 'plugins', () => {
beforeEach( () => { beforeEach( () => {
return DecoupledDocumentEditor.create( getEditorDataOrElement() ) return DecoupledEditor.create( getEditorDataOrElement() )
.then( newEditor => { .then( newEditor => {
editor = newEditor; editor = newEditor;
} ); } );
...@@ -212,7 +212,7 @@ describe( 'DecoupledDocumentEditor build', () => { ...@@ -212,7 +212,7 @@ describe( 'DecoupledDocumentEditor build', () => {
// https://github.com/ckeditor/ckeditor5/issues/572 // https://github.com/ckeditor/ckeditor5/issues/572
it( 'allows configure toolbar items through config.toolbar', () => { it( 'allows configure toolbar items through config.toolbar', () => {
return DecoupledDocumentEditor return DecoupledEditor
.create( getEditorDataOrElement(), { .create( getEditorDataOrElement(), {
toolbar: [ 'bold' ] toolbar: [ 'bold' ]
} ) } )
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
* For licensing, see LICENSE.md. * For licensing, see LICENSE.md.
*/ */
const DecoupledDocumentEditor = require( '../../build/ckeditor' ); const DecoupledEditor = require( '../../build/ckeditor' );
DecoupledDocumentEditor.create( document.querySelector( '#editor' ) ) DecoupledEditor.create( document.querySelector( '#editor' ) )
.then( editor => { .then( editor => {
document.querySelector( '.toolbar-container' ).appendChild( editor.ui.view.toolbar.element ); document.querySelector( '.toolbar-container' ).appendChild( editor.ui.view.toolbar.element );
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
* For licensing, see LICENSE.md. * For licensing, see LICENSE.md.
*/ */
import DecoupledDocumentEditor from '../../build/ckeditor'; import DecoupledEditor from '../../build/ckeditor';
DecoupledDocumentEditor.create( document.querySelector( '#editor' ) ) DecoupledEditor.create( document.querySelector( '#editor' ) )
.then( editor => { .then( editor => {
document.querySelector( '.toolbar-container' ).appendChild( editor.ui.view.toolbar.element ); document.querySelector( '.toolbar-container' ).appendChild( editor.ui.view.toolbar.element );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment