diff --git a/src/js/parsers/section.js b/src/js/parsers/section.js index 9d3fa1d3b..e7da4a8ec 100644 --- a/src/js/parsers/section.js +++ b/src/js/parsers/section.js @@ -69,14 +69,18 @@ class SectionParser { this._updateStateFromElement(element); - let childNodes = isTextNode(element) ? [element] : element.childNodes; + let finished = this.runPlugins(element); - if (this.state.section.isListSection) { - this.parseListItems(childNodes); - } else { - forEach(childNodes, el => { - this.parseNode(el); - }); + if (!finished) { + let childNodes = isTextNode(element) ? [element] : element.childNodes; + + if (this.state.section.isListSection) { + this.parseListItems(childNodes); + } else { + forEach(childNodes, el => { + this.parseNode(el); + }); + } } this._closeCurrentSection(); diff --git a/tests/unit/editor/editor-test.js b/tests/unit/editor/editor-test.js index 3cde5ee67..c74b485ff 100644 --- a/tests/unit/editor/editor-test.js +++ b/tests/unit/editor/editor-test.js @@ -354,7 +354,7 @@ test('editor parses HTML post using parser plugins', (assert) => { editor = new Editor({html, parserPlugins: [parserPlugin]}); assert.ok(!!editor.post, 'editor loads post'); - assert.deepEqual(seenTagNames, ['TEXTAREA', 'IMG']); + assert.deepEqual(seenTagNames, ['P', 'TEXTAREA', 'IMG']); }); test('#activeMarkups returns the markups at cursor when range is collapsed', (assert) => { diff --git a/tests/unit/parsers/html-test.js b/tests/unit/parsers/html-test.js index 10efd7747..ce99ac37f 100644 --- a/tests/unit/parsers/html-test.js +++ b/tests/unit/parsers/html-test.js @@ -47,25 +47,37 @@ test('newlines ("\\n") are replaced with space characters', (assert) => { // see https://github.com/bustlelabs/mobiledoc-kit/issues/494 test('top-level unknown void elements are parsed', (assert) => { let html = `