This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
122 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<p> | ||
<button id="destroyEditor">Destroy editor</button> | ||
<button id="initEditor">Init editor</button> | ||
</p> | ||
|
||
<div class="container"></div> | ||
|
||
<style> | ||
body { | ||
width: 10000px; | ||
height: 10000px; | ||
} | ||
|
||
|
||
.container { | ||
padding: 20px; | ||
width: 500px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md. | ||
*/ | ||
|
||
/* globals console:false, document, window */ | ||
|
||
import BalloonEditor from '../../src/ballooneditor'; | ||
import ArticlePluginSet from '@ckeditor/ckeditor5-core/tests/_utils/articlepluginset'; | ||
|
||
window.editors = []; | ||
const container = document.querySelector( '.container' ); | ||
|
||
function initEditor() { | ||
BalloonEditor | ||
.create( '<h2>Editor 1</h2><p>This is an editor instance.</p>', { | ||
plugins: [ ArticlePluginSet ], | ||
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', 'undo', 'redo' ] | ||
} ) | ||
.then( editor => { | ||
window.editors.push( editor ); | ||
container.appendChild( editor.element ); | ||
} ) | ||
.catch( err => { | ||
console.error( err.stack ); | ||
} ); | ||
} | ||
|
||
function destroyEditor() { | ||
window.editors.forEach( editor => { | ||
editor.destroy() | ||
.then( () => { | ||
editor.element.remove(); | ||
} ); | ||
} ); | ||
} | ||
|
||
document.getElementById( 'initEditor' ).addEventListener( 'click', initEditor ); | ||
document.getElementById( 'destroyEditor' ).addEventListener( 'click', destroyEditor ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
1. Click "Init editor". | ||
2. New editor instance should be appended to the document with initial data in it. | ||
3. After clicking "Destroy editor" all editors should be removed from the document. |