Skip to content

Commit

Permalink
destroy editor in demo before booting a new one
Browse files Browse the repository at this point in the history
  • Loading branch information
bantic committed Jul 17, 2015
1 parent 27cd46e commit 5b59865
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ function removeChildren(element) {
}
}

var editor;

var selfieCard = {
name: 'selfie-card',
display: {
Expand Down Expand Up @@ -214,7 +216,10 @@ var ContentKitDemo = exports.ContentKitDemo = {
};

function bootEditor(element, mobiledoc) {
var editor = new ContentKit.Editor(element, {
if (editor) {
editor.destroy();
}
editor = new ContentKit.Editor(element, {
autofocus: false,
mobiledoc: mobiledoc,
cards: [simpleCard, cardWithEditMode, cardWithInput, selfieCard]
Expand Down Expand Up @@ -345,7 +350,6 @@ var sampleMobiledocs = {


$(function() {
var editor;
var editorEl = $('#editor')[0];
var mobiledoc = sampleMobiledocs.simpleMobiledoc;

Expand Down

0 comments on commit 5b59865

Please sign in to comment.