refactoring

This commit is contained in:
Philipp Kühn
2021-03-14 17:01:52 +01:00
parent 5e9a0d4225
commit baa5bcc964
4 changed files with 37 additions and 47 deletions

View File

@@ -126,13 +126,16 @@ const MenuBar = ({ editor }) => {
export default () => {
const editor = useEditor({
// onTransaction({ editor }) {
// console.log('anchor', editor.state.selection.anchor)
// },
extensions: [
...defaultExtensions().filter(item => item.config.name !== 'heading'),
Heading.extend({
draggable: true,
addNodeView() {
return ReactNodeViewRenderer((props) => {
// console.log({props})
console.log({props})
return (
<NodeViewWrapper>
<div className="heading">
@@ -142,6 +145,10 @@ export default () => {
draggable={true}
suppressContentEditableWarning={true}
></span>
level: {props.node.attrs.level}
<button onClick={() => props.updateAttributes({ level: 1 })}>
set level 1
</button>
<NodeViewContent />
</div>
</NodeViewWrapper>