remove unused options in template and directly return attributes in helper fns

This commit is contained in:
Dominik Biedebach 2024-10-30 16:31:08 +01:00
parent a2d810f446
commit 3fa56e779e
2 changed files with 7 additions and 7 deletions

View File

@ -10,6 +10,8 @@ import React from 'react'
const MenuBar = () => {
const { editor } = useCurrentEditor()
window.editor = editor
if (!editor) {
return null
}
@ -230,6 +232,6 @@ const content = `
export default () => {
return (
<EditorProvider slotBefore={<MenuBar />} extensions={extensions} content={content} rendering={{ addTypeAttributes: true }}></EditorProvider>
<EditorProvider slotBefore={<MenuBar />} extensions={extensions} content={content}></EditorProvider>
)
}

View File

@ -20,13 +20,11 @@ export function getAttributes(
state.schema,
)
let attributes: Record<string, any> = {}
if (schemaType === 'node') {
attributes = getNodeAttributes(state, typeOrName as NodeType)
} else if (schemaType === 'mark') {
attributes = getMarkAttributes(state, typeOrName as MarkType)
return getNodeAttributes(state, typeOrName as NodeType)
} if (schemaType === 'mark') {
return getMarkAttributes(state, typeOrName as MarkType)
}
return attributes
return {}
}