Skip to content
Snippets Groups Projects
Commit d9aed5e1 authored by Alf Eaton's avatar Alf Eaton Committed by Yannis Barlas
Browse files

Allow "section title" to be unset

parent d510c1aa
No related branches found
No related tags found
No related merge requests found
...@@ -37,16 +37,15 @@ export default { ...@@ -37,16 +37,15 @@ export default {
h1: { h1: {
active: blockActive(schema.nodes.heading, { level: 1 }), active: blockActive(schema.nodes.heading, { level: 1 }),
content: icons.heading, content: icons.heading,
enable: setBlockType(schema.nodes.heading, { level: 1 }),
run: (state, dispatch) => { run: (state, dispatch) => {
if (blockActive(schema.marks.heading)(state)) { if (blockActive(schema.nodes.heading)(state)) {
setBlockType(schema.marks.paragraph)(state, dispatch) setBlockType(schema.nodes.paragraph)(state, dispatch)
return true return true
} }
setBlockType(schema.nodes.heading, { level: 1 })(state, dispatch) setBlockType(schema.nodes.heading, { level: 1 })(state, dispatch)
}, },
title: 'Change to heading level 1', title: 'Toggle section title',
}, },
}, },
history: { history: {
......
...@@ -10,14 +10,11 @@ const paragraph = { ...@@ -10,14 +10,11 @@ const paragraph = {
} }
const heading = { const heading = {
attrs: {
level: { default: 1 },
},
content: 'inline*', content: 'inline*',
defining: true, defining: true,
group: 'block', group: 'block',
parseDOM: [{ tag: 'h1', attrs: { level: 1 } }], parseDOM: [{ tag: 'h1' }],
toDOM: node => [`h${node.attrs.level}`, 0], toDOM: node => ['h1', 0],
} }
const text = { const text = {
...@@ -26,7 +23,7 @@ const text = { ...@@ -26,7 +23,7 @@ const text = {
export default { export default {
doc, doc,
heading,
paragraph, paragraph,
heading,
text, text,
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment