isolate editor nodes

pull/604/merge
Pete Matsyburka 1 month ago
parent 8b51079dcc
commit f0fafbadd4

@ -94,6 +94,8 @@ img.ProseMirror-separator {
} }
dynamic-variable { dynamic-variable {
background-color: #fef3c7; background-color: #fef3c7;
word-break: break-all;
overflow-wrap: anywhere;
}`) }`)
function collectDomAttrs (dom) { function collectDomAttrs (dom) {
@ -136,11 +138,12 @@ function collectSpanDomAttrs (dom) {
return result return result
} }
function createBlockNode (name, tag, content) { function createBlockNode (name, tag, content, extra = {}) {
return Node.create({ return Node.create({
name, name,
group: 'block', group: 'block',
content: content || 'block+', content: content || 'block+',
...extra,
addAttributes () { addAttributes () {
return { return {
htmlAttrs: { default: {} } htmlAttrs: { default: {} }
@ -194,9 +197,9 @@ const CustomHeading = Node.create({
}) })
const SectionNode = createBlockNode('section', 'section') const SectionNode = createBlockNode('section', 'section')
const ArticleNode = createBlockNode('article', 'article') const ArticleNode = createBlockNode('article', 'article', null, { isolating: true })
const HeaderNode = createBlockNode('header', 'header') const HeaderNode = createBlockNode('header', 'header', null, { isolating: true })
const FooterNode = createBlockNode('footer', 'footer') const FooterNode = createBlockNode('footer', 'footer', null, { isolating: true })
const DivNode = createBlockNode('div', 'div') const DivNode = createBlockNode('div', 'div')
const BlockquoteNode = createBlockNode('blockquote', 'blockquote') const BlockquoteNode = createBlockNode('blockquote', 'blockquote')
const PreNode = createBlockNode('pre', 'pre') const PreNode = createBlockNode('pre', 'pre')

Loading…
Cancel
Save