Skip to content

Commit 8218133

Browse files
committed
fix getContent
1 parent 0918621 commit 8218133

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/pen.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*! Licensed under MIT, https://github.com/sofish/pen */
2-
;(function(root, doc) {
2+
(function(root, doc) {
33

44
var Pen, debugMode, selection, utils = {};
55
var toString = Object.prototype.toString;
@@ -342,10 +342,10 @@
342342
}
343343

344344
function removeListener(ctx, target, type, listener) {
345-
var events = events = ctx._events[type];
345+
var events = ctx._events[type];
346346
if (!events) {
347347
var _index = ctx._eventTargets.indexOf(target);
348-
if (_index >= 0) events = ctx._eventsCache[_index][type]
348+
if (_index >= 0) events = ctx._eventsCache[_index][type];
349349
}
350350
if (!events) return ctx;
351351
var index = events.indexOf(listener);
@@ -525,7 +525,7 @@
525525
};
526526

527527
Pen.prototype.getContent = function() {
528-
return trim(this.config.editor.innerHTML);
528+
return this.isEmpty() ? '' : trim(this.config.editor.innerHTML);
529529
};
530530

531531
Pen.prototype.setContent = function(html) {

0 commit comments

Comments
 (0)