Unverified Commit c13766c9 authored by Maciej's avatar Maciej Committed by GitHub

Merge pull request #26 from ckeditor/t/23

Docs: Fixed code listing in the README.md. Closes #23.
parents 09f0f1b2 966d5aff
...@@ -31,17 +31,18 @@ npm install --save @ckeditor/ckeditor5-build-decoupled-document ...@@ -31,17 +31,18 @@ npm install --save @ckeditor/ckeditor5-build-decoupled-document
And use it in your website: And use it in your website:
```html ```html
<div id="toolbar-container"></div>
<div id="editor"> <div id="editor">
<p>This is the editor content.</p> <p>This is the editor content.</p>
</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>
DecoupledEditor DecoupledEditor
.create( '<h2>Hello world!</h2>', { .create( document.querySelector( '#editor' ) )
toolbarContainer: document.querySelector( '.toolbar-container' ),
editableContainer: document.querySelector( '.editable-container' )
} )
.then( editor => { .then( editor => {
// The toolbar needs to be explicitly appended.
document.querySelector( '#toolbar-container' ).appendChild( editor.ui.view.toolbar.element );
window.editor = editor; window.editor = editor;
} ) } )
.catch( err => { .catch( err => {
...@@ -59,13 +60,13 @@ import DecoupledEditor from '@ckeditor/ckeditor5-build-decoupled-document'; ...@@ -59,13 +60,13 @@ import DecoupledEditor from '@ckeditor/ckeditor5-build-decoupled-document';
// const DecoupledEditor = require( '@ckeditor/ckeditor5-build-decoupled-document' ); // const DecoupledEditor = require( '@ckeditor/ckeditor5-build-decoupled-document' );
DecoupledEditor DecoupledEditor
.create( '<h2>Hello world!</h2>', { .create( document.querySelector( '#editor' ) )
toolbarContainer: document.querySelector( '.toolbar-container' ), .then( editor => {
editableContainer: document.querySelector( '.editable-container' ) // The toolbar needs to be explicitly appended.
} ) document.querySelector( '#toolbar-container' ).appendChild( editor.ui.view.toolbar.element );
.then( editor => {
window.editor = editor; window.editor = editor;
} ) } )
.catch( err => { .catch( err => {
console.error( err.stack ); console.error( err.stack );
} ); } );
......
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