refactoring

This commit is contained in:
Philipp Kühn
2021-02-10 18:05:02 +01:00
parent f70974678b
commit 55ff908423
69 changed files with 519 additions and 527 deletions

View File

@@ -3,9 +3,15 @@ import getNodeType from '../helpers/getNodeType'
import deleteProps from '../utilities/deleteProps'
import { Command, Commands } from '../types'
/**
* Resets node attributes to the default value.
*/
declare module '@tiptap/core' {
interface Commands {
/**
* Resets node attributes to the default value.
*/
resetNodeAttributes: (typeOrName: string | NodeType, attributes: string | string[]) => Command,
}
}
export const resetNodeAttributes: Commands['resetNodeAttributes'] = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
const type = getNodeType(typeOrName, state.schema)
const { selection } = tr
@@ -19,9 +25,3 @@ export const resetNodeAttributes: Commands['resetNodeAttributes'] = (typeOrName,
return true
}
declare module '@tiptap/core' {
interface Commands {
resetNodeAttributes: (typeOrName: string | NodeType, attributes: string | string[]) => Command,
}
}