fix some errors
This commit is contained in:
@@ -4,6 +4,11 @@ import { Editor } from './Editor'
|
||||
import { GlobalAttributes } from './types'
|
||||
|
||||
export interface ExtensionSpec<Options = {}, Commands = {}> {
|
||||
/**
|
||||
* Name
|
||||
*/
|
||||
name?: string,
|
||||
|
||||
/**
|
||||
* Default options
|
||||
*/
|
||||
@@ -78,6 +83,7 @@ export type Extension = Required<Omit<ExtensionSpec, 'defaultOptions'> & {
|
||||
* Default extension
|
||||
*/
|
||||
export const defaultExtension: Extension = {
|
||||
name: 'extension',
|
||||
type: 'extension',
|
||||
options: {},
|
||||
addGlobalAttributes: () => [],
|
||||
|
||||
@@ -5,14 +5,14 @@ import getAttributesFromExtensions from './getAttributesFromExtensions'
|
||||
import getRenderedAttributes from './getRenderedAttributes'
|
||||
import isEmptyObject from './isEmptyObject'
|
||||
|
||||
function cleanUpSchemaItem(data: any) {
|
||||
function cleanUpSchemaItem<T>(data: T) {
|
||||
return Object.fromEntries(Object.entries(data).filter(([key, value]) => {
|
||||
if (key === 'attrs' && isEmptyObject(value)) {
|
||||
return false
|
||||
}
|
||||
|
||||
return value !== null && value !== undefined
|
||||
}))
|
||||
})) as T
|
||||
}
|
||||
|
||||
export default function getSchema(extensions: Extensions): Schema {
|
||||
|
||||
Reference in New Issue
Block a user