fix(editor): Fix hashtags not working after embeded content

Up to this point, once you've inserted a given URL to the editor, and it renders a new embeded content, if you hit Return, and try using a tag, or mention, it would not work since the paragraph was never closed, causing a sintatic error that rendered the mentions unable to be used unless you explicitly hit return again, to escape the given text block you were in. See the PR/Issue for further info.
This commit is contained in:
Marco Bomfim 2019-11-06 16:24:48 -03:00
parent 5609622e4a
commit f921244661
2 changed files with 14 additions and 18 deletions

View File

@ -63,30 +63,26 @@ describe('defaultExtensions', () => {
it('recognizes embed code', () => { it('recognizes embed code', () => {
const editor = createEditor() const editor = createEditor()
const expected = { const expected = {
type: 'doc',
content: [ content: [
{ {
type: 'paragraph',
content: [ content: [
{ {
text: 'Baby loves cat:', text: 'Baby loves cat:',
type: 'text', type: 'text'
}, }
], ]
type: 'paragraph',
}, },
{ {
content: [ type: 'embed',
{ attrs: {
attrs: { dataEmbedUrl: 'https://www.youtube.com/watch?v=qkdXAtO40Fo'
dataEmbedUrl: 'https://www.youtube.com/watch?v=qkdXAtO40Fo', }
}, }
type: 'embed', ]
},
],
type: 'paragraph',
},
],
type: 'doc',
} }
expect(editor.getJSON()).toEqual(expected) expect(editor.getJSON()).toEqual(expected)
}) })
}) })

View File

@ -38,8 +38,8 @@ export default class Embed extends Node {
default: null, default: null,
}, },
}, },
group: 'inline', group: 'block',
inline: true, inline: false,
parseDOM: [ parseDOM: [
{ {
tag: 'a[href].embed', tag: 'a[href].embed',