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

@@ -7,9 +7,15 @@ import {
AnyObject,
} from '../types'
/**
* Replaces text with a node within a range.
*/
declare module '@tiptap/core' {
interface Commands {
/**
* Replaces text with a node within a range.
*/
replaceRange: (range: Range, typeOrName: string | NodeType, attributes?: AnyObject) => Command,
}
}
export const replaceRange: Commands['replaceRange'] = (range, typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
const type = getNodeType(typeOrName, state.schema)
const { from, to } = range
@@ -26,9 +32,3 @@ export const replaceRange: Commands['replaceRange'] = (range, typeOrName, attrib
return true
}
declare module '@tiptap/core' {
interface Commands {
replaceRange: (range: Range, typeOrName: string | NodeType, attributes?: AnyObject) => Command,
}
}