add fontFamily commands

This commit is contained in:
Philipp Kühn
2020-11-18 12:09:04 +01:00
parent 116b189a93
commit fbee7656c8
2 changed files with 16 additions and 8 deletions

View File

@@ -38,11 +38,19 @@ const FontFamily = Extension.create({
addCommands() {
return {
/**
* Update the font family
* Set the font family
*/
fontFamily: (fontFamily: string | null = null): Command => ({ chain }) => {
setFontFamily: (fontFamily: string): Command => ({ chain }) => {
return chain()
.addMark('textStyle', { fontFamily })
.run()
},
/**
* Unset the font family
*/
unsetFontFamily: (): Command => ({ chain }) => {
return chain()
.addMark('textStyle', { fontFamily: null })
.removeEmptyTextStyle()
.run()
},