diff --git a/packages/xpub-edit/src/components/abstract/config/menu.js b/packages/xpub-edit/src/components/abstract/config/menu.js index 0763cb8ee054c729ade21eb87ecb3606dc378e15..ebd0314a3d4662df73f16a4814d1c088783f1539 100644 --- a/packages/xpub-edit/src/components/abstract/config/menu.js +++ b/packages/xpub-edit/src/components/abstract/config/menu.js @@ -37,16 +37,15 @@ export default { h1: { active: blockActive(schema.nodes.heading, { level: 1 }), content: icons.heading, - enable: setBlockType(schema.nodes.heading, { level: 1 }), run: (state, dispatch) => { - if (blockActive(schema.marks.heading)(state)) { - setBlockType(schema.marks.paragraph)(state, dispatch) + if (blockActive(schema.nodes.heading)(state)) { + setBlockType(schema.nodes.paragraph)(state, dispatch) return true } setBlockType(schema.nodes.heading, { level: 1 })(state, dispatch) }, - title: 'Change to heading level 1', + title: 'Toggle section title', }, }, history: { diff --git a/packages/xpub-edit/src/components/abstract/config/nodes.js b/packages/xpub-edit/src/components/abstract/config/nodes.js index 13ab00922d753773f59854a52895e1678c887b58..dc6e97868732164db12503e72048e75b98d3610f 100644 --- a/packages/xpub-edit/src/components/abstract/config/nodes.js +++ b/packages/xpub-edit/src/components/abstract/config/nodes.js @@ -10,14 +10,11 @@ const paragraph = { } const heading = { - attrs: { - level: { default: 1 }, - }, content: 'inline*', defining: true, group: 'block', - parseDOM: [{ tag: 'h1', attrs: { level: 1 } }], - toDOM: node => [`h${node.attrs.level}`, 0], + parseDOM: [{ tag: 'h1' }], + toDOM: node => ['h1', 0], } const text = { @@ -26,7 +23,7 @@ const text = { export default { doc, - heading, paragraph, + heading, text, }