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,7 +7,13 @@ type FontFamilyOptions = {
declare module '@tiptap/core' {
interface Commands {
/**
* Set the font family
*/
setFontFamily: (fontFamily: string) => Command,
/**
* Unset the font family
*/
unsetFontFamily: () => Command,
}
}
@@ -46,17 +52,11 @@ export const FontFamily = Extension.create({
addCommands() {
return {
/**
* Set the font family
*/
setFontFamily: fontFamily => ({ chain }) => {
return chain()
.setMark('textStyle', { fontFamily })
.run()
},
/**
* Unset the font family
*/
unsetFontFamily: () => ({ chain }) => {
return chain()
.setMark('textStyle', { fontFamily: null })