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

@@ -8,7 +8,13 @@ type TextAlignOptions = {
declare module '@tiptap/core' {
interface Commands {
/**
* Set the text align attribute
*/
setTextAlign: (alignment: string) => Command,
/**
* Unset the text align attribute
*/
unsetTextAlign: () => Command,
}
}
@@ -43,9 +49,6 @@ export const TextAlign = Extension.create({
addCommands() {
return {
/**
* Set the text align attribute
*/
setTextAlign: (alignment: string) => ({ commands }) => {
if (!this.options.alignments.includes(alignment)) {
return false
@@ -53,9 +56,6 @@ export const TextAlign = Extension.create({
return this.options.types.every(type => commands.updateNodeAttributes(type, { textAlign: alignment }))
},
/**
* Unset the text align attribute
*/
unsetTextAlign: () => ({ commands }) => {
return this.options.types.every(type => commands.resetNodeAttributes(type, 'textAlign'))
},