Skip to content

Commit c988fc1

Browse files
committed
Merge remote-tracking branch 'rosey/fix_paste' into develop
2 parents 061549f + b9d47b1 commit c988fc1

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/__test__/plugin-test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,14 @@ describe('draft-js-markdown-shortcuts-plugin', () => {
387387
expect(modifierSpy).to.have.been.calledWith(currentEditorState, 'hello');
388388
});
389389
});
390+
describe('non-string empty value in clipboard', () => {
391+
beforeEach(() => {
392+
pastedText = null;
393+
});
394+
it('returns not-handled', () => {
395+
expect(subject()).to.equal('not-handled');
396+
});
397+
});
390398
describe('pasted just text with new line code', () => {
391399
beforeEach(() => {
392400
pastedText = 'hello\nworld';

src/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ const createMarkdownShortcutsPlugin = (config = { insertEmptyBlockOnReturnWithMo
152152
if (html) {
153153
return 'not-handled';
154154
}
155+
156+
if (!text) {
157+
return 'not-handled';
158+
}
159+
155160
let newEditorState = editorState;
156161
let buffer = [];
157162
for (let i = 0; i < text.length; i += 1) {

0 commit comments

Comments
 (0)